Files
descrybe/apps/api/sql/schema/028_plan_is_legacy.sql
greeneclipse 8580c996c3 Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
2026-08-09 22:47:43 +02:00

26 lines
723 B
SQL

-- +goose Up
-- Explicit legacy packaging flag (A1 / migrated limited-nav).
-- Name-pattern detection still applies when this is false.
ALTER TABLE plans
ADD COLUMN IF NOT EXISTS is_legacy BOOLEAN NOT NULL DEFAULT false;
UPDATE plans SET is_legacy = true
WHERE is_legacy = false
AND (
lower(name) = 'legacy'
OR lower(name) LIKE '%legacy%'
OR lower(name) = 'a1'
OR lower(name) LIKE 'a1 %'
OR lower(name) LIKE 'a1-%'
OR lower(name) LIKE 'a1_%'
OR lower(name) LIKE '%a1 slovenija%'
);
CREATE INDEX IF NOT EXISTS plans_is_legacy_idx
ON plans (is_legacy)
WHERE is_legacy = true;
-- +goose Down
DROP INDEX IF EXISTS plans_is_legacy_idx;
ALTER TABLE plans DROP COLUMN IF EXISTS is_legacy;