create tablespace deckard_space OWNER deckard LOCATION '\tmp\deckard'; create database deckard WITH OWNER=deckard TABLESPACE=deckard_space; create table sessions ( sessionID UUID PRIMARY KEY, sessionKey VARCHAR (256) NOT NULL, last_update TIMESTAMP NOT NULL ); create table locations ( locationID UUID PRIMARY KEY, sessionID UUID REFERENCES sessions(sessionID), locationType text CHECK (locationType = 'deck' or 'hand' or 'discard'), showPublic boolean NOT NULL ); create table cards ( cardID UUID PRIMARY KEY sessionID UUID REFERENCES sessions(sessionID), locationID UUID REFERENCES locations(locationID), cardContent text NOT NULL, position integer NOT NULL );