16 lines
806 B
SQL
16 lines
806 B
SQL
-- ─── website_offer soft-delete: drop the zero-date (D4) ─────────────────────
|
|
-- o_deleted_at was datetime NOT NULL, so "not deleted" rows carried the invalid
|
|
-- zero-date '0000-00-00 00:00:00' (rejected under NO_ZERO_DATE/strict mode) and
|
|
-- the app had to filter for it explicitly. Make it nullable and normalise the
|
|
-- existing zero-dates to NULL, aligning with every other table's deleted_at.
|
|
|
|
ALTER TABLE `website_offer`
|
|
MODIFY `o_deleted_at` DATETIME NULL DEFAULT NULL;
|
|
|
|
-- Normalise legacy "not deleted" markers to NULL. Comparing against a literal
|
|
-- zero-date is itself unsafe under strict mode, so match by year 0 instead.
|
|
UPDATE `website_offer`
|
|
SET `o_deleted_at` = NULL
|
|
WHERE `o_deleted_at` IS NOT NULL
|
|
AND YEAR(`o_deleted_at`) = 0;
|