feat(deploy): update deployment workflow and migration paths
Some checks failed
Deploy to production / deploy (push) Has been cancelled
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.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await queryInterface.sequelize.query(`
|
||||
ALTER TABLE falukant_data.relationship_state
|
||||
ADD COLUMN IF NOT EXISTS marriage_satisfaction integer;
|
||||
`);
|
||||
|
||||
await queryInterface.sequelize.query(`
|
||||
UPDATE falukant_data.relationship_state
|
||||
SET marriage_satisfaction = 55
|
||||
WHERE marriage_satisfaction IS NULL;
|
||||
`);
|
||||
|
||||
await queryInterface.sequelize.query(`
|
||||
ALTER TABLE falukant_data.relationship_state
|
||||
ALTER COLUMN marriage_satisfaction SET DEFAULT 55;
|
||||
`);
|
||||
|
||||
await queryInterface.sequelize.query(`
|
||||
ALTER TABLE falukant_data.relationship_state
|
||||
ALTER COLUMN marriage_satisfaction SET NOT NULL;
|
||||
`);
|
||||
|
||||
await queryInterface.sequelize.query(`
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'relationship_state_marriage_satisfaction_check'
|
||||
AND connamespace = 'falukant_data'::regnamespace
|
||||
) THEN
|
||||
ALTER TABLE falukant_data.relationship_state
|
||||
ADD CONSTRAINT relationship_state_marriage_satisfaction_check
|
||||
CHECK (marriage_satisfaction >= 0 AND marriage_satisfaction <= 100);
|
||||
END IF;
|
||||
END $$;
|
||||
`);
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
await queryInterface.sequelize.query(`
|
||||
ALTER TABLE falukant_data.relationship_state
|
||||
DROP CONSTRAINT IF EXISTS relationship_state_marriage_satisfaction_check;
|
||||
`);
|
||||
|
||||
await queryInterface.sequelize.query(`
|
||||
ALTER TABLE falukant_data.relationship_state
|
||||
DROP COLUMN IF EXISTS marriage_satisfaction;
|
||||
`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user