Files
xinghuoapi/backend/migrations/006_fix_invalid_subscription_expires_at.sql
huangzhenpc f52498603c
Some checks failed
CI / test (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
Security Scan / backend-security (push) Has been cancelled
Security Scan / frontend-security (push) Has been cancelled
first commit
2026-01-15 20:29:55 +08:00

11 lines
317 B
SQL

-- Fix legacy subscription records with invalid expires_at (year > 2099).
DO $$
BEGIN
IF to_regclass('public.user_subscriptions') IS NOT NULL THEN
UPDATE user_subscriptions
SET expires_at = TIMESTAMPTZ '2099-12-31 23:59:59+00'
WHERE expires_at > TIMESTAMPTZ '2099-12-31 23:59:59+00';
END IF;
END $$;