This commit is contained in:
2026-04-13 22:31:06 +02:00
parent 38259bc706
commit e15b4ccf45
24 changed files with 1580 additions and 3858 deletions

View File

@@ -0,0 +1,35 @@
-- =============================================================
-- COMPENSATING MIGRATION
-- Kompensuje: 20260302_000018_create_orders_tables_and_schedule.sql
-- Powod: Oryginalna migracja 000018 uzywa CREATE TABLE IF NOT EXISTS.
-- Na srodowiskach gdzie tabela `orders` istniala wczesniej bez
-- kolumn `delivery_method` / `payment_method`, migracja 000018
-- nic nie zrobila i kolumny sa brakujace, mimo ze schemat
-- deklaruje je jako standardowe pola importu.
-- Status: Idempotentna - bezpieczna do ponownego uruchomienia.
-- =============================================================
SET @sql := (
SELECT IF(COUNT(*) = 0,
'ALTER TABLE `orders` ADD COLUMN `payment_method` VARCHAR(128) NULL',
'SELECT 1')
FROM information_schema.columns
WHERE table_schema = DATABASE()
AND table_name = 'orders'
AND column_name = 'payment_method'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @sql := (
SELECT IF(COUNT(*) = 0,
'ALTER TABLE `orders` ADD COLUMN `delivery_method` VARCHAR(128) NULL',
'SELECT 1')
FROM information_schema.columns
WHERE table_schema = DATABASE()
AND table_name = 'orders'
AND column_name = 'delivery_method'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;