-- +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;