refactor(db): retain scheme start time as text

This commit is contained in:
2026-08-03 11:18:38 +08:00
parent c126e99b60
commit 87d922ea61
2 changed files with 1 additions and 17 deletions
@@ -44,20 +44,4 @@ BEGIN
ALTER COLUMN timestamp TYPE TIMESTAMP WITH TIME ZONE
USING "timestamp" AT TIME ZONE ''UTC''';
END IF;
IF EXISTS (
SELECT 1
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = 'scheme_list'
AND column_name = 'scheme_start_time'
AND data_type IN ('character varying', 'text')
) THEN
EXECUTE 'ALTER TABLE public.scheme_list
ALTER COLUMN scheme_start_time TYPE TIMESTAMP WITH TIME ZONE
USING CASE
WHEN scheme_start_time ~ ''(Z|[+-][0-9]{2}:[0-9]{2})$'' THEN scheme_start_time::timestamptz
ELSE scheme_start_time::timestamp AT TIME ZONE ''UTC''
END';
END IF;
END $$;