Skip to content

Commit ae3eaf3

Browse files
committed
feat(seed): adding seed support for sequelize and compiled both into a gulp task, also took out the
1 parent 27b4941 commit ae3eaf3

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

server/config/lib/sequelize.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@ if (config.orm) {
4646

4747
orm.sync = function () {
4848
// Sync makes sure the database tables are created if they don't exist
49-
// and the `force` parameter will also drop the tables before re-creating them
5049
return this.sequelize.sync({
5150
force: (config.seedDB.reset || false)
5251
});
5352
};
5453

54+
orm.seed = function () {
55+
// Sync makes sure the database tables are created if they don't exist
56+
// and the `force` parameter will also drop the tables before re-creating them
57+
return this.sequelize.sync({ force: true });
58+
};
59+
5560
}
5661

5762
// Export this ORM module

server/gulpfile.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,19 @@ gulp.task('seed:mongoose', function(done) {
220220
});
221221
});
222222

223+
gulp.task('seed:sequelize', function(done) {
224+
const sequelize = require('./config/lib/sequelize');
225+
226+
sequelize.seed()
227+
.then(function() {
228+
done();
229+
});
230+
});
231+
232+
gulp.task('test:seed', function(done) {
233+
runSequence('seed:mongoose', 'seed:sequelize', done);
234+
});
235+
223236
gulp.task('test:integration', function(done) {
224237
runSequence('env:test', 'server:bootstrap', 'ava:test:integration', done);
225238
});

0 commit comments

Comments
 (0)