chore: Unify backend express project into ESM (#281)
This commit is contained in:
@@ -1,48 +1,43 @@
|
||||
'use strict';
|
||||
export async function up(queryInterface, Sequelize) {
|
||||
await queryInterface.createTable('caseAttachments', {
|
||||
id: {
|
||||
type: Sequelize.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
caseId: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'cases',
|
||||
key: 'id',
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
attachmentId: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'attachments',
|
||||
key: 'id',
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
createdAt: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
},
|
||||
updatedAt: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.createTable('caseAttachments', {
|
||||
id: {
|
||||
type: Sequelize.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
},
|
||||
caseId: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'cases',
|
||||
key: 'id',
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
attachmentId: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'attachments',
|
||||
key: 'id',
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE',
|
||||
},
|
||||
createdAt: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
},
|
||||
updatedAt: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
await queryInterface.addIndex('caseAttachments', ['caseId', 'attachmentId'], {
|
||||
unique: true,
|
||||
});
|
||||
}
|
||||
|
||||
await queryInterface.addIndex('caseAttachments', ['caseId', 'attachmentId'], {
|
||||
unique: true,
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface) => {
|
||||
await queryInterface.dropTable('caseAttachments');
|
||||
},
|
||||
};
|
||||
export async function down(queryInterface) {
|
||||
await queryInterface.dropTable('caseAttachments');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user