84 lines
2.4 KiB
JavaScript
84 lines
2.4 KiB
JavaScript
'use strict';
|
|
|
|
/** @type {import('sequelize-cli').Migration} */
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
const table = { schema: 'falukant_data', tableName: 'debtors_prism' };
|
|
|
|
await queryInterface.addColumn(table, 'status', {
|
|
type: Sequelize.STRING,
|
|
allowNull: false,
|
|
defaultValue: 'delinquent'
|
|
});
|
|
|
|
await queryInterface.addColumn(table, 'entered_at', {
|
|
type: Sequelize.DATE,
|
|
allowNull: true
|
|
});
|
|
|
|
await queryInterface.addColumn(table, 'released_at', {
|
|
type: Sequelize.DATE,
|
|
allowNull: true
|
|
});
|
|
|
|
await queryInterface.addColumn(table, 'debt_at_entry', {
|
|
type: Sequelize.DECIMAL(14, 2),
|
|
allowNull: true
|
|
});
|
|
|
|
await queryInterface.addColumn(table, 'remaining_debt', {
|
|
type: Sequelize.DECIMAL(14, 2),
|
|
allowNull: true
|
|
});
|
|
|
|
await queryInterface.addColumn(table, 'days_overdue', {
|
|
type: Sequelize.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 0
|
|
});
|
|
|
|
await queryInterface.addColumn(table, 'reason', {
|
|
type: Sequelize.STRING,
|
|
allowNull: true
|
|
});
|
|
|
|
await queryInterface.addColumn(table, 'creditworthiness_penalty', {
|
|
type: Sequelize.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 0
|
|
});
|
|
|
|
await queryInterface.addColumn(table, 'next_forced_action', {
|
|
type: Sequelize.STRING,
|
|
allowNull: true
|
|
});
|
|
|
|
await queryInterface.addColumn(table, 'assets_seized_json', {
|
|
type: Sequelize.JSONB,
|
|
allowNull: true
|
|
});
|
|
|
|
await queryInterface.addColumn(table, 'public_known', {
|
|
type: Sequelize.BOOLEAN,
|
|
allowNull: false,
|
|
defaultValue: false
|
|
});
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
const table = { schema: 'falukant_data', tableName: 'debtors_prism' };
|
|
|
|
await queryInterface.removeColumn(table, 'public_known');
|
|
await queryInterface.removeColumn(table, 'assets_seized_json');
|
|
await queryInterface.removeColumn(table, 'next_forced_action');
|
|
await queryInterface.removeColumn(table, 'creditworthiness_penalty');
|
|
await queryInterface.removeColumn(table, 'reason');
|
|
await queryInterface.removeColumn(table, 'days_overdue');
|
|
await queryInterface.removeColumn(table, 'remaining_debt');
|
|
await queryInterface.removeColumn(table, 'debt_at_entry');
|
|
await queryInterface.removeColumn(table, 'released_at');
|
|
await queryInterface.removeColumn(table, 'entered_at');
|
|
await queryInterface.removeColumn(table, 'status');
|
|
}
|
|
};
|