-- LegacyWorlds Beta 6 -- PostgreSQL database scripts -- -- Technology definitions -- -- Copyright(C) 2004-2010, DeepClone Development -- -------------------------------------------------------- -- -- Technology lines -- CREATE TABLE tech.lines( name_id INT NOT NULL PRIMARY KEY , description_id INT NOT NULL ); CREATE INDEX idx_lines_description ON tech.lines (description_id); ALTER TABLE tech.lines ADD CONSTRAINT fk_lines_name FOREIGN KEY (name_id) REFERENCES defs.strings , ADD CONSTRAINT fk_lines_description FOREIGN KEY (description_id) REFERENCES defs.strings; -- -- Technology levels -- CREATE TABLE tech.levels( id SERIAL NOT NULL PRIMARY KEY , line_id INT NOT NULL , level INT NOT NULL CHECK( level > 0 ) , name_id INT NOT NULL , description_id INT NOT NULL , points INT NOT NULL CHECK( points > 0 ) , cost INT NOT NULL CHECK( cost > 0 ) ); CREATE UNIQUE INDEX idx_levels_linelevel ON tech.levels (line_id, level); CREATE INDEX idx_levels_name ON tech.levels (name_id); CREATE INDEX idx_levels_description ON tech.levels (description_id); ALTER TABLE tech.levels ADD CONSTRAINT fk_levels_line FOREIGN KEY (line_id) REFERENCES tech.lines , ADD CONSTRAINT fk_levels_name FOREIGN KEY (name_id) REFERENCES defs.strings , ADD CONSTRAINT fk_levels_description FOREIGN KEY (description_id) REFERENCES defs.strings;