1
0
Fork 0

Add languages

This commit is contained in:
Alex Kotov 2023-01-25 19:29:41 +04:00
parent d74f8fc584
commit 91b057b0fb
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,3 @@
BEGIN;
DROP TABLE languages;
COMMIT;

View file

@ -0,0 +1,23 @@
BEGIN;
CREATE TABLE languages (
id BIGSERIAL PRIMARY KEY,
code VARCHAR(2) NOT NULL,
english_name VARCHAR NOT NULL,
self_name VARCHAR NOT NULL,
CONSTRAINT code_is_language_code CHECK (is_language_code(code)),
CONSTRAINT english_name_is_name CHECK (is_name(english_name)),
CONSTRAINT self_name_is_name CHECK (is_name(self_name))
);
CREATE UNIQUE INDEX languages_code ON languages (code);
CREATE UNIQUE INDEX languages_english_name ON languages (english_name);
INSERT INTO languages (code, english_name, self_name) VALUES
('en', 'English', 'English'),
('ru', 'Russian', 'Русский'),
('pl', 'Polish', 'Polski'),
('es', 'Spanish', 'Español'),
('ka', 'Georgian', 'ქართული');
COMMIT;