serverctl/services/db/migrations/003_add_projects.sql

24 lines
667 B
SQL

-- Write your migrate up statements here
create table sctl_project
(
id int GENERATED BY DEFAULT AS IDENTITY primary key,
name varchar(30) not null
);
create table sctl_project_member
(
project_id int REFERENCES sctl_project (id) ON UPDATE CASCADE ON DELETE CASCADE,
member_id int REFERENCES sctl_user (id) ON UPDATE CASCADE,
role varchar(20) not null,
CONSTRAINT project_member_pkey PRIMARY KEY (project_id, member_id)
);
---- create above / drop below ----
drop table sctl_project;
drop table sctl_project_member;
-- Write your migrate down statements here. If this migration is irreversible
-- Then delete the separator line above.