Files
database/migrations/archive/000.475.sql
T
Rikard BartholfandGitHub ddcbd0afb0 Archive old migrations (#426)
* Archive old migrations

* Fix invalid placement of migrations
2024-10-17 11:19:12 +02:00

17 lines
655 B
SQL

-- Add the new columns 'add_to_menu' and 'menu_title' to the 'editorial_content' table
ALTER TABLE editorial_content
ADD COLUMN add_to_menu BOOLEAN DEFAULT FALSE,
ADD COLUMN menu_title TEXT;
-- Add a new column 'visible' to the 'editorial_content' table
ALTER TABLE editorial_content ADD COLUMN IF NOT EXISTS visible BOOL NOT NULL DEFAULT TRUE;
-- Update all existing rows to set the value of the 'add_to_menu' column to FALSE
UPDATE editorial_content
SET add_to_menu = FALSE;
-- Create a unique partial index to enforce the constraint
CREATE UNIQUE INDEX unique_add_to_menu_per_locale
ON editorial_content (market_locale_id)
WHERE add_to_menu = TRUE;