refactor(db): retain scheme start time as text
This commit is contained in:
@@ -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 $$;
|
||||
|
||||
Reference in New Issue
Block a user