Added some more SQL files for later use. The world Iminiru already uses this structure.

This commit is contained in:
Gergely POLONKAI 2012-03-25 11:57:12 +02:00
parent d0d763788d
commit 738f9742d5
3 changed files with 42 additions and 0 deletions

5
sql/planes.sql Normal file
View File

@ -0,0 +1,5 @@
CREATE TABLE planes (
id integer primary key,
name varchar(40) not null unique
);

11
sql/planets.sql Normal file
View File

@ -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)
);

26
sql/rooms.sql Normal file
View File

@ -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)
);