annotate sql/createdb.sql @ 0:1eef88068f9f tip

initial commit of maze game source
author ferencd
date Sun, 15 Sep 2019 11:46:47 +0200
parents
children
rev   line source
ferencd@0 1 -- install script for mazedb
ferencd@0 2
ferencd@0 3 -- clear the leftovers, ie. a brand new database
ferencd@0 4 drop database if exists mazedb;
ferencd@0 5 drop role if exists mazedb;
ferencd@0 6
ferencd@0 7 -- create the requested mazedb user and DB
ferencd@0 8 create user mazedb createdb unencrypted password 's321851gper';
ferencd@0 9 create database mazedb owner mazedb;
ferencd@0 10
ferencd@0 11 -- just in case make it superuser
ferencd@0 12 alter user mazedb with SUPERUSER;
ferencd@0 13
ferencd@0 14 -- connect to the database
ferencd@0 15 \connect mazedb
ferencd@0 16
ferencd@0 17 CREATE TABLE games
ferencd@0 18 (
ferencd@0 19 game_id SERIAL, -- Just primary key
ferencd@0 20 level_id character varying, -- The ID of the level, also a URL parameter
ferencd@0 21 level_number integer, -- On which level the game was saved
ferencd@0 22 level_type CHARACTER(1), -- What type this game is: S, A, T
ferencd@0 23 created_at TIMESTAMP DEFAULT NOW(),-- When this game was created
ferencd@0 24 CONSTRAINT game_pk PRIMARY KEY (game_id)
ferencd@0 25 )
ferencd@0 26 WITH (
ferencd@0 27 OIDS = FALSE
ferencd@0 28 )
ferencd@0 29 ;