-- Generado por scripts/extract-releases-sql.php
-- Incluye DB::unprepared, DB::select/insert (1er arg string), y ->query(...)


-- =====================================================================
-- 104-release-27-03-25.php
-- =====================================================================

ALTER TABLE `t_room`
            ADD `Room_RequestLastDateStart` DATETIME NOT NULL DEFAULT NOW() AFTER `Room_RequestDateEnd`; 
            ALTER TABLE `t_room` ALTER `Room_RequestLastDateStart` DROP DEFAULT

ALTER TABLE `t_room`
            ADD `Room_RequestLastDateEnd` DATETIME NOT NULL DEFAULT NOW() AFTER `Room_RequestLastDateStart`; 
            ALTER TABLE `t_room` ALTER `Room_RequestLastDateEnd` DROP DEFAULT

UPDATE `t_room`
            SET `Room_RequestLastDateStart`=`Room_RequestDateStart`,
            `Room_RequestLastDateEnd`=`Room_RequestDateEnd`

ALTER TABLE `t_room`
            ADD `Room_DateChanged` INT(1) NOT NULL DEFAULT 1 AFTER `Room_NoValidAmount` -- 1: NO - 2: YES

ALTER TABLE `t_room` ALTER `Room_DateChanged` DROP DEFAULT

INSERT INTO `t_directory` (
                    `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                    `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
                ) VALUES  (372, 'tour', 'general.tour', 'Tours', '', '', 13, 0, 0, 0, 0, 310)

INSERT INTO `t_directory` (
                `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
            ) VALUES  (373, 'camp', 'general.tour.camp', 'Agregar en Overbooking', '', '', 1, 0, 0, 0, 0, 372)

INSERT INTO `t_directory` (
                `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
            ) VALUES  (374, 'lock', 'general.tour.lock', 'Agregar en Bloqueo', '', '', 2, 0, 0, 0, 0, 372)


-- =====================================================================
-- 106-realese-19-05-25.php
-- =====================================================================

ALTER TABLE `t_extra`
            ADD `Id_Extra_Refer` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_Location`

ALTER TABLE `t_extra` ALTER `Id_Extra_Refer` DROP DEFAULT

UPDATE `t_extra`
            SET `Id_Extra_Refer` = `Id_Extra`

ALTER TABLE `t_upgrade`
            ADD `Id_Upgrade_Refer` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_TypeUpgrade`

ALTER TABLE `t_upgrade` ALTER `Id_Upgrade_Refer` DROP DEFAULT

UPDATE `t_upgrade`
            SET `Id_Upgrade_Refer` = `Id_Upgrade`


-- =====================================================================
-- 106-release-24-05-25.php
-- =====================================================================

UPDATE `t_directory`
            SET `Directory_Url` = '/:package'
            WHERE `Id_Directory` = 51


-- =====================================================================
-- 108-release-18-06-25.php
-- =====================================================================

UPDATE `t_directory` SET `Directory_Code` = 'all', `Directory_Path`='booking.all' WHERE `Id_Directory` = 54

UPDATE `t_directory` SET `Directory_Code` = 'passenger', `Directory_Path`='booking.passenger' WHERE `Id_Directory` = 57

UPDATE `t_directory` SET `Directory_Code` = 'pending', `Directory_Path`='booking.pending' WHERE `Id_Directory` = 58

UPDATE `t_directory` SET `Directory_Code` = 'cancelled', `Directory_Path`='booking.cancelled' WHERE `Id_Directory` = 59

UPDATE `t_directory` SET `Directory_Code` = 'confirmed', `Directory_Path`='booking.confirmed' WHERE `Id_Directory` = 60

UPDATE `t_directory` SET `Directory_Code` = 'finalized', `Directory_Path`='booking.finalized' WHERE `Id_Directory` = 61

UPDATE `t_directory` SET `Directory_Code` = 'day', `Directory_Path`='booking.day' WHERE `Id_Directory` = 222

UPDATE `t_directory` SET `Directory_Code` = 'day-confirmed', `Directory_Path`='booking.day-confirmed' WHERE `Id_Directory` = 292

UPDATE `t_directory` SET `Directory_Code` = 'payment', `Directory_Path`='payment.payment' WHERE `Id_Directory` = 221

UPDATE `t_directory` SET `Directory_Code` = 'deleted', `Directory_Path`='booking.deleted' WHERE `Id_Directory` = 205

UPDATE `t_directory` SET `Directory_Code` = 'all', `Directory_Path`='booking.all' WHERE `Id_Directory` = 54

UPDATE `t_directory` SET `Directory_Code` = 'update', `Directory_Path`='booking.all.update' WHERE `Id_Directory` = 56

UPDATE `t_directory` SET `Directory_Code` = 'update', `Directory_Path`='booking.passenger.update' WHERE `Id_Directory` = 88

UPDATE `t_directory` SET `Directory_Code` = 'update', `Directory_Path`='booking.pending.update' WHERE `Id_Directory` = 90

UPDATE `t_directory` SET `Directory_Code` = 'update', `Directory_Path`='booking.cancelled.update' WHERE `Id_Directory` = 92

UPDATE `t_directory` SET `Directory_Code` = 'update', `Directory_Path`='booking.confirmed.update' WHERE `Id_Directory` = 94

UPDATE `t_directory` SET `Directory_Code` = 'update', `Directory_Path`='booking.finalized.update' WHERE `Id_Directory` = 96

UPDATE `t_directory` SET `Directory_Code` = 'update', `Directory_Path`='payment.payment.update' WHERE `Id_Directory` = 225

UPDATE `t_directory` SET `Directory_Code` = 'update', `Directory_Path`='booking.day.update' WHERE `Id_Directory` = 227

UPDATE `t_directory` SET `Directory_Code` = 'update', `Directory_Path`='booking.day-confirmed.update' WHERE `Id_Directory` = 294

UPDATE `t_directory` SET `Directory_Code` = 'receipt', `Directory_Path`='booking.all.update.receipt' WHERE `Id_Directory` = 127

UPDATE `t_directory` SET `Directory_Code` = 'receipt', `Directory_Path`='booking.passenger.update.receipt' WHERE `Id_Directory` = 138

UPDATE `t_directory` SET `Directory_Code` = 'receipt', `Directory_Path`='booking.pending.update.receipt' WHERE `Id_Directory` = 149

UPDATE `t_directory` SET `Directory_Code` = 'receipt', `Directory_Path`='booking.cancelled.update.receipt' WHERE `Id_Directory` = 160

UPDATE `t_directory` SET `Directory_Code` = 'receipt', `Directory_Path`='booking.confirmed.update.receipt' WHERE `Id_Directory` = 171

UPDATE `t_directory` SET `Directory_Code` = 'receipt', `Directory_Path`='booking.finalized.update.receipt' WHERE `Id_Directory` = 182

UPDATE `t_directory` SET `Directory_Code` = 'receipt', `Directory_Path`='payment.payment.update.receipt' WHERE `Id_Directory` = 232

UPDATE `t_directory` SET `Directory_Code` = 'receipt', `Directory_Path`='booking.day.update.receipt' WHERE `Id_Directory` = 239

UPDATE `t_directory` SET `Directory_Code` = 'receipt', `Directory_Path`='booking.day-confirmed.update.receipt' WHERE `Id_Directory` = 299

UPDATE `t_directory` SET `Directory_Code` = 'payment',
                `Directory_Path`='booking.all.update.receipt.payment' WHERE `Id_Directory` = 130

UPDATE `t_directory` SET `Directory_Code` = 'payment',
                `Directory_Path`='booking.passenger.update.receipt.payment' WHERE `Id_Directory` = 141

UPDATE `t_directory` SET `Directory_Code` = 'payment',
                `Directory_Path`='booking.pending.update.receipt.payment' WHERE `Id_Directory` = 152

UPDATE `t_directory` SET `Directory_Code` = 'payment',
                `Directory_Path`='booking.cancelled.update.receipt.payment' WHERE `Id_Directory` = 163

UPDATE `t_directory` SET `Directory_Code` = 'payment',
                `Directory_Path`='booking.confirmed.update.receipt.payment' WHERE `Id_Directory` = 174

UPDATE `t_directory` SET `Directory_Code` = 'payment',
                `Directory_Path`='booking.finalized.update.receipt.payment' WHERE `Id_Directory` = 185

UPDATE `t_directory` SET `Directory_Code` = 'payment',
                `Directory_Path`='payment.payment.update.receipt.payment' WHERE `Id_Directory` = 248

UPDATE `t_directory` SET `Directory_Code` = 'payment',
                `Directory_Path`='booking.day.update.receipt.payment' WHERE `Id_Directory` = 251

UPDATE `t_directory` SET `Directory_Code` = 'payment',
                `Directory_Path`='booking.day-confirmed.update.receipt.payment' WHERE `Id_Directory` = 307

UPDATE `t_directory` SET `Directory_Code` = 'redistribute',
                `Directory_Path`='booking.all.update.receipt.payment.redistribute' WHERE `Id_Directory` = 273

UPDATE `t_directory` SET `Directory_Code` = 'redistribute',
                `Directory_Path`='booking.passenger.update.receipt.payment.redistribute' WHERE `Id_Directory` = 275

UPDATE `t_directory` SET `Directory_Code` = 'redistribute',
                `Directory_Path`='booking.pending.update.receipt.payment.redistribute' WHERE `Id_Directory` = 277

UPDATE `t_directory` SET `Directory_Code` = 'redistribute',
                `Directory_Path`='booking.cancelled.update.receipt.payment.redistribute' WHERE `Id_Directory` = 279

UPDATE `t_directory` SET `Directory_Code` = 'redistribute',
                `Directory_Path`='booking.confirmed.update.receipt.payment.redistribute' WHERE `Id_Directory` = 281

UPDATE `t_directory` SET `Directory_Code` = 'redistribute',
                `Directory_Path`='booking.finalized.update.receipt.payment.redistribute' WHERE `Id_Directory` = 283

UPDATE `t_directory` SET `Directory_Code` = 'redistribute',
                `Directory_Path`='booking.day.update.receipt.payment.redistribute' WHERE `Id_Directory` = 285

UPDATE `t_directory` SET `Directory_Code` = 'redistribute',
                `Directory_Path`='payment.payment.update.receipt.payment.redistribute' WHERE `Id_Directory` = 287

UPDATE `t_directory` SET `Directory_Code` = 'redistribute',
                `Directory_Path`='booking.day-confirmed.update.receipt.payment.redistribute' WHERE `Id_Directory` = 309

INSERT INTO `t_directory`
                (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUE (375, 'reamount', 'booking.all.update.receipt.payment.redistribute.reamount', 'Cambio de Monto', NULL, NULL, 1, 1, 0, 0, 0, 273);

INSERT INTO `t_directory`
                (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUE (376, 'reamount', 'booking.passenger.update.receipt.payment.redistribute.reamount', 'Cambio de Monto', NULL, NULL, 1, 1, 0, 0, 0, 275);

INSERT INTO `t_directory`
                (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUE (377, 'reamount', 'booking.pending.update.receipt.payment.redistribute.reamount', 'Cambio de Monto', NULL, NULL, 1, 1, 0, 0, 0, 277);

INSERT INTO `t_directory`
                (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUE (378, 'reamount', 'booking.cancelled.update.receipt.payment.redistribute.reamount', 'Cambio de Monto', NULL, NULL, 1, 1, 0, 0, 0, 279);

INSERT INTO `t_directory`
                (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUE (379, 'reamount', 'booking.confirmed.update.receipt.payment.redistribute.reamount', 'Cambio de Monto', NULL, NULL, 1, 1, 0, 0, 0, 281);

INSERT INTO `t_directory`
                (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUE (380, 'reamount', 'booking.finalized.update.receipt.payment.redistribute.reamount', 'Cambio de Monto', NULL, NULL, 1, 1, 0, 0, 0, 283);

INSERT INTO `t_directory`
                (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUE (381, 'reamount', 'booking.day.update.receipt.payment.redistribute.reamount', 'Cambio de Monto', NULL, NULL, 1, 1, 0, 0, 0, 285);

INSERT INTO `t_directory`
                (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUE (382, 'reamount', 'payment.payment.update.receipt.payment.redistribute.reamount', 'Cambio de Monto', NULL, NULL, 1, 1, 0, 0, 0, 287);

INSERT INTO `t_directory`
                (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUE (383, 'reamount', 'booking.day-confirmed.update.receipt.payment.redistribute.reamount', 'Cambio de Monto', NULL, NULL, 1, 1, 0, 0, 0, 309);


-- =====================================================================
-- 109-release-08-07-25.php
-- =====================================================================

ALTER TABLE `t_pax_information`
            ADD `PaxInformation_Lock` INT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `PaxInformation_ShowAllPassenger`

ALTER TABLE `t_pax_information` ALTER `PaxInformation_Lock` DROP DEFAULT


-- =====================================================================
-- 109-release-09-07-25.php
-- =====================================================================

ALTER TABLE `t_passenger` ADD `Id_Admin_Confirm` INT(11) UNSIGNED NOT NULL AFTER `Id_TypeRate`;

ALTER TABLE `t_passenger` ALTER COLUMN `Id_Admin_Confirm` DROP DEFAULT;

UPDATE `t_passenger`      SET `Id_Admin_Confirm` = 0;

ALTER TABLE `t_passenger` ADD `Passenger_Passport_Revision_Status` INT(1) UNSIGNED NOT NULL AFTER `Id_Admin_Confirm`;

ALTER TABLE `t_passenger` ALTER COLUMN `Passenger_Passport_Revision_Status` DROP DEFAULT;

UPDATE `t_passenger`      SET `Passenger_Passport_Revision_Status` = 1;

ALTER TABLE `t_passenger` ADD `Passenger_Passport_Revision_Date` DATETIME NOT NULL AFTER `Passenger_Passport_Revision_Status`;

ALTER TABLE `t_passenger` ALTER COLUMN `Passenger_Passport_Revision_Date` DROP DEFAULT;

UPDATE `t_passenger`      SET `Passenger_Passport_Revision_Date` = '1000-01-01 00:00:00'  WHERE `Passenger_Passport_Revision_Date` IS NULL;

ALTER TABLE `t_passenger` ADD INDEX (`Id_Admin_Confirm`);

INSERT INTO `t_directory` (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`, `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`) 
            VALUES (386, 'passports', 'passports', 'Pasaportes', '', 'badge', 20, '2', '2', '0', '0', 0);

INSERT INTO `t_directory` (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,`Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`) 
            VALUES(387, 'my-passport', 'passports.my-passport', 'Mis Pasaportes','/my-passports', 'badge', '1', '2', '0', '1', '1', 386);

ALTER TABLE `t_passenger` ALTER COLUMN `Passenger_DateEntrance` DROP DEFAULT;

UPDATE `t_passenger`      SET `Passenger_DateEntrance` = '1000-01-01 00:00:00' WHERE `Passenger_DateEntrance`;


-- =====================================================================
-- 109-release-10-07-25.php
-- =====================================================================

ALTER TABLE `t_user_country`
            ADD `UserCountry_ConsetturId` INT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `UserCountry_FrequentOrder`

ALTER TABLE `t_user_country` ALTER `UserCountry_ConsetturId` DROP DEFAULT

UPDATE `t_user_country` SET `UserCountry_ConsetturId`=1 WHERE `t_user_country`.`Id_UserCountry`= 13;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=2 WHERE `t_user_country`.`Id_UserCountry`= 14;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=3 WHERE `t_user_country`.`Id_UserCountry`= 15;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=4 WHERE `t_user_country`.`Id_UserCountry`= 7;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=5 WHERE `t_user_country`.`Id_UserCountry`= 10;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=6 WHERE `t_user_country`.`Id_UserCountry`= 11;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=7 WHERE `t_user_country`.`Id_UserCountry`= 20;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=8 WHERE `t_user_country`.`Id_UserCountry`= 22;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=9 WHERE `t_user_country`.`Id_UserCountry`= 21;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=10 WHERE `t_user_country`.`Id_UserCountry`= 24;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=11 WHERE `t_user_country`.`Id_UserCountry`= 33;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=12 WHERE `t_user_country`.`Id_UserCountry`= 29;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=13 WHERE `t_user_country`.`Id_UserCountry`= 228;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=14 WHERE `t_user_country`.`Id_UserCountry`= 93;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=15 WHERE `t_user_country`.`Id_UserCountry`= 235;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=16 WHERE `t_user_country`.`Id_UserCountry`= 90;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=17 WHERE `t_user_country`.`Id_UserCountry`= 73;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=18 WHERE `t_user_country`.`Id_UserCountry`= 78;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=19 WHERE `t_user_country`.`Id_UserCountry`= 148;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=20 WHERE `t_user_country`.`Id_UserCountry`= 81;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=21 WHERE `t_user_country`.`Id_UserCountry`= 77;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=22 WHERE `t_user_country`.`Id_UserCountry`= 57;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=23 WHERE `t_user_country`.`Id_UserCountry`= 63;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=24 WHERE `t_user_country`.`Id_UserCountry`= 101;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=25 WHERE `t_user_country`.`Id_UserCountry`= 95;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=26 WHERE `t_user_country`.`Id_UserCountry`= 97;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=27 WHERE `t_user_country`.`Id_UserCountry`= 99;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=28 WHERE `t_user_country`.`Id_UserCountry`= 202;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=29 WHERE `t_user_country`.`Id_UserCountry`= 102;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=30 WHERE `t_user_country`.`Id_UserCountry`= 108;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=31 WHERE `t_user_country`.`Id_UserCountry`= 37;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=32 WHERE `t_user_country`.`Id_UserCountry`= 38;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=33 WHERE `t_user_country`.`Id_UserCountry`= 54;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=34 WHERE `t_user_country`.`Id_UserCountry`= 113;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=35 WHERE `t_user_country`.`Id_UserCountry`= 44;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=36 WHERE `t_user_country`.`Id_UserCountry`= 50;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=37 WHERE `t_user_country`.`Id_UserCountry`= 112;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=38 WHERE `t_user_country`.`Id_UserCountry`= 115;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=39 WHERE `t_user_country`.`Id_UserCountry`= 119;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=40 WHERE `t_user_country`.`Id_UserCountry`= 121;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=41 WHERE `t_user_country`.`Id_UserCountry`= 122;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=42 WHERE `t_user_country`.`Id_UserCountry`= 135;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=43 WHERE `t_user_country`.`Id_UserCountry`= 137;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=44 WHERE `t_user_country`.`Id_UserCountry`= 138;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=45 WHERE `t_user_country`.`Id_UserCountry`= 151;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=46 WHERE `t_user_country`.`Id_UserCountry`= 158;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=47 WHERE `t_user_country`.`Id_UserCountry`= 169;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=48 WHERE `t_user_country`.`Id_UserCountry`= 170;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=49 WHERE `t_user_country`.`Id_UserCountry`= 174;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=50 WHERE `t_user_country`.`Id_UserCountry`= 176;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=51 WHERE `t_user_country`.`Id_UserCountry`= 64;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=52 WHERE `t_user_country`.`Id_UserCountry`= 195;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=53 WHERE `t_user_country`.`Id_UserCountry`= 196;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=54 WHERE `t_user_country`.`Id_UserCountry`= 205;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=55 WHERE `t_user_country`.`Id_UserCountry`= 229;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=56 WHERE `t_user_country`.`Id_UserCountry`= 212;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=57 WHERE `t_user_country`.`Id_UserCountry`= 221;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=58 WHERE `t_user_country`.`Id_UserCountry`= 222;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=59 WHERE `t_user_country`.`Id_UserCountry`= 220;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=60 WHERE `t_user_country`.`Id_UserCountry`= 225;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=61 WHERE `t_user_country`.`Id_UserCountry`= 231;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=62 WHERE `t_user_country`.`Id_UserCountry`= 226;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=63 WHERE `t_user_country`.`Id_UserCountry`= 72;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=64 WHERE `t_user_country`.`Id_UserCountry`= 73;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=65 WHERE `t_user_country`.`Id_UserCountry`= 55;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=66 WHERE `t_user_country`.`Id_UserCountry`= 209;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=67 WHERE `t_user_country`.`Id_UserCountry`= 208;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=68 WHERE `t_user_country`.`Id_UserCountry`= 67;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=69 WHERE `t_user_country`.`Id_UserCountry`= 200;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=70 WHERE `t_user_country`.`Id_UserCountry`= 105;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=71 WHERE `t_user_country`.`Id_UserCountry`= 51;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=72 WHERE `t_user_country`.`Id_UserCountry`= 175;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=73 WHERE `t_user_country`.`Id_UserCountry`= 92;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=74 WHERE `t_user_country`.`Id_UserCountry`= 96;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=75 WHERE `t_user_country`.`Id_UserCountry`= 107;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=76 WHERE `t_user_country`.`Id_UserCountry`= 127;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=77 WHERE `t_user_country`.`Id_UserCountry`= 193;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=78 WHERE `t_user_country`.`Id_UserCountry`= 211;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=79 WHERE `t_user_country`.`Id_UserCountry`= 27;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=80 WHERE `t_user_country`.`Id_UserCountry`= 16;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=81 WHERE `t_user_country`.`Id_UserCountry`= 44;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=82 WHERE `t_user_country`.`Id_UserCountry`= 47;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=83 WHERE `t_user_country`.`Id_UserCountry`= 94;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=84 WHERE `t_user_country`.`Id_UserCountry`= 156;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=85 WHERE `t_user_country`.`Id_UserCountry`= 124;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=86 WHERE `t_user_country`.`Id_UserCountry`= 130;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=87 WHERE `t_user_country`.`Id_UserCountry`= 160;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=88 WHERE `t_user_country`.`Id_UserCountry`= 164;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=89 WHERE `t_user_country`.`Id_UserCountry`= 166;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=90 WHERE `t_user_country`.`Id_UserCountry`= 167;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=91 WHERE `t_user_country`.`Id_UserCountry`= 188;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=92 WHERE `t_user_country`.`Id_UserCountry`= 214;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=93 WHERE `t_user_country`.`Id_UserCountry`= 227;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=94 WHERE `t_user_country`.`Id_UserCountry`= 82;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=95 WHERE `t_user_country`.`Id_UserCountry`= 234;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=96 WHERE `t_user_country`.`Id_UserCountry`= 240;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=97 WHERE `t_user_country`.`Id_UserCountry`= 109;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=98 WHERE `t_user_country`.`Id_UserCountry`= 3;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=99 WHERE `t_user_country`.`Id_UserCountry`= 116;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=100 WHERE `t_user_country`.`Id_UserCountry`= 28;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=101 WHERE `t_user_country`.`Id_UserCountry`= 213;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=102 WHERE `t_user_country`.`Id_UserCountry`= 145;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=103 WHERE `t_user_country`.`Id_UserCountry`= 62;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=104 WHERE `t_user_country`.`Id_UserCountry`= 142;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=105 WHERE `t_user_country`.`Id_UserCountry`= 79;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=106 WHERE `t_user_country`.`Id_UserCountry`= 210;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=107 WHERE `t_user_country`.`Id_UserCountry`= 147;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=108 WHERE `t_user_country`.`Id_UserCountry`= 132;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=109 WHERE `t_user_country`.`Id_UserCountry`= 191;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=110 WHERE `t_user_country`.`Id_UserCountry`= 165;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=111 WHERE `t_user_country`.`Id_UserCountry`= 230;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=112 WHERE `t_user_country`.`Id_UserCountry`= 173;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=113 WHERE `t_user_country`.`Id_UserCountry`= 52;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=114 WHERE `t_user_country`.`Id_UserCountry`= 2;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=115 WHERE `t_user_country`.`Id_UserCountry`= 154;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=116 WHERE `t_user_country`.`Id_UserCountry`= 239;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=117 WHERE `t_user_country`.`Id_UserCountry`= 143;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=119 WHERE `t_user_country`.`Id_UserCountry`= 6;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=120 WHERE `t_user_country`.`Id_UserCountry`= 203;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=121 WHERE `t_user_country`.`Id_UserCountry`= 68;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=122 WHERE `t_user_country`.`Id_UserCountry`= 219;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=123 WHERE `t_user_country`.`Id_UserCountry`= 26;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=124 WHERE `t_user_country`.`Id_UserCountry`= 163;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=125 WHERE `t_user_country`.`Id_UserCountry`= 126;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=126 WHERE `t_user_country`.`Id_UserCountry`= 120;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=127 WHERE `t_user_country`.`Id_UserCountry`= 17;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=128 WHERE `t_user_country`.`Id_UserCountry`= 19;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=130 WHERE `t_user_country`.`Id_UserCountry`= 42;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=131 WHERE `t_user_country`.`Id_UserCountry`= 100;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=132 WHERE `t_user_country`.`Id_UserCountry`= 104;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=133 WHERE `t_user_country`.`Id_UserCountry`= 129;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=134 WHERE `t_user_country`.`Id_UserCountry`= 125;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=135 WHERE `t_user_country`.`Id_UserCountry`= 189;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=136 WHERE `t_user_country`.`Id_UserCountry`= 215;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=137 WHERE `t_user_country`.`Id_UserCountry`= 91;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=138 WHERE `t_user_country`.`Id_UserCountry`= 60;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=139 WHERE `t_user_country`.`Id_UserCountry`= 139;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=140 WHERE `t_user_country`.`Id_UserCountry`= 98;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=141 WHERE `t_user_country`.`Id_UserCountry`= 199;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=142 WHERE `t_user_country`.`Id_UserCountry`= 12;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=143 WHERE `t_user_country`.`Id_UserCountry`= 80;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=144 WHERE `t_user_country`.`Id_UserCountry`= 1;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=145 WHERE `t_user_country`.`Id_UserCountry`= 5;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=147 WHERE `t_user_country`.`Id_UserCountry`= 9;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=149 WHERE `t_user_country`.`Id_UserCountry`= 18;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=151 WHERE `t_user_country`.`Id_UserCountry`= 23;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=152 WHERE `t_user_country`.`Id_UserCountry`= 25;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=154 WHERE `t_user_country`.`Id_UserCountry`= 31;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=155 WHERE `t_user_country`.`Id_UserCountry`= 32;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=156 WHERE `t_user_country`.`Id_UserCountry`= 34;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=157 WHERE `t_user_country`.`Id_UserCountry`= 35;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=158 WHERE `t_user_country`.`Id_UserCountry`= 36;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=159 WHERE `t_user_country`.`Id_UserCountry`= 39;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=164 WHERE `t_user_country`.`Id_UserCountry`= 48;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=165 WHERE `t_user_country`.`Id_UserCountry`= 56;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=166 WHERE `t_user_country`.`Id_UserCountry`= 49;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=168 WHERE `t_user_country`.`Id_UserCountry`= 103;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=169 WHERE `t_user_country`.`Id_UserCountry`= 58;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=171 WHERE `t_user_country`.`Id_UserCountry`= 61;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=172 WHERE `t_user_country`.`Id_UserCountry`= 65;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=173 WHERE `t_user_country`.`Id_UserCountry`= 66;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=175 WHERE `t_user_country`.`Id_UserCountry`= 70;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=176 WHERE `t_user_country`.`Id_UserCountry`= 71;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=178 WHERE `t_user_country`.`Id_UserCountry`= 74;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=180 WHERE `t_user_country`.`Id_UserCountry`= 75;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=181 WHERE `t_user_country`.`Id_UserCountry`= 76;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=184 WHERE `t_user_country`.`Id_UserCountry`= 83;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=185 WHERE `t_user_country`.`Id_UserCountry`= 85;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=186 WHERE `t_user_country`.`Id_UserCountry`= 86;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=187 WHERE `t_user_country`.`Id_UserCountry`= 87;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=188 WHERE `t_user_country`.`Id_UserCountry`= 88;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=189 WHERE `t_user_country`.`Id_UserCountry`= 89;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=193 WHERE `t_user_country`.`Id_UserCountry`= 106;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=195 WHERE `t_user_country`.`Id_UserCountry`= 110;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=196 WHERE `t_user_country`.`Id_UserCountry`= 114;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=197 WHERE `t_user_country`.`Id_UserCountry`= 117;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=198 WHERE `t_user_country`.`Id_UserCountry`= 118;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=200 WHERE `t_user_country`.`Id_UserCountry`= 128;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=201 WHERE `t_user_country`.`Id_UserCountry`= 73;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=202 WHERE `t_user_country`.`Id_UserCountry`= 133;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=205 WHERE `t_user_country`.`Id_UserCountry`= 144;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=206 WHERE `t_user_country`.`Id_UserCountry`= 146;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=207 WHERE `t_user_country`.`Id_UserCountry`= 149;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=208 WHERE `t_user_country`.`Id_UserCountry`= 150;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=209 WHERE `t_user_country`.`Id_UserCountry`= 152;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=210 WHERE `t_user_country`.`Id_UserCountry`= 153;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=212 WHERE `t_user_country`.`Id_UserCountry`= 13;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=213 WHERE `t_user_country`.`Id_UserCountry`= 159;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=215 WHERE `t_user_country`.`Id_UserCountry`= 168;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=216 WHERE `t_user_country`.`Id_UserCountry`= 172;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=217 WHERE `t_user_country`.`Id_UserCountry`= 177;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=218 WHERE `t_user_country`.`Id_UserCountry`= 179;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=219 WHERE `t_user_country`.`Id_UserCountry`= 180;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=220 WHERE `t_user_country`.`Id_UserCountry`= 181;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=221 WHERE `t_user_country`.`Id_UserCountry`= 183;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=222 WHERE `t_user_country`.`Id_UserCountry`= 184;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=223 WHERE `t_user_country`.`Id_UserCountry`= 185;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=224 WHERE `t_user_country`.`Id_UserCountry`= 186;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=225 WHERE `t_user_country`.`Id_UserCountry`= 187;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=226 WHERE `t_user_country`.`Id_UserCountry`= 190;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=227 WHERE `t_user_country`.`Id_UserCountry`= 192;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=228 WHERE `t_user_country`.`Id_UserCountry`= 197;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=229 WHERE `t_user_country`.`Id_UserCountry`= 198;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=232 WHERE `t_user_country`.`Id_UserCountry`= 204;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=234 WHERE `t_user_country`.`Id_UserCountry`= 207;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=235 WHERE `t_user_country`.`Id_UserCountry`= 216;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=236 WHERE `t_user_country`.`Id_UserCountry`= 217;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=237 WHERE `t_user_country`.`Id_UserCountry`= 218;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=239 WHERE `t_user_country`.`Id_UserCountry`= 223;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=240 WHERE `t_user_country`.`Id_UserCountry`= 232;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=241 WHERE `t_user_country`.`Id_UserCountry`= 236;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=242 WHERE `t_user_country`.`Id_UserCountry`= 237;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=243 WHERE `t_user_country`.`Id_UserCountry`= 238;
            UPDATE `t_user_country` SET `UserCountry_ConsetturId`=246 WHERE `t_user_country`.`Id_UserCountry`= 171;

ALTER TABLE `t_type_document`
            ADD `TypeDocument_ConsetturId` INT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `TypeDocument_ForPassenger`

ALTER TABLE `t_type_document` ALTER `TypeDocument_ConsetturId` DROP DEFAULT

UPDATE `t_type_document` SET `TypeDocument_ConsetturId`=1 WHERE `t_type_document`.`Id_TypeDocument`= 1;
            UPDATE `t_type_document` SET `TypeDocument_ConsetturId`=2 WHERE `t_type_document`.`Id_TypeDocument`= 4;
            UPDATE `t_type_document` SET `TypeDocument_ConsetturId`=4 WHERE `t_type_document`.`Id_TypeDocument`= 2;
            UPDATE `t_type_document` SET `TypeDocument_ConsetturId`=4 WHERE `t_type_document`.`Id_TypeDocument`= 3;
            UPDATE `t_type_document` SET `TypeDocument_ConsetturId`=4 WHERE `t_type_document`.`Id_TypeDocument`= 5;
            UPDATE `t_type_document` SET `TypeDocument_ConsetturId`=4 WHERE `t_type_document`.`Id_TypeDocument`= 6;


-- =====================================================================
-- 109-release-16-09-25.php
-- =====================================================================

UPDATE `t_directory` SET `Directory_Order` = 9 WHERE `Id_Directory` = 386;


-- =====================================================================
-- 109-release-18-06-25.php
-- =====================================================================

ALTER TABLE `t_booking_extra`
                ADD `BookingExtra_Status` INT(1) NOT NULL DEFAULT 1 AFTER `BookingExtra_Included`; -- 0: ELIMINADO - 1: PENDING
                ALTER TABLE `t_booking_extra` ALTER `BookingExtra_Status` DROP DEFAULT;
                ALTER TABLE `t_booking_extra` ADD INDEX `INDEX_BookingExtra_Status` (`BookingExtra_Status`);

                ALTER TABLE `t_booking_upgrade`
                ADD `BookingUpgrade_Status` INT(1) NOT NULL DEFAULT 1 AFTER `BookingUpgrade_Included`; -- 0: ELIMINADO - 1: PENDING
                ALTER TABLE `t_booking_upgrade` ALTER `BookingUpgrade_Status` DROP DEFAULT;
                ALTER TABLE `t_booking_upgrade` ADD INDEX `INDEX_BookingUpgrade_Status` (`BookingUpgrade_Status`);

ALTER TABLE `t_booking_extra`
                ADD `BookingExtra_Mode` INT(1) NOT NULL DEFAULT 1 AFTER `BookingExtra_Included`;
                 -- 1: REGULAR - 2: UPGRADE - 3: EXTRA - 4: ALTERNATIVE
                ALTER TABLE `t_booking_extra` ALTER `BookingExtra_Mode` DROP DEFAULT;
                ALTER TABLE `t_booking_extra` ADD INDEX `INDEX_BookingExtra_Mode` (`BookingExtra_Mode`);

                ALTER TABLE `t_booking_upgrade`
                ADD `BookingUpgrade_Mode` INT(1) NOT NULL DEFAULT 1 AFTER `BookingUpgrade_Included`;
                 -- 1: REGULAR - 2: UPGRADE - 3: EXTRA - 4: ALTERNATIVE
                ALTER TABLE `t_booking_upgrade` ALTER `BookingUpgrade_Mode` DROP DEFAULT;
                ALTER TABLE `t_booking_upgrade` ADD INDEX `INDEX_BookingUpgrade_Mode` (`BookingUpgrade_Mode`);

                ALTER TABLE `t_booking_equipment`
                ADD `BookingEquipment_Mode` INT(1) NOT NULL DEFAULT 1 AFTER `BookingEquipment_Included`;
                 -- 1: REGULAR - 2: UPGRADE - 3: EXTRA - 4: ALTERNATIVE
                ALTER TABLE `t_booking_equipment` ALTER `BookingEquipment_Mode` DROP DEFAULT;
                ALTER TABLE `t_booking_equipment` ADD INDEX `INDEX_BookingEquipment_Mode` (`BookingEquipment_Mode`);

ALTER TABLE `t_booking_upgrade`
                ADD `BookingUpgrade_Show` INT(1) NOT NULL DEFAULT 2 AFTER `BookingUpgrade_Feature`;
                 -- 1: REGULAR - 2: UPGRADE - 3: EXTRA - 4: ALTERNATIVE
                ALTER TABLE `t_booking_upgrade` ALTER `BookingUpgrade_Show` DROP DEFAULT;
                ALTER TABLE `t_booking_upgrade` ADD INDEX `INDEX_BookingUpgrade_Show` (`BookingUpgrade_Show`);

                ALTER TABLE `t_booking_equipment`
                ADD `BookingEquipment_Show` INT(1) NOT NULL DEFAULT 2 AFTER `BookingEquipment_Total`;
                 -- 1: REGULAR - 2: UPGRADE - 3: EXTRA - 4: ALTERNATIVE
                ALTER TABLE `t_booking_equipment` ALTER `BookingEquipment_Show` DROP DEFAULT;
                ALTER TABLE `t_booking_equipment` ADD INDEX `INDEX_BookingEquipment_Show` (`BookingEquipment_Show`);

ALTER TABLE `t_type_upgrade`
                ADD `TypeUpgrade_Icon` VARCHAR(500) NOT NULL DEFAULT '' AFTER `TypeUpgrade_Abrv`;
                ALTER TABLE `t_type_upgrade` ALTER `TypeUpgrade_Icon` DROP DEFAULT;

                ALTER TABLE `t_type_upgrade`
                ADD `TypeUpgrade_Icon_Thumb` VARCHAR(500) NOT NULL DEFAULT '' AFTER `TypeUpgrade_Icon`;
                ALTER TABLE `t_type_upgrade` ALTER `TypeUpgrade_Icon` DROP DEFAULT;

                ALTER TABLE `t_type_extra`
                ADD `TypeExtra_Icon` VARCHAR(500) NOT NULL DEFAULT '' AFTER `TypeExtra_Abrv`;
                ALTER TABLE `t_type_extra` ALTER `TypeExtra_Icon` DROP DEFAULT;

                ALTER TABLE `t_type_extra`
                ADD `TypeExtra_Icon_Thumb` VARCHAR(500) NOT NULL DEFAULT '' AFTER `TypeExtra_Icon`;
                ALTER TABLE `t_type_extra` ALTER `TypeExtra_Icon` DROP DEFAULT;

                ALTER TABLE `t_type_equipment`
                ADD `TypeEquipment_Icon` VARCHAR(500) NOT NULL DEFAULT '' AFTER `TypeEquipment_Abrv`;
                ALTER TABLE `t_type_equipment` ALTER `TypeEquipment_Icon` DROP DEFAULT;

                ALTER TABLE `t_type_equipment`
                ADD `TypeEquipment_Icon_Thumb` VARCHAR(500) NOT NULL DEFAULT '' AFTER `TypeEquipment_Icon`;
                ALTER TABLE `t_type_equipment` ALTER `TypeEquipment_Icon` DROP DEFAULT;


-- =====================================================================
-- 110-release-06-09-25.php
-- =====================================================================

ALTER TABLE `t_invoice_detail`
                ADD `InvoiceDetail_DateEntryStart` DATETIME NOT NULL DEFAULT '1000-01-01 00:00:00' AFTER `InvoiceDetail_Group`;
                ALTER TABLE `t_invoice_detail`
                ADD `InvoiceDetail_DateEntryEnd` DATETIME NOT NULL DEFAULT '1000-01-01 00:00:00' AFTER `InvoiceDetail_DateEntryStart`;
                ALTER TABLE `t_invoice_detail`
                ADD `InvoiceDetail_DateReturnStart` DATETIME NOT NULL DEFAULT '1000-01-01 00:00:00' AFTER `InvoiceDetail_DateEntryEnd`;
                ALTER TABLE `t_invoice_detail`
                ADD `InvoiceDetail_DateReturnEnd` DATETIME NOT NULL DEFAULT '1000-01-01 00:00:00' AFTER `InvoiceDetail_DateReturnStart`;

ALTER TABLE `t_invoice_detail`
                ADD `InvoiceDetail_Mode` INT(1) NOT NULL DEFAULT 1 AFTER `InvoiceDetail_Included`;
                -- 1: REGULAR - 2: UPGRADE - 3: EXTRA - 4: ALTERNATIVE - 5: FEE - 6: DISCOUNT - 7: TAX - 8: PACKAGE - 9: CANCELLED

UPDATE `t_invoice_detail` `id`
                INNER JOIN `t_invoice` `i` ON `i`.`Id_Invoice` = `id`.`Id_Invoice`
                SET `id`.`InvoiceDetail_Mode` = 8,
                `id`.`InvoiceDetail_DateEntryStart` = CONVERT(( SELECT `bt`.`BookingTour_DateStart`
                                                            FROM `t_booking_tour` `bt`
                                                            INNER JOIN `t_booking_tour_passenger` `btp` ON `btp`.`Id_BookingTour` = `bt`.`Id_BookingTour`
                                                            WHERE `bt`.`Id_Booking` = `i`.`Id_Booking`
                                                            AND `btp`.`Id_BookingTourPassenger` = `id`.`Id`
                                                            ORDER BY `bt`.`BookingTour_DateStart` ASC
                                                            LIMIT 1 ), DATETIME ),
                `id`.`InvoiceDetail_DateEntryEnd` = '1000-01-01 00:00:00',
                `id`.`InvoiceDetail_DateReturnStart` = '1000-01-01 00:00:00',
                `id`.`InvoiceDetail_DateReturnEnd` = '1000-01-01 00:00:00'
                WHERE `id`.`InvoiceDetail_Type` = 0
                AND `id`.`Id_InvoiceDetail` NOT IN (72144, 72160);

                UPDATE `t_invoice_detail` `id`
                INNER JOIN `t_invoice` `i` ON `i`.`Id_Invoice` = `id`.`Id_Invoice`
                SET `id`.`InvoiceDetail_Type` = 5
                WHERE
                     ( SELECT IF (
                        `bup`.`BookingUpgradePassenger_Is23MigrationValue` = 2,
                        IF (
                            `bup`.`BookingUpgradePassenger_OnlyReturn` = 2,
                            `bup`.`BookingUpgradePassenger_Datereturn`,
                            `bup`.`BookingUpgradePassenger_DateEntry`
                        ),
                        `bup`.`BookingUpgradePassenger_DateEntry`
                        )
                        FROM `t_booking_upgrade` `bu`
                        INNER JOIN `t_booking_upgrade_passenger` `bup` ON `bup`.`Id_BookingUpgrade` = `bu`.`Id_BookingUpgrade`
                        INNER JOIN `t_booking_tour_passenger` `btp` ON `btp`.`Id_BookingTourPassenger` = `bup`.`Id_BookingTourPassenger`
                        WHERE `bu`.`Id_BookingUpgrade` = `id`.`Id`
                        AND `btp`.`Id_Passenger` = `i`.`Id_Passenger`
                        LIMIT 1 ) IS NULL
                AND `id`.`InvoiceDetail_Type` = 1;
                
                UPDATE `t_invoice_detail` `id`
                INNER JOIN `t_invoice` `i` ON `i`.`Id_Invoice` = `id`.`Id_Invoice`
                SET `id`.`InvoiceDetail_Mode` = 1,
                    `id`.`InvoiceDetail_DateEntryStart` = ( SELECT IF (
                                                            `bup`.`BookingUpgradePassenger_Is23MigrationValue` = 2,
                                                            IF (
                                                                `bup`.`BookingUpgradePassenger_OnlyReturn` = 2,
                                                                `bup`.`BookingUpgradePassenger_Datereturn`,
                                                                `bup`.`BookingUpgradePassenger_DateEntry`
                                                            ),
                                                            `bup`.`BookingUpgradePassenger_DateEntry`
                                                            )
                                                            FROM `t_booking_upgrade` `bu`
                                                            INNER JOIN `t_booking_upgrade_passenger` `bup` ON `bup`.`Id_BookingUpgrade` = `bu`.`Id_BookingUpgrade`
                                                            INNER JOIN `t_booking_tour_passenger` `btp` ON `btp`.`Id_BookingTourPassenger` = `bup`.`Id_BookingTourPassenger`
                                                            WHERE `bu`.`Id_BookingUpgrade` = `id`.`Id`
                                                            AND `btp`.`Id_Passenger` = `i`.`Id_Passenger`
                                                            LIMIT 1 ),
                    `id`.`InvoiceDetail_DateReturnStart` = ( SELECT IF (
                                                                `bup`.`BookingUpgradePassenger_OnlyReturn` = 2,
                                                                '1000-01-01 00:00:00',
                                                                `bup`.`BookingUpgradePassenger_Datereturn`
                                                            )
                                                            FROM `t_booking_upgrade` `bu`
                                                            INNER JOIN `t_booking_upgrade_passenger` `bup` ON `bup`.`Id_BookingUpgrade` = `bu`.`Id_BookingUpgrade`
                                                            INNER JOIN `t_booking_tour_passenger` `btp` ON `btp`.`Id_BookingTourPassenger` = `bup`.`Id_BookingTourPassenger`
                                                            WHERE `bu`.`Id_BookingUpgrade` = `id`.`Id`
                                                            AND `btp`.`Id_Passenger` = `i`.`Id_Passenger`
                                                            LIMIT 1 ),
                    `id`.`InvoiceDetail_DateEntryEnd` = '1000-01-01 00:00:00',
                    `id`.`InvoiceDetail_DateReturnEnd` = '1000-01-01 00:00:00'
                WHERE `id`.`InvoiceDetail_Type` = 1;

                UPDATE `t_invoice_detail` `id`
                INNER JOIN `t_invoice` `i` ON `i`.`Id_Invoice` = `id`.`Id_Invoice`
                SET `id`.`InvoiceDetail_Type` = 5
                WHERE
                    ( SELECT `bep`.`BookingExtraPassenger_DateEntryStart`
                    FROM `t_booking_extra` `be`
                    INNER JOIN `t_booking_extra_passenger` `bep` ON `bep`.`Id_BookingExtra` = `be`.`Id_BookingExtra`
                    INNER JOIN `t_booking_tour_passenger` `btp` ON `btp`.`Id_BookingTourPassenger` = `bep`.`Id_BookingTourPassenger`
                    WHERE `be`.`Id_BookingExtra` = `id`.`Id`
                    AND `btp`.`Id_Passenger` = `i`.`Id_Passenger`
                    LIMIT 1 ) IS NULL
                AND `id`.`InvoiceDetail_Type` = 2;
                
                UPDATE `t_invoice_detail` `id`
                INNER JOIN `t_invoice` `i` ON `i`.`Id_Invoice` = `id`.`Id_Invoice`
                SET `id`.`InvoiceDetail_Mode` = 1,
                    `id`.`InvoiceDetail_DateEntryStart` = ( SELECT `bep`.`BookingExtraPassenger_DateEntryStart`
                                                            FROM `t_booking_extra` `be`
                                                            INNER JOIN `t_booking_extra_passenger` `bep` ON `bep`.`Id_BookingExtra` = `be`.`Id_BookingExtra`
                                                            INNER JOIN `t_booking_tour_passenger` `btp` ON `btp`.`Id_BookingTourPassenger` = `bep`.`Id_BookingTourPassenger`
                                                            WHERE `be`.`Id_BookingExtra` = `id`.`Id`
                                                            AND `btp`.`Id_Passenger` = `i`.`Id_Passenger`
                                                            LIMIT 1 ),
                    `id`.`InvoiceDetail_DateEntryEnd` = ( SELECT `bep`.`BookingExtraPassenger_DateEntryEnd`
                                                            FROM `t_booking_extra` `be`
                                                            INNER JOIN `t_booking_extra_passenger` `bep` ON `bep`.`Id_BookingExtra` = `be`.`Id_BookingExtra`
                                                            INNER JOIN `t_booking_tour_passenger` `btp` ON `btp`.`Id_BookingTourPassenger` = `bep`.`Id_BookingTourPassenger`
                                                            WHERE `be`.`Id_BookingExtra` = `id`.`Id`
                                                            AND `btp`.`Id_Passenger` = `i`.`Id_Passenger`
                                                            LIMIT 1 ),
                    `id`.`InvoiceDetail_DateReturnStart` = '1000-01-01 00:00:00',
                    `id`.`InvoiceDetail_DateReturnEnd` = '1000-01-01 00:00:00'
                WHERE `id`.`InvoiceDetail_Type` = 2;

                UPDATE `t_invoice_detail` `id`
                INNER JOIN `t_invoice` `i` ON `i`.`Id_Invoice` = `id`.`Id_Invoice`
                SET `id`.`InvoiceDetail_Type` = 5
                WHERE
                CONVERT(( SELECT `bt`.`BookingTour_DateStart`
                    FROM `t_booking_equipment` `be`
                    INNER JOIN `t_booking_equipment_passenger` `bep` ON `bep`.`Id_BookingEquipment` = `be`.`Id_BookingEquipment`
                    INNER JOIN `t_booking_tour_passenger` `btp` ON `btp`.`Id_BookingTourPassenger` = `bep`.`Id_BookingTourPassenger`
                    INNER JOIN `t_booking_tour` `bt` ON `bt`.`Id_BookingTour` = `btp`.`Id_BookingTour`
                    WHERE `be`.`Id_BookingEquipment` = `id`.`Id`
                    AND `btp`.`Id_Passenger` = `i`.`Id_Passenger`
                    LIMIT 1 ), DATETIME ) IS NULL
                AND `id`.`InvoiceDetail_Type` = 3;

                UPDATE `t_invoice_detail` `id`
                INNER JOIN `t_invoice` `i` ON `i`.`Id_Invoice` = `id`.`Id_Invoice`
                SET `id`.`InvoiceDetail_Mode` = 1,
                `id`.`InvoiceDetail_DateEntryStart` = '1000-01-01 00:00:00',
                `id`.`InvoiceDetail_DateEntryEnd` = '1000-01-01 00:00:00',
                `id`.`InvoiceDetail_DateReturnStart` = '1000-01-01 00:00:00',
                `id`.`InvoiceDetail_DateReturnEnd` = '1000-01-01 00:00:00'
                WHERE `id`.`InvoiceDetail_Type` = 3;
                
                UPDATE `t_invoice_detail` `id`
                INNER JOIN `t_invoice` `i` ON `i`.`Id_Invoice` = `id`.`Id_Invoice`
                SET `id`.`InvoiceDetail_Mode` = 3
                WHERE `id`.`InvoiceDetail_Type` = 4
                AND `id`.`InvoiceDetail_Price` >= 0;
                
                UPDATE `t_invoice_detail` `id`
                INNER JOIN `t_invoice` `i` ON `i`.`Id_Invoice` = `id`.`Id_Invoice`
                SET `id`.`InvoiceDetail_Mode` = 5
                WHERE `id`.`InvoiceDetail_Type` = 4
                AND `id`.`InvoiceDetail_Description` = 'PAYMENT GATEWAY FEE';

                UPDATE `t_invoice_detail` `id`
                SET `id`.`InvoiceDetail_Mode` = 6
                WHERE `id`.`InvoiceDetail_Type` = 4
                AND `id`.`InvoiceDetail_Price` < 0;

                UPDATE `t_invoice_detail` `id`
                SET `id`.`InvoiceDetail_Mode` = 9
                WHERE `id`.`InvoiceDetail_Type` = 5;

ALTER TABLE `t_invoice_detail`
                ADD INDEX `INDEX_InvoiceDetail_Mode` (`InvoiceDetail_Mode`);
                
                ALTER TABLE `t_invoice_detail`
                ADD INDEX `INDEX_InvoiceDetail_Group` (`InvoiceDetail_Group`);
                
                ALTER TABLE `t_invoice_detail`
                ADD INDEX `INDEX_InvoiceDetail_Status` (`InvoiceDetail_Status`);
                
                ALTER TABLE `t_invoice_fee`
                ADD INDEX `INDEX_InvoiceFee_Type` (`InvoiceFee_Type`);
                
                ALTER TABLE `t_invoice_fee`
                ADD INDEX `INDEX_InvoiceFee_Full` (`InvoiceFee_Full`);
                
                ALTER TABLE `t_invoice_fee`
                ADD INDEX `INDEX_InvoiceFee_Amount` (`InvoiceFee_Amount`);
                
                ALTER TABLE `t_invoice_fee`
                ADD INDEX `INDEX_InvoiceFee_AmountPending` (`InvoiceFee_AmountPending`);
                
                ALTER TABLE `t_invoice_fee`
                ADD INDEX `INDEX_InvoiceFee_AmountPay` (`InvoiceFee_AmountPay`);
                
                ALTER TABLE `t_booking_tour`
                ADD INDEX `INDEX_BookingTour_Status` (`BookingTour_Status`);
                
                ALTER TABLE `t_booking_tour_passenger`
                ADD INDEX `INDEX_BookingTourPassenger_Price` (`BookingTourPassenger_Price`);
                
                ALTER TABLE `t_booking_tour_passenger`
                ADD INDEX `INDEX_BookingTourPassenger_Full` (`BookingTourPassenger_Full`);
                
                ALTER TABLE `t_booking_upgrade_passenger`
                ADD INDEX `INDEX_BookingUpgradePassenger_Status` (`BookingUpgradePassenger_Status`);
                
                ALTER TABLE `t_credential`
                ADD INDEX `INDEX_Credential_Public` (`Credential_Public`);


-- =====================================================================
-- 110-release-17-07-25.php
-- =====================================================================

INSERT INTO `t_directory`
                (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUES (385, 'calendar-package', 'general.calendar-package', 'Disponibilidad por Paquete', '', '', 14, 0, 0, 0, 0, 310);


-- =====================================================================
-- 110-release-19-09-25.php
-- =====================================================================

CREATE TABLE `t_briefing_office` (
                                `Id_BriefingOffice` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                                `BriefingOffice_Date` DATETIME NOT NULL,
                                `BriefingOffice_DateUpdate` DATETIME NOT NULL,
                                `BriefingOffice_Name` VARCHAR(100) NOT NULL, 
                                `BriefingOffice_Status` INT(1) NOT NULL,                -- Inactivo: 1, Activo: 2
                                `BriefingOffice_Color` VARCHAR(7) NOT NULL,             -- Color de la oficina
                                `BriefingOffice_Capacity` INT NOT NULL,                 -- Capacidad de la oficina
                                `Parent_Office_Id` INT(11) UNSIGNED NULL,               -- Oficina padre Id_BriefingOffice (si es suboficina)
                                `Id_Location` INT(11) UNSIGNED NOT NULL,
                                FOREIGN KEY (`Parent_Office_Id`) REFERENCES `t_briefing_office`(`Id_BriefingOffice`),
                                FOREIGN KEY (`Id_Location`) REFERENCES `t_location`(`Id_Location`)
                            );

                            CREATE TABLE `t_briefing_passenger` (
                                `Id_BriefingPassenger` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                                `BriefingPassenger_Date` DATETIME NOT NULL,
                                `BriefingPassenger_DateUpdate` DATETIME NOT NULL,
                                `BriefingPassenger_Type` INT(1) NOT NULL, -- 1: Oficina, 2: Llamada, 3: Hotel, 4: Otros
                                `BriefingPassenger_Hotel` VARCHAR(150) NOT NULL,
                                `BriefingPassenger_Time` TIME NOT NULL,
                                `BriefingPassenger_Phone` VARCHAR(20) NOT NULL,
                                `BriefingPassenger_Other` VARCHAR(500) NOT NULL,
                                `BriefingPassenger_Observations` VARCHAR(500) NOT NULL,
                                `Id_Group` INT(11) UNSIGNED NOT NULL,
                                `Id_Booking` INT(11) UNSIGNED NOT NULL,
                                `Id_BriefingOffice` INT(11) UNSIGNED NOT NULL,
                                `Id_Passenger` INT(11) UNSIGNED NOT NULL,
                                `Id_Admin` INT(11) UNSIGNED NOT NULL,
                                FOREIGN KEY (`Id_Group`) REFERENCES `t_group`(`Id_Group`),
                                FOREIGN KEY (`Id_Booking`) REFERENCES `t_booking`(`Id_Booking`),
                                FOREIGN KEY (`Id_Passenger`) REFERENCES `t_passenger`(`Id_Passenger`),
                                FOREIGN KEY (`Id_Admin`) REFERENCES `t_admin`(`Id_Admin`)
                            );

INSERT INTO `t_directory` 
                                (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, 
                                `Directory_Url`, `Directory_Icon`, `Directory_Order`, `Directory_ShowInMenu`, 
                                `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`) 
                            VALUES 
                                (388, 'offices-briefing', 'maintenance.briefing', 'Oficinas Briefing', 
                                '/offices-briefing', 'location_city', 18, 2, 1, 1, 1, 1);

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
INSERT INTO `t_history_table` 
                                (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) 
                            VALUES
                                (200, 't_briefing_office', 'Oficina Briefing', 'sp_briefing_office_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
INSERT INTO `t_history_table` 
                                (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) 
                            VALUES
                                (201, 't_briefing_passenger', 'Pasajero Briefing', 'sp_briefing_passenger_index(?,@sts,@cod,@msg)');


-- =====================================================================
-- 111-release-16-09-25.php
-- =====================================================================

DELETE `ge`
                FROM `t_group_equipment` `ge`
                INNER JOIN `t_booking_equipment_passenger` `bep`
                    ON `bep`.`Id_BookingEquipmentPassenger` = `ge`.`Id_BookingEquipmentPassenger`
                WHERE `bep`.`BookingEquipmentPassenger_Status` = 0;


-- =====================================================================
-- 111-release-30-09-25.php
-- =====================================================================

ALTER TABLE `t_user`
                ADD `User_ImgProfile` VARCHAR(500) NOT NULL DEFAULT '' AFTER `User_ContactPhone`;
                ALTER TABLE `t_user` ALTER `User_ImgProfile` DROP DEFAULT;

                ALTER TABLE `t_user`
                ADD `User_ImgProfile_Thumb` VARCHAR(500) NOT NULL DEFAULT '' AFTER `User_ImgProfile`;
                ALTER TABLE `t_user` ALTER `User_ImgProfile_Thumb` DROP DEFAULT;

                ALTER TABLE `t_user`
                ADD `User_SelfDetraction` INT(1) NOT NULL DEFAULT 1 AFTER `User_ImgProfile_Thumb`; -- 1: FALSE - 2: TRUE
                ALTER TABLE `t_user` ALTER `User_SelfDetraction` DROP DEFAULT;

                ALTER TABLE `t_user`
                ADD INDEX `INDEX_Id_TypeDocument` (`Id_TypeDocument`);

                ALTER TABLE `t_user`
                ADD INDEX `INDEX_User_Status` (`User_Status`);

                UPDATE `t_user`
                SET
                    `User_Name` = TRIM(`User_Name`),
                    `User_LastName` = TRIM(`User_LastName`),
                    `User_Email` = TRIM(`User_Email`),
                    `User_Phone` = TRIM(`User_Phone`),
                    `User_Address` = TRIM(`User_Address`),
                    `User_ContactName` = TRIM(`User_ContactName`),
                    `User_ContactPhone` = TRIM(`User_ContactPhone`);

                INSERT INTO `t_credential`
                (`Id_Credential`, `Credential_key`, `Credential_Value`, `Credential_Description`, `Credential_Public`)
                VALUES
                (44, 'Tax_Detraction', '12', 'Impuesto sobre la renta', 2);


-- =====================================================================
-- 112-release-05-12-25.php
-- =====================================================================

ALTER TABLE `t_briefing_passenger`
                MODIFY `BriefingPassenger_Observations` TEXT NOT NULL;


-- =====================================================================
-- 112-release-09-10-25.php
-- =====================================================================

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_category_extra`
                (
                    `Id_CategoryExtra`          INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `CategoryExtra_Date`        DATETIME NOT NULL,
                    `CategoryExtra_DateUpdate`  DATETIME NOT NULL,
                    `CategoryExtra_Name`        VARCHAR(250) NOT NULL,
                    `CategoryExtra_Abrv`        VARCHAR(20) NOT NULL,
                    `CategoryExtra_Icon`        VARCHAR(500) NOT NULL,
                    `CategoryExtra_IconThumb`   VARCHAR(500) NOT NULL,
                    `CategoryExtra_Group`       INT(11) NOT NULL,
                    `CategoryExtra_Version`     INT(11) NOT NULL,
                    `CategoryExtra_Status`      INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_TypeExtra`              INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_CategoryExtra`),
                    FOREIGN KEY (`Id_TypeExtra`) REFERENCES `t_type_extra`(`Id_TypeExtra`),
                    INDEX(`CategoryExtra_Date`),
                    INDEX(`CategoryExtra_Status`),
                    INDEX(`CategoryExtra_Name`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
                
                 -- Vestigio de la tabla t_upgrade
                ALTER TABLE `t_extra`
                ADD `Extra_OneWay` INT(1) NOT NULL DEFAULT 1 AFTER `Extra_Group`; -- 1: FALSE - 2: TRUE
                ALTER TABLE `t_extra` ALTER `Extra_OneWay` DROP DEFAULT;

                ALTER TABLE `t_extra`
                ADD `Extra_Icon` VARCHAR(500) NOT NULL DEFAULT '' AFTER `Extra_OneWay`;
                ALTER TABLE `t_extra` ALTER `Extra_Icon` DROP DEFAULT;

                ALTER TABLE `t_extra`
                ADD `Extra_Icon_Thumb` VARCHAR(500) NOT NULL DEFAULT '' AFTER `Extra_Icon`;
                ALTER TABLE `t_extra` ALTER `Extra_Icon_Thumb` DROP DEFAULT;

                ALTER TABLE `t_extra`
                ADD `Extra_TypeBefore` INT(1) NOT NULL DEFAULT 2 AFTER `Extra_Icon_Thumb`;
                ALTER TABLE `t_extra` ALTER `Extra_TypeBefore` DROP DEFAULT; -- 1: UPGRADE - 2: EXTRA - 3: EQUIPMENT

                ALTER TABLE `t_extra`
                ADD `Extra_IdBefore` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Extra_TypeBefore`;
                ALTER TABLE `t_extra` ALTER `Extra_IdBefore` DROP DEFAULT;

                ALTER TABLE `t_extra`
                ADD `Id_Route` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_Location`;
                ALTER TABLE `t_extra` ALTER `Id_Route` DROP DEFAULT;

                ALTER TABLE `t_extra`
                ADD INDEX `INDEX_Id_Route` (`Id_Route`);

                ALTER TABLE `t_extra`
                ADD `Id_CategoryExtra` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_Route`;
                ALTER TABLE `t_extra` ALTER `Id_CategoryExtra` DROP DEFAULT;

                ALTER TABLE `t_extra`
                ADD INDEX `INDEX_Id_CategoryExtra` (`Id_CategoryExtra`);

                ALTER TABLE `t_extra`
                ADD `Id_Item` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_CategoryExtra`;
                ALTER TABLE `t_extra` ALTER `Id_Item` DROP DEFAULT;

                ALTER TABLE `t_extra`
                ADD INDEX `INDEX_Id_Item` (`Id_Item`);
                
                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (202, 't_category_extra', 'Categoría de extra', 'sp_category_extra_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_extra_requirement`
                (
                    `Id_ExtraRequirement`           INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ExtraRequirement_Date`         DATETIME NOT NULL,
                    `ExtraRequirement_DateUpdate`   DATETIME NOT NULL,
                    `ExtraRequirement_Name`         VARCHAR(250) NOT NULL,
                    `ExtraRequirement_DateStart`    VARCHAR(20) NOT NULL,
                    `ExtraRequirement_RequestTime`  VARCHAR(500) NOT NULL,
                    `ExtraRequirement_Version`      INT(11) NOT NULL,
                    `ExtraRequirement_Status`       INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_Route`                      INT(11) UNSIGNED NOT NULL,
                    `Id_Extra`                      INT(11) UNSIGNED NOT NULL,
                    `Id_ProvisionRate`              INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_ExtraRequirement`),
                    FOREIGN KEY (`Id_Extra`) REFERENCES `t_extra`(`Id_Extra`),
                    INDEX(`ExtraRequirement_Date`),
                    INDEX(`ExtraRequirement_Status`),
                    INDEX(`ExtraRequirement_Name`),
                    INDEX(`Id_Route`),
                    INDEX(`Id_ProvisionRate`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (209, 't_extra_requirement', 'Requerimiento de servicio', 'sp_extra_requirement_index(?,@sts,@cod,@msg)');

                CREATE TABLE `t_extra_requirement_schedule`
                (
                    `Id_ExtraRequirementSchedule`           INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ExtraRequirementSchedule_Date`         DATETIME NOT NULL,
                    `ExtraRequirementSchedule_DateUpdate`   DATETIME NOT NULL,
                    `ExtraRequirementSchedule_DayStart`     VARCHAR(250) NOT NULL,
                    `ExtraRequirementSchedule_TimeStart`    VARCHAR(20) NOT NULL,
                    `ExtraRequirementSchedule_DayEnd`       VARCHAR(500) NOT NULL,
                    `ExtraRequirementSchedule_TimeEnd`      VARCHAR(500) NOT NULL,
                    `ExtraRequirementSchedule_Version`      INT(11) NOT NULL,
                    `ExtraRequirementSchedule_Status`       INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_ExtraRequirement`                   INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_ExtraRequirementSchedule`),
                    FOREIGN KEY (`Id_ExtraRequirement`) REFERENCES `t_extra_requirement`(`Id_ExtraRequirement`),
                    INDEX(`ExtraRequirementSchedule_Date`),
                    INDEX(`ExtraRequirementSchedule_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (
                    210,
                    't_extra_requirement_schedule',
                    'Horario del requerimiento de servicio',
                    'sp_extra_requirement_schedule_index(?,@sts,@cod,@msg)'
                );

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_extra_rate`
                (
                    `Id_ExtraRate`                  INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ExtraRate_Date`                DATETIME NOT NULL,
                    `ExtraRate_DateUpdate`          DATETIME NOT NULL,
                    `ExtraRate_Price`               DECIMAL(12,2) NOT NULL,
                    `ExtraRate_PriceConfidential`   DECIMAL(12,2) NOT NULL,
                    `ExtraRate_PaxStart`            INT(11) NOT NULL,
                    `ExtraRate_PaxEnd`              INT(11) NOT NULL,
                    `ExtraRate_ByDay`               INT(1) NOT NULL, -- 1: FALSE - 2: TRUE
                    `ExtraRate_DateStart`           DATETIME NOT NULL,
                    `ExtraRate_DateEnd`             DATETIME NOT NULL,
                    `ExtraRate_Order`               INT(11) NOT NULL,
                    `ExtraRate_IsMain`              INT(11) NOT NULL,
                    `ExtraRate_Version`             INT(11) NOT NULL,
                    `ExtraRate_Status`              INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_Extra`                      INT(11) UNSIGNED NOT NULL,
                    `Id_Provision`                  INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_ExtraRate`),
                    FOREIGN KEY (`Id_Extra`) REFERENCES `t_extra`(`Id_Extra`),
                    INDEX(`ExtraRate_Date`),
                    INDEX(`ExtraRate_Status`),
                    INDEX(`Id_Provision`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (203, 't_extra_rate', 'Requerimiento de servicio', 'sp_extra_rate_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_extra_availability`
                (
                    `Id_ExtraAvailability`                  INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ExtraAvailability_Date`                DATETIME NOT NULL,
                    `ExtraAvailability_DateUpdate`          DATETIME NOT NULL,
                    `ExtraAvailability_DateStart`           DATETIME NOT NULL,
                    `ExtraAvailability_Availability`        INT(11) NOT NULL,
                    `ExtraAvailability_Description`         VARCHAR(1000) NOT NULL,
                    `ExtraAvailability_Version`             INT(11) NOT NULL,
                    `ExtraAvailability_Status`              INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_Extra`                      INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_ExtraAvailability`),
                    FOREIGN KEY (`Id_Extra`) REFERENCES `t_extra`(`Id_Extra`),
                    INDEX(`ExtraAvailability_Date`),
                    INDEX(`ExtraAvailability_DateStart`),
                    INDEX(`ExtraAvailability_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (204, 't_extra_availability', 'Disponibilidad de servicio', 'sp_extra_availability_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
ALTER TABLE `t_type_provider`
                ADD `TypeProvider_Date` DATETIME NOT NULL DEFAULT NOW() AFTER `Id_TypeProvider`;
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_Date` DROP DEFAULT;

                ALTER TABLE `t_type_provider`
                ADD `TypeProvider_DateUpdate` DATETIME NOT NULL DEFAULT NOW() AFTER `TypeProvider_Date`;
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_DateUpdate` DROP DEFAULT;

                ALTER TABLE `t_type_provider`
                ADD `TypeProvider_Icon` VARCHAR(250) NOT NULL DEFAULT '' AFTER `TypeProvider_Endorser`;
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_Icon` DROP DEFAULT;

                ALTER TABLE `t_type_provider`
                ADD `TypeProvider_Color` VARCHAR(250) NOT NULL DEFAULT '' AFTER `TypeProvider_Icon`;
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_Color` DROP DEFAULT;

                CREATE TABLE `t_category_provider`
                (
                    `Id_CategoryProvider`          INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `CategoryProvider_Date`        DATETIME NOT NULL,
                    `CategoryProvider_DateUpdate`  DATETIME NOT NULL,
                    `CategoryProvider_Name`        VARCHAR(250) NOT NULL,
                    `CategoryProvider_Abrv`        VARCHAR(20) NOT NULL,
                    `CategoryProvider_Level`       INT(11) NOT NULL,
                    `CategoryProvider_Version`     INT(11) NOT NULL,
                    `CategoryProvider_Status`      INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_TypeProvider`              INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_CategoryProvider`),
                    FOREIGN KEY (`Id_TypeProvider`) REFERENCES `t_type_provider`(`Id_TypeProvider`),
                    INDEX(`CategoryProvider_Date`),
                    INDEX(`CategoryProvider_Status`),
                    INDEX(`CategoryProvider_Name`),
                    INDEX(`CategoryProvider_Level`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (205, 't_category_provider', 'Categoría de proveedor', 'sp_category_provider_index(?,@sts,@cod,@msg)');

                CREATE TABLE `t_provider_general`
                (
                    `Id_ProviderGeneral`            INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ProviderGeneral_Date`          DATETIME NOT NULL,
                    `ProviderGeneral_DateUpdate`    DATETIME NOT NULL,
                    `ProviderGeneral_Name`          VARCHAR(250) NOT NULL,
                    `ProviderGeneral_Phone`         VARCHAR(50) NOT NULL,
                    `ProviderGeneral_Dni`           VARCHAR(20) NOT NULL,
                    `ProviderGeneral_Ruc`           VARCHAR(20) NOT NULL,
                    `ProviderGeneral_SolUser`       VARCHAR(250) NOT NULL,
                    `ProviderGeneral_SolPassword`   VARCHAR(250) NOT NULL,
                    `ProviderGeneral_Profile`       VARCHAR(500) NOT NULL,
                    `ProviderGeneral_Profile_Thumb`  VARCHAR(500) NOT NULL,
                    `ProviderGeneral_TypePerson`    INT(1) NOT NULL, -- 1: NATURAL - 2: LEGAL
                    `ProviderGeneral_Version`       INT(11) NOT NULL,
                    `ProviderGeneral_Status`        INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_ProviderContact`            INT(11) UNSIGNED NOT NULL,
                    `Id_TypeDocument`               INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_ProviderGeneral`),
                    FOREIGN KEY (`Id_TypeDocument`) REFERENCES `t_type_document`(`Id_TypeDocument`),
                    INDEX(`ProviderGeneral_Date`),
                    INDEX(`ProviderGeneral_Name`),
                    INDEX(`ProviderGeneral_Status`),
                    INDEX(`Id_ProviderContact`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (206, 't_provider_general', 'Proveedor', 'sp_provider_general_index(?,@sts,@cod,@msg)');

                ALTER TABLE `t_provider`
                ADD `Provider_Direction` VARCHAR(500) NOT NULL DEFAULT '' AFTER `Provider_NickName`;
                ALTER TABLE `t_provider` ALTER `Provider_Direction` DROP DEFAULT;

                ALTER TABLE `t_provider`
                ADD `Id_Location` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_City`;
                ALTER TABLE `t_provider` ALTER `Id_Location` DROP DEFAULT;

                ALTER TABLE `t_provider`
                ADD `Id_ProviderGeneral` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_Location`;
                ALTER TABLE `t_provider` ALTER `Id_ProviderGeneral` DROP DEFAULT;

                ALTER TABLE `t_provider`
                ADD INDEX `INDEX_Id_Location` (`Id_Location`);

                ALTER TABLE `t_provider`
                ADD INDEX `INDEX_Id_ProviderGeneral` (`Id_ProviderGeneral`);

                CREATE TABLE `t_provider_contact`
                (
                    `Id_ProviderContact`            INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ProviderContact_Date`          DATETIME NOT NULL,
                    `ProviderContact_DateUpdate`    DATETIME NOT NULL,
                    `ProviderContact_Name`          VARCHAR(250) NOT NULL,
                    `ProviderContact_Phone`         VARCHAR(50) NOT NULL,
                    `ProviderContact_Email`         VARCHAR(250) NOT NULL,
                    `ProviderContact_Version`       INT(11) NOT NULL,
                    `ProviderContact_Status`        INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_ProviderGeneral`            INT(11) UNSIGNED NOT NULL,
                    `Id_TypeDocument`               INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_ProviderContact`),
                    FOREIGN KEY (`Id_ProviderGeneral`) REFERENCES `t_provider_general`(`Id_ProviderGeneral`),
                    FOREIGN KEY (`Id_TypeDocument`) REFERENCES `t_type_document`(`Id_TypeDocument`),
                    INDEX(`ProviderContact_Date`),
                    INDEX(`ProviderContact_Name`),
                    INDEX(`ProviderContact_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (207, 't_provider_contact', 'Contacto de Proveedor', 'sp_provider_contact_index(?,@sts,@cod,@msg)');

                ALTER TABLE `t_provider_type_provider`
                ADD `ProviderTypeProvider_Date` DATETIME NOT NULL DEFAULT NOW() AFTER `Id_ProviderTypeProvider`;
                ALTER TABLE `t_provider_type_provider` ALTER `ProviderTypeProvider_Date` DROP DEFAULT;

                ALTER TABLE `t_provider_type_provider`
                ADD `ProviderTypeProvider_DateUpdate` DATETIME NOT NULL DEFAULT NOW() AFTER `ProviderTypeProvider_Date`;
                ALTER TABLE `t_provider_type_provider` ALTER `ProviderTypeProvider_DateUpdate` DROP DEFAULT;

                ALTER TABLE `t_provider_type_provider`
                ADD `ProviderTypeProvider_Version` INT(11) NOT NULL DEFAULT 1 AFTER `ProviderTypeProvider_DateUpdate`;
                ALTER TABLE `t_provider_type_provider` ALTER `ProviderTypeProvider_Version` DROP DEFAULT;

                ALTER TABLE `t_provider_type_provider`
                ADD `Id_CategoryProvider` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_TypeProvider`;
                ALTER TABLE `t_provider_type_provider` ALTER `Id_CategoryProvider` DROP DEFAULT;

                ALTER TABLE `t_provider_type_provider`
                ADD INDEX `INDEX_Id_CategoryProvider` (`Id_CategoryProvider`);

                CREATE TABLE `t_provider_contributor`
                (
                    `Id_ProviderContributor`            INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ProviderContributor_Date`          DATETIME NOT NULL,
                    `ProviderContributor_DateUpdate`    DATETIME NOT NULL,
                    `ProviderContributor_Name`          VARCHAR(250) NOT NULL,
                    `ProviderContributor_LastName`      VARCHAR(250) NOT NULL,
                    `ProviderContributor_NoDocument`    VARCHAR(250) NOT NULL,
                    `ProviderContributor_Phone`         VARCHAR(50) NOT NULL,
                    `ProviderContributor_Email`         VARCHAR(250) NOT NULL,
                    `ProviderContributor_Version`       INT(11) NOT NULL,
                    `ProviderContributor_Status`        INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_Provider`                       INT(11) UNSIGNED NOT NULL,
                    `Id_TypeDocument`                   INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_ProviderContributor`),
                    FOREIGN KEY (`Id_Provider`) REFERENCES `t_provider`(`Id_Provider`),
                    FOREIGN KEY (`Id_TypeDocument`) REFERENCES `t_type_document`(`Id_TypeDocument`),
                    INDEX(`ProviderContributor_Date`),
                    INDEX(`ProviderContributor_Name`),
                    INDEX(`ProviderContributor_Phone`),
                    INDEX(`ProviderContributor_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (208, 't_provider_contributor', 'Contribuidor de proveedor', 'sp_provider_contributor_index(?,@sts,@cod,@msg)');


                CREATE OR REPLACE VIEW Calendar_Confirm AS
                SELECT  `b`.`Id_Booking`,
                        `bt`.`Id_BookingTour`,
                        `bt`.`Id_Package`,
                        `bt`.`Id_Tour`,
                        `bt`.`BookingTour_Group`,
                        `b`.`Id_Admin`,
                        `btp`.`Id_Passenger`,
                        `btp`.`Id_BookingTourPassenger`,
                        `b`.`Booking_DateConfirm`,
                        `bt`.`BookingTour_DateStart`,
                        YEAR(`b`.`Booking_DateConfirm`) AS `Year`,
                        MONTH(`b`.`Booking_DateConfirm`) AS `Month`,
                        DAY(`b`.`Booking_DateConfirm`) AS `Day`,
                        `b`.`Booking_DateConfirm` as `Date`,
                        IF(`u`.`User_Type` = 1 AND `b`.`Booking_Type` = 1, 1, 0) AS `ReservaWeb`,
                        IF(`u`.`User_Type` = 1 AND `b`.`Booking_Type` = 1, 0, 1) AS `NotReservaWeb`,
                        IF(`u`.`User_Type` = 2, 0, IF(`b`.`Booking_InPerson` = 1, `b`.`Booking_Type`, 8)) AS `Type`,
                        `cmd`.`Id_CashMovementDetail`,
                        `cmd`.`CashMovementDetail_Amount`
                FROM `t_booking_tour_passenger` `btp`
                INNER JOIN `t_booking_tour` `bt` ON `bt`.`Id_BookingTour` = `btp`.`Id_BookingTour`
                INNER JOIN `t_booking` `b` ON `b`.`Id_Booking` = `bt`.`Id_Booking`
                INNER JOIN `t_user` `u` ON `u`.`Id_User` = `b`.`Id_User`
                INNER JOIN `t_invoice` `i` ON `i`.`Id_Passenger` = `btp`.`Id_Passenger`
                LEFT JOIN `t_cash_movement_detail` `cmd` ON `cmd`.`Id_Invoice` = `i`.`Id_Invoice`
                WHERE `bt`.`BookingTour_Status` = 2
                AND `btp`.`BookingTourPassenger_Status` IN (2, 3)
                AND `fn_booking_tour_passenger_check`(
                        `b`.`Booking_Status`,
                        `b`.`Booking_ManuallyConfirmed`,
                        1,
                        1,
                        `btp`.`BookingTourPassenger_PaymentStatus`
                    );

                CREATE OR REPLACE VIEW Calendar_Start AS
                SELECT  `b`.`Id_Booking`,
                        `bt`.`Id_BookingTour`,
                        `bt`.`Id_Package`,
                        `bt`.`Id_Tour`,
                        `bt`.`BookingTour_Group`,
                        `b`.`Id_Admin`,
                        `btp`.`Id_Passenger`,
                        `btp`.`Id_BookingTourPassenger`,
                        `b`.`Booking_DateConfirm`,
                        `bt`.`BookingTour_DateStart`,
                        YEAR(`bt`.`BookingTour_DateStart`) AS `Year`,
                        MONTH(`bt`.`BookingTour_DateStart`) AS `Month`,
                        DAY(`bt`.`BookingTour_DateStart`) AS `Day`,
                        `bt`.`BookingTour_DateStart` as `Date`,
                        IF(`u`.`User_Type` = 1 AND `b`.`Booking_Type` = 1, 1, 0) AS `ReservaWeb`,
                        IF(`u`.`User_Type` = 1 AND `b`.`Booking_Type` = 1, 0, 1) AS `NotReservaWeb`,
                        IF(`u`.`User_Type` = 2, 0, IF(`b`.`Booking_InPerson` = 1, `b`.`Booking_Type`, 8)) AS `Type`,
                        `cmd`.`Id_CashMovementDetail`,
                        `cmd`.`CashMovementDetail_Amount`
                FROM `t_booking_tour_passenger` `btp`
                INNER JOIN `t_booking_tour` `bt` ON `bt`.`Id_BookingTour` = `btp`.`Id_BookingTour`
                INNER JOIN `t_booking` `b` ON `b`.`Id_Booking` = `bt`.`Id_Booking`
                INNER JOIN `t_user` `u` ON `u`.`Id_User` = `b`.`Id_User`
                INNER JOIN `t_invoice` `i` ON `i`.`Id_Passenger` = `btp`.`Id_Passenger`
                LEFT JOIN `t_cash_movement_detail` `cmd` ON `cmd`.`Id_Invoice` = `i`.`Id_Invoice`
                WHERE `bt`.`BookingTour_Status` = 2
                AND `btp`.`BookingTourPassenger_Status` IN (2, 3)
                AND `fn_booking_tour_passenger_check`(
                        `b`.`Booking_Status`,
                        `b`.`Booking_ManuallyConfirmed`,
                        1,
                        1,
                        `btp`.`BookingTourPassenger_PaymentStatus`
                    );

                -- FLUSH TABLES;


                CREATE TABLE `t_provider_availability`
                (
                    `Id_ProviderAvailability`           INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ProviderAvailability_Date`         DATETIME NOT NULL,
                    `ProviderAvailability_DateUpdate`   DATETIME NOT NULL,
                    `ProviderAvailability_DateStart`    DATETIME NOT NULL,
                    `ProviderAvailability_Remark`       VARCHAR(1000) NOT NULL,
                    `ProviderAvailability_Version`      INT(11) NOT NULL,
                    `ProviderAvailability_Status`       INT(1) NOT NULL, -- 0: Eliminado, 1: Unavailable, 2: Available
                    `Id_Provider`                       INT(11) UNSIGNED NOT NULL,
                    `Id_TypeProviderAvailability`       INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_ProviderAvailability`),
                    FOREIGN KEY (`Id_Provider`) REFERENCES `t_provider`(`Id_Provider`),
                    INDEX(`ProviderAvailability_Date`),
                    INDEX(`ProviderAvailability_DateStart`),
                    INDEX(`ProviderAvailability_Status`),
                    INDEX(`Id_TypeProviderAvailability`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


                CREATE TABLE `t_type_provider_availability`
                (
                    `Id_TypeProviderAvailability`           INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `TypeProviderAvailability_Date`         DATETIME NOT NULL,
                    `TypeProviderAvailability_DateUpdate`   DATETIME NOT NULL,
                    `TypeProviderAvailability_Name`         VARCHAR(250) NOT NULL,
                    `TypeProviderAvailability_Abrv`         VARCHAR(50) NOT NULL,
                    `TypeProviderAvailability_Color`        VARCHAR(250) NOT NULL,
                    `TypeProviderAvailability_Locking`      INT(1) UNSIGNED NOT NULL, -- 1: No - 2: Yes
                    `TypeProviderAvailability_Version`      INT(11) NOT NULL,
                    `TypeProviderAvailability_Status`       INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2: Activo

                    PRIMARY KEY (`Id_TypeProviderAvailability`),
                    INDEX(`TypeProviderAvailability_Date`),
                    INDEX(`TypeProviderAvailability_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (211, 't_provider_availability', 'Disponibilidad de proveedor', 'sp_provider_availability_index(?,@sts,@cod,@msg)');

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (212, 't_type_provider_availability', 'Tipo de disponibilidad de proveedor', 'sp_type_provider_availability_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_defined_provision`
                (
                    `Id_DefinedProvision`           INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `DefinedProvision_Date`         DATETIME NOT NULL,
                    `DefinedProvision_DateUpdate`   DATETIME NOT NULL,
                    `DefinedProvision_Name`         VARCHAR(250) NOT NULL,
                    `DefinedProvision_Code`         VARCHAR(50) NOT NULL,
                    `DefinedProvision_Capacity`     INT(11) NOT NULL,
                    `DefinedProvision_Version`      INT(11) NOT NULL,
                    `DefinedProvision_Status`       INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2: Activo
                    
                    `Id_TypeProvider`               INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_DefinedProvision`),
                    FOREIGN KEY (`Id_TypeProvider`) REFERENCES `t_type_provider`(`Id_TypeProvider`),
                    INDEX(`DefinedProvision_Date`),
                    INDEX(`DefinedProvision_Name`),
                    INDEX(`DefinedProvision_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (213, 't_defined_provision', 'Provision Definida', 'sp_defined_provision_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_category_room`
                (
                    `Id_CategoryRoom`           INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `CategoryRoom_Date`         DATETIME NOT NULL,
                    `CategoryRoom_DateUpdate`   DATETIME NOT NULL,
                    `CategoryRoom_Name`         VARCHAR(250) NOT NULL,
                    `CategoryRoom_Level`        INT(11) NOT NULL,
                    `CategoryRoom_Version`      INT(11) NOT NULL,
                    `CategoryRoom_Status`       INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2: Activo
                    
                    `Id_TypeProvider`           INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_CategoryRoom`),
                    FOREIGN KEY (`Id_TypeProvider`) REFERENCES `t_type_provider`(`Id_TypeProvider`),
                    INDEX(`CategoryRoom_Date`),
                    INDEX(`CategoryRoom_Name`),
                    INDEX(`CategoryRoom_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (214, 't_category_room', 'Categoría de habitación', 'sp_category_room_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_type_room_category`
                (
                    `Id_TypeRoomCategory`               INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `TypeRoomCategory_Date`             DATETIME NOT NULL,
                    `TypeRoomCategory_DateUpdate`       DATETIME NOT NULL,
                    `TypeRoomCategory_BreakfastPrice`   DECIMAL(10,2) NOT NULL,
                    `TypeRoomCategory_BreakfastStatus`  INT(1) NOT NULL, -- 1: Inactivo, 2: Activo
                    `TypeRoomCategory_LunchPrice`       DECIMAL(10,2) NOT NULL,
                    `TypeRoomCategory_LunchStatus`      INT(1) NOT NULL, -- 1: Inactivo, 2: Activo
                    `TypeRoomCategory_DinnerPrice`      DECIMAL(10,2) NOT NULL,
                    `TypeRoomCategory_DinnerStatus`     INT(1) NOT NULL, -- 1: Inactivo, 2: Activo
                    `TypeRoomCategory_Version`          INT(11) NOT NULL,
                    `TypeRoomCategory_Status`           INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2: Activo
                    
                    `Id_TypeRoom`                       INT(11) UNSIGNED NOT NULL,
                    `Id_CategoryRoom`                   INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_TypeRoomCategory`),
                    FOREIGN KEY (`Id_TypeRoom`) REFERENCES `t_type_room`(`Id_TypeRoom`),
                    FOREIGN KEY (`Id_CategoryRoom`) REFERENCES `t_category_room`(`Id_CategoryRoom`),
                    INDEX(`TypeRoomCategory_Date`),
                    INDEX(`TypeRoomCategory_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (215, 't_type_room_category', 'Categoría de tipo de habitación', 'sp_type_room_category_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_type_equine`
                (
                    `Id_TypeEquine`             INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `TypeEquine_Date`           DATETIME NOT NULL,
                    `TypeEquine_DateUpdate`     DATETIME NOT NULL,
                    `TypeEquine_Name`           VARCHAR(250) NOT NULL,
                    `TypeEquine_Capacity`       INT(11) NOT NULL, -- KG
                    `TypeEquine_PaxCapacity`    INT(11) NOT NULL,
                    `TypeEquine_Version`        INT(11) NOT NULL,
                    `TypeEquine_Status`         INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2: Activo

                    PRIMARY KEY (`Id_TypeEquine`),
                    INDEX(`TypeEquine_Date`),
                    INDEX(`TypeEquine_Name`),
                    INDEX(`TypeEquine_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (216, 't_type_equine', 'Tipo de equino', 'sp_type_equine_index(?,@sts,@cod,@msg)');

ALTER TABLE `t_provider_general`
                ADD `ProviderGeneral_BusinessName` VARCHAR(250) NOT NULL DEFAULT '' AFTER `ProviderGeneral_Name`; -- Nombre comercial
                ALTER TABLE `t_provider_general` ALTER `ProviderGeneral_BusinessName` DROP DEFAULT;
                ALTER TABLE `t_provider_general`
                ADD INDEX `INDEX_ProviderGeneral_BusinessName` (`ProviderGeneral_BusinessName`);
                
                ALTER TABLE `t_provider_general`
                ADD `ProviderGeneral_NickName` VARCHAR(250) NOT NULL DEFAULT '' AFTER `ProviderGeneral_BusinessName`; -- Nombre comercial
                ALTER TABLE `t_provider_general` ALTER `ProviderGeneral_NickName` DROP DEFAULT;
                ALTER TABLE `t_provider_general`
                ADD INDEX `INDEX_ProviderGeneral_NickName` (`ProviderGeneral_NickName`);

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_equine`
                (
                    `Id_Equine`             INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `Equine_Date`           DATETIME NOT NULL,
                    `Equine_DateUpdate`     DATETIME NOT NULL,
                    `Equine_Code`           VARCHAR(50) NOT NULL,
                    `Equine_Name`           VARCHAR(250) NOT NULL,
                    `Equine_Type`           INT(11) NOT NULL, -- 1: Caballo? - 2: Asno?
                    `Equine_Color`          VARCHAR(250) NOT NULL,
                    `Equine_Version`        INT(11) NOT NULL,
                    `Equine_Status`         INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2: Activo

                    `Id_TypeEquine`             INT(11) UNSIGNED NOT NULL,
                    `Id_ProviderTypeProvider`   INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_Equine`),
                    FOREIGN KEY (`Id_TypeEquine`) REFERENCES `t_type_equine`(`Id_TypeEquine`),
                    FOREIGN KEY (`Id_ProviderTypeProvider`) REFERENCES `t_provider_type_provider`(`Id_ProviderTypeProvider`),
                    INDEX(`Equine_Date`),
                    INDEX(`Equine_Name`),
                    INDEX(`Equine_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (217, 't_equine', 'Equino', 'sp_equine_index(?,@sts,@cod,@msg)');

ALTER TABLE `t_type_room`
                ADD `TypeRoom_Group` VARCHAR(250) NOT NULL DEFAULT '' AFTER `TypeRoom_Abrv`; -- Nombre comercial
                ALTER TABLE `t_type_room` ALTER `TypeRoom_Group` DROP DEFAULT;
                ALTER TABLE `t_type_room`
                ADD INDEX `INDEX_TypeRoom_Group` (`TypeRoom_Group`);

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_vehicle_brand`
                (
                    `Id_VehicleBrand`             INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `VehicleBrand_Date`           DATETIME NOT NULL,
                    `VehicleBrand_DateUpdate`     DATETIME NOT NULL,
                    `VehicleBrand_Name`           VARCHAR(250) NOT NULL,
                    `VehicleBrand_Abrv`           VARCHAR(50) NOT NULL,
                    `VehicleBrand_Version`        INT(11) NOT NULL,
                    `VehicleBrand_Status`         INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2: Activo

                    PRIMARY KEY (`Id_VehicleBrand`),
                    INDEX(`VehicleBrand_Date`),
                    INDEX(`VehicleBrand_Name`),
                    INDEX(`VehicleBrand_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (218, 't_vehicle_brand', 'Marca de Vehículo', 'sp_vehicle_brand_index(?,@sts,@cod,@msg)');

                CREATE TABLE `t_vehicle_model`
                (
                    `Id_VehicleModel`             INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `VehicleModel_Date`           DATETIME NOT NULL,
                    `VehicleModel_DateUpdate`     DATETIME NOT NULL,
                    `VehicleModel_Name`           VARCHAR(250) NOT NULL,
                    `VehicleModel_Abrv`           VARCHAR(50) NOT NULL,
                    `VehicleModel_Version`        INT(11) NOT NULL,
                    `VehicleModel_Status`         INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2: Activo

                    PRIMARY KEY (`Id_VehicleModel`),
                    INDEX(`VehicleModel_Date`),
                    INDEX(`VehicleModel_Name`),
                    INDEX(`VehicleModel_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (219, 't_vehicle_model', 'Marca de Vehículo', 'sp_vehicle_model_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_type_vehicle`
                (
                    `Id_TypeVehicle`                    INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `TypeVehicle_Date`                  DATETIME NOT NULL,
                    `TypeVehicle_DateUpdate`            DATETIME NOT NULL,
                    `TypeVehicle_Name`                  VARCHAR(250) NOT NULL,
                    `TypeVehicle_Abrv`                  VARCHAR(50) NOT NULL,
                    `TypeVehicle_CapacityDriverCabin`       INT(11) NOT NULL,
                    `TypeVehicle_CapacityPassengerCabin`    INT(11) NOT NULL,
                    `TypeVehicle_PaxCapacity`               INT(11) NOT NULL,
                    `TypeVehicle_Version`               INT(11) NOT NULL,
                    `TypeVehicle_Status`                INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2: Activo
                    `Id_VehicleModel`                   INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_TypeVehicle`),
                    FOREIGN KEY (`Id_VehicleModel`) REFERENCES `t_vehicle_model`(`Id_VehicleModel`),
                    INDEX(`TypeVehicle_Date`),
                    INDEX(`TypeVehicle_Name`),
                    INDEX(`TypeVehicle_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (220, 't_type_vehicle', 'Tipo de Vehículo', 'sp_type_vehicle_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_type_vehicle`
                (
                    `Id_TypeVehicle`                    INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `TypeVehicle_Date`                  DATETIME NOT NULL,
                    `TypeVehicle_DateUpdate`            DATETIME NOT NULL,
                    `TypeVehicle_Name`                  VARCHAR(250) NOT NULL,
                    `TypeVehicle_Abrv`                  VARCHAR(50) NOT NULL,
                    `TypeVehicle_CapacityDriverCabin`       INT(11) NOT NULL,
                    `TypeVehicle_CapacityPassengerCabin`    INT(11) NOT NULL,
                    `TypeVehicle_PaxCapacity`               INT(11) NOT NULL,
                    `TypeVehicle_Version`               INT(11) NOT NULL,
                    `TypeVehicle_Status`                INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2: Activo
                    `Id_VehicleModel`                   INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_TypeVehicle`),
                    FOREIGN KEY (`Id_VehicleModel`) REFERENCES `t_vehicle_model`(`Id_VehicleModel`),
                    INDEX(`TypeVehicle_Date`),
                    INDEX(`TypeVehicle_Name`),
                    INDEX(`TypeVehicle_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (220, 't_type_vehicle', 'Tipo de Vehículo', 'sp_type_vehicle_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_vehicle`
                (
                    `Id_Vehicle`                    INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `Vehicle_Date`                  DATETIME NOT NULL,
                    `Vehicle_DateUpdate`            DATETIME NOT NULL,
                    `Vehicle_LicensePlate`          VARCHAR(50) NOT NULL,
                    `Vehicle_Year`                  INT(11) NOT NULL,
                    `Vehicle_Color`                 VARCHAR(50) NOT NULL,
                    `Vehicle_Version`               INT(11) NOT NULL,
                    `Vehicle_Status`                INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2: Activo
                    `Id_VehicleBrand`               INT(11) UNSIGNED NOT NULL,
                    `Id_ProviderTypeProvider`       INT(11) UNSIGNED NOT NULL,
                    `Id_TypeVehicle`                INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_Vehicle`),
                    INDEX (`Id_VehicleBrand`),
                    FOREIGN KEY (`Id_ProviderTypeProvider`) REFERENCES `t_provider_type_provider`(`Id_ProviderTypeProvider`),
                    FOREIGN KEY (`Id_TypeVehicle`) REFERENCES `t_type_vehicle`(`Id_TypeVehicle`),
                    INDEX(`Vehicle_Date`),
                    INDEX(`Vehicle_Status`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (221, 't_vehicle', 'Tipo de Vehículo', 'sp_vehicle_index(?,@sts,@cod,@msg)');

ALTER TABLE `t_provider_contact`
                ADD `ProviderContact_LastName` VARCHAR(250) NOT NULL DEFAULT '' AFTER `ProviderContact_Name`; -- Apellido
                ALTER TABLE `t_provider_contact` ALTER `ProviderContact_LastName` DROP DEFAULT;

                ALTER TABLE `t_provider_contact`
                ADD `ProviderContact_NoDocument` VARCHAR(50) NOT NULL DEFAULT '' AFTER `ProviderContact_LastName`; -- Documento
                ALTER TABLE `t_provider_contact` ALTER `ProviderContact_NoDocument` DROP DEFAULT;

                ALTER TABLE `t_provider_general`
                DROP CONSTRAINT IF EXISTS `t_provider_general_ibfk_1`;

                ALTER TABLE `t_provider_general`
                DROP COLUMN `Id_TypeDocument`;

                ALTER TABLE `t_provider`
                DROP CONSTRAINT IF EXISTS `t_provider_ibfk_2`;

                DROP INDEX IF EXISTS `INDEX_Id_CategoryExtra` ON `t_extra`;
                DROP INDEX IF EXISTS `INDEX_Id_Item` ON `t_extra`;
                ALTER TABLE `t_extra`
                DROP IF EXISTS `Id_Route`,
                DROP IF EXISTS `Extra_IdBefore`,
                DROP IF EXISTS `Extra_TypeBefore`,
                DROP IF EXISTS `Extra_Icon_Thumb`,
                DROP IF EXISTS `Extra_Icon`,
                DROP IF EXISTS `Extra_OneWay`,
                DROP IF EXISTS `Id_CategoryExtra`,
                DROP IF EXISTS `Id_Item`;
                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 200;

                
                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 201;
                DROP TABLE IF EXISTS `t_extra_requirement_schedule`;
                
                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 202;

                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 203;

                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 204;

ALTER TABLE `t_type_provider`
                DROP IF EXISTS `TypeProvider_Date`,
                DROP IF EXISTS `TypeProvider_DateUpdate`,
                DROP IF EXISTS `TypeProvider_Icon`,
                DROP IF EXISTS `TypeProvider_Color`;

                DROP TABLE IF EXISTS `t_category_provider`;
                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 205;

                DROP TABLE IF EXISTS `t_provider_general`;  
                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 206;

                ALTER TABLE `t_provider`
                DROP IF EXISTS `Provider_Direction`,
                DROP IF EXISTS `Id_Location`,
                DROP IF EXISTS `Id_ProviderGeneral`;

                DROP TABLE IF EXISTS `t_provider_contact`;
                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 207;

                ALTER TABLE `t_provider_type_provider`
                DROP IF EXISTS `ProviderTypeProvider_Date`,
                DROP IF EXISTS `ProviderTypeProvider_DateUpdate`,
                DROP IF EXISTS `ProviderTypeProvider_Version`,
                DROP IF EXISTS `Id_CategoryProvider`;

                DROP TABLE IF EXISTS `t_provider_contact`;
                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 208;

                DROP TABLE IF EXISTS `t_provider_availability`;
                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 211;

                DROP TABLE IF EXISTS `t_type_provider_availability`;
                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 212;

                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 213;

                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 214;

                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 215;

                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 216;

ALTER TABLE `t_provider_general`
                DROP IF EXISTS `ProviderGeneral_BusinessName`,
                DROP IF EXISTS `ProviderGeneral_NickName`;

                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 217;

ALTER TABLE `t_type_room`
                DROP IF EXISTS `TypeRoom_Group`;

                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 218;
                DROP TABLE IF EXISTS `t_vehicle_model`;
                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 219;

                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 220;

                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 221;

ALTER TABLE `t_provider_contact`
                DROP IF EXISTS `ProviderContact_LastName`;

                ALTER TABLE `t_provider_contact`
                DROP IF EXISTS `ProviderContact_NoDocument`;

                ALTER TABLE `t_provider_general`
                ADD COLUMN `Id_TypeDocument` INT(11) UNSIGNED NOT NULL;

                ALTER TABLE `t_provider_general`
                ADD CONSTRAINT `t_provider_general_ibfk_1` FOREIGN KEY (`Id_TypeDocument`) REFERENCES `t_type_document` (`Id_TypeDocument`);


-- =====================================================================
-- 112-release-12-12-25.php
-- =====================================================================

INSERT INTO `t_directory` (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`,
                             `Directory_Icon`, `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                            VALUES  (393, 'route', 'maintenance.route', 'Rutas', '/route', 'alt_route', 18, 2, 1, 1, 1, 1);


-- =====================================================================
-- 112-release-24-10-25.php
-- =====================================================================

ALTER TABLE `t_web_contact_message`
                ADD FULLTEXT INDEX `FULLTEXT_WebContactMessage_FullName` (`WebContactMessage_Name`, WebContactMessage_LastName);

CREATE OR REPLACE VIEW v_booking_sales AS
                    SELECT  `b`.`Id_Booking`,
                            `bt`.`Id_BookingTour`,
                            `bt`.`Id_Package`,
                            `bt`.`Id_Tour`,
                            `bt`.`BookingTour_Group`,
                            `b`.`Id_Admin`,
                            `btp`.`Id_Passenger`,
                            `btp`.`Id_BookingTourPassenger`,
                            `b`.`Id_User`,
                            `u`.`Id_UserCountry`,

                            `b`.`Booking_DateConfirm` AS `Booking_Confirm_Date`,
                            YEAR(`b`.`Booking_DateConfirm`) AS `Booking_Confirm_Year`,
                            MONTH(`b`.`Booking_DateConfirm`) AS `Booking_Confirm_Month`,
                            DAY(`b`.`Booking_DateConfirm`) AS `Booking_Confirm_Day`,

                            `bt`.`BookingTour_DateStart` AS `Booking_Start_Date`,
                            YEAR(`bt`.`BookingTour_DateStart`) AS `Booking_Start_Year`,
                            MONTH(`bt`.`BookingTour_DateStart`) AS `Booking_Start_Month`,
                            DAY(`bt`.`BookingTour_DateStart`) AS `Booking_Start_Day`,

                            IF(`u`.`User_Type` = 1, 1, 2) AS `Booking_Agency`, -- Endosado

                            IF(`u`.`User_Type` = 1 AND `b`.`Booking_Type` = 1, 1, 0) AS `ReservaWeb`,
                            IF(`u`.`User_Type` = 1 AND `b`.`Booking_Type` = 1, 0, 1) AS `NotReservaWeb`,
                            IF(`u`.`User_Type` = 2, 0, IF(`b`.`Booking_InPerson` = 1, `b`.`Booking_Type`, 8)) AS `Booking_Type`,
                            `cmd`.`Id_CashMovementDetail`,
                            `cmd`.`CashMovementDetail_Amount`
                    FROM `t_booking_tour_passenger` `btp`
                    INNER JOIN `t_booking_tour` `bt` ON `bt`.`Id_BookingTour` = `btp`.`Id_BookingTour`
                    INNER JOIN `t_booking` `b` ON `b`.`Id_Booking` = `bt`.`Id_Booking`
                    INNER JOIN `t_user` `u` ON `u`.`Id_User` = `b`.`Id_User`
                    INNER JOIN `t_invoice` `i` ON `i`.`Id_Passenger` = `btp`.`Id_Passenger`
                    LEFT JOIN `t_cash_movement_detail` `cmd` ON `cmd`.`Id_Invoice` = `i`.`Id_Invoice`
                    WHERE `bt`.`BookingTour_Status` = 2
                    AND `btp`.`BookingTourPassenger_Status` IN (2, 3)
                    AND `fn_booking_tour_passenger_check`(
                            `b`.`Booking_Status`,
                            `b`.`Booking_ManuallyConfirmed`,
                            1,
                            1,
                            `btp`.`BookingTourPassenger_PaymentStatus`
                    );




                CREATE OR REPLACE VIEW v_leads AS
                    SELECT 	`Id_WebContactMessage` AS `Id_Lead`,
                            `WebContactMessage_Date` AS `Lead_Date`,
                            YEAR(`WebContactMessage_Date`) AS `Lead_Date_Year`,
                            MONTH(`WebContactMessage_Date`) AS `Lead_Date_Month`,
                            DAY(`WebContactMessage_Date`) AS `Lead_Date_Day`,
                            `WebContactMessage_Type` AS `Lead_Type`,
                            `WebContactMessage_Status` AS `Lead_Status`,			-- 0: DELETED - 1: NEW - 2: PRE_BOOKING - 3: CONFIRMED - 4: CANCELED - 5: ASSOCIATED
                                                                                    -- 6: ASSIGNED - 7: ANSWERED - 8: LOST - 9: HOLD - 10: RECOVERED
                            `Id_WebContact`,
                            `Id_Country`,
                            `Id_Language`,
                            `Id_Channel`,
                            `Id_Language_Contact`,
                            `Id_WebTypeClient`,
                            `Id_Admin`,
                            `Id_WebPage`,
                            `Id_Booking`
                    FROM `t_web_contact_message`;
                -- FLUSH TABLES;

INSERT INTO `t_directory`
                    (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`, `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUES
                    (391, 'analytic', 'analytics', 'Analytics', '', 'insert_chart', 20, 2, 0, 0, 0, 0),
                    (394, 'sales', 'analytic.sales', 'Ventas', '/analytic/sales', 'sell', 1, 2, 0, 0, 0, 391),
                    (395, 'booking', 'analytic.booking', 'Reservas', '/analytic/booking', 'event_available', 2, 2, 0, 0, 0, 391),
                    (396, 'passenger', 'analytic.passenger', 'Pasajeros', '/analytic/passenger', 'luggage', 3, 2, 0, 0, 0, 391),
                    (397, 'product', 'analytic.product', 'Productos', '/analytic/product', 'hiking', 4, 2, 0, 0, 0, 391),
                    (398, 'lead', 'analytic.lead', 'Leads', '/analytic/lead', 'support_agent', 5, 2, 0, 0, 0, 391),
                    (399, 'agency', 'analytic.agency', 'Endosadores', '/analytic/agency', 'apartment', 6, 2, 0, 0, 0, 391);


-- =====================================================================
-- 112-release-26-11-25.php
-- =====================================================================

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
ALTER TABLE `t_type_provider`
                ADD `TypeProvider_Date` DATETIME NOT NULL DEFAULT NOW() AFTER `Id_TypeProvider`;
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_Date` DROP DEFAULT;

                ALTER TABLE `t_type_provider`
                ADD `TypeProvider_DateUpdate` DATETIME NOT NULL DEFAULT NOW() AFTER `TypeProvider_Date`;
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_DateUpdate` DROP DEFAULT;

                ALTER TABLE `t_type_provider`
                ADD `TypeProvider_Icon` VARCHAR(250) NOT NULL DEFAULT '' AFTER `TypeProvider_Endorser`;
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_Icon` DROP DEFAULT;

                ALTER TABLE `t_type_provider`
                ADD `TypeProvider_Color` VARCHAR(250) NOT NULL DEFAULT '' AFTER `TypeProvider_Icon`;
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_Color` DROP DEFAULT;

                CREATE TABLE `t_category_provider`
                (
                    `Id_CategoryProvider`          INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `CategoryProvider_Date`        DATETIME NOT NULL,
                    `CategoryProvider_DateUpdate`  DATETIME NOT NULL,
                    `CategoryProvider_Name`        VARCHAR(250) NOT NULL,
                    `CategoryProvider_Abrv`        VARCHAR(20) NOT NULL,
                    `CategoryProvider_Level`       INT(11) NOT NULL,
                    `CategoryProvider_Version`     INT(11) NOT NULL,
                    `CategoryProvider_Status`      INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_TypeProvider`              INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_CategoryProvider`),
                    FOREIGN KEY (`Id_TypeProvider`) REFERENCES `t_type_provider`(`Id_TypeProvider`),
                    INDEX(`CategoryProvider_Date`),
                    INDEX(`CategoryProvider_Status`),
                    INDEX(`CategoryProvider_Name`),
                    INDEX(`CategoryProvider_Level`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (205, 't_category_provider', 'Categoría de proveedor', 'sp_category_provider_index(?,@sts,@cod,@msg)');

ALTER TABLE `t_route`
                DROP CONSTRAINT IF EXISTS `t_route_ibfk_3`;

ALTER TABLE `t_provider_general`
                ADD `ProviderGeneral_HasIncaTrail` INT(1) NOT NULL DEFAULT 1 AFTER `ProviderGeneral_Ruc`; -- 1: NO - 2: SÍ
                ALTER TABLE `t_provider_general` ALTER `ProviderGeneral_HasIncaTrail` DROP DEFAULT;

ALTER TABLE `t_provider`
                ADD `Provider_Email` VARCHAR(250) NOT NULL DEFAULT '' AFTER `Provider_Phone`;
                ALTER TABLE `t_provider` ALTER `Provider_Email` DROP DEFAULT;


-- =====================================================================
-- 112-release-27-11-25.php
-- =====================================================================

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
ALTER TABLE `t_tour_extra`
                ADD `TourExtra_ServiceType` INT(1) NOT NULL DEFAULT 2 AFTER `TourExtra_RequireDay`;
                -- 1: UPGRADE - 2: EXTRA - 3: EQUIPMENT
                ALTER TABLE `t_tour_extra` ALTER `TourExtra_ServiceType` DROP DEFAULT;

                ALTER TABLE `t_tour_extra`
                ADD `TourExtra_OnUnavailable` INT(1) NOT NULL DEFAULT 1 AFTER `TourExtra_ServiceType`;
                -- 1: DO NOTHING - 2: NEXT SCHEDULE - 3: SELECT EXTRA - 4: LOCK TOUR
                ALTER TABLE `t_tour_extra` ALTER `TourExtra_OnUnavailable` DROP DEFAULT;

                ALTER TABLE `t_tour_extra`
                ADD `Id_Tour` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_Extra`;
                ALTER TABLE `t_tour_extra` ALTER `Id_Tour` DROP DEFAULT;

                ALTER TABLE `t_tour_extra`
                DROP CONSTRAINT IF EXISTS `t_tour_extra_ibfk_1`;

                ALTER TABLE `t_tour_extra`
                ADD `TourExtra_Date` DATETIME NOT NULL DEFAULT NOW() AFTER `Id_TourExtra`;
                ALTER TABLE `t_tour_extra` ALTER `TourExtra_Date` DROP DEFAULT;

                ALTER TABLE `t_tour_extra`
                ADD `TourExtra_DateUpdate` DATETIME NOT NULL DEFAULT NOW() AFTER `TourExtra_Date`;
                ALTER TABLE `t_tour_extra` ALTER `TourExtra_DateUpdate` DROP DEFAULT;

                ALTER TABLE `t_tour_extra`
                ADD `TourExtra_Version` INT(11) UNSIGNED NOT NULL DEFAULT 1 AFTER `TourExtra_OnUnavailable`;
                ALTER TABLE `t_tour_extra` ALTER `TourExtra_Version` DROP DEFAULT;

                ALTER TABLE `t_tour_extra`
                ADD INDEX `INDEX_TourExtra_Tour` (`Id_Tour`);


                CREATE TABLE `t_tour_extra_requirement` (
                    `Id_TourExtraRequirement` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    `TourExtraRequirement_Date` DATETIME NOT NULL,
                    `TourExtraRequirement_DateUpdate` DATETIME NOT NULL,
                    `TourExtraRequirement_DayStart` INT(11) NOT NULL,
                    `TourExtraRequirement_HourStart` TIME NOT NULL,
                    `TourExtraRequirement_DayEnd` INT(11) NOT NULL,
                    `TourExtraRequirement_HourEnd` TIME NOT NULL,
                    `TourExtraRequirement_Version` INT(11) NOT NULL,
                    `TourExtraRequirement_Status` INT(1) NOT NULL, -- 0: DELETED - 1: INACTIVE - 2: ACTIVE
                    `Id_TourExtra` INT(11) UNSIGNED NOT NULL,
                    `Id_ExtraRequirement` INT(11) UNSIGNED NOT NULL,

                    FOREIGN KEY (`Id_TourExtra`) REFERENCES `t_tour_extra`(`Id_TourExtra`),
                    FOREIGN KEY (`Id_ExtraRequirement`) REFERENCES `t_extra_requirement`(`Id_ExtraRequirement`),
                    INDEX (`TourExtraRequirement_Date`),
                    INDEX (`TourExtraRequirement_Status`)
                );

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) 
                VALUES
                    (225, 't_tour_extra_requirement', 'Requerimientos de servicio de tour', 'sp_tour_extra_requirement_index(?,@sts,@cod,@msg)');

                    
                CREATE TABLE `t_package_tour_extra_requirement` (
                    `Id_PackageTourExtraRequirement` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    `PackageTourExtraRequirement_Date` DATETIME NOT NULL,
                    `PackageTourExtraRequirement_DateUpdate` DATETIME NOT NULL,
                    `PackageTourExtraRequirement_DayStart` INT(11) NOT NULL,
                    `PackageTourExtraRequirement_HourStart` TIME NOT NULL,
                    `PackageTourExtraRequirement_DayEnd` INT(11) NOT NULL,
                    `PackageTourExtraRequirement_HourEnd` TIME NOT NULL,
                    `PackageTourExtraRequirement_Version` INT(11) NOT NULL,
                    `PackageTourExtraRequirement_Status` INT(1) NOT NULL, -- 0: DELETED - 1: INACTIVE - 2: ACTIVE
                    `Id_PackageTourExtra` INT(11) UNSIGNED NOT NULL,
                    `Id_ExtraRequirement` INT(11) UNSIGNED NOT NULL,

                    FOREIGN KEY (`Id_PackageTourExtra`) REFERENCES `t_package_tour_extra`(`Id_PackageTourExtra`),
                    FOREIGN KEY (`Id_ExtraRequirement`) REFERENCES `t_extra_requirement`(`Id_ExtraRequirement`),
                    INDEX (`PackageTourExtraRequirement_Date`),
                    INDEX (`PackageTourExtraRequirement_Status`)
                );

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) 
                VALUES
                    (226, 't_package_tour_extra_requirement',
                        'Requerimientos de servicio de tour de paquete', 'sp_package_tour_extra_requirement_index(?,@sts,@cod,@msg)');

ALTER TABLE `t_package_tour_extra`
                ADD `PackageTourExtra_Date` DATETIME NOT NULL DEFAULT NOW() AFTER `Id_PackageTourExtra`;
                ALTER TABLE `t_package_tour_extra` ALTER `PackageTourExtra_Date` DROP DEFAULT;

                ALTER TABLE `t_package_tour_extra`
                ADD `PackageTourExtra_DateUpdate` DATETIME NOT NULL DEFAULT NOW() AFTER `PackageTourExtra_Date`;
                ALTER TABLE `t_package_tour_extra` ALTER `PackageTourExtra_DateUpdate` DROP DEFAULT;

                ALTER TABLE `t_package_tour_extra`
                ADD `PackageTourExtra_Order` INT(11) NOT NULL DEFAULT 1 AFTER `PackageTourExtra_DateUpdate`;
                ALTER TABLE `t_package_tour_extra` ALTER `PackageTourExtra_Order` DROP DEFAULT;

                ALTER TABLE `t_package_tour_extra`
                ADD `PackageTourExtra_IsAdded` INT(1) NOT NULL DEFAULT 1 AFTER `PackageTourExtra_Passenger`; -- 1: NO - 2: YES
                ALTER TABLE `t_package_tour_extra` ALTER `PackageTourExtra_IsAdded` DROP DEFAULT;

                ALTER TABLE `t_package_tour_extra`
                ADD `PackageTourExtra_OnUnavailable` INT(1) NOT NULL DEFAULT 1 AFTER `PackageTourExtra_IsAdded`;
                -- 1: DO NOTHING - 2: NEXT SCHEDULE - 3: SELECT EXTRA - 4: LOCK TOUR
                ALTER TABLE `t_package_tour_extra` ALTER `PackageTourExtra_OnUnavailable` DROP DEFAULT;

                ALTER TABLE `t_package_tour_extra`
                ADD `PackageTourExtra_Version` INT(11) UNSIGNED NOT NULL DEFAULT 1 AFTER `PackageTourExtra_OnUnavailable`;
                ALTER TABLE `t_package_tour_extra` ALTER `PackageTourExtra_Version` DROP DEFAULT;

                ALTER TABLE `t_package_tour_extra`
                ADD `PackageTourExtra_Status` INT(1) NOT NULL DEFAULT 1 AFTER `PackageTourExtra_Version`; -- 0: DELETED - 1: INACTIVE - 2: ACTIVE
                ALTER TABLE `t_package_tour_extra` ALTER `PackageTourExtra_Status` DROP DEFAULT;

ALTER TABLE `t_package_tour_extra`
                DROP IF EXISTS `PackageTourExtra_Date`,
                DROP IF EXISTS `PackageTourExtra_DateUpdate`,
                DROP IF EXISTS `PackageTourExtra_Order`,
                DROP IF EXISTS `PackageTourExtra_IsAdded`,
                DROP IF EXISTS `PackageTourExtra_OnUnavailable`,
                DROP IF EXISTS `PackageTourExtra_Version`,
                DROP IF EXISTS `PackageTourExtra_Status`;


-- =====================================================================
-- 113-release-02-01-26.php
-- =====================================================================

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_provision`
                (
                    `Id_Provision`              INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `Provision_Date`            DATETIME NOT NULL,
                    `Provision_DateUpdate`      DATETIME NOT NULL,
                    `Provision_Capacity`        INT(11) NOT NULL,
                    `Provision_Version`         INT(11) NOT NULL,
                    `Provision_Status`          INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público

                    `Id_ProviderTypeProvider`   INT(11) UNSIGNED NOT NULL,
                    `Id_DefinedProvision`       INT(11) UNSIGNED NOT NULL,
                    `Id_Route`                  INT(11) UNSIGNED NOT NULL,
                    `Id_Tour`                   INT(11) UNSIGNED NOT NULL,
                    `Id_TypeEquine`             INT(11) UNSIGNED NOT NULL,
                    `Id_TypeVehicle`            INT(11) UNSIGNED NOT NULL,
                    `Id_TypeRoomCategory`       INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_Provision`),
                    FOREIGN KEY (`Id_ProviderTypeProvider`) REFERENCES `t_provider_type_provider`(`Id_ProviderTypeProvider`),
                    INDEX(`Provision_Date`),
                    INDEX(`Provision_Status`),
                    INDEX(`Id_DefinedProvision`),
                    INDEX(`Id_Route`),
                    INDEX(`Id_Tour`),
                    INDEX(`Id_TypeEquine`),
                    INDEX(`Id_TypeVehicle`),
                    INDEX(`Id_TypeRoomCategory`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (222, 't_provision', 'Provisión', 'sp_provision_index(?,@sts,@cod,@msg)');

                CREATE TABLE `t_provision_rate`
                (
                    `Id_ProvisionRate`                  INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ProvisionRate_Date`                DATETIME NOT NULL,
                    `ProvisionRate_DateUpdate`          DATETIME NOT NULL,
                    `ProvisionRate_Price`               DECIMAL(12,2) NOT NULL,
                    `ProvisionRate_PriceConfidential`   DECIMAL(12,2) NOT NULL,
                    `ProvisionRate_PaxStart`            INT(11) NOT NULL,
                    `ProvisionRate_PaxEnd`              INT(11) NOT NULL,
                    `ProvisionRate_ByDay`               INT(1) NOT NULL,
                    `ProvisionRate_HasDateStart`        INT(1) NOT NULL,
                    `ProvisionRate_HasDateEnd`          INT(1) NOT NULL,
                    `ProvisionRate_DateStart`           DATETIME NOT NULL,
                    `ProvisionRate_DateEnd`             DATETIME NOT NULL,
                    `ProvisionRate_Order`               INT(11) NOT NULL,
                    `ProvisionRate_IsMain`              INT(1) NOT NULL,
                    `ProvisionRate_Version`             INT(11) NOT NULL,
                    `ProvisionRate_Status`              INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público

                    `Id_Provision`                      INT(11) UNSIGNED NOT NULL,
                    `Id_Currency`                       INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_ProvisionRate`),
                    FOREIGN KEY (`Id_Provision`) REFERENCES `t_provision`(`Id_Provision`),
                    INDEX(`ProvisionRate_Date`),
                    INDEX(`ProvisionRate_Status`),
                    INDEX(`Id_Currency`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (224, 't_provision_rate', 'Tarifa de provisión', 'sp_provision_rate_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_currency`
                (
                    `Id_Currency`           INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `Currency_Date`         DATETIME NOT NULL,
                    `Currency_DateUpdate`   DATETIME NOT NULL,
                    `Currency_Name`         VARCHAR(250) NOT NULL,
                    `Currency_Code`         VARCHAR(50) NOT NULL,
                    `Currency_Version`      INT(11) NOT NULL,
                    `Currency_Status`       INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público

                    PRIMARY KEY (`Id_Currency`),
                    INDEX(`Currency_Date`),
                    INDEX(`Currency_Status`),
                    INDEX(`Currency_Name`),
                    INDEX(`Currency_Code`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (223, 't_currency', 'Moneda', 'sp_currency_index(?,@sts,@cod,@msg)');

                DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 223;


-- =====================================================================
-- 113-release-08-01-26.php
-- =====================================================================

UPDATE `t_extra`
                SET `Extra_OneWay` = 2
                WHERE `Extra_OneWay` = 0;

INSERT INTO `t_directory` (
                    `Id_Directory`,
                    `Directory_Code`,
                    `Directory_Path`,
                    `Directory_Name`,
                    `Directory_Url`,
                    `Directory_Icon`,
                    `Directory_Order`,
                    `Directory_ShowInMenu`,
                    `Directory_Delete`,
                    `Directory_Update`,
                    `Directory_Insert`,
                    `Directory_Self`
                ) VALUES (
                    403,
                    'category-service',
                    'maintenance.category-service',
                    'Categoría de Servicio',
                    '/category-service',
                    'addchart',
                    18,
                    2,
                    1,
                    1,
                    1,
                    1
                );

INSERT INTO `t_directory` (
                    `Id_Directory`,
                    `Directory_Code`,
                    `Directory_Path`,
                    `Directory_Name`,
                    `Directory_Url`,
                    `Directory_Icon`,
                    `Directory_Order`,
                    `Directory_ShowInMenu`,
                    `Directory_Delete`,
                    `Directory_Update`,
                    `Directory_Insert`,
                    `Directory_Self`
                ) VALUES (
                    393,
                    'route',
                    'maintenance.route',
                    'Rutas',
                    '/route',
                    'alt_route',
                    18,
                    2,
                    1,
                    1,
                    1,
                    1
                );


-- =====================================================================
-- 113-release-10-01-26.php
-- =====================================================================

UPDATE t_directory
                    SET Directory_ShowInMenu = 1
                WHERE Id_Directory = 42;

                UPDATE t_directory
                    SET Directory_ShowInMenu = 1
                WHERE Id_Directory = 46;
                
                UPDATE t_directory
                    SET Directory_Name = 'Producto - Servicio', Directory_Path = 'extra', Directory_Code = 'extra'
                WHERE Id_Directory = 44;
                
                UPDATE t_directory 
                    SET Directory_Name = 'Tipo de Servicio' 
                WHERE Id_Directory = 26;

                UPDATE t_directory 
                    SET Directory_Order = 10 
                WHERE Id_Directory = 403;

                UPDATE t_directory 
                    SET Directory_ShowInMenu = 0 
                WHERE Id_Directory = 24;

                INSERT INTO `t_directory` (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`, `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`)
                VALUES (406, 'availability-service', 'extra.availability-service', 'Disponibilidad de Servicio', '', '', 5, 0, 1, 1, 1, 44);

INSERT INTO `t_location` (`Id_Location`, `Location_Name`, `Location_Status`) VALUES 
                (1, 'Cusco', 1),
                (2, 'Aguas Calientes', 1),
                (3, 'Ollantaytambo', 1)
                ON DUPLICATE KEY UPDATE `Location_Name` = VALUES(`Location_Name`);

                INSERT INTO `t_route` (`Route_Description`, `Id_Location_Start`, `Id_Location_End`, `Id_TypeDefinedService`, `Route_Status`, `Route_Version`, `Route_Date`, `Route_DateUpdate`) 
                VALUES ('Cusco - Ollantaytambo', 1, 3, 0, 2, 1, NOW(), NOW()), ('Ollantaytambo - Cusco', 3, 1, 0, 2, 1, NOW(), NOW());

                INSERT INTO `t_route` (`Route_Description`, `Id_Location_Start`, `Id_Location_End`, `Id_TypeDefinedService`, `Route_Status`, `Route_Version`, `Route_Date`, `Route_DateUpdate`) 
                VALUES ('Ollantaytambo - Aguas Calientes', 3, 2, 0, 2, 1, NOW(), NOW()), ('Aguas Calientes - Ollantaytambo', 2, 3, 0, 2, 1, NOW(), NOW());

                INSERT INTO `t_route` (`Route_Description`, `Id_Location_Start`, `Id_Location_End`, `Id_TypeDefinedService`, `Route_Status`, `Route_Version`, `Route_Date`, `Route_DateUpdate`) 
                VALUES ('Cusco - Aguas Calientes', 1, 2, 0, 2, 1, NOW(), NOW()), ('Aguas Calientes - Cusco', 2, 1, 0, 2, 1, NOW(), NOW());


-- =====================================================================
-- 113-release-11-12-25.php
-- =====================================================================

INSERT INTO `t_directory` (
                    `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                    `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
                ) VALUES  (392, 'providers-review-score', 'review.providers-review-score', 'Calificaciones', '/providers-review-score', 'score', 5, 2, 0, 0, 0, 261)

ALTER TABLE `t_passenger_review`
                ADD INDEX `INDEX_pr_gp_btp` (`Id_GroupPassenger`, `Id_BookingTourPassenger`);


-- =====================================================================
-- 113-release-17-12-25.php
-- =====================================================================

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
ALTER TABLE `t_tour`
                ADD `Tour_Img` VARCHAR(500) NOT NULL DEFAULT '' AFTER `Tour_UrlThumbnail`;
                ALTER TABLE `t_tour` ALTER `Tour_Img` DROP DEFAULT;
                
                ALTER TABLE `t_tour`
                ADD `Tour_Img_Thumb` VARCHAR(500) NOT NULL DEFAULT '' AFTER `Tour_Img`;
                ALTER TABLE `t_tour` ALTER `Tour_Img_Thumb` DROP DEFAULT;

                CREATE TABLE `t_tour_type_tour` (
                    `Id_TourTypeTour` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    `TourTypeTour_Date` DATETIME NOT NULL,
                    `TourTypeTour_DateUpdate` DATETIME NOT NULL,
                    `TourTypeTour_Version` INT(11) NOT NULL,
                    `TourTypeTour_Status` INT(1) NOT NULL, -- 0: DELETED - 1: INACTIVE - 2: ACTIVE
                    `Id_Tour` INT(11) UNSIGNED NOT NULL,
                    `Id_TypeTour` INT(11) UNSIGNED NOT NULL,

                    FOREIGN KEY (`Id_Tour`) REFERENCES `t_tour`(`Id_Tour`),
                    FOREIGN KEY (`Id_TypeTour`) REFERENCES `t_type_tour`(`Id_TypeTour`),
                    INDEX (`TourTypeTour_Date`),
                    INDEX (`TourTypeTour_Status`)
                );
                

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) 
                VALUES
                    (228, 't_tour_type_tour', 'Tour Tipo de Servicio', 'sp_tour_type_tour_index(?,@sts,@cod,@msg)');

                CREATE TABLE `t_tour_category_tour` (
                    `Id_TourCategoryTour` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    `TourCategoryTour_Date` DATETIME NOT NULL,
                    `TourCategoryTour_DateUpdate` DATETIME NOT NULL,
                    `TourCategoryTour_Version` INT(11) NOT NULL,
                    `TourCategoryTour_Status` INT(1) NOT NULL, -- 0: DELETED - 1: INACTIVE - 2: ACTIVE
                    `Id_Tour` INT(11) UNSIGNED NOT NULL,
                    `Id_CategoryTour` INT(11) UNSIGNED NOT NULL,

                    FOREIGN KEY (`Id_Tour`) REFERENCES `t_tour`(`Id_Tour`),
                    FOREIGN KEY (`Id_CategoryTour`) REFERENCES `t_category_tour`(`Id_CategoryTour`),
                    INDEX (`TourCategoryTour_Date`),
                    INDEX (`TourCategoryTour_Status`)
                );

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) 
                VALUES
                    (229, 't_tour_category_tour', 'Tour Categoría de Servicio', 'sp_tour_category_tour_index(?,@sts,@cod,@msg)');
                
                INSERT INTO `t_tour_type_tour` (
                    `Id_TourTypeTour`,
                    `TourTypeTour_Date`,
                    `TourTypeTour_DateUpdate`,
                    `TourTypeTour_Version`,
                    `TourTypeTour_Status`,
                    `Id_Tour`,
                    `Id_TypeTour`
                )
                SELECT NULL,
                    `fn_reduce_datetime_to_peru`(NOW()),
                    `fn_reduce_datetime_to_peru`(NOW()),
                    1,
                    2,
                    `t`.`Id_Tour`,
                    `t`.`Id_TypeTour`
                FROM `t_tour` `t`;

                INSERT INTO `t_tour_category_tour` (
                    `Id_TourCategoryTour`,
                    `TourCategoryTour_Date`,
                    `TourCategoryTour_DateUpdate`,
                    `TourCategoryTour_Version`,
                    `TourCategoryTour_Status`,
                    `Id_Tour`,
                    `Id_CategoryTour`
                )
                SELECT NULL,
                    `fn_reduce_datetime_to_peru`(NOW()),
                    `fn_reduce_datetime_to_peru`(NOW()),
                    1,
                    2,
                    `t`.`Id_Tour`,
                    `t`.`Id_CategoryTour`
                FROM `t_tour` `t`;

ALTER TABLE `t_tour`
                DROP COLUMN `Tour_Img`,
                DROP COLUMN `Tour_Img_Thumb`;

                DROP TABLE `t_tour_type_tour`;
                DROP TABLE `t_tour_category_tour`;


-- =====================================================================
-- 113-release-22-01-26.php
-- =====================================================================

ALTER TABLE t_extra_requirement ADD Id_TypeRoomCategory INT(11) UNSIGNED NULL;
                            ALTER TABLE t_extra_requirement ADD Id_Provision INT(11) UNSIGNED NULL;
                            ALTER TABLE t_extra_requirement ADD Id_DefinedProvision INT(11) UNSIGNED NULL;

                            CREATE INDEX Id_TypeRoomCategory ON t_extra_requirement(Id_TypeRoomCategory);
                            CREATE INDEX Id_Provision ON t_extra_requirement(Id_Provision);
                            CREATE INDEX Id_DefinedProvision ON t_extra_requirement(Id_DefinedProvision);

ALTER TABLE t_extra_requirement
                            MODIFY COLUMN Id_TypeRoomCategory int(11) UNSIGNED NOT NULL,
                            MODIFY COLUMN Id_Provision int(11) UNSIGNED NOT NULL,
                            MODIFY COLUMN Id_DefinedProvision int(11) UNSIGNED NOT NULL;

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
ALTER TABLE t_extra_requirement_schedule ADD COLUMN ExtraRequirementSchedule_IsMain INT(11) NOT NULL;

                ALTER TABLE t_extra_requirement CHANGE COLUMN ExtraRequirement_DateStart ExtraRequirement_Order INT(11) NOT NULL;

                ALTER TABLE t_extra_requirement CHANGE ExtraRequirement_RequestTime ExtraRequirement_RequestTime TIME NOT NULL;
                
                ALTER TABLE `t_extra_requirement_schedule` MODIFY COLUMN `ExtraRequirementSchedule_DayStart` INT(11) NOT NULL;

                ALTER TABLE `t_extra_requirement_schedule` MODIFY COLUMN `ExtraRequirementSchedule_DayEnd` INT(11) NOT NULL;

                ALTER TABLE `t_extra_requirement_schedule` MODIFY COLUMN `ExtraRequirementSchedule_TimeStart` TIME NOT NULL;

                ALTER TABLE `t_extra_requirement_schedule` MODIFY COLUMN `ExtraRequirementSchedule_TimeEnd` TIME NOT NULL;

                ALTER TABLE `t_extra_requirement` ADD COLUMN `ExtraRequirement_DayStart` INT(11) NOT NULL AFTER `ExtraRequirement_Name`;
                

                CREATE TABLE `t_type_extra_provider` (
                    `Id_TypeExtraProvider`          INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `TypeExtraProvider_Date`        DATETIME NOT NULL,
                    `TypeExtraProvider_DateUpdate`  DATETIME NOT NULL,
                    `TypeExtraProvider_Version`     INT(11) NOT NULL,
                    `TypeExtraProvider_Status`      INT(1) NOT NULL,
                    `Id_TypeExtra`                  INT(11) UNSIGNED NOT NULL, 
                    `Id_TypeProvider`               INT(11) UNSIGNED NOT NULL, 
                    `Id_Extra`                      INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_TypeExtraProvider`),
                    
                    CONSTRAINT `type_extra` FOREIGN KEY (`Id_TypeExtra`) 
                    REFERENCES `t_type_extra` (`Id_TypeExtra`) ON DELETE CASCADE ON UPDATE CASCADE,
                    
                    CONSTRAINT `type_provider` FOREIGN KEY (`Id_TypeProvider`) 
                    REFERENCES `t_type_provider` (`Id_TypeProvider`) ON DELETE CASCADE ON UPDATE CASCADE,
                    
                    CONSTRAINT `fk_extra_main` FOREIGN KEY (`Id_Extra`) 
                    REFERENCES `t_extra` (`Id_Extra`) ON DELETE CASCADE ON UPDATE CASCADE
                    
                ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) 
                VALUES (230, 't_type_extra_provider', 'Servicio de Proveedor', 'sp_type_extra_provider_index(?,@sts,@cod,@msg)');

ALTER TABLE t_extra_requirement DROP COLUMN Id_TypeRoomCategory;
                            ALTER TABLE t_extra_requirement DROP COLUMN Id_Provision;
                            ALTER TABLE t_extra_requirement DROP COLUMN Id_DefinedProvision;
                            
                            DROP TABLE IF EXISTS t_type_extra_provider;


-- =====================================================================
-- 113-release-29-01-26.php
-- =====================================================================

INSERT INTO `t_directory` (
          `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
          `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
        ) VALUES
        (400, 'category-room', 'maintenance.category-room', 'Categoría de Habitación','/category-room', 'local_hotel', 19, 2, 0, 0, 0, 1);

        INSERT INTO `t_directory` (
          `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
          `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
        ) VALUES
        (401, 'equine', 'maintenance.equine', 'Caballos','/equine', 'bedroom_baby', 20, 2, 0, 0, 0, 1);

        INSERT INTO `t_directory` (
          `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
          `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
        ) VALUES
        (402, 'vehicle', 'maintenance.vehicle', 'Vehículos','/vehicle', 'airport_shuttle', 21, 2, 0, 0, 0, 1);

        INSERT INTO `t_directory` (
          `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
          `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
        ) VALUES
        (404, 'general-provision', 'maintenance.general-provision', 'Servicios Generales','/general-provision', 'real_estate_agent', 22, 2, 0, 0, 0, 1);

        INSERT INTO `t_directory` (
          `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
          `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
        ) VALUES
        (405, 'type-equine', 'maintenance.type-equine', 'Tipos de Caballos','/type-equine', 'group_work', 22, 2, 0, 0, 0, 1);


        INSERT INTO `t_directory` (
          `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
          `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
        ) VALUES
        (407, 'type-vehicle', 'maintenance.type-vehicle', 'Tipos de Vehículos','/type-vehicle', 'local_car_wash', 24, 2, 0, 0, 0, 1);


        INSERT INTO `t_directory` (
          `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
          `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
        ) VALUES
        (408, 'vehicle-model', 'maintenance.vehicle-model', 'Modelos de Vehículos','/vehicle-model', 'taxi_alert', 25, 2, 0, 0, 0, 1);


        INSERT INTO `t_directory` (
          `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
          `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
        ) VALUES
        (409, 'type-room-category', 'maintenance.type-room-category', 'Tipo de categoría de habitación','/type-room-category', 'door_sliding', 26, 2, 0, 0, 0, 1);

        INSERT INTO `t_directory` (
          `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
          `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
        ) VALUES
        (410, 'vehicle-brand', 'maintenance.vehicle-brand', 'Marca de vehículo','/vehicle-brand', 'support', 27, 2, 0, 0, 0, 1);


        INSERT INTO `t_directory` (
          `Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
          `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
        ) VALUES
        (411, 'currency', 'maintenance.currency', 'Moneda','/currency', 'currency_exchange', 28, 2, 0, 0, 0, 1);               
                      
               
        INSERT INTO `t_directory` 
            (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, 
            `Directory_Url`, `Directory_Icon`, `Directory_Order`, `Directory_ShowInMenu`, 
            `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`) 
        VALUES 
            (389, 'provider-detail', 'provider.provider-detail', 'Detalle', 
            '/:provider', '', 1, 1, 1, 1, 1, 41);

ALTER TABLE `t_type_provider`      -- 1: General, 2: Caballos, 3: Vehículos, 4: Habitaciones  
                ADD `TypeProvider_Type` INT(1) NOT NULL DEFAULT 0 AFTER `TypeProvider_Abrv`;     
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_Type` DROP DEFAULT;


-- =====================================================================
-- 114-JLC-release-29-01-26.php
-- =====================================================================

-- ALTER TABLE `t_booking_tour`
                -- ADD `BookingTour_PackageDateStart` DATE NOT NULL DEFAULT NOW() AFTER `BookingTour_DateStart`;
                -- ALTER TABLE `t_booking_tour` ALTER `BookingTour_PackageDateStart` DROP DEFAULT;

                -- UPDATE `t_booking_tour`
                -- SET `BookingTour_PackageDateStart` = `fn_booking_tour_package_datestart`(`Id_Booking`, `BookingTour_Group`);

ALTER TABLE `t_package_tour_upgrade`
                ADD `PackageTourUpgrade_IsVisible` INT(1) NOT NULL DEFAULT 2 AFTER `PackageTourUpgrade_Passenger`; -- 1: NO - 2: SÍ
                ALTER TABLE `t_package_tour_upgrade` ALTER `PackageTourUpgrade_IsVisible` DROP DEFAULT;

                ALTER TABLE `t_package_tour_extra`
                ADD `PackageTourExtra_IsVisible` INT(1) NOT NULL DEFAULT 2 AFTER `PackageTourExtra_Passenger`; -- 1: NO - 2: SÍ
                ALTER TABLE `t_package_tour_extra` ALTER `PackageTourExtra_IsVisible` DROP DEFAULT;

                ALTER TABLE `t_package_tour_equipment`
                ADD `PackageTourEquipment_IsVisible` INT(1) NOT NULL DEFAULT 2 AFTER `PackageTourEquipment_Passenger`; -- 1: NO - 2: SÍ
                ALTER TABLE `t_package_tour_equipment` ALTER `PackageTourEquipment_IsVisible` DROP DEFAULT;

ALTER TABLE `t_schedule`
                ADD `Schedule_IgnoreAvailabilityCheck` INT(1) NOT NULL DEFAULT 1 AFTER `Schedule_Total`; -- 1: NO - 2: SÍ
                ALTER TABLE `t_schedule` ALTER `Schedule_IgnoreAvailabilityCheck` DROP DEFAULT;

                UPDATE `t_directory` SET `Directory_Code` = 'user-role',    `Directory_Path` = 'user.user-role'     WHERE Id_Directory = 73;
                UPDATE `t_directory` SET `Directory_Code` = 'user',         `Directory_Path` = 'user.user'          WHERE Id_Directory = 72;
                UPDATE `t_directory` SET `Directory_Code` = 'credential',   `Directory_Path` = 'user.credential'    WHERE Id_Directory = 71;
                UPDATE `t_directory` SET `Directory_Code` = 'permission',       `Directory_Path` = 'user.user-role.permission'  WHERE Id_Directory = 75;
                UPDATE `t_directory` SET `Directory_Code` = 'change-password',  `Directory_Path` = 'user.user.change-password'  WHERE Id_Directory = 208;

                UPDATE `t_directory` SET `Directory_Code` = 'payment-link', `Directory_Path` = 'booking.passenger.update.payment-link' WHERE Id_Directory = 142;
                UPDATE `t_directory` SET `Directory_Code` = 'payment-link', `Directory_Path` = 'booking.day.update.payment-link' WHERE Id_Directory = 240;
                UPDATE `t_directory` SET `Directory_Code` = 'payment-link', `Directory_Path` = 'booking.pending.update.payment-link' WHERE Id_Directory = 153;
                UPDATE `t_directory` SET `Directory_Code` = 'payment-link', `Directory_Path` = 'booking.day-confirmed.update.payment-link' WHERE Id_Directory = 300;
                UPDATE `t_directory` SET `Directory_Code` = 'payment-link', `Directory_Path` = 'booking.finalized.update.payment-link' WHERE Id_Directory = 186;
                UPDATE `t_directory` SET `Directory_Code` = 'payment-link', `Directory_Path` = 'booking.cancelled.update.payment-link' WHERE Id_Directory = 164;
                UPDATE `t_directory` SET `Directory_Code` = 'payment-link', `Directory_Path` = 'booking.all.update.payment-link' WHERE Id_Directory = 131;
                UPDATE `t_directory` SET `Directory_Code` = 'payment-link', `Directory_Path` = 'booking.confirmed.update.payment-link' WHERE Id_Directory = 175;
                UPDATE `t_directory` SET `Directory_Code` = 'payment-link', `Directory_Path` = 'payment.payment.update.payment-link' WHERE Id_Directory = 233;


                INSERT INTO `t_directory`  (`Id_Directory`, `Directory_Code`, `Directory_Path`,
                    `Directory_Name`, `Directory_Url`, `Directory_Icon`, `Directory_Order`,
                    `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
                )
                VALUES
                (411, 'ignore-availability', 'booking.passenger.update.payment-link.ignore-availability',       'Ignorar Disponibilidad', '', '', 1, 0, 0, 0, 0, 142),
                (412, 'ignore-availability', 'booking.day.update.payment-link.ignore-availability',             'Ignorar Disponibilidad', '', '', 1, 0, 0, 0, 0, 240),
                (413, 'ignore-availability', 'booking.pending.update.payment-link.ignore-availability',         'Ignorar Disponibilidad', '', '', 1, 0, 0, 0, 0, 153),
                (414, 'ignore-availability', 'booking.day-confirmed.update.payment-link.ignore-availability',   'Ignorar Disponibilidad', '', '', 1, 0, 0, 0, 0, 300),
                (415, 'ignore-availability', 'booking.finalized.update.payment-link.ignore-availability',       'Ignorar Disponibilidad', '', '', 1, 0, 0, 0, 0, 186),
                (416, 'ignore-availability', 'booking.cancelled.update.payment-link.ignore-availability',       'Ignorar Disponibilidad', '', '', 1, 0, 0, 0, 0, 164),
                (417, 'ignore-availability', 'booking.all.update.payment-link.ignore-availability',             'Ignorar Disponibilidad', '', '', 1, 0, 0, 0, 0, 131),
                (418, 'ignore-availability', 'booking.confirmed.update.payment-link.ignore-availability',       'Ignorar Disponibilidad', '', '', 1, 0, 0, 0, 0, 175),
                (419, 'ignore-availability', 'payment.payment.update.payment-link.ignore-availability',         'Ignorar Disponibilidad', '', '', 1, 0, 0, 0, 0, 233);

INSERT INTO `t_directory`  (`Id_Directory`, `Directory_Code`, `Directory_Path`,
                    `Directory_Name`, `Directory_Url`, `Directory_Icon`, `Directory_Order`,
                    `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`
                )
                VALUES
                (425, 'reedit', 'tickets.ticket_train.reedit', 'Reeditar', '', '', 2, 0, 0, 0, 0, 85),
                (426, 'reedit', 'tickets.ticket_entrance.reedit', 'Reeditar', '', '', 2, 0, 0, 0, 0, 86);


-- =====================================================================
-- 114-jcl-release-24-01-26.php
-- =====================================================================

ALTER TABLE `t_tour_extra`
                ADD `TourExtra_Included` INT(1) NOT NULL DEFAULT 1 AFTER `TourExtra_Order`;
                ALTER TABLE `t_tour_extra` ALTER `TourExtra_Included` DROP DEFAULT;

ALTER TABLE `t_tour_extra`
                DROP COLUMN `TourExtra_Included`;


-- =====================================================================
-- 115-JCL-release-19-02-26.php
-- =====================================================================

SELECT * FROM `t_provider` WHERE Id_TypeProvider IN (1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 22)

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT * FROM `t_provider_general` WHERE Id_ProviderGeneral=? LIMIT 1

SELECT * FROM `t_provider` WHERE Id_TypeProvider NOT IN (1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 22)

UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'nordic_walking', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 1;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'nordic_walking', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 2;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'flatware', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 3;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'bedroom_baby', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 4;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 2, `TypeProvider_Icon` = 'airport_shuttle', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 5;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 3, `TypeProvider_Icon` = 'kitchen', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 6;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'apartment', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 7;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 4, `TypeProvider_Icon` = 'hotel', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 8;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'train', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 9;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'hiking', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 10;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'nordic_walking', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 11;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'nordic_walking', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 12;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'nordic_walking', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 13;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 2, `TypeProvider_Icon` = 'bedroom_baby', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 14;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'festival', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 15;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'festival', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 16;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'flatware', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 17;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 2, `TypeProvider_Icon` = 'bedroom_baby', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 18;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'hiking', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 19;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 3, `TypeProvider_Icon` = 'airport_shuttle', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 20;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'nordic_walking', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 21;
                UPDATE `t_type_provider` SET `TypeProvider_Type` = 1, `TypeProvider_Icon` = 'nordic_walking', `TypeProvider_Color` = '#99abb4' WHERE `Id_TypeProvider` = 22;

                INSERT INTO `t_type_provider`
                ( `Id_TypeProvider`, `TypeProvider_Type`, `TypeProvider_Icon`, `TypeProvider_Color`)
                VALUES ( 23, 1, 'confirmation_number', '#99abb4');

                INSERT INTO `t_category_provider`
                (
                    `Id_CategoryProvider`,
                    `CategoryProvider_Date`,
                    `CategoryProvider_DateUpdate`,
                    `CategoryProvider_Name`,
                    `CategoryProvider_Abrv`,
                    `CategoryProvider_Level`,
                    `CategoryProvider_Version`,
                    `CategoryProvider_Status`,
                    `Id_TypeProvider`
                )
                SELECT NULL,
                    `fn_reduce_datetime_to_peru`(NOW()),
                    `fn_reduce_datetime_to_peru`(NOW()),
                    'Estándar',
                    'STND',
                    1,
                    1,
                    2,
                    `Id_TypeProvider`
                FROM `t_type_provider`;

                UPDATE `t_provider_type_provider` `ptp`
                SET `Id_CategoryProvider` = ( SELECT `Id_CategoryProvider` FROM `t_category_provider` `cp` WHERE `cp`.`Id_TypeProvider` = `ptp`.`Id_TypeProvider` LIMIT 1 ),
                    `ProviderTypeProvider_Version` = 1;

ALTER TABLE `t_provision_rate`
                ADD `ProvisionRate_Name` VARCHAR(250) NOT NULL DEFAULT '' AFTER `ProvisionRate_DateUpdate`;
                ALTER TABLE `t_provision_rate` ALTER `ProvisionRate_Name` DROP DEFAULT;

                ALTER TABLE `t_type_room`
                ADD `TypeRoom_Icon` VARCHAR(500) NOT NULL DEFAULT '' AFTER `TypeRoom_Group`;
                ALTER TABLE `t_type_room` ALTER `TypeRoom_Icon` DROP DEFAULT;
                ALTER TABLE `t_type_room`
                ADD `TypeRoom_Icon_Thumb` VARCHAR(500) NOT NULL DEFAULT '' AFTER `TypeRoom_Icon`;
                ALTER TABLE `t_type_room` ALTER `TypeRoom_Icon_Thumb` DROP DEFAULT;

UPDATE `t_directory`
                SET `Directory_Code` = 'provider',
                    `Directory_Path` = 'provider.provider'
                WHERE `Id_Directory` = 41;

                UPDATE `t_directory`
                SET `Directory_Code` = 'detail',
                    `Directory_Path` = 'provider.provider.detail'
                WHERE `Id_Directory` = 389;
                
                INSERT INTO `t_directory` (`Id_Directory`, `Directory_Code`, `Directory_Path`, `Directory_Name`, `Directory_Url`, `Directory_Icon`,
                    `Directory_Order`, `Directory_ShowInMenu`, `Directory_Delete`, `Directory_Update`, `Directory_Insert`, `Directory_Self`) 
                VALUES
                    (420, 'branch', 'provider.provider.detail.branch', 'Sucursales', '/branch', '', 1, '1', '1', '1', '1', 389),
                    (421, 'detail', 'provider.provider.detail.branch.detail', 'Detalles', '/:branch', '', 1, '1', '1', '1', '1', 420),
                    (422, 'typeCategory', 'provider.provider.detail.branch.detail.typeCategory', 'Tipos Categorías', '/typeCategory', '', 1, '1', '1', '1', '1', 421),
                    (423, 'detail', 'provider.provider.detail.branch.detail.typeCategory.detail', 'Detalles', '/:typeCategory', '', 1, '1', '1', '1', '1', 422);

CREATE TABLE `t_booking_extra_requirement`
                (
                    `Id_BookingExtraRequirement`            INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `BookingExtraRequirement_Date`          DATETIME NOT NULL,
                    `BookingExtraRequirement_DateUpdate`    DATETIME NOT NULL,
                    `BookingExtraRequirement_Name`          VARCHAR(250) NOT NULL,
                    `BookingExtraRequirement_Version`       INT(11) NOT NULL,
                    `BookingExtraRequirement_Status`        INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_ExtraRequirement`                   INT(11) UNSIGNED NOT NULL,
                    `Id_BookingExtra`                       INT(11) UNSIGNED NOT NULL,
                    `Id_TypeRoomCategory`                   INT(11) UNSIGNED NOT NULL,
                    `Id_DefinedProvision`                   INT(11) UNSIGNED NOT NULL,
                    `Id_ProvisionRate`                      INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_BookingExtraRequirement`),
                    FOREIGN KEY (`Id_ExtraRequirement`) REFERENCES `t_extra_requirement`(`Id_ExtraRequirement`),
                    FOREIGN KEY (`Id_BookingExtra`) REFERENCES `t_booking_extra`(`Id_BookingExtra`),
                    INDEX(`BookingExtraRequirement_Date`),
                    INDEX(`BookingExtraRequirement_Status`),
                    INDEX(`BookingExtraRequirement_Name`),
                    INDEX(`Id_TypeRoomCategory`),
                    INDEX(`Id_DefinedProvision`),
                    INDEX(`Id_ProvisionRate`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                CREATE TABLE `t_booking_extra_requirement_passenger`
                (
                    `Id_BookingExtraRequirementPassenger`               INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `BookingExtraRequirementPassenger_Date`             DATETIME NOT NULL,
                    `BookingExtraRequirementPassenger_DateUpdate`       DATETIME NOT NULL,
                    `BookingExtraRequirementPassenger_DateStart`        DATETIME NOT NULL,
                    `BookingExtraRequirementPassenger_DateEnd`          DATETIME NOT NULL,
                    `BookingExtraRequirementPassenger_FromPassenger`    INT(1) NOT NULL, -- No recuerdo qué significa
                    `BookingExtraRequirementPassenger_NoShow`           INT(1) NOT NULL,
                    `BookingExtraRequirementPassenger_Version`          INT(11) NOT NULL,
                    `BookingExtraRequirementPassenger_Status`           INT(1) NOT NULL, -- 0: Eliminado, 1: Pendiente, 2: Comprado, 3: Reservado
                    `Id_BookingExtraPassenger`                          INT(11) UNSIGNED NOT NULL,
                    `Id_BookingExtraRequirement`                        INT(11) UNSIGNED NOT NULL,
                    `Id_ProvisionRate`                                  INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_BookingExtraRequirementPassenger`),
                    FOREIGN KEY (`Id_BookingExtraPassenger`) REFERENCES `t_booking_extra_passenger`(`Id_BookingExtraPassenger`),
                    FOREIGN KEY (`Id_BookingExtraRequirement`) REFERENCES `t_booking_extra_requirement`(`Id_BookingExtraRequirement`),
                    INDEX(`BookingExtraRequirementPassenger_Date`),
                    INDEX(`BookingExtraRequirementPassenger_Status`),
                    INDEX(`Id_ProvisionRate`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `t_service`
                (
                    `Id_Service`                INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `Service_Date`              DATETIME NOT NULL,
                    `Service_DateUpdate`        DATETIME NOT NULL,
                    `Service_Price`             DECIMAL(12,2) NOT NULL,
                    `Service_Paid`              INT(1) UNSIGNED NOT NULL,
                    `Service_Code`              VARCHAR(250) NOT NULL,
                    `Service_Receipt`           VARCHAR(250) NOT NULL,
                    `Service_FlightNumber`      VARCHAR(250) NOT NULL,
                    `Service_Number`            VARCHAR(250) NOT NULL,
                    `Service_Origin`            VARCHAR(250) NOT NULL,
                    `Service_Destination`       VARCHAR(250) NOT NULL,
                    `Service_DateStart`         DATETIME NOT NULL,
                    `Service_DateEnd`           DATETIME NOT NULL,
                    `Service_DatePayment`       DATETIME NOT NULL,
                    `Service_DatePaymentAlarm`  DATETIME NOT NULL,
                    `Service_DatePaymentFinal`  DATETIME NOT NULL,
                    `Service_From`              INT(1) UNSIGNED NOT NULL,
                    `Service_NoShow`            INT(1) UNSIGNED NOT NULL,
                    `Service_Version`           INT(11) NOT NULL,
                    `Service_Status`            INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_ExtraRequirement`       INT(11) UNSIGNED NOT NULL,
                    `Id_GroupProvider`          INT(11) UNSIGNED NOT NULL,
                    `Id_ProvisionRate`          INT(11) UNSIGNED NOT NULL,
                    `Id_Currency`               INT(11) UNSIGNED NOT NULL,
                    `Id_Route`                  INT(11) UNSIGNED NOT NULL,
                    `Id_Tour`                   INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_Service`),
                    FOREIGN KEY (`Id_ExtraRequirement`) REFERENCES `t_extra_requirement`(`Id_ExtraRequirement`),
                    FOREIGN KEY (`Id_GroupProvider`) REFERENCES `t_group_provider`(`Id_GroupProvider`),
                    INDEX(`Service_Date`),
                    INDEX(`Service_Status`),
                    INDEX(`Service_Price`),
                    INDEX(`Id_ProvisionRate`),
                    INDEX(`Id_Currency`),
                    INDEX(`Id_Route`),
                    INDEX(`Id_Tour`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `t_booking_extra_requirement`
                ADD `Id_Route` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_ProvisionRate`;
                ALTER TABLE `t_booking_extra_requirement` ALTER `Id_Route` DROP DEFAULT;

                ALTER TABLE `t_booking_extra_requirement_passenger`
                ADD `Id_Service` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_ProvisionRate`;
                ALTER TABLE `t_booking_extra_requirement_passenger` ALTER `Id_Service` DROP DEFAULT;
                
                ALTER TABLE `t_service`
                ADD `Service_DateChanged` DATETIME NOT NULL DEFAULT NOW() AFTER `Service_DatePaymentFinal`;
                ALTER TABLE `t_service` ALTER `Service_DateChanged` DROP DEFAULT;
                
                ALTER TABLE `t_service`
                ADD `Service_Remark` VARCHAR(500) NOT NULL DEFAULT '' AFTER `Service_DateChanged`;
                ALTER TABLE `t_service` ALTER `Service_Remark` DROP DEFAULT;
                
                ALTER TABLE `t_service`
                ADD `Service_Lock` INT(1) NOT NULL DEFAULT 1 AFTER `Service_Remark`; -- 1: NO - 2: SÍ
                ALTER TABLE `t_service` ALTER `Service_Lock` DROP DEFAULT;
                
                ALTER TABLE `t_service`
                ADD `Service_PassengerAmount` INT(11) NOT NULL DEFAULT 0 AFTER `Service_Lock`;
                ALTER TABLE `t_service` ALTER `Service_PassengerAmount` DROP DEFAULT;
                
                ALTER TABLE `t_service`
                ADD `Id_PaxInformationRoom` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_Tour`;
                ALTER TABLE `t_service` ALTER `Id_PaxInformationRoom` DROP DEFAULT;
                
                ALTER TABLE `t_service`
                ADD `Id_Admin` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_PaxInformationRoom`;
                ALTER TABLE `t_service` ALTER `Id_Admin` DROP DEFAULT;
                
                ALTER TABLE `t_service`
                ADD `Id_Admin_Validated` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_Admin`;
                ALTER TABLE `t_service` ALTER `Id_Admin_Validated` DROP DEFAULT;

ALTER TABLE `t_package_tour_upgrade`
                ADD `PackageTourUpgrade_Status` INT(1) NOT NULL DEFAULT 2 AFTER `PackageTourUpgrade_IsVisible`; -- 0: DELETED - 2: ACTIVE
                ALTER TABLE `t_package_tour_upgrade` ALTER `PackageTourUpgrade_Status` DROP DEFAULT;

                ALTER TABLE `t_package_tour_equipment`
                ADD `PackageTourEquipment_Status` INT(11) UNSIGNED NOT NULL DEFAULT 2 AFTER `PackageTourEquipment_IsVisible`; -- 0: DELETED - 2: ACTIVE
                ALTER TABLE `t_package_tour_equipment` ALTER `PackageTourEquipment_Status` DROP DEFAULT;

CREATE TABLE `t_release_history` (
                    `Id_ReleaseHistory`         INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ReleaseHistory_Date`       DATETIME NOT NULL,
                    `ReleaseHistory_Table`      VARCHAR(100) NOT NULL,
                    `ReleaseHistory_Id`         INT(11) UNSIGNED NOT NULL,
                    `ReleaseHistory_Action`     VARCHAR(100) NOT NULL,

                    PRIMARY KEY (`Id_ReleaseHistory`)
                ) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
                
                CREATE TABLE `t_release_history_column` (
                    `Id_ReleaseHistoryColumn`           INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ReleaseHistoryColumn_Name`         VARCHAR(100) NOT NULL,
                    `ReleaseHistoryColumn_ColumnType`   VARCHAR(100) NOT NULL,
                    `ReleaseHistoryColumn_LastValue`    TEXT NOT NULL,
                    `ReleaseHistoryColumn_NewValue`     TEXT NOT NULL,
                    `Id_ReleaseHistory`                 INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_ReleaseHistoryColumn`),
                    FOREIGN KEY (`Id_ReleaseHistory`) REFERENCES `t_release_history`(`Id_ReleaseHistory`)
                ) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `t_service_media`
                (
                    `Id_ServiceMedia`               INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `ServiceMedia_Date`             DATETIME NOT NULL,
                    `ServiceMedia_DateUpdate`       DATETIME NOT NULL,
                    `ServiceMedia_Url`              VARCHAR(500) NOT NULL,
                    `ServiceMedia_Url_Thumb`        VARCHAR(500) NOT NULL,
                    `ServiceMedia_Extension`        VARCHAR(255) NOT NULL,
                    `ServiceMedia_MimeType`         VARCHAR(255) NOT NULL,
                    `ServiceMedia_RemoteName`       VARCHAR(500) NOT NULL,
                    `ServiceMedia_Version`          INT(11) NOT NULL,
                    `ServiceMedia_Status`           INT(1) NOT NULL, -- 0: Eliminado, 1: No público, 2: Público
                    `Id_Service`                    INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_ServiceMedia`),
                    FOREIGN KEY (`Id_Service`) REFERENCES `t_service`(`Id_Service`)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `t_equine`
                DROP FOREIGN KEY `t_equine_ibfk_2`;

ALTER TABLE `t_vehicle_model`
                ADD `Id_VehicleBrand` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `VehicleModel_Status`;
                ALTER TABLE `t_vehicle_model` ALTER `Id_VehicleBrand` DROP DEFAULT;
                
                ALTER TABLE `t_vehicle_model`
                ADD INDEX `INDEX_Id_VehicleBrand` (`Id_VehicleBrand`);

DELETE FROM `t_admin_role_auth` WHERE `Id_Directory` = 401;
                DELETE FROM `t_directory` WHERE `Id_Directory` = 401;
                
                DELETE FROM `t_admin_role_auth` WHERE `Id_Directory` = 402;
                DELETE FROM `t_directory` WHERE `Id_Directory` = 402;

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
CREATE TABLE `t_category_provider_category_room` (
                    `Id_CategoryProviderCategoryRoom` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `CategoryProviderCategoryRoom_Date` DATETIME NOT NULL,
                    `CategoryProviderCategoryRoom_DateUpdate` DATETIME NOT NULL,
                    `CategoryProviderCategoryRoom_Status` INT(1) NOT NULL, -- 0: Eliminado, 2: Activo
                    `CategoryProviderCategoryRoom_Version` INT(1) NOT NULL,
                    `Id_CategoryProvider` INT(11) UNSIGNED NOT NULL,
                    `Id_CategoryRoom` INT(11) UNSIGNED NOT NULL,

                    PRIMARY KEY (`Id_CategoryProviderCategoryRoom`),
                    FOREIGN KEY (`Id_CategoryProvider`) REFERENCES `t_category_provider`(`Id_CategoryProvider`),
                    FOREIGN KEY (`Id_CategoryRoom`) REFERENCES `t_category_room`(`Id_CategoryRoom`),
                    INDEX(`CategoryProviderCategoryRoom_Date`),
                    INDEX(`CategoryProviderCategoryRoom_Status`)
                );

                INSERT INTO `t_history_table` (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`) VALUES
                (235, 't_category_provider_category_room', 'Categoría de proveedor por categoría de habitación', 'sp_category_provider_category_room_index(?,@sts,@cod,@msg)');

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT * FROM `t_booking_extra` WHERE `Id_BookingTour` = ?

SELECT *
            FROM `t_booking_upgrade`
            WHERE `Id_BookingTour` IN (

SELECT *
            FROM `t_booking_equipment`
            WHERE `Id_BookingTour` IN (

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT * FROM `t_extra_requirement` WHERE `Id_Extra` = ?

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT * FROM `t_booking_extra_passenger` WHERE `Id_BookingExtra` = ?

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT Id_Extra
                    FROM t_extra
                    WHERE Extra_IdBefore = ?
                    AND Extra_TypeBefore = ?

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT * FROM `t_commercial_invoice` WHERE `Id_BookingUpgradePassenger` = ?

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT Id_Extra
                    FROM t_extra
                    WHERE Extra_IdBefore = ?
                    AND Extra_TypeBefore = ?
                    LIMIT 1

SELECT * FROM t_booking_tour

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT * FROM `t_booking_upgrade` WHERE Id_BookingTour = ? AND BookingUpgrade_Status <> 0

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT * FROM t_booking_upgrade_passenger WHERE Id_BookingUpgrade = ? AND BookingUpgradePassenger_Status <> 0

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT * FROM t_booking_equipment WHERE Id_BookingTour = ? AND BookingEquipment_Status <> 0

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT `bep`.*, `bt`.`BookingTour_DateStart`
            FROM `t_booking_equipment_passenger` `bep`
            INNER JOIN `t_booking_equipment` `be` ON `be`.`Id_BookingEquipment` = `bep`.`Id_BookingEquipment`
            INNER JOIN `t_booking_tour` `bt` ON `bt`.`Id_BookingTour` = `be`.`Id_BookingTour`
            WHERE `bep`.`Id_BookingEquipment` = ?
            AND `bep`.`BookingEquipmentPassenger_Status` <> 0

SELECT *
            FROM `t_package_tour_extra` `pte`
            INNER JOIN `t_package_tour` `pt` ON `pt`.`Id_PackageTour` = `pte`.`Id_PackageTour`
            WHERE `PackageTourExtra_Status` <> 0

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
SELECT * FROM `t_tour_extra` WHERE Id_Tour = ? AND Id_Extra = ? AND TourExtra_Status = ?

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
INSERT INTO `t_provider_general`(
                    `Id_ProviderGeneral`,
                    `ProviderGeneral_Date`,
                    `ProviderGeneral_DateUpdate`,
                    `ProviderGeneral_Name`,
                    `ProviderGeneral_BusinessName`,
                    `ProviderGeneral_NickName`,
                    `ProviderGeneral_Phone`,
                    `ProviderGeneral_Dni`,
                    `ProviderGeneral_Ruc`,
                    `ProviderGeneral_HasIncaTrail`,
                    `ProviderGeneral_SolUser`,
                    `ProviderGeneral_SolPassword`,
                    `ProviderGeneral_Profile`,
                    `ProviderGeneral_Profile_Thumb`,
                    `ProviderGeneral_TypePerson`,
                    `ProviderGeneral_Version`,
                    `ProviderGeneral_Status`,
                    `Id_ProviderContact`
                )
                VALUE (
                    NULL,
                    `fn_reduce_datetime_to_peru`(NOW()),
                    `fn_reduce_datetime_to_peru`(NOW()),
                    ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
                )

SELECT LAST_INSERT_ID() as Id_ProviderGeneral

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
INSERT INTO `t_provider_contributor`(
                    `Id_ProviderContributor`,
                    `ProviderContributor_Date`,
                    `ProviderContributor_DateUpdate`,
                    `ProviderContributor_Name`,
                    `ProviderContributor_LastName`,
                    `ProviderContributor_NoDocument`,
                    `ProviderContributor_Phone`,
                    `ProviderContributor_Email`,
                    `ProviderContributor_Version`,
                    `ProviderContributor_Status`,
                    `Id_Provider`,
                    `Id_TypeDocument`
                ) VALUE (
                    NULL,
                    `fn_reduce_datetime_to_peru`(NOW()),
                    `fn_reduce_datetime_to_peru`(NOW()),
                    ?, ?, ?, ?, ?, ?, ?, ?, ?
                )

SELECT LAST_INSERT_ID() as Id_ProviderContributor

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
INSERT INTO `t_provider_contact`(
                    `Id_ProviderContact`,
                    `ProviderContact_Date`,
                    `ProviderContact_DateUpdate`,
                    `ProviderContact_Name`,
                    `ProviderContact_LastName`,
                    `ProviderContact_NoDocument`,
                    `ProviderContact_Phone`,
                    `ProviderContact_Email`,
                    `ProviderContact_Version`,
                    `ProviderContact_Status`,
                    `Id_ProviderGeneral`,
                    `Id_TypeDocument`
                ) VALUE (
                    NULL,
                    `fn_reduce_datetime_to_peru`(NOW()),
                    `fn_reduce_datetime_to_peru`(NOW()),
                    ?, ?, ?, ?, ?, ?, ?, ?, ?
                )

SELECT LAST_INSERT_ID() as Id_ProviderContact

DELETE FROM `t_extra`
                WHERE `Id_Extra` IN (101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
                    116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134);

                DELETE FROM `t_type_extra_transl`
                WHERE `Id_TypeExtraTransl` IN (8, 9, 10, 11, 12, 13, 14, 15);

                DELETE FROM `t_category_extra`
                WHERE `Id_CategoryExtra` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);

                DELETE FROM `t_type_extra`
                WHERE `Id_TypeExtra` IN (8, 9, 10, 11, 12, 13, 14, 15);


-- =====================================================================
-- 115-release-09-02-26.php
-- =====================================================================

CREATE TABLE `t_commercial_invoice` (
                    `Id_CommercialInvoice` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                    `CommercialInvoice_Date` datetime NOT NULL,
                    `CommercialInvoice_DateUpdate` datetime NOT NULL,
                    `CommercialInvoice_IssueDate` date NOT NULL,
                    `CommercialInvoice_CodeReservation` varchar(50) NOT NULL,
                    `CommercialInvoice_NumberSerie` varchar(50) NOT NULL,
                    `CommercialInvoice_Type` int(1) NOT NULL,
                    `CommercialInvoice_AmountWithoutIgv` decimal(12,2) NOT NULL,
                    `CommercialInvoice_AmountWithIgv` decimal(12,2) NOT NULL,
                    `CommercialInvoice_Status` int(1) NOT NULL,
                    `CommercialInvoice_Version` int(1) NOT NULL,
                    `Id_BookingUpgradePassenger` int(11) UNSIGNED NOT NULL,
                    `Id_BookingExtraPassenger` int(11) UNSIGNED NOT NULL,
                    `Id_Booking` int(11) UNSIGNED NOT NULL,
                    PRIMARY KEY (`Id_CommercialInvoice`),
                    INDEX `INDEX_Id_BookingUpgradePassenger` (`Id_BookingUpgradePassenger`),
                    INDEX `INDEX_Id_BookingExtraPassenger` (`Id_BookingExtraPassenger`),
                    INDEX `INDEX_Id_Booking` (`Id_Booking`)
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

-- NOTA: contiene placeholders (?); en MySQL puro hay que sustituirlos antes de ejecutar.
INSERT INTO `t_history_table`
                    (`Id_HistoryTable`, `HistoryTable_Name`, `HistoryTable_Title`, `HistoryTable_Procedure`)
                    VALUES (231, 't_commercial_invoice', 'Facturas de Proveedor', 'sp_commercial_invoice_index(?,@sts,@cod,@msg)')

ALTER TABLE `t_booking_upgrade_passenger`
                ADD COLUMN `Id_CommercialInvoice` INT(11) UNSIGNED NOT NULL,
                ADD INDEX `idx_upgrade_commercial_invoice` (`Id_CommercialInvoice`);

ALTER TABLE `t_booking_extra_passenger`
                ADD COLUMN `Id_CommercialInvoice` INT(11) UNSIGNED NOT NULL,
                ADD INDEX `idx_extra_commercial_invoice` (`Id_CommercialInvoice`);

ALTER TABLE `t_booking_upgrade_passenger` DROP COLUMN `Id_CommercialInvoice`;

ALTER TABLE `t_booking_upgrade_passenger` DROP COLUMN `Id_CommercialInvoice`;


DELETE FROM `t_history_table` WHERE `Id_HistoryTable` = 231;

ALTER TABLE `t_booking_extra_passenger` DROP COLUMN `BookingExtraPassenger_Series`;


-- =====================================================================
-- 115-release-12-02-2026.php
-- =====================================================================

INSERT IGNORE INTO `t_state` (`Id_State`, `State_Code`, `State_Name`, `State_Status`, `Id_Country`) VALUES
                (2, 'AMA', 'Amazonas', 2, 1),
                (3, 'ANC', 'Ancash', 2, 1),
                (4, 'APU', 'Apurímac', 2, 1),
                (5, 'ARE', 'Arequipa', 2, 1),
                (6, 'AYA', 'Ayacucho', 2, 1),
                (7, 'CAJ', 'Cajamarca', 2, 1),
                (8, 'CAL', 'Callao', 2, 1),
                (9, 'HUV', 'Huancavelica', 2, 1),
                (10, 'HUA', 'Huánuco', 2, 1),
                (11, 'ICA', 'Ica', 2, 1),
                (12, 'JUN', 'Junín', 2, 1),
                (13, 'LAL', 'La Libertad', 2, 1),
                (14, 'LAM', 'Lambayeque', 2, 1),
                (15, 'LIM', 'Lima', 2, 1),
                (16, 'LOR', 'Loreto', 2, 1),
                (17, 'MDD', 'Madre de Dios', 2, 1),
                (18, 'MOQ', 'Moquegua', 2, 1),
                (19, 'PAS', 'Pasco', 2, 1),
                (20, 'PIU', 'Piura', 2, 1),
                (21, 'PUN', 'Puno', 2, 1),
                (22, 'SAM', 'San Martín', 2, 1),
                (23, 'TAC', 'Tacna', 2, 1),
                (24, 'TUM', 'Tumbes', 2, 1),
                (25, 'UCA', 'Ucayali', 2, 1);

                INSERT IGNORE INTO `t_city` (`City_Code`, `City_Name`, `City_Status`, `Id_State`) VALUES
                ('ACO', 'Acomayo', 2, 1),
                ('CAN', 'Canas', 2, 1),
                ('CHE', 'Canchis', 2, 1),
                ('CHU', 'Chumbivilcas', 2, 1),
                ('ESP', 'Espinar', 2, 1),
                ('PAR', 'Paruro', 2, 1);

                -- Amazonas (2), Ancash (3), Apurímac (4), Arequipa (5)
                INSERT IGNORE INTO `t_city` (`City_Code`, `City_Name`, `City_Status`, `Id_State`) VALUES
                ('CHA', 'Chachapoyas', 2, 2), ('BAG', 'Bagua', 2, 2), ('BON', 'Bongará', 2, 2), ('CON', 'Condorcanqui', 2, 2), ('LUY', 'Luya', 2, 2), ('ROD', 'Rodríguez de Mendoza', 2, 2), ('UTC', 'Utcubamba', 2, 2),
                ('HUA', 'Huaraz', 2, 3), ('AIJ', 'Aija', 2, 3), ('ANT', 'Antonio Raymondi', 2, 3), ('ASU', 'Asunción', 2, 3), ('BOL', 'Bolognesi', 2, 3), ('CAR', 'Carhuaz', 2, 3), ('CAS', 'Casma', 2, 3), ('COR', 'Corongo', 2, 3), ('HUA', 'Huari', 2, 3), ('HUA', 'Huarmey', 2, 3), ('HUA', 'Huaylas', 2, 3), ('MAR', 'Mariscal Luzuriaga', 2, 3), ('OCR', 'Ocros', 2, 3), ('PAL', 'Pallasca', 2, 3), ('POM', 'Pomabamba', 2, 3), ('REC', 'Recuay', 2, 3), ('SAN', 'Santa', 2, 3), ('SIH', 'Sihuas', 2, 3), ('YUN', 'Yungay', 2, 3),
                ('ABA', 'Abancay', 2, 4), ('AND', 'Andahuaylas', 2, 4), ('ANT', 'Antabamba', 2, 4), ('AYM', 'Aymaraes', 2, 4), ('COT', 'Cotabambas', 2, 4), ('CHI', 'Chincheros', 2, 4), ('GRA', 'Grau', 2, 4),
                ('ARE', 'Arequipa', 2, 5), ('CAM', 'Camaná', 2, 5), ('CAR', 'Caravelí', 2, 5), ('CAS', 'Castilla', 2, 5), ('CAY', 'Caylloma', 2, 5), ('CON', 'Condesuyos', 2, 5), ('ISL', 'Islay', 2, 5), ('LAU', 'La Unión', 2, 5);

                -- Ayacucho (6), Cajamarca (7), Callao (8), Huancavelica (9)
                INSERT IGNORE INTO `t_city` (`City_Code`, `City_Name`, `City_Status`, `Id_State`) VALUES
                ('HUA', 'Huamanga', 2, 6), ('CAN', 'Cangallo', 2, 6), ('HSA', 'Huanca Sancos', 2, 6), ('HUA', 'Huanta', 2, 6), ('LAM', 'La Mar', 2, 6), ('LUC', 'Lucanas', 2, 6), ('PAR', 'Parinacochas', 2, 6), ('PAU', 'Paucar del Sara Sara', 2, 6), ('SUC', 'Sucre', 2, 6), ('VFA', 'Víctor Fajardo', 2, 6), ('VHU', 'Vilcas Huamán', 2, 6),
                ('CAJ', 'Cajamarca', 2, 7), ('CAJ', 'Cajabamba', 2, 7), ('CEL', 'Celendín', 2, 7), ('CHO', 'Chota', 2, 7), ('CON', 'Contumazá', 2, 7), ('CUT', 'Cutervo', 2, 7), ('HUA', 'Hualgayoc', 2, 7), ('JAE', 'Jaén', 2, 7), ('SIG', 'San Ignacio', 2, 7), ('SMA', 'San Marcos', 2, 7), ('SMI', 'San Miguel', 2, 7), ('SPA', 'San Pablo', 2, 7), ('SCR', 'Santa Cruz', 2, 7),
                ('CAL', 'Callao', 2, 8),
                ('HUV', 'Huancavelica', 2, 9), ('ACO', 'Acobamba', 2, 9), ('ANG', 'Angaraes', 2, 9), ('CAS', 'Castrovirreyna', 2, 9), ('CHU', 'Churcampa', 2, 9), ('HUA', 'Huaytará', 2, 9), ('TAY', 'Tayacaja', 2, 9);

                -- Huánuco (10), Ica (11), Junín (12), La Libertad (13)
                INSERT IGNORE INTO `t_city` (`City_Code`, `City_Name`, `City_Status`, `Id_State`) VALUES
                ('HUA', 'Huánuco', 2, 10), ('AMB', 'Ambo', 2, 10), ('DMN', 'Dos de Mayo', 2, 10), ('HBA', 'Huacaybamba', 2, 10), ('HML', 'Huamalíes', 2, 10), ('LPR', 'Leoncio Prado', 2, 10), ('MAR', 'Marañón', 2, 10), ('PAC', 'Pachitea', 2, 10), ('PIN', 'Puerto Inca', 2, 10), ('LAU', 'Lauricocha', 2, 10), ('YAR', 'Yarowilca', 2, 10),
                ('ICA', 'Ica', 2, 11), ('CHI', 'Chincha', 2, 11), ('NAS', 'Nasca', 2, 11), ('PAL', 'Palpa', 2, 11), ('PIS', 'Pisco', 2, 11),
                ('HUA', 'Huancayo', 2, 12), ('CHA', 'Chanchamayo', 2, 12), ('CHU', 'Chupaca', 2, 12), ('CON', 'Concepción', 2, 12), ('JAU', 'Jauja', 2, 12), ('JUN', 'Junín', 2, 12), ('SAT', 'Satipo', 2, 12), ('TAR', 'Tarma', 2, 12), ('YAU', 'Yauli', 2, 12),
                ('TRU', 'Trujillo', 2, 13), ('ASC', 'Ascope', 2, 13), ('BOL', 'Bolívar', 2, 13), ('CHE', 'Chepén', 2, 13), ('GCH', 'Gran Chimú', 2, 13), ('JUL', 'Julcán', 2, 13), ('OTU', 'Otuzco', 2, 13), ('PAC', 'Pacasmayo', 2, 13), ('PAT', 'Pataz', 2, 13), ('SCA', 'Sánchez Carrión', 2, 13), ('SCH', 'Santiago de Chuco', 2, 13), ('VIR', 'Virú', 2, 13);

                -- Lambayeque (14), Lima (15), Loreto (16), Madre de Dios (17), Moquegua (18)
                INSERT IGNORE INTO `t_city` (`City_Code`, `City_Name`, `City_Status`, `Id_State`) VALUES
                ('CHI', 'Chiclayo', 2, 14), ('FER', 'Ferreñafe', 2, 14), ('LAM', 'Lambayeque', 2, 14),
                ('LIM', 'Lima', 2, 15), ('BAR', 'Barranca', 2, 15), ('CAJ', 'Cajatambo', 2, 15), ('CAN', 'Canta', 2, 15), ('CAÑ', 'Cañete', 2, 15), ('HRL', 'Huaral', 2, 15), ('HRI', 'Huarochirí', 2, 15), ('HUA', 'Huaura', 2, 15), ('OYO', 'Oyón', 2, 15), ('YAU', 'Yauyos', 2, 15),
                ('MAY', 'Maynas', 2, 16), ('AAM', 'Alto Amazonas', 2, 16), ('LOR', 'Loreto', 2, 16), ('MRC', 'Mariscal Ramón Castilla', 2, 16), ('REQ', 'Requena', 2, 16), ('UCA', 'Ucayali', 2, 16), ('DMA', 'Datem del Marañón', 2, 16), ('PUT', 'Putumayo', 2, 16),
                ('TAM', 'Tambopata', 2, 17), ('MAN', 'Manu', 2, 17), ('TAH', 'Tahuamanu', 2, 17),
                ('MNI', 'Mariscal Nieto', 2, 18), ('GSC', 'General Sánchez Cerro', 2, 18), ('ILO', 'Ilo', 2, 18);

                -- Pasco (19), Piura (20), Puno (21), San Martín (22), Tacna (23), Tumbes (24), Ucayali (25)
                INSERT IGNORE INTO `t_city` (`City_Code`, `City_Name`, `City_Status`, `Id_State`) VALUES
                ('PAS', 'Pasco', 2, 19), ('DAC', 'Daniel Alcides Carrión', 2, 19), ('OXA', 'Oxapampa', 2, 19),
                ('PIU', 'Piura', 2, 20), ('AYA', 'Ayabaca', 2, 20), ('HBA', 'Huancabamba', 2, 20), ('MOR', 'Morropón', 2, 20), ('PAI', 'Paita', 2, 20), ('SEC', 'Sechura', 2, 20), ('SUL', 'Sullana', 2, 20), ('TAL', 'Talara', 2, 20),
                ('PUN', 'Puno', 2, 21), ('AZA', 'Azángaro', 2, 21), ('CAR', 'Carabaya', 2, 21), ('CHU', 'Chucuito', 2, 21), ('ECO', 'El Collao', 2, 21), ('HNE', 'Huancané', 2, 21), ('LAM', 'Lampa', 2, 21), ('MEL', 'Melgar', 2, 21), ('MOH', 'Moho', 2, 21), ('SAP', 'San Antonio de Putina', 2, 21), ('SRO', 'San Román', 2, 21), ('SAN', 'Sandia', 2, 21), ('YUN', 'Yunguyo', 2, 21),
                ('MOY', 'Moyobamba', 2, 22), ('BEL', 'Bellavista', 2, 22), ('ELD', 'El Dorado', 2, 22), ('HUA', 'Huallaga', 2, 22), ('LAM', 'Lamas', 2, 22), ('MCA', 'Mariscal Cáceres', 2, 22), ('PIC', 'Picota', 2, 22), ('RIO', 'Rioja', 2, 22), ('SAM', 'San Martín', 2, 22), ('TOC', 'Tocache', 2, 22),
                ('TAC', 'Tacna', 2, 23), ('CAN', 'Candarave', 2, 23), ('JBA', 'Jorge Basadre', 2, 23), ('TAR', 'Tarata', 2, 23),
                ('TUM', 'Tumbes', 2, 24), ('CVI', 'Contralmirante Villar', 2, 24), ('ZAR', 'Zarumilla', 2, 24),
                ('CPO', 'Coronel Portillo', 2, 25), ('ATA', 'Atalaya', 2, 25), ('PAB', 'Padre Abad', 2, 25), ('PUR', 'Purús', 2, 25);


-- =====================================================================
-- 115-release-14-02-26.php
-- =====================================================================

CREATE OR REPLACE VIEW v_booking_sales AS
					SELECT  `b`.`Id_Booking`,
							`bt`.`Id_BookingTour`,
							`bt`.`Id_Package`,
							`bt`.`Id_Tour`,
							`t`.`Id_CategoryTour`,
							`bt`.`BookingTour_Group`,
							`b`.`Id_Admin`,
							`btp`.`Id_Passenger`,
							`btp`.`Id_BookingTourPassenger`,
							`b`.`Id_User`,
							`u`.`Id_UserCountry`,

							`i`.`Id_Invoice`,
							`i`.`Invoice_Total`,
							`i`.`Invoice_TotalPay`,
							`i`.`Invoice_TotalPending`,

							`b`.`Booking_DateConfirm` AS `Booking_Confirm_Date`,
							YEAR(`b`.`Booking_DateConfirm`) AS `Booking_Confirm_Year`,
							MONTH(`b`.`Booking_DateConfirm`) AS `Booking_Confirm_Month`,
							DAY(`b`.`Booking_DateConfirm`) AS `Booking_Confirm_Day`,

							`bt`.`BookingTour_DateStart` AS `Booking_Start_Date`,
							YEAR(`bt`.`BookingTour_DateStart`) AS `Booking_Start_Year`,
							MONTH(`bt`.`BookingTour_DateStart`) AS `Booking_Start_Month`,
							DAY(`bt`.`BookingTour_DateStart`) AS `Booking_Start_Day`,

							IF(`u`.`User_Type` = 1, 1, 2) AS `Booking_Agency`, -- Endosado

							IF(`u`.`User_Type` = 1 AND `b`.`Booking_Type` = 1, 1, 0) AS `ReservaWeb`,
							IF(`u`.`User_Type` = 1 AND `b`.`Booking_Type` = 1, 0, 1) AS `NotReservaWeb`,
							IF(`u`.`User_Type` = 2, 0, IF(`b`.`Booking_InPerson` = 1, `b`.`Booking_Type`, 8)) AS `Booking_Type`,
							`cmd`.`Id_CashMovementDetail`,
							`cmd`.`CashMovementDetail_Amount`
					FROM `t_booking_tour_passenger` `btp`
					INNER JOIN `t_booking_tour` `bt` ON `bt`.`Id_BookingTour` = `btp`.`Id_BookingTour`
					INNER JOIN `t_booking` `b` ON `b`.`Id_Booking` = `bt`.`Id_Booking`
					INNER JOIN `t_tour` `t` ON `t`.`Id_Tour` = `bt`.`Id_Tour`
					INNER JOIN `t_user` `u` ON `u`.`Id_User` = `b`.`Id_User`
					INNER JOIN `t_invoice` `i` ON `i`.`Id_Passenger` = `btp`.`Id_Passenger`
					LEFT JOIN `t_cash_movement_detail` `cmd` ON `cmd`.`Id_Invoice` = `i`.`Id_Invoice`
					WHERE `bt`.`BookingTour_Status` = 2
					AND `btp`.`BookingTourPassenger_Status` IN (2, 3)
					AND `fn_booking_tour_passenger_check`(
							`b`.`Booking_Status`,
							`b`.`Booking_ManuallyConfirmed`,
							1,
							1,
							`btp`.`BookingTourPassenger_PaymentStatus`
					);




				CREATE OR REPLACE VIEW v_leads AS
					SELECT 	`Id_WebContactMessage` AS `Id_Lead`,
							`WebContactMessage_Date` AS `Lead_Date`,
							YEAR(`WebContactMessage_Date`) AS `Lead_Date_Year`,
							MONTH(`WebContactMessage_Date`) AS `Lead_Date_Month`,
							DAY(`WebContactMessage_Date`) AS `Lead_Date_Day`,
							`WebContactMessage_Type` AS `Lead_Type`,
							`WebContactMessage_Status` AS `Lead_Status`,			-- 0: DELETED - 1: NEW - 2: PRE_BOOKING - 3: CONFIRMED - 4: CANCELED - 5: ASSOCIATED
																					-- 6: ASSIGNED - 7: ANSWERED - 8: LOST - 9: HOLD - 10: RECOVERED
							`Id_WebContact`,
							`Id_Country` AS `Id_UserCountry`,
							`Id_Language`,
							`Id_Channel`,
							`Id_Language_Contact`,
							`Id_WebTypeClient`,
							`Id_Admin`,
							`Id_WebPage`,
							`Id_Booking`
					FROM `t_web_contact_message`;


-- =====================================================================
-- 115-release-21-02-2026.php
-- =====================================================================

ALTER TABLE `t_tour_extra_requirement` ADD `Id_ExtraRequirementSchedule` INT(11) UNSIGNED NOT NULL AFTER `Id_ExtraRequirement`;
                            ALTER TABLE `t_tour_extra_requirement` ADD INDEX `INDEX_ExtraRequirementSchedule` (`Id_ExtraRequirementSchedule`);
                            ALTER TABLE `t_tour_extra_requirement` ADD `TourExtraRequirement_IsMain` INT(1) UNSIGNED NOT NULL DEFAULT 1 AFTER `Id_ExtraRequirementSchedule`;

ALTER TABLE `t_tour_extra_requirement` DROP INDEX `INDEX_ExtraRequirementSchedule`;
                            ALTER TABLE `t_tour_extra_requirement` DROP `Id_ExtraRequirementSchedule`;
                            ALTER TABLE `t_tour_extra_requirement` DROP `TourExtraRequirement_IsMain`;


-- =====================================================================
-- 116-release-20-02-26.php
-- =====================================================================

ALTER TABLE `t_tour`
                ADD COLUMN `Tour_GroupCamp` INT(1) UNSIGNED NOT NULL AFTER Tour_ScoreTotal;

ALTER TABLE t_passenger
                ADD COLUMN Passenger_TypeParticipation INT(1) UNSIGNED DEFAULT 1 NOT NULL AFTER Passenger_Reportable; -- 1: Regular, 2: Interno, 3: Colaboración;
                ALTER TABLE `t_passenger` ALTER `Passenger_TypeParticipation` DROP DEFAULT;


-- =====================================================================
-- 116-release-25-02-2026.php
-- =====================================================================

ALTER TABLE `t_package`
                            ADD `Package_Img` VARCHAR(500) NOT NULL DEFAULT '' AFTER `Package_UrlThumbnail`;
                            ALTER TABLE `t_package` ALTER `Package_Img` DROP DEFAULT;

                            ALTER TABLE `t_package`
                            ADD `Package_Img_Thumb` VARCHAR(500) NOT NULL DEFAULT '' AFTER `Package_Img`;
                            ALTER TABLE `t_package` ALTER `Package_Img_Thumb` DROP DEFAULT;

ALTER TABLE `t_package_rate`
                            ADD `PackageRate_DateStart` DATETIME NOT NULL AFTER `PackageRate_Type`;

                            ALTER TABLE `t_package_rate` 
                            ADD `PackageRate_DateEnd` DATETIME NOT NULL AFTER `PackageRate_DateStart`;

ALTER TABLE `t_package_rate`
                            ADD `PackageRate_isMain` INT(11) NOT NULL AFTER `PackageRate_DateEnd`;

                            ALTER TABLE `t_package_rate`
                            ADD `PackageRate_Order` INT(11) NOT NULL AFTER `PackageRate_isMain`;
                            
                            ALTER TABLE `t_package_rate`
                            ADD `PackageRate_Version` INT(11) NOT NULL AFTER `PackageRate_Order`;

UPDATE `t_package_rate` SET `PackageRate_isMain` = 1, `PackageRate_Order` = 1, `PackageRate_Version` = 1

ALTER TABLE `t_package` DROP COLUMN `Package_Img_Thumb`;
                            ALTER TABLE `t_package` DROP COLUMN `Package_Img`;

ALTER TABLE `t_package_rate` DROP COLUMN `PackageRate_DateEnd`;
                            ALTER TABLE `t_package_rate` DROP COLUMN `PackageRate_DateStart`;

ALTER TABLE `t_package_rate` DROP COLUMN `PackageRate_isMain`;
                            ALTER TABLE `t_package_rate` DROP COLUMN `PackageRate_Order`;
                            ALTER TABLE `t_package_rate` DROP COLUMN `PackageRate_Version`;


-- =====================================================================
-- 117-release-06-03-2026.php
-- =====================================================================

ALTER TABLE `t_package_tour_extra`
                            ADD `PackageTourExtra_Included` INT(1) NOT NULL DEFAULT 1 AFTER `PackageTourExtra_Order`;   

                            ALTER TABLE `t_package_tour_extra`
                            ADD `PackageTourExtra_Select` INT(11) NOT NULL AFTER `PackageTourExtra_Included`;

                            ALTER TABLE `t_package_tour_extra`
                            ADD `PackageTourExtra_Day` INT(11) NOT NULL AFTER `PackageTourExtra_Select`;

                            ALTER TABLE `t_package_tour_extra`
                            ADD `PackageTourExtra_RequireDay` INT(11) NOT NULL AFTER `PackageTourExtra_Day`;

ALTER TABLE `t_package_tour` ADD `PackageTour_Status` INT(1) NOT NULL AFTER `PackageTour_Price`;
                            ALTER TABLE `t_package_tour` ADD `PackageTour_Version` INT(11) NOT NULL AFTER `PackageTour_Status`;

ALTER TABLE `t_package_tour_extra` DROP COLUMN `PackageTourExtra_Select`;
                            ALTER TABLE `t_package_tour_extra` DROP COLUMN `PackageTourExtra_Day`;
                            ALTER TABLE `t_package_tour_extra` DROP COLUMN `PackageTourExtra_RequireDay`;

ALTER TABLE `t_package_tour` DROP COLUMN `PackageTour_Status`;
                            ALTER TABLE `t_package_tour` DROP COLUMN `PackageTour_Version`;


-- =====================================================================
-- 117-release-07-04-26.php
-- =====================================================================

CREATE TABLE t_application
                (
                    Id_Application      INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    Application_Name    VARCHAR(150) NOT NULL,
                    Application_Status  INT(1) NOT NULL -- 0: Eliminado, 1: Inactivo, 2:Activo
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                CREATE INDEX INDEX_Application_Status
                    ON t_application (Application_Status);


                CREATE TABLE t_application_key
                (
                    Id_ApplicationKey            INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    ApplicationKey_Value         VARCHAR(255) NOT NULL,
                    ApplicationKey_SecretHash   VARCHAR(255) NOT NULL,
                    ApplicationKey_ExpiresDate    DATETIME NOT NULL,
                    ApplicationKey_LastUsedDate  DATETIME NOT NULL,
                    ApplicationKey_TokenType INT(1) NOT NULL, -- 1: Short-Lived, 2: Long-Lived
                    ApplicationKey_Status        INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2:Activo
                    Id_Application               INT(11) UNSIGNED NOT NULL,

                    CONSTRAINT t_application_key_ibfk_1
                        FOREIGN KEY (Id_Application)
                        REFERENCES t_application (Id_Application)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                CREATE INDEX INDEX_ApplicationKey_Value
                    ON t_application_key (ApplicationKey_Value);

                CREATE INDEX INDEX_Id_Application
                    ON t_application_key (Id_Application);

                CREATE INDEX INDEX_ApplicationKey_ExpiresDate
                    ON t_application_key (ApplicationKey_ExpiresDate);

                CREATE INDEX INDEX_ApplicationKey_Status
                    ON t_application_key (ApplicationKey_Status);

                CREATE INDEX INDEX_ApplicationKey_LastUsedDate
                    ON t_application_key (ApplicationKey_LastUsedDate);


                CREATE TABLE t_application_session
                (
                    Id_ApplicationSession            INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    ApplicationSession_Token         VARCHAR(255) NOT NULL,
                    ApplicationSession_IssuedDate     DATETIME NOT NULL,
                    ApplicationSession_ExpiresDate    DATETIME NOT NULL,
                    ApplicationSession_Status        INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2:Activo
                    ApplicationSession_LastUsedDate  DATETIME NOT NULL,
                    Id_ApplicationKey                INT(11) UNSIGNED NOT NULL,

                    CONSTRAINT t_application_session_ibfk_1
                        FOREIGN KEY (Id_ApplicationKey)
                        REFERENCES t_application_key (Id_ApplicationKey)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                CREATE INDEX INDEX_ApplicationSession_Token
                    ON t_application_session (ApplicationSession_Token);

                CREATE INDEX INDEX_Id_ApplicationKey
                    ON t_application_session (Id_ApplicationKey);

                CREATE INDEX INDEX_ApplicationSession_ExpiresDate
                    ON t_application_session (ApplicationSession_ExpiresDate);

                CREATE INDEX INDEX_ApplicationSession_Status
                    ON t_application_session (ApplicationSession_Status);

                CREATE INDEX INDEX_ApplicationSession_LastUsedDate
                    ON t_application_session (ApplicationSession_LastUsedDate);


                CREATE TABLE t_scope
                (
                    Id_Scope      INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    Scope_Name    VARCHAR(250) NOT NULL,
                    Scope_Status  INT(1) NOT NULL
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                CREATE INDEX INDEX_Scope_Status
                    ON t_scope (Scope_Status);

                CREATE TABLE t_application_scope
                (
                    Id_ApplicationScope     INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    ApplicationScope_Status INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2:Activo
                    Id_Application          INT(11) UNSIGNED NOT NULL,
                    Id_Scope                INT(11) UNSIGNED NOT NULL,

                    CONSTRAINT t_application_scope_ibfk_1
                        FOREIGN KEY (Id_Application)
                        REFERENCES t_application (Id_Application),

                    CONSTRAINT t_application_scope_ibfk_2
                        FOREIGN KEY (Id_Scope)
                        REFERENCES t_scope (Id_Scope)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                CREATE UNIQUE INDEX INDEX_IdApplication_IdScope
                    ON t_application_scope (Id_Application, Id_Scope);

                CREATE INDEX INDEX_Id_Application
                    ON t_application_scope (Id_Application);

                CREATE INDEX INDEX_Id_Scope
                    ON t_application_scope (Id_Scope);

                CREATE INDEX INDEX_ApplicationScope_Status
                    ON t_application_scope (ApplicationScope_Status);


                CREATE TABLE t_endpoint
                (
                    Id_Endpoint      INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    Endpoint_Path    VARCHAR(255) NOT NULL,
                    Endpoint_Method  VARCHAR(10) NOT NULL,
                    Endpoint_Status  INT(1) NOT NULL -- 0: Eliminado, 1: Inactivo, 2:Activo
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                CREATE INDEX INDEX_Endpoint_Status
                    ON t_endpoint (Endpoint_Status);


                CREATE TABLE t_endpoint_scope
                (
                    Id_EndpointScope      INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    EndpointScope_Status   INT(1) NOT NULL, -- 0: Eliminado, 1: Inactivo, 2:Activo
                    Id_Endpoint            INT(11) UNSIGNED NOT NULL,
                    Id_Scope               INT(11) UNSIGNED NOT NULL,
                    CONSTRAINT t_endpoint_scope_ibfk_1
                        FOREIGN KEY (Id_Endpoint)
                        REFERENCES t_endpoint (Id_Endpoint),
                    CONSTRAINT t_endpoint_scope_ibfk_2
                        FOREIGN KEY (Id_Scope)
                        REFERENCES t_scope (Id_Scope)
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                CREATE INDEX INDEX_EndpointScope_Status
                    ON t_endpoint_scope (EndpointScope_Status);


                CREATE TABLE t_request_log
                (
                    Id_RequestLog            INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
                    RequestLog_EndpointPath  VARCHAR(255) NOT NULL,
                    RequestLog_Method        VARCHAR(10) NOT NULL,
                    RequestLog_Date          DATETIME NOT NULL,
                    RequestLog_Response      TEXT NOT NULL,
                    RequestLog_ErrorMessage  TEXT NOT NULL,
                    Id_ApplicationKey        INT(11) UNSIGNED NOT NULL,
                    Id_Application           INT(11) UNSIGNED NOT NULL,
                    Id_ApplicationSession    INT(11) UNSIGNED NOT NULL
                )
                ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                CREATE INDEX INDEX_RequestLog_Date
                    ON t_request_log (RequestLog_Date);

                CREATE INDEX INDEX_Id_ApplicationKey
                    ON t_request_log (Id_ApplicationKey);

                CREATE INDEX INDEX_Id_Application
                    ON t_request_log (Id_Application);

                CREATE INDEX INDEX_Id_ApplicationSession
                    ON t_request_log (Id_ApplicationSession);

INSERT INTO t_application
                    (Id_Application, Application_Name, Application_Status)
                VALUES
                    (1, 'HubSpot', 2);


                INSERT INTO t_application_key
                    (Id_ApplicationKey, ApplicationKey_Value, ApplicationKey_SecretHash, ApplicationKey_ExpiresDate, ApplicationKey_TokenType, ApplicationKey_Status, ApplicationKey_LastUsedDate, Id_Application)
                VALUES
                    (1, 'hs_live_7f3a9c2d4e6b8a1f0c3d5e7a9b2c4d6', '$2y$10$LQ45NbQpGsYK6W8uKCTjlelMFBeg9hZvXQV1kkj4v2A2asqjX0UMK', '2027-05-01 00:00:00', 2, 2, NOW(), 1);


                INSERT INTO t_scope
                    (Id_Scope, Scope_Name, Scope_Status)
                VALUES
                    (1, 'leads.write', 2);


                INSERT INTO t_application_scope
                    (Id_ApplicationScope, ApplicationScope_Status, Id_Application, Id_Scope)
                VALUES
                    (1, 2, 1, 1);

                INSERT INTO t_endpoint
                    (Id_Endpoint, Endpoint_Path, Endpoint_Method, Endpoint_Status)
                VALUES
                    (1, 'applications/webContactMessage/hubspot', 'POST', 2);

                INSERT INTO t_endpoint_scope
                    (Id_EndpointScope, EndpointScope_Status, Id_Endpoint, Id_Scope)
                VALUES
                    (1, 2, 1, 1);


-- =====================================================================
-- 118-release-12-03-2026.php
-- =====================================================================

ALTER TABLE `t_extra_rate` 
                            ADD `ExtraRate_PriceReference` decimal(12,2) NOT NULL 
                            AFTER ExtraRate_PriceConfidential ;

ALTER TABLE `t_extra_rate` 
                            DROP `ExtraRate_PriceReference` ;


-- =====================================================================
-- 119-JCL-release-21-04-26.php
-- =====================================================================

ALTER TABLE `t_provision`
                ADD `Provision_Name` VARCHAR(255) NOT NULL DEFAULT '' AFTER `Provision_DateUpdate`;
                ALTER TABLE `t_provision` ALTER `Provision_Name` DROP DEFAULT;

                INSERT INTO `t_tour_type_tour` (`Id_TourTypeTour`, `TourTypeTour_Date`, `TourTypeTour_DateUpdate`, `TourTypeTour_Version`,  `TourTypeTour_Status`, `Id_Tour`, `Id_TypeTour`)
                SELECT NULL,
                    `fn_reduce_datetime_to_peru`(NOW()),
                    `fn_reduce_datetime_to_peru`(NOW()),
                    1,
                    2,
                    `Id_Tour`,
                    `Id_TypeTour`
                FROM `t_tour`;

                INSERT INTO `t_tour_category_tour` (`Id_TourCategoryTour`, `TourCategoryTour_Date`, `TourCategoryTour_DateUpdate`, `TourCategoryTour_Version`,  `TourCategoryTour_Status`, `Id_Tour`, `Id_CategoryTour`)
                SELECT NULL,
                    `fn_reduce_datetime_to_peru`(NOW()),
                    `fn_reduce_datetime_to_peru`(NOW()),
                    1,
                    2,
                    `Id_Tour`,
                    `Id_CategoryTour`
                FROM `t_tour`;

ALTER TABLE `t_vehicle_model`
                ADD `Id_TypeVehicle` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `VehicleModel_Status`; 
                ALTER TABLE `t_vehicle_model` ALTER `Id_TypeVehicle` DROP DEFAULT;
                
                ALTER TABLE `t_vehicle_model`
                ADD INDEX `Id_TypeVehicle` (`Id_TypeVehicle`);

                ALTER TABLE `t_type_vehicle`
                DROP FOREIGN KEY `t_type_vehicle_ibfk_1`;

                ALTER TABLE `t_type_vehicle`
                DROP COLUMN `Id_VehicleModel`;

                ALTER TABLE `t_vehicle`
                DROP FOREIGN KEY `t_vehicle_ibfk_3`;

                ALTER TABLE `t_vehicle`
                DROP COLUMN `Id_TypeVehicle`;

                ALTER TABLE `t_vehicle`
                ADD `Id_VehicleModel` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_ProviderTypeProvider`; 
                ALTER TABLE `t_vehicle` ALTER `Id_VehicleModel` DROP DEFAULT;

                ALTER TABLE `t_vehicle`
                ADD INDEX `Id_VehicleModel` (`Id_VehicleModel`);

ALTER TABLE `t_route`
                ADD `Route_Steps` VARCHAR(255) NOT NULL DEFAULT '' AFTER `Route_Description`; 
                ALTER TABLE `t_route` ALTER `Route_Steps` DROP DEFAULT;

                ALTER TABLE `t_route`
                ADD `Route_IsDirect` INT(1) NOT NULL DEFAULT 2 AFTER `Route_Steps`; -- 1: NO - 2: SÍ
                ALTER TABLE `t_route` ALTER `Route_IsDirect` DROP DEFAULT;

ALTER TABLE `t_type_provider`
                ADD `TypeProvider_HideGeneralService` INT(1) NOT NULL DEFAULT 1 AFTER `TypeProvider_Type`; 
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_HideGeneralService` DROP DEFAULT;

                ALTER TABLE `t_type_provider`
                ADD `TypeProvider_HideRoute` INT(1) NOT NULL DEFAULT 1 AFTER `TypeProvider_HideGeneralService`; 
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_HideRoute` DROP DEFAULT;

                ALTER TABLE `t_type_provider`
                ADD `TypeProvider_HideTour` INT(1) NOT NULL DEFAULT 1 AFTER `TypeProvider_HideRoute`; 
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_HideTour` DROP DEFAULT;

                ALTER TABLE `t_type_provider`
                ADD `TypeProvider_RouteTypeSelected` INT(1) NOT NULL DEFAULT 1 AFTER `TypeProvider_HideTour`;
                ALTER TABLE `t_type_provider` ALTER `TypeProvider_RouteTypeSelected` DROP DEFAULT;

                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 1;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 2;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 3;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 2, `TypeProvider_HideRoute`= 1, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 4;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 2, `TypeProvider_HideRoute`= 1, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 2 WHERE `Id_TypeProvider` = 5;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 2, `TypeProvider_HideRoute`= 1, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 6;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 2, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 7;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 2, `TypeProvider_HideRoute`= 1, `TypeProvider_HideGeneralService` = 2, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 8;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 2, `TypeProvider_HideRoute`= 1, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 2 WHERE `Id_TypeProvider` = 9;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 1, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 2 WHERE `Id_TypeProvider` = 10;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 11;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 12;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 13;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 1, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 14;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 2, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 15;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 2, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 16;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 17;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 2, `TypeProvider_HideRoute`= 1, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 18;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 1, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 2 WHERE `Id_TypeProvider` = 19;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 2, `TypeProvider_HideRoute`= 1, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 2 WHERE `Id_TypeProvider` = 20;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 21;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 22;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 2, `TypeProvider_HideRoute`= 1, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 23;
                UPDATE `t_type_provider` SET `TypeProvider_HideTour` = 1, `TypeProvider_HideRoute`= 2, `TypeProvider_HideGeneralService` = 1, `TypeProvider_RouteTypeSelected` = 1 WHERE `Id_TypeProvider` = 24;

ALTER TABLE `t_provision`
                DROP COLUMN `Provision_Name`;


-- =====================================================================
-- 119-release-10-04-26.php
-- =====================================================================

INSERT INTO `t_vehicle_brand`
                            (`Id_VehicleBrand`, `VehicleBrand_Date`, `VehicleBrand_DateUpdate`, `VehicleBrand_Name`, `VehicleBrand_Abrv`, `VehicleBrand_Version`, `VehicleBrand_Status`)
                            VALUES
                            (1, NOW(), NOW(), 'Mercedes-Benz', 'MB', 1, 2),
                            (2, NOW(), NOW(), 'Volkswagen', 'VW', 1, 2),
                            (3, NOW(), NOW(), 'Renault', 'REN', 1, 2),
                            (4, NOW(), NOW(), 'Peugeot', 'PEU', 1, 2),
                            (5, NOW(), NOW(), 'Volvo', 'VOL', 1, 2),
                            (6, NOW(), NOW(), 'Scania', 'SCA', 1, 2),
                            (7, NOW(), NOW(), 'Joylong', 'JL', 1, 2),
                            (8, NOW(), NOW(), 'King Long', 'KL', 1, 2),
                            (9, NOW(), NOW(), 'Foton', 'FOT', 1, 2),
                            (10, NOW(), NOW(), 'Maxus', 'MAX', 1, 2),
                            (11, NOW(), NOW(), 'JAC Motors', 'JAC', 1, 2),
                            (12, NOW(), NOW(), 'Golden Dragon', 'GDR', 1, 2),
                            (13, NOW(), NOW(), 'Yutong', 'YUT', 1, 2),
                            (14, NOW(), NOW(), 'Hyundai', 'HYU', 1, 2),
                            (15, NOW(), NOW(), 'Kia', 'KIA', 1, 2),
                            (16, NOW(), NOW(), 'Daewoo', 'DAE', 1, 2),
                            (17, NOW(), NOW(), 'SsangYong', 'SSY', 1, 2),
                            (18, NOW(), NOW(), 'Jetour', 'JTR', 1, 2),
                            (19, NOW(), NOW(), 'Changan', 'CHA', 1, 2),
                            (20, NOW(), NOW(), 'Chery', 'CHE', 1, 2),
                            (21, NOW(), NOW(), 'Haval', 'HAV', 1, 2)

INSERT INTO `t_type_vehicle` 
                (`TypeVehicle_Date`, `TypeVehicle_DateUpdate`, `TypeVehicle_Name`, `TypeVehicle_Abrv`,
                `TypeVehicle_CapacityDriverCabin`, `TypeVehicle_CapacityPassengerCabin`, `TypeVehicle_PaxCapacity`,
                `TypeVehicle_Version`, `TypeVehicle_Status`) 
                VALUES
                -- ==========================================
                -- VANS Y MINIBUSES (Ids del 1 al 15)
                -- ==========================================
                (NOW(), NOW(), 'Minivan Turística', 'MNV', 2, 9, 10, 1, 2),     -- 1: Minivan Turística 9+1 (1-2)
                (NOW(), NOW(), 'Minibús', 'MNB', 2, 28, 29, 1, 2),              -- 2: Minibús 28+1 (3)
                (NOW(), NOW(), 'Minivan VIP', 'MVIP', 2, 5, 6, 1, 2),           -- 3: Minivan VIP 5+1 (4)
                (NOW(), NOW(), 'Van Larga', 'VANL', 3, 16, 18, 1, 2),           -- 4: Van Larga 16+2 (5, 6)
                (NOW(), NOW(), 'Van Media', 'VANM', 3, 12, 14, 1, 2),           -- 5: Van Media 12+2 (7, 8, 11)
                (NOW(), NOW(), 'Minivan Larga', 'MNVL', 2, 13, 14, 1, 2),       -- 6: Minivan Larga 13+1 (9, 14, 15)
                (NOW(), NOW(), 'Van Larga', 'VANL', 3, 15, 17, 1, 2),           -- 7: Van Larga 15+2 (10, 12, 13)

                -- ==========================================
                -- SUVS GRANDES DE 3 FILAS (Ids del 16 al 25)
                -- ==========================================
                (NOW(), NOW(), 'SUV 3 Filas', 'SUV3', 2, 5, 6, 1, 2),           -- 8: SUV 3 Filas 5+1 (16, 17, 19, 23, 27, 32, 37, 39, 54, 56)
                (NOW(), NOW(), 'SUV', 'SUV', 2, 3, 4, 1, 2),                    -- 9: SUV 3+1 (18, 20, 21, 22, 24, 25, 26, 31, 36, 43, 46, 51)
                

                -- ==========================================
                -- SUVS, AUTOS Y CAMIONETAS (Ids del 26 al 57)
                -- ==========================================
                (NOW(), NOW(), 'Auto Sedán', 'SED', 2, 3, 4, 1, 2),             -- 10: Auto Sedán 3+1 (28, 29, 34, 41, 44, 52)
                (NOW(), NOW(), 'Camión Ligero', 'CAML', 3, 0, 2, 1, 2),         -- 11: Camión Ligero 0+2 (30, 35)
                (NOW(), NOW(), 'Auto Hatchback', 'HAT', 2, 3, 4, 1, 2),         -- 12: Auto Hatchback 3+1 (33, 40, 47)
                (NOW(), NOW(), 'Pick-up', 'PCK', 2, 3, 4, 1, 2),                -- 13: Pick-up 3+4 (38, 42, 45, 48, 53, 55, 57)
                (NOW(), NOW(), 'SUV Premium', 'SUVP', 2, 3, 4, 1, 2),           -- 14: SUV Premium 3+4 (49)
                (NOW(), NOW(), 'Auto Premium', 'SEDP', 2, 3, 4, 1, 2);          -- 15: Auto Premium 3+4 (50)

INSERT INTO `t_vehicle_model` 
                            (`VehicleModel_Date`, `VehicleModel_DateUpdate`, `VehicleModel_Name`, `VehicleModel_Abrv`,
                            `VehicleModel_Version`, `VehicleModel_Status`, `Id_VehicleBrand`, `Id_TypeVehicle`) 
                            VALUES
                            -- ==========================================
                            -- VANS Y MINIBUSES (Los reyes del turismo)
                            -- ==========================================
                            -- Hyundai
                            (NOW(), NOW(), 'H-1', 'H1', 1, 2, 14, 1),              -- 1
                            (NOW(), NOW(), 'Staria', 'STR', 1, 2, 14, 1),          -- 2
                            (NOW(), NOW(), 'County', 'COU', 1, 2, 14, 2),          -- 3
                            -- Kia
                            (NOW(), NOW(), 'Carnival', 'CAR', 1, 2, 15, 3),        -- 4
                            -- Mercedes-Benz
                            (NOW(), NOW(), 'Sprinter', 'SPR', 1, 2, 1, 4),         -- 5
                            -- Volkswagen
                            (NOW(), NOW(), 'Crafter', 'CRA', 1, 2, 2, 4),          -- 6
                            -- Renault
                            (NOW(), NOW(), 'Master', 'MAS', 1, 2, 3, 5),           -- 7
                            -- Peugeot
                            (NOW(), NOW(), 'Boxer', 'BOX', 1, 2, 4, 5),            -- 8
                            -- Foton
                            (NOW(), NOW(), 'View CS2', 'CS2', 1, 2, 9, 6),         -- 9
                            (NOW(), NOW(), 'Toano', 'TOA', 1, 2, 9, 7),            -- 10
                            -- Maxus
                            (NOW(), NOW(), 'V80', 'V80', 1, 2, 10, 5),             -- 11
                            (NOW(), NOW(), 'V90', 'V90', 1, 2, 10, 7),             -- 12
                            -- JAC Motors
                            (NOW(), NOW(), 'Sunray', 'SUN', 1, 2, 11, 7),          -- 13
                            -- Joylong
                            (NOW(), NOW(), 'A6', 'A6', 1, 2, 7, 6),                -- 14
                            -- King Long
                            (NOW(), NOW(), 'Kingo', 'KGO', 1, 2, 8, 6),            -- 15

                            -- ==========================================
                            -- SUVS GRANDES (3 Filas y Privados)
                            -- ==========================================
                            -- Jetour
                            (NOW(), NOW(), 'Jetour X70', 'X70', 1, 2, 18, 8),      -- 16
                            (NOW(), NOW(), 'Jetour X70 Plus', 'X70P', 1, 2, 18, 8),-- 17
                            (NOW(), NOW(), 'Jetour Dashing', 'DSH', 1, 2, 18, 9),  -- 18
                            -- Changan
                            (NOW(), NOW(), 'CX70', 'CX70', 1, 2, 19, 8),           -- 19
                            (NOW(), NOW(), 'CS35 Plus', 'C35', 1, 2, 19, 9),       -- 20
                            (NOW(), NOW(), 'CS55 Plus', 'C55', 1, 2, 19, 9),       -- 21
                            -- Chery
                            (NOW(), NOW(), 'Tiggo 7 Pro', 'TG7', 1, 2, 20, 9),     -- 22
                            (NOW(), NOW(), 'Tiggo 8 Pro', 'TG8', 1, 2, 20, 8),     -- 23
                            -- Haval
                            (NOW(), NOW(), 'H6', 'H6', 1, 2, 21, 9),               -- 24
                            (NOW(), NOW(), 'Jolion', 'JOL', 1, 2, 21, 9),          -- 25

                            -- ==========================================
                            -- SUVS, AUTOS Y CAMIONETAS (Apoyo y logística)
                            -- ==========================================
                            -- Hyundai (Adicionales)
                            (NOW(), NOW(), 'Tucson', 'TUC', 1, 2, 14, 9),           -- 26
                            (NOW(), NOW(), 'Santa Fe', 'STA', 1, 2, 14, 8),         -- 27
                            (NOW(), NOW(), 'Accent', 'ACC', 1, 2, 14, 10),          -- 28
                            (NOW(), NOW(), 'Elantra', 'ELA', 1, 2, 14, 10),         -- 29
                            (NOW(), NOW(), 'H-100', 'H100', 1, 2, 14, 11),          -- 30
                            -- Kia (Adicionales)
                            (NOW(), NOW(), 'Sportage', 'SPO', 1, 2, 15, 9),         -- 31
                            (NOW(), NOW(), 'Sorento', 'SOR', 1, 2, 15, 8),          -- 32
                            (NOW(), NOW(), 'Rio', 'RIO', 1, 2, 15, 12),             -- 33
                            (NOW(), NOW(), 'Cerato', 'CER', 1, 2, 15, 10),          -- 34
                            (NOW(), NOW(), 'K2700', 'K27', 1, 2, 15, 11),           -- 35
                            -- SsangYong (KGM)
                            (NOW(), NOW(), 'Korando', 'KOR', 1, 2, 17, 9),          -- 36
                            (NOW(), NOW(), 'Rexton', 'REX', 1, 2, 17, 8),           -- 37
                            (NOW(), NOW(), 'Musso Grand', 'MUS', 1, 2, 17, 13),     -- 38
                            -- Volkswagen (Adicionales)
                            (NOW(), NOW(), 'Tiguan', 'TIG', 1, 2, 2, 8),            -- 39
                            (NOW(), NOW(), 'Gol', 'GOL', 1, 2, 2, 12),              -- 40
                            (NOW(), NOW(), 'Jetta', 'JET', 1, 2, 2, 10),            -- 41
                            (NOW(), NOW(), 'Amarok', 'AMA', 1, 2, 2, 13),           -- 42
                            -- Renault (Adicionales)
                            (NOW(), NOW(), 'Duster', 'DUS', 1, 2, 3, 9),            -- 43
                            (NOW(), NOW(), 'Logan', 'LOG', 1, 2, 3, 10),            -- 44
                            (NOW(), NOW(), 'Oroch', 'ORO', 1, 2, 3, 13),            -- 45
                            -- Peugeot (Adicionales)
                            (NOW(), NOW(), '3008', '3008', 1, 2, 4, 9),             -- 46
                            (NOW(), NOW(), '208', '208', 1, 2, 4, 12),              -- 47
                            (NOW(), NOW(), 'Landtrek', 'LAN', 1, 2, 4, 13),         -- 48
                            -- Mercedes-Benz (Adicionales)
                            (NOW(), NOW(), 'GLC', 'GLC', 1, 2, 1, 14),              -- 49
                            (NOW(), NOW(), 'Clase C', 'CLC', 1, 2, 1, 15),          -- 50
                            -- JAC Motors (Adicionales)
                            (NOW(), NOW(), 'JS4', 'JS4', 1, 2, 11, 9),              -- 51
                            (NOW(), NOW(), 'J4', 'J4', 1, 2, 11, 10),               -- 52
                            (NOW(), NOW(), 'T8', 'T8', 1, 2, 11, 13),               -- 53
                            -- Foton (Adicionales)
                            (NOW(), NOW(), 'Sauvana', 'SAU', 1, 2, 9, 8),           -- 54
                            (NOW(), NOW(), 'Tunland', 'TUN', 1, 2, 9, 13),          -- 55
                            -- Maxus (Adicionales)
                            (NOW(), NOW(), 'D60', 'D60', 1, 2, 10, 8),              -- 56
                            (NOW(), NOW(), 'T60', 'T60', 1, 2, 10, 13);             -- 57


-- =====================================================================
-- 120-release-10-04-26.php
-- =====================================================================

INSERT IGNORE INTO `t_type_provider` (
                                `Id_TypeProvider`,
                                `TypeProvider_Date`,
                                `TypeProvider_DateUpdate`,
                                `TypeProvider_Name`,
                                `TypeProvider_Abrv`,
                                `TypeProvider_Type`,
                                `TypeProvider_Endorser`,
                                `TypeProvider_Icon`,
                                `TypeProvider_Color`,
                                `TypeProvider_Lock`,
                                `TypeProvider_Status`
                            ) VALUES (
                                8,
                                NOW(),
                                NOW(),
                                'Hotel',
                                'HTL',
                                4,
                                1,
                                'hotel',
                                '#99abb4',
                                0,
                                2
                            );

INSERT INTO `t_category_room` (
                                `CategoryRoom_Date`, 
                                `CategoryRoom_DateUpdate`, 
                                `CategoryRoom_Name`, 
                                `CategoryRoom_Level`, 
                                `CategoryRoom_Version`, 
                                `CategoryRoom_Status`, 
                                `Id_TypeProvider`
                            ) VALUES 
                            (NOW(), NOW(), '1 Estrella', 1, 1, 2, 8),
                            (NOW(), NOW(), '2 Estrellas', 2, 1, 2, 8),
                            (NOW(), NOW(), '3 Estrellas', 3, 1, 2, 8),
                            (NOW(), NOW(), '4 Estrellas', 4, 1, 2, 8),
                            (NOW(), NOW(), '5 Estrellas', 5, 1, 2, 8);

INSERT INTO `t_currency` (
                                `Currency_Date`,
                                `Currency_DateUpdate`,
                                `Currency_Name`,
                                `Currency_Code`,
                                `Currency_Version`,
                                `Currency_Status`
                            )
                            VALUES
                            (NOW(), NOW(), 'Soles', 'PEN', 1, 2),
                            (NOW(), NOW(), 'Dólares', 'USD', 1, 2);


-- =====================================================================
-- 121-release-20-04-2026.php
-- =====================================================================

ALTER TABLE `t_extra`
                ADD COLUMN `Id_TypeRoom` INT(11) UNSIGNED NOT NULL AFTER `Id_Item`;

                ALTER TABLE `t_extra`
                ADD INDEX `INDEX_Id_TypeRoom` (`Id_TypeRoom`);

                ALTER TABLE `t_extra`
                ADD CONSTRAINT `fk_extra_type_room`
                FOREIGN KEY (`Id_TypeRoom`) REFERENCES `t_type_room`(`Id_TypeRoom`);

ALTER TABLE `t_extra_requirement`
                ADD COLUMN `Id_TypeRoom` INT(11) UNSIGNED NOT NULL AFTER `Id_TypeRoomCategory`;

                ALTER TABLE `t_extra_requirement`
                ADD INDEX `INDEX_Id_TypeRoom` (`Id_TypeRoom`);

                -- ALTER TABLE `t_extra_requirement`
                -- ADD CONSTRAINT `fk_extra_requirement_type_room`
                -- FOREIGN KEY (`Id_TypeRoom`) REFERENCES `t_type_room`(`Id_TypeRoom`);

ALTER TABLE `t_extra`
                DROP FOREIGN KEY `fk_extra_type_room`;

                ALTER TABLE `t_extra`
                DROP INDEX `INDEX_Id_TypeRoom`;

                ALTER TABLE `t_extra`
                DROP COLUMN `Id_TypeRoom`;

ALTER TABLE `t_extra_requirement`
                DROP FOREIGN KEY `fk_extra_requirement_type_room`;

                ALTER TABLE `t_extra_requirement`
                DROP INDEX `INDEX_Id_TypeRoom`;

                ALTER TABLE `t_extra_requirement`
                DROP COLUMN `Id_TypeRoom`;


-- =====================================================================
-- 122-release-22-04-2026.php
-- =====================================================================

ALTER TABLE `t_provision`
                ADD COLUMN `Provision_BreakfastPrice`   DECIMAL(10,2)   UNSIGNED NOT NULL AFTER `Provision_Status`,
                ADD COLUMN `Provision_BreakfastStatus`  INT(1)          UNSIGNED NOT NULL AFTER `Provision_BreakfastPrice`,
                ADD COLUMN `Provision_LunchPrice`       DECIMAL(10,2)   UNSIGNED NOT NULL AFTER `Provision_BreakfastStatus`,
                ADD COLUMN `Provision_LunchStatus`      INT(1)          UNSIGNED NOT NULL AFTER `Provision_LunchPrice`,
                ADD COLUMN `Provision_DinnerPrice`      DECIMAL(10,2)   UNSIGNED NOT NULL AFTER `Provision_LunchStatus`,
                ADD COLUMN `Provision_DinnerStatus`     INT(1)          UNSIGNED NOT NULL AFTER `Provision_DinnerPrice`;

ALTER TABLE `t_provision`
                DROP COLUMN IF EXISTS `Provision_BreakfastPrice`,
                DROP COLUMN IF EXISTS `Provision_BreakfastStatus`,
                DROP COLUMN IF EXISTS `Provision_LunchPrice`,
                DROP COLUMN IF EXISTS `Provision_LunchStatus`,
                DROP COLUMN IF EXISTS `Provision_DinnerPrice`,
                DROP COLUMN IF EXISTS `Provision_DinnerStatus`;


-- =====================================================================
-- 123-release-25-04-2026.php
-- =====================================================================

ALTER TABLE `t_extra_requirement`
            ADD COLUMN `ExtraRequirement_EndRequestTime`   TIME NOT NULL AFTER `ExtraRequirement_RequestTime`;

ALTER TABLE `t_extra_requirement`
            DROP COLUMN IF EXISTS `ExtraRequirement_EndRequestTime`;


-- =====================================================================
-- 124-release-28-04-2026.php
-- =====================================================================

CREATE TABLE IF NOT EXISTS `t_extra_route`
                            (
                                `Id_ExtraRoute` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                                `Id_Extra` INT(11) UNSIGNED NOT NULL,
                                `Id_Route` INT(11) UNSIGNED NOT NULL,
                                PRIMARY KEY (`Id_ExtraRoute`),
                                UNIQUE KEY `UNIQUE_Id_Extra_Id_Route` (`Id_Extra`, `Id_Route`),
                                INDEX `INDEX_Id_Extra` (`Id_Extra`),
                                INDEX `INDEX_Id_Route` (`Id_Route`)
                            )
                            ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                            INSERT IGNORE INTO `t_extra_route` (`Id_Extra`, `Id_Route`)
                            SELECT `Id_Extra`, `Id_Route`
                            FROM `t_extra`
                            WHERE `Id_Route` > 0;

                            CREATE TABLE IF NOT EXISTS `t_extra_requirement_route`
                            (
                                `Id_ExtraRequirementRoute` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
                                `Id_ExtraRequirement` INT(11) UNSIGNED NOT NULL,
                                `Id_Route` INT(11) UNSIGNED NOT NULL,
                                PRIMARY KEY (`Id_ExtraRequirementRoute`),
                                UNIQUE KEY `UNIQUE_Id_ExtraRequirement_Id_Route` (`Id_ExtraRequirement`, `Id_Route`),
                                INDEX `INDEX_Id_ExtraRequirement` (`Id_ExtraRequirement`),
                                INDEX `INDEX_Id_Route` (`Id_Route`)
                            )
                            ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

                            INSERT IGNORE INTO `t_extra_requirement_route` (`Id_ExtraRequirement`, `Id_Route`)
                            SELECT `Id_ExtraRequirement`, `Id_Route`
                            FROM `t_extra_requirement`
                            WHERE `Id_Route` > 0;

            DROP TABLE IF EXISTS `t_extra_route`;


-- =====================================================================
-- 125-release-28-04-2026.php
-- =====================================================================

ALTER TABLE `t_tour_extra`
                ADD COLUMN `Id_Route` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `Id_Tour`;
            ALTER TABLE `t_tour_extra`
                ADD INDEX `INDEX_Id_Route` (`Id_Route`);

ALTER TABLE `t_tour_extra` DROP INDEX `INDEX_Id_Route`;
            ALTER TABLE `t_tour_extra` DROP COLUMN `Id_Route`;


-- =====================================================================
-- 126-JCL-release-26-05-26.php
-- =====================================================================

ALTER TABLE `t_provider_contact`
                ADD `Id_Provider` INT(1) NOT NULL DEFAULT 0 AFTER `Id_TypeDocument`;
                ALTER TABLE `t_provider_contact` ALTER `Id_Provider` DROP DEFAULT;

                ALTER TABLE `t_provider_contact` ADD INDEX `INDEX_Id_Provider` (`Id_Provider`);

ALTER TABLE `t_provider_contact`
                DROP COLUMN `Id_Provider`;

