DB Migrations
Replacing modl’s built-in table creation and removal with manual migrations. Thanks to @DavidHuie for gomigrate!
This commit is contained in:
parent
c5f94ab67d
commit
8fa594e3f0
6 changed files with 53 additions and 17 deletions
5
datastore/migrations/00001_AddUsers_down.sql
Normal file
5
datastore/migrations/00001_AddUsers_down.sql
Normal file
|
@ -0,0 +1,5 @@
|
|||
-- bactdb
|
||||
-- Matthew R Dillon
|
||||
|
||||
DROP TABLE users;
|
||||
|
19
datastore/migrations/00001_AddUsers_up.sql
Normal file
19
datastore/migrations/00001_AddUsers_up.sql
Normal file
|
@ -0,0 +1,19 @@
|
|||
-- bactdb
|
||||
-- Matthew R Dillon
|
||||
|
||||
CREATE TABLE users (
|
||||
id BIGSERIAL NOT NULL,
|
||||
username CHARACTER VARYING(100),
|
||||
|
||||
createdat TIMESTAMP WITH TIME ZONE,
|
||||
updatedat TIMESTAMP WITH TIME ZONE,
|
||||
deletedat TIMESTAMP WITH TIME ZONE,
|
||||
|
||||
CONSTRAINT users_pkey PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX username_idx
|
||||
ON users
|
||||
USING btree
|
||||
(username COLLATE pg_catalog."default");
|
||||
|
Reference in a new issue