Some checks failed
Deploy to production / deploy (push) Has been cancelled
- Modified the deployment workflow to include new migration paths for the backend, ensuring that migrations are correctly referenced in the deployment process. - Updated the `db:migrate` script in package.json to point to the `migrations-active` directory, enhancing clarity and organization of migration files. - Adjusted the deployment conditions to account for changes in migration file locations, improving the accuracy of change detection during deployments. - Removed obsolete migration files to streamline the migration process and prevent confusion.
47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
/* eslint-disable */
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
// Für bereits existierende Installationen: Spalte sicherstellen + Backfill
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE falukant_type.reputation_action
|
|
ADD COLUMN IF NOT EXISTS decay_window_days integer;
|
|
`);
|
|
await queryInterface.sequelize.query(`
|
|
UPDATE falukant_type.reputation_action
|
|
SET decay_window_days = 7
|
|
WHERE decay_window_days IS NULL;
|
|
`);
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE falukant_type.reputation_action
|
|
ALTER COLUMN decay_window_days SET DEFAULT 7;
|
|
`);
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE falukant_type.reputation_action
|
|
ALTER COLUMN decay_window_days SET NOT NULL;
|
|
`);
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE falukant_type.reputation_action
|
|
DROP CONSTRAINT IF EXISTS reputation_action_decay_window_days_chk;
|
|
`);
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE falukant_type.reputation_action
|
|
ADD CONSTRAINT reputation_action_decay_window_days_chk
|
|
CHECK (decay_window_days >= 1 AND decay_window_days <= 365);
|
|
`);
|
|
},
|
|
|
|
async down(queryInterface, Sequelize) {
|
|
// optional: wieder entfernen
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE falukant_type.reputation_action
|
|
DROP CONSTRAINT IF EXISTS reputation_action_decay_window_days_chk;
|
|
`);
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE falukant_type.reputation_action
|
|
DROP COLUMN IF EXISTS decay_window_days;
|
|
`);
|
|
},
|
|
};
|
|
|
|
|