diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sql/createdb.sql	Sun Sep 15 11:46:47 2019 +0200
@@ -0,0 +1,29 @@
+-- install script for mazedb
+
+-- clear the leftovers, ie. a brand new database
+drop database if exists mazedb;
+drop role if exists mazedb;
+
+-- create the requested mazedb user and DB
+create user mazedb createdb unencrypted password 's321851gper';
+create database mazedb owner mazedb;
+
+-- just in case make it superuser
+alter  user mazedb with SUPERUSER;
+
+-- connect to the database
+\connect mazedb
+
+CREATE TABLE games
+(
+   game_id SERIAL,        						-- Just primary key
+   level_id character varying, 				-- The ID of the level, also a URL parameter
+   level_number integer, 							-- On which level the game was saved
+   level_type CHARACTER(1),           -- What type this game is: S, A, T
+   created_at TIMESTAMP DEFAULT NOW(),-- When this game was created
+   CONSTRAINT game_pk PRIMARY KEY (game_id)
+)
+WITH (
+  OIDS = FALSE
+)
+;