This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb6/legacyworlds-server/legacyworlds-server-data/db-structure/parts/data/080-techs-data.sql

57 lines
1.3 KiB
MySQL
Raw Normal View History

2018-10-23 09:38:02 +02:00
-- 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;