From 738f9742d5e69f1baa9ab9554e755f5d6cebeb77 Mon Sep 17 00:00:00 2001 From: Gergely POLONKAI Date: Sun, 25 Mar 2012 11:57:12 +0200 Subject: [PATCH] Added some more SQL files for later use. The world Iminiru already uses this structure. --- sql/planes.sql | 5 +++++ sql/planets.sql | 11 +++++++++++ sql/rooms.sql | 26 ++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 sql/planes.sql create mode 100644 sql/planets.sql create mode 100644 sql/rooms.sql diff --git a/sql/planes.sql b/sql/planes.sql new file mode 100644 index 0000000..708537c --- /dev/null +++ b/sql/planes.sql @@ -0,0 +1,5 @@ +CREATE TABLE planes ( + id integer primary key, + name varchar(40) not null unique +); + diff --git a/sql/planets.sql b/sql/planets.sql new file mode 100644 index 0000000..9671f99 --- /dev/null +++ b/sql/planets.sql @@ -0,0 +1,11 @@ +CREATE TABLE planets ( + id integer NOT NULL PRIMARY KEY, + name varchar(40) NOT NULL UNIQUE +); + +CREATE TABLE planet_planes ( + planet_id integer NOT NULL REFERENCES planets(id), + plane_id integer NOT NULL REFERENCES planes(id), + UNIQUE (planet_id, plane_id) +); + diff --git a/sql/rooms.sql b/sql/rooms.sql new file mode 100644 index 0000000..1d41d4b --- /dev/null +++ b/sql/rooms.sql @@ -0,0 +1,26 @@ +CREATE TABLE directions ( + id integer NOT NULL PRIMARY KEY, + short_name varchar(2) NOT NULL UNIQUE, + name varchar(10) NOT NULL UNIQUE +); + +CREATE TABLE areas ( + id integer NOT NULL PRIMARY KEY, + name varchar(50) NOT NULL +); + +CREATE TABLE rooms ( + id integer NOT NULL PRIMARY KEY, + area integer NOT NULL REFERENCES areas(id), + name varchar(50) NOT NULL, + distant_description text, + close_description text NOT NULL, + UNIQUE (area, name) +); + +CREATE TABLE room_exits ( + room_id integer NOT NULL REFERENCES rooms(id), + direction integer REFERENCES directions(id), + other_side integer NOT NULL REFERENCES rooms(id), + PRIMARY KEY (room_id, direction) +);