Remove nonprofits seeding procedures
parent
90d97db079
commit
cda1ab780e
|
@ -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);
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue