mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
/** @type {import('sequelize-cli').Migration} */
|
|
module.exports = {
|
|
async up (queryInterface, Sequelize) {
|
|
await queryInterface.dropTable('event_notifications')
|
|
await queryInterface.createTable('tasks', {
|
|
id: {
|
|
type: Sequelize.INTEGER,
|
|
primaryKey: true,
|
|
autoIncrement: true,
|
|
allowNull: false,
|
|
},
|
|
status: {
|
|
type: Sequelize.ENUM,
|
|
values: ['new', 'sent', 'error', 'sending'],
|
|
defaultValue: 'new',
|
|
index: true
|
|
},
|
|
error: {
|
|
type: Sequelize.TEXT
|
|
},
|
|
eventId: {
|
|
type: Sequelize.INTEGER,
|
|
allowNull: true,
|
|
references: {
|
|
model: 'events',
|
|
key: 'id'
|
|
},
|
|
onUpdate: 'CASCADE',
|
|
onDelete: 'CASCADE'
|
|
},
|
|
notificationId: {
|
|
allowNull: true,
|
|
type: Sequelize.INTEGER,
|
|
references: {
|
|
model: 'notifications',
|
|
key: 'id'
|
|
},
|
|
onUpdate: 'CASCADE',
|
|
onDelete: 'CASCADE'
|
|
},
|
|
createdAt: {
|
|
allowNull: false,
|
|
type: Sequelize.DATE
|
|
},
|
|
updatedAt: {
|
|
allowNull: false,
|
|
type: Sequelize.DATE
|
|
}
|
|
})
|
|
},
|
|
|
|
async down (queryInterface, Sequelize) {
|
|
await queryInterface.dropTable('tasks')
|
|
}
|
|
};
|