Skip to content

Commit

Permalink
1604-hoax-migration-script
Browse files Browse the repository at this point in the history
  • Loading branch information
basarbk committed Aug 7, 2020
1 parent fe23b22 commit f495314
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions database/migrations/20200807210113-create-hoax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('hoaxes', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER,
},
content: {
type: Sequelize.STRING,
},
timestamp: {
type: Sequelize.BIGINT,
},
});
},

// eslint-disable-next-line no-unused-vars
down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable('hoaxes');
},
};
2 changes: 2 additions & 0 deletions database/seeders/20200803205715-add-users.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const bcrypt = require('bcrypt');

module.exports = {
// eslint-disable-next-line no-unused-vars
up: async (queryInterface, Sequelize) => {
const hash = await bcrypt.hash('P4ssword', 10);
const users = [];
Expand All @@ -18,6 +19,7 @@ module.exports = {
await queryInterface.bulkInsert('users', users, {});
},

// eslint-disable-next-line no-unused-vars
down: async (queryInterface, Sequelize) => {
await queryInterface.bulkdDelete('users', null, {});
},
Expand Down

0 comments on commit f495314

Please sign in to comment.