Skip to content

Commit

Permalink
Merge 83fe276 into 14322ad
Browse files Browse the repository at this point in the history
  • Loading branch information
chialuka committed Jul 31, 2019
2 parents 14322ad + 83fe276 commit 9c9b4ab
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .hound.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ javascript:
enabled: false
eslint:
enabled: true
config_file: .eslintrc
config_file: .eslintrc.json
ignore_file: .eslintignore
2 changes: 1 addition & 1 deletion .sequelizerc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const path = require('path');
module.exports = {
'config': path.resolve('server/database/config', 'config.js'),
'models-path': path.resolve('server/database/models'),
'seeds-path': path.resolve('server/database/seeds'),
'seeders-path': path.resolve('server/database/seeds'),
'migrations-path': path.resolve('server/database/migrations')
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"scripts": {
"lint": "eslint '**/*.js'",
"lint:fix": "prettier-eslint '**/*.js' --write",
"test:staged": "nyc mocha --timeout 1000 -r esm --exit && nyc check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
"test:staged": "nyc mocha --timeout 1000 -r esm --exit",
"build": "babel server --out-dir dist && npm run copy:docs",
"copy:docs": "cp -r server/docs/ dist/docs/",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"db:migrate": "sequelize db:migrate",
"db:migrate-undo": "sequelize db:migrate:undo:all",
"db:rollback": "npm run db:back && npm run db:roll && npm run db:seed",
"db:rollback": "npm run db:migrate-undo && npm run db:migrate && npm run db:seed",
"db:seed": "sequelize db:seed:all",
"start": "node dist/index.js",
"start:dev": "cross-env NODE_ENV=development DEBUG=dev nodemon --exec babel-node server",
"test": "nyc mocha --timeout 1000 -r esm --exit"
"start:dev": "DEBUG=dev nodemon --exec babel-node server",
"test": "npm run db:rollback && nyc mocha --timeout 1000 -r esm --exit"
},
"husky": {
"hooks": {
Expand Down
34 changes: 34 additions & 0 deletions server/database/migrations/20190731122403-create-user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
export default {
up: (queryInterface, Sequelize) => queryInterface.createTable('Users', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
firstName: {
type: Sequelize.STRING
},
lastName: {
type: Sequelize.STRING
},
userName: {
type: Sequelize.STRING
},
email: {
type: Sequelize.STRING
},
password: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
}),
down: queryInterface => queryInterface.dropTable('Users')
};
2 changes: 1 addition & 1 deletion server/database/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ Object.keys(db).forEach((modelName) => {
db.sequelize = sequelize;
db.Sequelize = Sequelize;

module.exports = db;
export default db;
19 changes: 19 additions & 0 deletions server/database/seeds/20190731131745-my-seed-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export default {
up: queryInterface => queryInterface.bulkInsert(
'Users',
[
{
firstName: 'Beyonce',
lastName: 'Afolabi',
userName: 'bey_fola',
email: 'beyonce.afolabi@andela.com',
password: 'incorrect',
createdAt: new Date(),
updatedAt: new Date()
}
],
{}
),

down: queryInterface => queryInterface.bulkDelete('Users', null, {})
};

0 comments on commit 9c9b4ab

Please sign in to comment.