Created
December 5, 2020 17:15
-
-
Save indy-singh/a41eef47351d8e350cf60c8a26db5b82 to your computer and use it in GitHub Desktop.
test2.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE example.manufacturer ( | |
id BIGSERIAL PRIMARY KEY, | |
name TEXT NOT NULL UNIQUE | |
); | |
CREATE TABLE example.telephone_model ( | |
id BIGSERIAL PRIMARY KEY, | |
manufacturer_id BIGINT NOT NULL, | |
name TEXT NOT NULL UNIQUE, | |
is_in_production bool NOT NULL | |
); | |
CREATE TABLE example.member ( | |
id BIGSERIAL PRIMARY KEY, | |
firstname TEXT NOT NULL, | |
surname TEXT NOT NULL | |
); | |
CREATE TABLE example.telephone ( | |
id BIGSERIAL PRIMARY KEY, | |
telephone_number TEXT NOT NULL UNIQUE, | |
aquired_at timestamptz NOT NULL, | |
model_id BIGINT NOT NULL REFERENCES example.telephone_model (id), | |
staff_owner_id BIGINT NULL REFERENCES example.member (id), | |
CHECK ( telephone_number LIKE '0%') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment