Skip to content

Commit

Permalink
Creating seeds for setup an User and a Conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
Luan Guimarães committed Dec 1, 2016
1 parent 40b8b92 commit bedf5c4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions db/seeders/users_seeder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

var models = require('../../src/models');
var User = models.User;
var helper = require('../../test/helper');

module.exports = {
up: (queryInterface, Sequelize) => {
return User.create(helper.validUserAttributes)
.then((user) => {
user.createConversation(helper.validConversationAttributes);
});
},

down: function (queryInterface, Sequelize) {
return User.destroy({ where: {} });
}
};


2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"db:drop:dev:osx": "psql -c \"drop database pt_dev\"",
"db:migrate": "./node_modules/.bin/sequelize db:migrate",
"db:migrate:undo": "./node_modules/.bin/sequelize db:migrate:undo",
"db:seed": "./node_modules/.bin/sequelize db:seed:all",
"migration:create": "./node_modules/.bin/sequelize migration:create",
"setup": "./scripts/quickstart.sh",
"setup:osx": "./scripts/OSX_quickstart.sh",
"start": "./scripts/start.sh"
Expand Down

0 comments on commit bedf5c4

Please sign in to comment.