Added new tables units and units_members

This commit is contained in:
Keanu D?lle 2020-12-05 21:45:32 +01:00
parent 69f5abd2f7
commit 1a18576bf1
4 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
drop table units;

View File

@ -0,0 +1,8 @@
-- Your SQL goes here
create table units
(
unit_id uuid default uuid_generate_v1() not null
constraint untis_pk
primary key,
name text not null
);

View File

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
drop table units_members;

View File

@ -0,0 +1,14 @@
create table units_members
(
unit_id uuid
constraint units_members_units_unit_id_fk
references units
on update cascade on delete cascade,
member_id uuid
constraint units_members_members_entity_id_fk
references members
on update cascade on delete cascade,
crew smallint not null,
PRIMARY KEY (unit_id, member_id)
);