1
0
Fork 0

Align and comment code

This commit is contained in:
Alex Kotov 2023-02-18 10:41:59 +04:00
parent 1dbf4b868f
commit 672bdd2f9a
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 36 additions and 23 deletions

View file

@ -1,10 +1,13 @@
BEGIN;
CREATE TABLE languages (
-- name type constraints
id BIGSERIAL PRIMARY KEY,
code VARCHAR(2) NOT NULL,
english_name VARCHAR NOT NULL,
self_name VARCHAR NOT NULL,
-- CONSTRAINT name CHECK (condition)
CONSTRAINT code_is_language_code CHECK (is_language_code(code)),
CONSTRAINT english_name_is_sane_text CHECK (is_sane_text(english_name)),
CONSTRAINT self_name_is_sane_text CHECK (is_sane_text(self_name))

View file

@ -1,15 +1,19 @@
BEGIN;
CREATE TABLE examples (
-- name type constraints
id BIGSERIAL PRIMARY KEY
);
CREATE TABLE example_texts (
-- name type constraints
id BIGSERIAL PRIMARY KEY,
example_id BIGINT NOT NULL REFERENCES examples (id),
language_id BIGINT NOT NULL REFERENCES languages (id),
index BIGINT NOT NULL,
value TEXT NOT NULL,
-- CONSTRAINT name CHECK (condition)
CONSTRAINT index_is_not_negative CHECK (index >= 0),
CONSTRAINT value_is_sane_text CHECK (is_sane_text(value))
);

View file

@ -1,16 +1,22 @@
BEGIN;
CREATE TABLE words (
-- name type constraints
id BIGSERIAL PRIMARY KEY,
language_id BIGINT NOT NULL REFERENCES languages (id),
primary_form VARCHAR NOT NULL,
-- CONSTRAINT name CHECK (condition)
CONSTRAINT primary_form_is_sane_text CHECK (is_sane_text(primary_form))
);
CREATE TABLE word_forms (
-- name type constraints
id BIGSERIAL PRIMARY KEY,
word_id BIGINT NOT NULL REFERENCES words (id),
value VARCHAR NOT NULL,
-- CONSTRAINT name CHECK (condition)
CONSTRAINT value_is_sane_text CHECK (is_sane_text(value))
);