
ferencd@0: -- install script for mazedb
ferencd@0: 
ferencd@0: -- clear the leftovers, ie. a brand new database
ferencd@0: drop database if exists mazedb;
ferencd@0: drop role if exists mazedb;
ferencd@0: 
ferencd@0: -- create the requested mazedb user and DB
ferencd@0: create user mazedb createdb unencrypted password 's321851gper';
ferencd@0: create database mazedb owner mazedb;
ferencd@0: 
ferencd@0: -- just in case make it superuser
ferencd@0: alter  user mazedb with SUPERUSER;
ferencd@0: 
ferencd@0: -- connect to the database
ferencd@0: \connect mazedb
ferencd@0: 
ferencd@0: CREATE TABLE games
ferencd@0: (
ferencd@0:    game_id SERIAL,        						-- Just primary key
ferencd@0:    level_id character varying, 				-- The ID of the level, also a URL parameter
ferencd@0:    level_number integer, 							-- On which level the game was saved
ferencd@0:    level_type CHARACTER(1),           -- What type this game is: S, A, T
ferencd@0:    created_at TIMESTAMP DEFAULT NOW(),-- When this game was created
ferencd@0:    CONSTRAINT game_pk PRIMARY KEY (game_id)
ferencd@0: )
ferencd@0: WITH (
ferencd@0:   OIDS = FALSE
ferencd@0: )
ferencd@0: ;




