All checks were successful
Deploy to production / deploy (push) Successful in 2m54s
- Introduced new benefits including 'reputation_periodic', 'appoint_politicians', 'set_regional_tax', 'free_lover_slots', 'guard_protection', and 'court_immunity' to the political office system. - Updated database migration to add and remove the 'last_political_daily_salary_on' column using SQL queries for better performance. - Enhanced localization files for multiple languages to support new benefits, improving user experience across the application. - Updated UI components to display new benefits correctly in the PoliticsView, ensuring accurate representation of political office functionalities.
73 lines
2.6 KiB
JavaScript
73 lines
2.6 KiB
JavaScript
'use strict';
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE falukant_data.falukant_user
|
|
ADD COLUMN IF NOT EXISTS last_political_daily_salary_on date NULL;
|
|
`);
|
|
|
|
await queryInterface.sequelize.query(`
|
|
DO $$
|
|
BEGIN
|
|
IF EXISTS (
|
|
SELECT 1 FROM information_schema.columns
|
|
WHERE table_schema = 'falukant_predefine'
|
|
AND table_name = 'political_office_benefit'
|
|
AND column_name = 'political_office_id'
|
|
) AND NOT EXISTS (
|
|
SELECT 1 FROM information_schema.columns
|
|
WHERE table_schema = 'falukant_predefine'
|
|
AND table_name = 'political_office_benefit'
|
|
AND column_name = 'office_type_id'
|
|
) THEN
|
|
ALTER TABLE falukant_predefine.political_office_benefit
|
|
RENAME COLUMN political_office_id TO office_type_id;
|
|
ELSIF EXISTS (
|
|
SELECT 1 FROM information_schema.columns
|
|
WHERE table_schema = 'falukant_predefine'
|
|
AND table_name = 'political_office_benefit'
|
|
AND column_name = 'political_office_id'
|
|
) AND EXISTS (
|
|
SELECT 1 FROM information_schema.columns
|
|
WHERE table_schema = 'falukant_predefine'
|
|
AND table_name = 'political_office_benefit'
|
|
AND column_name = 'office_type_id'
|
|
) THEN
|
|
UPDATE falukant_predefine.political_office_benefit
|
|
SET office_type_id = COALESCE(office_type_id, political_office_id);
|
|
ALTER TABLE falukant_predefine.political_office_benefit
|
|
DROP COLUMN political_office_id;
|
|
END IF;
|
|
END $$;
|
|
`);
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
await queryInterface.sequelize.query(`
|
|
ALTER TABLE falukant_data.falukant_user
|
|
DROP COLUMN IF EXISTS last_political_daily_salary_on;
|
|
`);
|
|
|
|
await queryInterface.sequelize.query(`
|
|
DO $$
|
|
BEGIN
|
|
IF EXISTS (
|
|
SELECT 1 FROM information_schema.columns
|
|
WHERE table_schema = 'falukant_predefine'
|
|
AND table_name = 'political_office_benefit'
|
|
AND column_name = 'office_type_id'
|
|
) AND NOT EXISTS (
|
|
SELECT 1 FROM information_schema.columns
|
|
WHERE table_schema = 'falukant_predefine'
|
|
AND table_name = 'political_office_benefit'
|
|
AND column_name = 'political_office_id'
|
|
) THEN
|
|
ALTER TABLE falukant_predefine.political_office_benefit
|
|
RENAME COLUMN office_type_id TO political_office_id;
|
|
END IF;
|
|
END $$;
|
|
`);
|
|
}
|
|
};
|