diff --git a/supabase/proposed/20261023060200_drop_duplicate_indexes.sql b/supabase/migrations/20261023073000_drop_duplicate_indexes.sql similarity index 94% rename from supabase/proposed/20261023060200_drop_duplicate_indexes.sql rename to supabase/migrations/20261023073000_drop_duplicate_indexes.sql index 20fba4394..abdf5e178 100644 --- a/supabase/proposed/20261023060200_drop_duplicate_indexes.sql +++ b/supabase/migrations/20261023073000_drop_duplicate_indexes.sql @@ -1,5 +1,5 @@ --- DB-05 (proposed, destructive): drop indexes that duplicate another index --- on the same table and column. +-- DB-05: drop indexes that duplicate another index on the same table and +-- column. Approved by Adam 23 Oct 2026; moved from supabase/proposed/. -- -- subscriptions idx_subscriptions_stripe_customer duplicates -- idx_subscriptions_stripe_customer_id (both plain diff --git a/supabase/proposed/20261023060300_promo_redeem_failures_primary_key.sql b/supabase/migrations/20261023073100_promo_redeem_failures_primary_key.sql similarity index 58% rename from supabase/proposed/20261023060300_promo_redeem_failures_primary_key.sql rename to supabase/migrations/20261023073100_promo_redeem_failures_primary_key.sql index f79ecc16c..bf76d11aa 100644 --- a/supabase/proposed/20261023060300_promo_redeem_failures_primary_key.sql +++ b/supabase/migrations/20261023073100_promo_redeem_failures_primary_key.sql @@ -1,4 +1,5 @@ --- DB-05 (proposed): give private.promo_redeem_failures a primary key. +-- DB-05: give private.promo_redeem_failures a primary key (approved by Adam +-- 23 Oct 2026; moved from supabase/proposed/). -- -- It is the one table without a primary key. Its natural columns -- (user_id, failed_at) can repeat when two failures share a timestamp, so a @@ -10,5 +11,7 @@ -- IF NOT EXISTS skips the whole statement, primary key included; check with -- `\d private.promo_redeem_failures` first. -ALTER TABLE private.promo_redeem_failures - ADD COLUMN IF NOT EXISTS id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY; +-- The rewrite and lock are accepted: the table holds a handful of rows +-- (1 on production on 23 Oct 2026) and only promo redemption writes to it. +-- squawk-ignore adding-field-with-default,adding-serial-primary-key-field +ALTER TABLE private.promo_redeem_failures ADD COLUMN IF NOT EXISTS id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY; diff --git a/supabase/proposed/20261023060100_drop_staging_auto_admin.sql b/supabase/proposed/20261023060100_drop_staging_auto_admin.sql deleted file mode 100644 index a205f0146..000000000 --- a/supabase/proposed/20261023060100_drop_staging_auto_admin.sql +++ /dev/null @@ -1,15 +0,0 @@ --- DB-04 (proposed, destructive, STAGING ONLY: brifeyypjauyusmkptkx). --- --- staging_auto_admin() is left over from a trigger that was dropped by hand --- on staging. It does not exist on production or anywhere in --- supabase/migrations, so it must never be added to migrations. Run this by --- hand in the staging SQL editor. Check first that no trigger still uses it: --- --- SELECT tgname, tgrelid::regclass FROM pg_trigger t --- JOIN pg_proc p ON p.oid = t.tgfoid WHERE p.proname = 'staging_auto_admin'; --- --- That query must return no rows; without CASCADE the drop fails otherwise. --- `\df public.staging_auto_admin` should show it with no arguments; if it --- takes any, add them to the DROP below, or IF EXISTS skips it silently. - -DROP FUNCTION IF EXISTS public.staging_auto_admin();