58 lines
1.5 KiB
MySQL
58 lines
1.5 KiB
MySQL
|
-- LegacyWorlds Beta 6
|
||
|
-- PostgreSQL database scripts
|
||
|
--
|
||
|
-- Preference definitions
|
||
|
--
|
||
|
-- Copyright(C) 2004-2010, DeepClone Development
|
||
|
-- --------------------------------------------------------
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Preference groups
|
||
|
--
|
||
|
CREATE TABLE defs.preference_groups(
|
||
|
id SERIAL PRIMARY KEY ,
|
||
|
name VARCHAR(32) NOT NULL ,
|
||
|
display_id INT NOT NULL
|
||
|
);
|
||
|
|
||
|
CREATE UNIQUE INDEX idx_prefgroups_name
|
||
|
ON defs.preference_groups (name);
|
||
|
CREATE INDEX idx_prefgroups_dispname
|
||
|
ON defs.preference_groups (display_id);
|
||
|
|
||
|
ALTER TABLE defs.preference_groups
|
||
|
ADD CONSTRAINT fk_prefgroups_display
|
||
|
FOREIGN KEY (display_id) REFERENCES defs.strings;
|
||
|
|
||
|
|
||
|
--
|
||
|
-- Preference definitions
|
||
|
--
|
||
|
CREATE TABLE defs.preference_definitions(
|
||
|
id SERIAL PRIMARY KEY ,
|
||
|
group_id INT NOT NULL ,
|
||
|
name VARCHAR(32) NOT NULL ,
|
||
|
disp_name_id INT NOT NULL ,
|
||
|
disp_desc_id INT NOT NULL ,
|
||
|
java_type VARCHAR( 255 ) NOT NULL ,
|
||
|
default_value TEXT NOT NULL
|
||
|
);
|
||
|
|
||
|
CREATE INDEX idx_prefdefs_group
|
||
|
ON defs.preference_definitions (group_id);
|
||
|
CREATE UNIQUE INDEX idx_prefdefs_name
|
||
|
ON defs.preference_definitions (name);
|
||
|
CREATE INDEX idx_prefdefs_dispname
|
||
|
ON defs.preference_definitions (disp_name_id);
|
||
|
CREATE INDEX idx_prefdefs_dispdesc
|
||
|
ON defs.preference_definitions (disp_desc_id);
|
||
|
|
||
|
ALTER TABLE defs.preference_definitions
|
||
|
ADD CONSTRAINT fk_prefdefs_group
|
||
|
FOREIGN KEY (group_id) REFERENCES defs.preference_groups ,
|
||
|
ADD CONSTRAINT fk_prefdefs_dispname
|
||
|
FOREIGN KEY (disp_name_id) REFERENCES defs.strings ,
|
||
|
ADD CONSTRAINT fk_prefdefs_dispdesc
|
||
|
FOREIGN KEY (disp_desc_id) REFERENCES defs.strings;
|