add migration for timestamp->timestamptz for postgres (#33)

This commit is contained in:
Michael Quigley 2022-11-01 17:32:16 -04:00
parent 477ff0f031
commit cc80b0e860
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 21 additions and 8 deletions

View File

@ -8,8 +8,8 @@ create table accounts (
email varchar(1024) not null unique,
password char(128) not null,
token varchar(32) not null unique,
created_at timestamptz not null default(current_timestamp),
updated_at timestamptz not null default(current_timestamp),
created_at timestamp not null default(current_timestamp),
updated_at timestamp not null default(current_timestamp),
constraint chk_email check (email <> ''),
constraint chk_password check (password <> ''),
@ -24,8 +24,8 @@ create table account_requests (
token varchar(32) not null unique,
email varchar(1024) not null unique,
source_address varchar(64) not null,
created_at timestamptz not null default(current_timestamp),
updated_at timestamptz not null default(current_timestamp)
created_at timestamp not null default(current_timestamp),
updated_at timestamp not null default(current_timestamp)
);
--
@ -38,8 +38,8 @@ create table environments (
host varchar(256),
address varchar(64),
z_id varchar(32) not null unique,
created_at timestamptz not null default(current_timestamp),
updated_at timestamptz not null default(current_timestamp),
created_at timestamp not null default(current_timestamp),
updated_at timestamp not null default(current_timestamp),
constraint chk_z_id check (z_id <> '')
);
@ -54,8 +54,8 @@ create table services (
name varchar(32) not null unique,
frontend varchar(1024),
backend varchar(1024),
created_at timestamptz not null default(current_timestamp),
updated_at timestamptz not null default(current_timestamp),
created_at timestamp not null default(current_timestamp),
updated_at timestamp not null default(current_timestamp),
constraint chk_z_id check (z_id <> ''),
constraint chk_name check (name <> '')

View File

@ -0,0 +1,13 @@
-- +migrate Up
alter table accounts alter column created_at type timestamptz;
alter table accounts alter column updated_at type timestamptz;
alter table account_requests alter column created_at type timestamptz;
alter table account_requests alter column updated_at type timestamptz;
alter table environments alter column created_at type timestamptz;
alter table environments alter column updated_at type timestamptz;
alter table services alter column created_at type timestamptz;
alter table services alter column updated_at type timestamptz;