update
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user