-- Add up migration script here create table players ( id varchar(64) primary key not null ); create table sessions ( 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 object_journal ( id uuid not null, seq bigint not null, payload jsonb not null ); create unique index journal_entry on object_journal (id, seq); create type player_position as enum ('west', 'north', 'east', 'south'); create table table_players ( active_tables_id uuid not null references active_tables (id), player_id varchar(64) not null references players (id), position player_position, primary key(active_tables_id, player_id, position) ); create unique index player_table on table_players (player_id);