'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
    up: async (queryInterface, Sequelize) => {
        await queryInterface.addColumn('shifttypes', 'holidaylist_id', {
            type: Sequelize.INTEGER,
            allowNull: true,
            references: { model: 'holidaylists', key: 'id' },
            onUpdate: 'CASCADE',
            onDelete: 'SET NULL'
        });

        await queryInterface.changeColumn('shifttypes', 'holidaygroup_id', {
            type: Sequelize.INTEGER,
            allowNull: true
        });
    },
    down: async (queryInterface, Sequelize) => {
        await queryInterface.removeColumn('shifttypes', 'holidaylist_id');
        await queryInterface.changeColumn('shifttypes', 'holidaygroup_id', {
            type: Sequelize.INTEGER,
            allowNull: false
        });
    }
};
