-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
324 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
server/migrations/20190409194718-create-comment-history.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('Comment_histories', { | ||
id: { | ||
allowNull: false, | ||
primaryKey: true, | ||
type: Sequelize.UUID, | ||
defaultValue: Sequelize.UUIDV4, | ||
unique: true, | ||
}, | ||
comment_id: { | ||
type: Sequelize.UUID, | ||
allowNull: false, | ||
}, | ||
body: { | ||
type: Sequelize.STRING, | ||
allowNull: false, | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
defaultValue: Sequelize.fn('now'), | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
defaultValue: Sequelize.fn('now'), | ||
}, | ||
}); | ||
}, | ||
down: queryInterface => queryInterface.dropTable('Comment_histories'), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = (sequelize, DataTypes) => { | ||
const Comment_history = sequelize.define('Comment_history', { | ||
id: { | ||
allowNull: false, | ||
primaryKey: true, | ||
type: DataTypes.UUID, | ||
defaultValue: DataTypes.UUIDV4, | ||
unique: true, | ||
}, | ||
comment_id: { | ||
type: DataTypes.UUID, | ||
allowNull: false, | ||
}, | ||
body: { | ||
type: DataTypes.STRING, | ||
allowNull: false, | ||
}, | ||
}); | ||
// Comment_history.associate = models => { | ||
// Comment_history.belongsTo(models.Comment, { | ||
// foreignKey: 'id', | ||
// as: 'updatedComments', | ||
// }); | ||
// }; | ||
return Comment_history; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
up: queryInterface => | ||
queryInterface.bulkInsert('Comment_histories', [ | ||
{ | ||
id: 'c125a9a9-f6d0-4e8f-ac39-6964f7b6a2c5', | ||
comment_id: '15a2628f-ecf7-4098-8db5-95ecaf24847e', | ||
body: 'deep write up', | ||
}, | ||
{ | ||
id: '10ed2582-0e52-4645-a135-cd22b030ef41', | ||
comment_id: '15a2628f-ecf7-4098-8db5-95ecaf24847e', | ||
body: 'updated comment', | ||
}, | ||
{ | ||
id: 'a1adb042-5111-4d16-bb5c-ef2f4b57bf65', | ||
comment_id: '0b29d287-0ad0-42ca-8f74-3159bbe304af', | ||
body: 'Nice', | ||
}, | ||
{ | ||
id: '4432824c-dd6e-43e7-a154-f4a95c3734a2', | ||
comment_id: '0b29d287-0ad0-42ca-8f74-3159bbe304af', | ||
body: 'Hmmm', | ||
}, | ||
]), | ||
}; |
Oops, something went wrong.