feat(04-schema-docs): annotate ensure_* compensating migrations and update DB_SCHEMA.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 10:15:58 +01:00
parent 9a0dbe050b
commit 2d4b52adfc
15 changed files with 735 additions and 64 deletions

View File

@@ -1,3 +1,14 @@
-- =============================================================
-- COMPENSATING MIGRATION
-- Kompensuje: 20260302_000017_add_shoppro_orders_fetch_settings_to_integrations.sql
-- Powód: Oryginalna migracja 000017 używa prostego ALTER TABLE bez sprawdzenia
-- istnienia kolumn (nie-idempotentna). Na środowisku, gdzie kolumny
-- orders_fetch_enabled i orders_fetch_start_date już istniały (ręczne zmiany
-- lub wcześniejszy deploy), migracja 000017 zawodziła z błędem duplicate column.
-- Migracja 000039 dodaje kolumny warunkowo przez information_schema.
-- Status: Środowisko zsynchronizowane po 2026-03-08. Migracja
-- idempotentna — bezpieczna do ponownego uruchomienia.
-- =============================================================
SET @sql := (
SELECT IF(COUNT(*) = 0,
'ALTER TABLE `integrations` ADD COLUMN `orders_fetch_enabled` TINYINT(1) NOT NULL DEFAULT 0 AFTER `is_active`',