Commit 2d872870 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix failed migrations: remove invalid AFTER refs and duplicate FK names

- Phase_63_005: removed AFTER `time_tier` (column doesn't exist), use AFTER `is_active` instead; removed duplicate `booker_type` ADD (already in schema)
- Phase_63_006: renamed FK `fk_pa_player` → `fk_pach_player` and `fk_ppl_player` → `fk_pplog_player` to avoid duplicate constraint names
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 8580e415
...@@ -4,22 +4,20 @@ declare(strict_types=1); ...@@ -4,22 +4,20 @@ declare(strict_types=1);
return [ return [
'up' => " 'up' => "
ALTER TABLE `facility_time_slots` ALTER TABLE `facility_time_slots`
ADD COLUMN `access_type` VARCHAR(20) NOT NULL DEFAULT 'open' COMMENT 'open, members_only, vip' AFTER `time_tier`, ADD COLUMN `access_type` VARCHAR(20) NOT NULL DEFAULT 'open' COMMENT 'open, members_only, vip' AFTER `is_active`,
ADD COLUMN `member_price` DECIMAL(10,2) NULL AFTER `price`, ADD COLUMN `member_price` DECIMAL(10,2) NULL AFTER `access_type`,
ADD COLUMN `guest_price` DECIMAL(10,2) NULL AFTER `member_price`, ADD COLUMN `guest_price` DECIMAL(10,2) NULL AFTER `member_price`,
ADD COLUMN `carnet_guest_price` DECIMAL(10,2) NULL AFTER `guest_price`, ADD COLUMN `carnet_guest_price` DECIMAL(10,2) NULL AFTER `guest_price`,
ADD INDEX `idx_fts_access` (`access_type`); ADD INDEX `idx_fts_access` (`access_type`);
ALTER TABLE `pool_bookings` ALTER TABLE `pool_bookings`
ADD COLUMN `booker_type` VARCHAR(20) NULL DEFAULT 'member' COMMENT 'member, player, guest, carnet_guest' AFTER `pool_config_id`,
ADD COLUMN `booker_member_id` BIGINT UNSIGNED NULL AFTER `booker_type`, ADD COLUMN `booker_member_id` BIGINT UNSIGNED NULL AFTER `booker_type`,
ADD COLUMN `carnet_guest_entry_id` BIGINT UNSIGNED NULL AFTER `booker_member_id` ADD COLUMN `carnet_guest_entry_id` BIGINT UNSIGNED NULL AFTER `booker_member_id`
", ",
'down' => " 'down' => "
ALTER TABLE `pool_bookings` ALTER TABLE `pool_bookings`
DROP COLUMN `carnet_guest_entry_id`, DROP COLUMN `carnet_guest_entry_id`,
DROP COLUMN `booker_member_id`, DROP COLUMN `booker_member_id`;
DROP COLUMN `booker_type`;
ALTER TABLE `facility_time_slots` ALTER TABLE `facility_time_slots`
DROP INDEX `idx_fts_access`, DROP INDEX `idx_fts_access`,
DROP COLUMN `carnet_guest_price`, DROP COLUMN `carnet_guest_price`,
......
...@@ -34,8 +34,8 @@ return [ ...@@ -34,8 +34,8 @@ return [
INDEX `idx_pa_player` (`player_id`), INDEX `idx_pa_player` (`player_id`),
INDEX `idx_pa_achievement` (`achievement_id`), INDEX `idx_pa_achievement` (`achievement_id`),
INDEX `idx_pa_date` (`earned_at`), INDEX `idx_pa_date` (`earned_at`),
CONSTRAINT `fk_pa_player` FOREIGN KEY (`player_id`) REFERENCES `players`(`id`), CONSTRAINT `fk_pach_player` FOREIGN KEY (`player_id`) REFERENCES `players`(`id`),
CONSTRAINT `fk_pa_achievement` FOREIGN KEY (`achievement_id`) REFERENCES `achievement_definitions`(`id`) CONSTRAINT `fk_pach_achievement` FOREIGN KEY (`achievement_id`) REFERENCES `achievement_definitions`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `player_progression_log` ( CREATE TABLE IF NOT EXISTS `player_progression_log` (
...@@ -54,7 +54,7 @@ return [ ...@@ -54,7 +54,7 @@ return [
INDEX `idx_ppl_player` (`player_id`), INDEX `idx_ppl_player` (`player_id`),
INDEX `idx_ppl_discipline` (`discipline_id`), INDEX `idx_ppl_discipline` (`discipline_id`),
INDEX `idx_ppl_date` (`recorded_at`), INDEX `idx_ppl_date` (`recorded_at`),
CONSTRAINT `fk_ppl_player` FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) CONSTRAINT `fk_pplog_player` FOREIGN KEY (`player_id`) REFERENCES `players`(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
", ",
'down' => " 'down' => "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment