← back to NationalPaperHangers

db/migrations/012_installer_templates.sql

15 lines

-- Per-installer page template + per-template overrides.
--
-- template_slug      : which of the 6 layouts renders /installer/:slug
--                      (editorial | trade-pro | concierge | studio | heritage | bilingue)
-- template_settings  : jsonb bag for accent_color, hero_choice, language toggles, etc.

ALTER TABLE installers
  ADD COLUMN IF NOT EXISTS template_slug TEXT NOT NULL DEFAULT 'editorial',
  ADD COLUMN IF NOT EXISTS template_settings JSONB NOT NULL DEFAULT '{}'::jsonb;

-- Defensive: if any pre-existing rows had NULL via prior partial migration.
UPDATE installers SET template_slug = 'editorial' WHERE template_slug IS NULL;

CREATE INDEX IF NOT EXISTS idx_installers_template_slug ON installers(template_slug);