automated-invoice-processing-agent-backend / src /db /migrations /20240711115635-create-error-log.js
Bansari Akhani
set invoice id nullable in error logs
1fa8cbc
raw
history blame contribute delete
910 Bytes
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('error_log', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
invoice_id: {
allowNull: true,
type: Sequelize.INTEGER,
references: {
model: 'invoices',
key: 'id'
},
onDelete: 'CASCADE'
},
error_type: {
allowNull: false,
type: Sequelize.STRING(255)
},
error_details: {
allowNull: false,
type: Sequelize.TEXT
},
created_at: {
type: Sequelize.DATE
},
updated_at: {
type: Sequelize.DATE
}
});
},
async down(queryInterface, Sequelize) {
await queryInterface.dropTable('error_log');
}
};