diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2022-10-08 18:33:22 -0400 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2022-10-08 18:33:22 -0400 |
commit | a7d833d6b7729f09bef891b0c8b7bd998ac17abf (patch) | |
tree | 018bba6c2ff1a58ed5b739939f63a3929d0dc662 /server/migrations/20221008120534_init.up.sql | |
parent | 30102e5da48b53806b33f04041a46bec4c3b2fa3 (diff) |
Add bridge table to db; introduce player ids from oauth subject ids
Diffstat (limited to 'server/migrations/20221008120534_init.up.sql')
-rw-r--r-- | server/migrations/20221008120534_init.up.sql | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/server/migrations/20221008120534_init.up.sql b/server/migrations/20221008120534_init.up.sql index b3527eb..6a46f84 100644 --- a/server/migrations/20221008120534_init.up.sql +++ b/server/migrations/20221008120534_init.up.sql @@ -1,8 +1,24 @@ -- Add up migration script here +create table players ( + id varchar(64) primary key not null +); + create table sessions ( - id uuid primary key, + id uuid primary key not null, + player_id varchar(64) references players (id) not null, access_token varchar(2048) not null, access_token_expiration timestamp with time zone not null, refresh_token varchar(1024) not null, last_refresh timestamp with time zone not null default now() ); + +create table active_tables ( + id uuid primary key not null +); + +create table table_players ( + active_tables_id uuid not null references active_tables (id), + player_id varchar(64) not null references players (id), + primary key(active_tables_id, player_id) +); +create unique index player_table on table_players (player_id); |