Convert all columns to timestamptz in migration
This commit is contained in:
parent
6614cdfb4b
commit
bc4b4af2d6
@ -1 +0,0 @@
|
|||||||
DROP TABLE IF EXISTS bulk_extracts;
|
|
@ -1,5 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS bulk_extracts (
|
|
||||||
extract_id serial PRIMARY KEY,
|
|
||||||
extracted_on timestamp NOT NULL,
|
|
||||||
extract_path text NOT NULL
|
|
||||||
);
|
|
8
migrations/012.bulk-extracts.down.sql
Normal file
8
migrations/012.bulk-extracts.down.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
DROP TABLE IF EXISTS bulk_extracts;
|
||||||
|
|
||||||
|
-- convert all existing timestamp columns to timestamptz assuming UTC
|
||||||
|
ALTER TABLE logs ALTER log_timestamp TYPE timestamp;
|
||||||
|
ALTER TABLE users
|
||||||
|
ALTER registered TYPE timestamp,
|
||||||
|
ALTER deleted_on TYPE timestamp;
|
||||||
|
ALTER TABLE user_password_reset_tokens ALTER expires_on TYPE timestamp;
|
12
migrations/012.bulk-extracts.up.sql
Normal file
12
migrations/012.bulk-extracts.up.sql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS bulk_extracts (
|
||||||
|
extract_id serial PRIMARY KEY,
|
||||||
|
extracted_on timestamptz NOT NULL,
|
||||||
|
extract_path text NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
-- convert all existing timestamp columns to timestamptz assuming UTC
|
||||||
|
ALTER TABLE logs ALTER log_timestamp TYPE timestamptz USING log_timestamp AT TIME ZONE 'UTC';
|
||||||
|
ALTER TABLE users
|
||||||
|
ALTER registered TYPE timestamptz USING registered AT TIME ZONE 'UTC',
|
||||||
|
ALTER deleted_on TYPE timestamptz USING deleted_on AT TIME ZONE 'UTC';
|
||||||
|
ALTER TABLE user_password_reset_tokens ALTER expires_on TYPE timestamptz USING expires_on AT TIME ZONE 'UTC';
|
Loading…
Reference in New Issue
Block a user