Remove nonprofits seeding procedures

pull/18182/head
Berkeley Martinez 2016-01-14 16:54:33 -08:00
parent 90d97db079
commit cda1ab780e
1 changed files with 0 additions and 29 deletions

View File

@ -1,29 +0,0 @@
/* eslint-disable no-process-exit */
require('babel/register');
require('dotenv').load();
var Rx = require('rx');
var app = require('../server/server');
var Nonprofits = app.models.Nonprofit;
var nonprofits = require('./nonprofits.json');
var destroy = Rx.Observable.fromNodeCallback(Nonprofits.destroyAll, Nonprofits);
var create = Rx.Observable.fromNodeCallback(Nonprofits.create, Nonprofits);
destroy()
.flatMap(function() {
if (!nonprofits) {
return Rx.Observable.throw(new Error('No nonprofits found'));
}
return create(nonprofits);
})
.subscribe(
function(nonprofits) {
console.log('successfully saved %d nonprofits', nonprofits.length);
},
function(err) { throw err; },
function() {
console.log('nonprofit seed completed');
process.exit(0);
}
);