[model] migrations setup

This commit is contained in:
les
2019-10-25 18:43:49 +02:00
parent c6a5895de7
commit 69a50fea4f
26 changed files with 426 additions and 337 deletions

View File

@@ -0,0 +1,41 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('comments',
{
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true
},
activitypub_id: {
type: Sequelize.STRING(18),
index: true,
unique: true
},
eventId: {
type: Sequelize.INTEGER,
references: {
model: 'events',
key: 'id',
},
onUpdate: 'CASCADE',
onDelete: 'SET NULL',
},
data: Sequelize.JSON,
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
})
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('comments')
}
};