This repository has been archived on 2025-01-04. You can view files and clone it, but cannot push or open issues or pull requests.
lwb6/legacyworlds-server-data/db-structure/parts/030-data/010-i18n.sql
Emmanuel BENOîT e50775ec76 Database definition & tests organisation
* The main loader script has been updated to generate the list of files
it needs to load automatically. As a consequence, files that contained
manually-maintained lists of scripts have been removed, and definition
directories have been renamed accordingly.

* PostgreSQL extension loading and configuration has been moved to a
separate script to be loaded automatically in the main transaction.

* Data and function definition scripts that had the -data or -functions
suffix have been renamed (the suffix is unnecessary).

* Unit tests have been reorganised to follow the definition's structure.

* Documentation has been improved
2012-01-06 11:19:19 +01:00

53 lines
1 KiB
SQL

-- LegacyWorlds Beta 6
-- PostgreSQL database scripts
--
-- Translations
--
-- Copyright(C) 2004-2010, DeepClone Development
-- --------------------------------------------------------
--
-- Languages
--
CREATE TABLE defs.languages(
id SERIAL PRIMARY KEY ,
language VARCHAR(5) NOT NULL ,
name VARCHAR(48) NOT NULL
);
CREATE UNIQUE INDEX idx_languages_lid
ON defs.languages (language);
--
-- Internationalised strings
--
CREATE TABLE defs.strings(
id SERIAL PRIMARY KEY ,
name VARCHAR(64) NOT NULL
);
CREATE UNIQUE INDEX idx_strings_id
ON defs.strings (name);
--
-- Translations
--
CREATE TABLE defs.translations(
lang_id INT NOT NULL ,
string_id INT NOT NULL ,
translated_string TEXT NOT NULL ,
PRIMARY KEY (lang_id, string_id)
);
CREATE INDEX idx_translations_string
ON defs.translations (string_id);
ALTER TABLE defs.translations
ADD CONSTRAINT fk_translation_language
FOREIGN KEY (lang_id) REFERENCES defs.languages ,
ADD CONSTRAINT fk_translation_string
FOREIGN KEY (string_id) REFERENCES defs.strings;