Files
threshold/internal/db/migrations/postgres/03_db.up.sql
T
Michael Gaffney 477a47897e Add wt_timestamp type to database (#52)
* Add wt_timestamp type to database

* Swap the order of domains and oplog migrations

All migrations should use the new 'wt_timestamp' domain type for
timestamps.

* Remove dead code

* Add down migration for wt_timestamp
2020-05-13 10:40:57 -04:00

31 lines
1.0 KiB
SQL

-- create test tables used in the unit tests for the internal/db package
-- these tables (db_test_user, db_test_car, db_test_rental) are not part
-- of the Watchtower domain model... they are simply used for testing the internal/db package
CREATE TABLE if not exists db_test_user (
id bigint generated always as identity primary key,
create_time wt_timestamp,
update_time wt_timestamp,
public_id text NOT NULL UNIQUE,
name text UNIQUE,
phone_number text,
email text
);
CREATE TABLE if not exists db_test_car (
id bigint generated always as identity primary key,
create_time wt_timestamp,
update_time wt_timestamp,
public_id text NOT NULL UNIQUE,
name text UNIQUE,
model text,
mpg smallint
);
CREATE TABLE if not exists db_test_rental (
id bigint generated always as identity primary key,
create_time wt_timestamp,
update_time wt_timestamp,
public_id text NOT NULL UNIQUE,
name text UNIQUE,
user_id bigint not null REFERENCES db_test_user(id),
car_id bigint not null REFERENCES db_test_car(id)
);