1 drop table if exists authorities
cascade;
2 drop table if exists accounts
cascade;
3 drop table if exists tokens
cascade;
4 drop table if exists owners
cascade;
6 create table authorities (
7 authority
text not null primary key
10 insert into authorities
values('github');
12 create table accounts (
13 account uuid
not null default uuid_generate_v4() primary key
17 token text not null primary key
18 ,account uuid
not null references accounts
on update cascade on delete cascade
19 ,authority
text not null references authorities
on update cascade on delete cascade
24 account uuid
not null references accounts
on update cascade on delete cascade
25 ,authority
text not null references authorities
on update cascade on delete cascade
28 ,primary key (account
,authority
)
29 ,unique (login,authority
)