module.exports = {
    /**
     * @param {QueryInterface} queryInterface
     * @param {Sequelize} Sequelize
     * @returns {Promise<void>}
     */
    async up(queryInterface, Sequelize) {
        /**
         * @type {Transaction}
         */
        const transaction = await queryInterface.sequelize.transaction();
        try {
            
                
                    await queryInterface.createTable('users', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('roles', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('permissions', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('organizations', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('hotels', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('departments', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('staff_profiles', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('shifts', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('room_types', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('rooms', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('guests', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('guest_documents', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('rate_plans', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('seasonal_rates', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('dynamic_pricing_rules', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('sales_channels', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('ota_connections', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('reservations', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('reservation_guests', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('stay_folios', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('folio_items', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('payments', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('refunds', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('invoices', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('housekeeping_tasks', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('maintenance_tickets', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('notifications', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('booking_widgets', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('subscriptions', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('audit_logs', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('daily_snapshots', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'firstName',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'lastName',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'phoneNumber',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'email',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'disabled',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'password',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'emailVerified',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'emailVerificationToken',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'emailVerificationTokenExpiresAt',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'passwordResetToken',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'passwordResetTokenExpiresAt',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'provider',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'app_roleId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'roles',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'roles',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'roles',
                      'role_customization',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'roles',
                      'globalAccess',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'permissions',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'organizations',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'legal_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'address_line1',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'address_line2',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'city',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'state_region',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'postal_code',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'country',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'phone',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'email',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'website',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'timezone',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'currency',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'default_tax_rate',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'stripe_customer_reference',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'hotels',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'departments',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'departments',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'departments',
                      'description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'departments',
                      'active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'departments',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'staff_profiles',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'staff_profiles',
                      'userId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'users',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'staff_profiles',
                      'departmentId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'departments',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'staff_profiles',
                      'job_title',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'staff_profiles',
                      'employee_code',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'staff_profiles',
                      'hire_date',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'staff_profiles',
                      'can_login',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'staff_profiles',
                      'active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'staff_profiles',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'shifts',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'shifts',
                      'staff_profileId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'staff_profiles',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'shifts',
                      'start_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'shifts',
                      'end_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'shifts',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['scheduled','in_progress','completed','cancelled'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'shifts',
                      'notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'shifts',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'room_types',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'room_types',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'room_types',
                      'description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'room_types',
                      'capacity_adults',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'room_types',
                      'capacity_children',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'room_types',
                      'base_rate',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'room_types',
                      'active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'room_types',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rooms',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rooms',
                      'room_typeId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'room_types',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rooms',
                      'room_number',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rooms',
                      'floor',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rooms',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['available','occupied','dirty','cleaning','inspected','out_of_service'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rooms',
                      'notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rooms',
                      'active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rooms',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'first_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'last_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'email',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'phone',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'nationality',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'address_line1',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'address_line2',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'city',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'state_region',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'postal_code',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'country',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'preferences',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'loyalty_points',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'marketing_opt_in',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guests',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guest_documents',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guest_documents',
                      'guestId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'guests',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guest_documents',
                      'document_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['passport','national_id','drivers_license','other'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guest_documents',
                      'document_number',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guest_documents',
                      'issued_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guest_documents',
                      'expires_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'guest_documents',
                      'notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'guest_documents',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rate_plans',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rate_plans',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rate_plans',
                      'plan_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['standard','non_refundable','package','corporate','promo'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rate_plans',
                      'refundable',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rate_plans',
                      'min_nights',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rate_plans',
                      'max_nights',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rate_plans',
                      'deposit_percent',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rate_plans',
                      'cancellation_policy',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rate_plans',
                      'active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'rate_plans',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'seasonal_rates',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'seasonal_rates',
                      'room_typeId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'room_types',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'seasonal_rates',
                      'rate_planId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'rate_plans',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'seasonal_rates',
                      'start_date',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'seasonal_rates',
                      'end_date',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'seasonal_rates',
                      'nightly_rate',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'seasonal_rates',
                      'pricing_mode',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['override','delta'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'seasonal_rates',
                      'delta_amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'seasonal_rates',
                      'active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'seasonal_rates',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'room_typeId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'room_types',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'rate_planId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'rate_plans',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'rule_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['occupancy_based','days_before_arrival','day_of_week','length_of_stay'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'adjustment_percent',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'adjustment_amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'min_occupancy_percent',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'max_occupancy_percent',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'min_days_before',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'max_days_before',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'applies_days_of_week',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'dynamic_pricing_rules',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sales_channels',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sales_channels',
                      'channel_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['direct','ota','phone','walk_in','corporate'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sales_channels',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sales_channels',
                      'external_reference',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sales_channels',
                      'active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sales_channels',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ota_connections',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ota_connections',
                      'sales_channelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'sales_channels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ota_connections',
                      'provider',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['booking_com','expedia','airbnb','agoda','other'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ota_connections',
                      'account_identifier',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ota_connections',
                      'api_key_reference',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ota_connections',
                      'inventory_sync_enabled',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ota_connections',
                      'rate_sync_enabled',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ota_connections',
                      'last_sync_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ota_connections',
                      'sync_status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['ok','warning','error','disabled'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ota_connections',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'reservation_number',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'guestId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'guests',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'roomId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'rooms',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'room_typeId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'room_types',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'rate_planId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'rate_plans',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'sales_channelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'sales_channels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'check_in_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'check_out_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'adults',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'children',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['pending','confirmed','checked_in','checked_out','cancelled','no_show'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'total_amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'tax_amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'deposit_amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'special_requests',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'internal_notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'cancelled_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'cancellation_reason',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservations',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservation_guests',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservation_guests',
                      'reservationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'reservations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservation_guests',
                      'guestId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'guests',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservation_guests',
                      'guest_role',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['primary','additional'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservation_guests',
                      'is_primary',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reservation_guests',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'stay_folios',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'stay_folios',
                      'reservationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'reservations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'stay_folios',
                      'folio_number',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'stay_folios',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['open','closed','void'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'stay_folios',
                      'balance_due',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'stay_folios',
                      'total_charges',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'stay_folios',
                      'total_payments',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'stay_folios',
                      'notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'stay_folios',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'folio_items',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'folio_items',
                      'stay_folioId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'stay_folios',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'folio_items',
                      'item_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['room_charge','tax','fee','service','pos','discount','adjustment'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'folio_items',
                      'description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'folio_items',
                      'posted_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'folio_items',
                      'quantity',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'folio_items',
                      'unit_price',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'folio_items',
                      'amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'folio_items',
                      'taxable',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'folio_items',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'stay_folioId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'stay_folios',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'reservationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'reservations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'method',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['cash','credit_card','debit_card','bank_transfer','stripe'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['pending','authorized','captured','failed','refunded','cancelled'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'paid_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'stripe_payment_intent_reference',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'stripe_charge_reference',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'receipt_number',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'payments',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refunds',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refunds',
                      'paymentId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'payments',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refunds',
                      'amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refunds',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['pending','succeeded','failed','cancelled'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refunds',
                      'refunded_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refunds',
                      'stripe_refund_reference',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refunds',
                      'reason',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refunds',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'stay_folioId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'stay_folios',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'invoice_number',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'issued_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'due_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['draft','issued','paid','void','overdue'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'subtotal_amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'tax_amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'total_amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'billing_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'billing_address',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'invoices',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'housekeeping_tasks',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'housekeeping_tasks',
                      'roomId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'rooms',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'housekeeping_tasks',
                      'assigned_staff_profileId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'staff_profiles',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'housekeeping_tasks',
                      'scheduled_for',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'housekeeping_tasks',
                      'started_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'housekeeping_tasks',
                      'completed_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'housekeeping_tasks',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['pending','in_progress','completed','cancelled'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'housekeeping_tasks',
                      'task_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['cleaning','inspection','turndown','linen_change','deep_clean'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'housekeeping_tasks',
                      'notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'housekeeping_tasks',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'maintenance_tickets',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'maintenance_tickets',
                      'roomId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'rooms',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'maintenance_tickets',
                      'category',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['plumbing','electrical','hvac','appliance','furniture','internet_tv','other'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'maintenance_tickets',
                      'priority',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['low','medium','high','urgent'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'maintenance_tickets',
                      'title',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'maintenance_tickets',
                      'description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'maintenance_tickets',
                      'assigned_staff_profileId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'staff_profiles',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'maintenance_tickets',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['open','in_progress','closed'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'maintenance_tickets',
                      'opened_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'maintenance_tickets',
                      'closed_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'maintenance_tickets',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'reservationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'reservations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'guestId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'guests',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'channel',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['email','sms'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'template_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['booking_confirmation','check_in_reminder','check_out_reminder','payment_confirmation','invoice'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['queued','sent','failed','cancelled'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'scheduled_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'sent_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'to_address',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'subject',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'body',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'provider_message_reference',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'error_message',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'notifications',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'booking_widgets',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'booking_widgets',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'booking_widgets',
                      'public_key',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'booking_widgets',
                      'allowed_domains',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'booking_widgets',
                      'active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'booking_widgets',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'plan',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['starter','professional','enterprise'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'billing_cycle',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['monthly','annual'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['trialing','active','past_due','cancelled','paused'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'trial_ends_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'current_period_start_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'current_period_end_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'included_rooms_limit',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'included_users_limit',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'stripe_subscription_reference',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'stripe_price_reference',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'auto_renew',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'subscriptions',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_logs',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_logs',
                      'actor_userId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'users',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_logs',
                      'action',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['create','update','delete','login','logout','export','sync','suspend'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_logs',
                      'entity_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_logs',
                      'record_reference',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_logs',
                      'occurred_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_logs',
                      'ip_address',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_logs',
                      'user_agent',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_logs',
                      'details',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_logs',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'hotelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'hotels',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'snapshot_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'rooms_available',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'rooms_occupied',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'rooms_dirty',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'rooms_out_of_service',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'occupancy_rate_percent',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'revenue_today',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'revenue_month_to_date',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'adr',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'revpar',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'arrivals_today',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'departures_today',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'daily_snapshots',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
            
            
            await transaction.commit();
        } catch (err) {
            await transaction.rollback();
            throw err;
        }
    },
    /**
     * @param {QueryInterface} queryInterface
     * @param {Sequelize} Sequelize
     * @returns {Promise<void>}
     */
    async down(queryInterface, Sequelize) {
        /**
         * @type {Transaction}
         */
        const transaction = await queryInterface.sequelize.transaction();
        try {
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'departures_today',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'arrivals_today',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'revpar',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'adr',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'revenue_month_to_date',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'revenue_today',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'occupancy_rate_percent',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'rooms_out_of_service',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'rooms_dirty',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'rooms_occupied',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'rooms_available',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'snapshot_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'daily_snapshots',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_logs',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_logs',
                        'details',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_logs',
                        'user_agent',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_logs',
                        'ip_address',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_logs',
                        'occurred_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_logs',
                        'record_reference',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_logs',
                        'entity_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_logs',
                        'action',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_logs',
                        'actor_userId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_logs',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'auto_renew',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'stripe_price_reference',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'stripe_subscription_reference',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'included_users_limit',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'included_rooms_limit',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'current_period_end_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'current_period_start_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'trial_ends_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'billing_cycle',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'plan',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'subscriptions',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'booking_widgets',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'booking_widgets',
                        'active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'booking_widgets',
                        'allowed_domains',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'booking_widgets',
                        'public_key',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'booking_widgets',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'booking_widgets',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'error_message',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'provider_message_reference',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'body',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'subject',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'to_address',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'sent_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'scheduled_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'template_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'channel',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'guestId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'reservationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'notifications',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'maintenance_tickets',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'maintenance_tickets',
                        'closed_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'maintenance_tickets',
                        'opened_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'maintenance_tickets',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'maintenance_tickets',
                        'assigned_staff_profileId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'maintenance_tickets',
                        'description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'maintenance_tickets',
                        'title',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'maintenance_tickets',
                        'priority',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'maintenance_tickets',
                        'category',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'maintenance_tickets',
                        'roomId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'maintenance_tickets',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'housekeeping_tasks',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'housekeeping_tasks',
                        'notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'housekeeping_tasks',
                        'task_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'housekeeping_tasks',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'housekeeping_tasks',
                        'completed_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'housekeeping_tasks',
                        'started_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'housekeeping_tasks',
                        'scheduled_for',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'housekeeping_tasks',
                        'assigned_staff_profileId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'housekeeping_tasks',
                        'roomId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'housekeeping_tasks',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'billing_address',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'billing_name',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'total_amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'tax_amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'subtotal_amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'due_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'issued_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'invoice_number',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'stay_folioId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'invoices',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refunds',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refunds',
                        'reason',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refunds',
                        'stripe_refund_reference',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refunds',
                        'refunded_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refunds',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refunds',
                        'amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refunds',
                        'paymentId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refunds',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'receipt_number',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'stripe_charge_reference',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'stripe_payment_intent_reference',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'paid_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'method',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'reservationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'stay_folioId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'payments',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'folio_items',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'folio_items',
                        'taxable',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'folio_items',
                        'amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'folio_items',
                        'unit_price',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'folio_items',
                        'quantity',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'folio_items',
                        'posted_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'folio_items',
                        'description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'folio_items',
                        'item_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'folio_items',
                        'stay_folioId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'folio_items',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'stay_folios',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'stay_folios',
                        'notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'stay_folios',
                        'total_payments',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'stay_folios',
                        'total_charges',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'stay_folios',
                        'balance_due',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'stay_folios',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'stay_folios',
                        'folio_number',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'stay_folios',
                        'reservationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'stay_folios',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservation_guests',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservation_guests',
                        'is_primary',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservation_guests',
                        'guest_role',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservation_guests',
                        'guestId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservation_guests',
                        'reservationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservation_guests',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'cancellation_reason',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'cancelled_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'internal_notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'special_requests',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'deposit_amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'tax_amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'total_amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'children',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'adults',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'check_out_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'check_in_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'sales_channelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'rate_planId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'room_typeId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'roomId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'guestId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'reservation_number',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reservations',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ota_connections',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ota_connections',
                        'sync_status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ota_connections',
                        'last_sync_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ota_connections',
                        'rate_sync_enabled',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ota_connections',
                        'inventory_sync_enabled',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ota_connections',
                        'api_key_reference',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ota_connections',
                        'account_identifier',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ota_connections',
                        'provider',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ota_connections',
                        'sales_channelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ota_connections',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sales_channels',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sales_channels',
                        'active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sales_channels',
                        'external_reference',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sales_channels',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sales_channels',
                        'channel_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sales_channels',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'applies_days_of_week',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'max_days_before',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'min_days_before',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'max_occupancy_percent',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'min_occupancy_percent',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'adjustment_amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'adjustment_percent',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'rule_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'rate_planId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'room_typeId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'dynamic_pricing_rules',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'seasonal_rates',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'seasonal_rates',
                        'active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'seasonal_rates',
                        'delta_amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'seasonal_rates',
                        'pricing_mode',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'seasonal_rates',
                        'nightly_rate',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'seasonal_rates',
                        'end_date',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'seasonal_rates',
                        'start_date',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'seasonal_rates',
                        'rate_planId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'seasonal_rates',
                        'room_typeId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'seasonal_rates',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rate_plans',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rate_plans',
                        'active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rate_plans',
                        'cancellation_policy',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rate_plans',
                        'deposit_percent',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rate_plans',
                        'max_nights',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rate_plans',
                        'min_nights',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rate_plans',
                        'refundable',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rate_plans',
                        'plan_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rate_plans',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rate_plans',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guest_documents',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guest_documents',
                        'notes',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'guest_documents',
                        'expires_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guest_documents',
                        'issued_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guest_documents',
                        'document_number',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guest_documents',
                        'document_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guest_documents',
                        'guestId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guest_documents',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'marketing_opt_in',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'loyalty_points',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'preferences',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'country',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'postal_code',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'state_region',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'city',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'address_line2',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'address_line1',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'nationality',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'phone',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'email',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'last_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'first_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'guests',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rooms',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rooms',
                        'active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rooms',
                        'notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rooms',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rooms',
                        'floor',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rooms',
                        'room_number',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rooms',
                        'room_typeId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'rooms',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'room_types',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'room_types',
                        'active',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'room_types',
                        'base_rate',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'room_types',
                        'capacity_children',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'room_types',
                        'capacity_adults',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'room_types',
                        'description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'room_types',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'room_types',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'shifts',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'shifts',
                        'notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'shifts',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'shifts',
                        'end_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'shifts',
                        'start_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'shifts',
                        'staff_profileId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'shifts',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'staff_profiles',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'staff_profiles',
                        'active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'staff_profiles',
                        'can_login',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'staff_profiles',
                        'hire_date',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'staff_profiles',
                        'employee_code',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'staff_profiles',
                        'job_title',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'staff_profiles',
                        'departmentId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'staff_profiles',
                        'userId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'staff_profiles',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'departments',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'departments',
                        'active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'departments',
                        'description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'departments',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'departments',
                        'hotelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'stripe_customer_reference',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'default_tax_rate',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'currency',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'timezone',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'website',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'email',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'phone',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'country',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'postal_code',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'state_region',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'city',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'address_line2',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'address_line1',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'legal_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'hotels',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'organizations',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'permissions',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'roles',
                        'globalAccess',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'roles',
                        'role_customization',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'roles',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'app_roleId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'provider',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'passwordResetTokenExpiresAt',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'passwordResetToken',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'emailVerificationTokenExpiresAt',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'emailVerificationToken',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'emailVerified',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'password',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'disabled',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'email',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'phoneNumber',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'lastName',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'firstName',
                        { transaction }
                    );
                
            
                
                    await queryInterface.dropTable('daily_snapshots', { transaction });
                
            
                
                    await queryInterface.dropTable('audit_logs', { transaction });
                
            
                
                    await queryInterface.dropTable('subscriptions', { transaction });
                
            
                
                    await queryInterface.dropTable('booking_widgets', { transaction });
                
            
                
                    await queryInterface.dropTable('notifications', { transaction });
                
            
                
                    await queryInterface.dropTable('maintenance_tickets', { transaction });
                
            
                
                    await queryInterface.dropTable('housekeeping_tasks', { transaction });
                
            
                
                    await queryInterface.dropTable('invoices', { transaction });
                
            
                
                    await queryInterface.dropTable('refunds', { transaction });
                
            
                
                    await queryInterface.dropTable('payments', { transaction });
                
            
                
                    await queryInterface.dropTable('folio_items', { transaction });
                
            
                
                    await queryInterface.dropTable('stay_folios', { transaction });
                
            
                
                    await queryInterface.dropTable('reservation_guests', { transaction });
                
            
                
                    await queryInterface.dropTable('reservations', { transaction });
                
            
                
                    await queryInterface.dropTable('ota_connections', { transaction });
                
            
                
                    await queryInterface.dropTable('sales_channels', { transaction });
                
            
                
                    await queryInterface.dropTable('dynamic_pricing_rules', { transaction });
                
            
                
                    await queryInterface.dropTable('seasonal_rates', { transaction });
                
            
                
                    await queryInterface.dropTable('rate_plans', { transaction });
                
            
                
                    await queryInterface.dropTable('guest_documents', { transaction });
                
            
                
                    await queryInterface.dropTable('guests', { transaction });
                
            
                
                    await queryInterface.dropTable('rooms', { transaction });
                
            
                
                    await queryInterface.dropTable('room_types', { transaction });
                
            
                
                    await queryInterface.dropTable('shifts', { transaction });
                
            
                
                    await queryInterface.dropTable('staff_profiles', { transaction });
                
            
                
                    await queryInterface.dropTable('departments', { transaction });
                
            
                
                    await queryInterface.dropTable('hotels', { transaction });
                
            
                
                    await queryInterface.dropTable('organizations', { transaction });
                
            
                
                    await queryInterface.dropTable('permissions', { transaction });
                
            
                
                    await queryInterface.dropTable('roles', { transaction });
                
            
                
                    await queryInterface.dropTable('users', { transaction });
                
            
            await transaction.commit();
        } catch (err) {
            await transaction.rollback();
            throw err;
        }
    }
};
