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

24 lines
667 B
MySQL
Raw Normal View History

2022-02-14 01:25:36 +01:00
-- Write your migrate up statements here
create table sctl_project
(
2022-02-14 22:19:44 +01:00
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)
2022-02-14 01:25:36 +01:00
);
---- create above / drop below ----
drop table sctl_project;
2022-02-14 22:19:44 +01:00
drop table sctl_project_member;
2022-02-14 01:25:36 +01:00
-- Write your migrate down statements here. If this migration is irreversible
-- Then delete the separator line above.