Align and comment code
This commit is contained in:
parent
1dbf4b868f
commit
672bdd2f9a
3 changed files with 36 additions and 23 deletions
|
@ -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))
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
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 index_is_not_negative CHECK(index >= 0),
|
||||
|
||||
-- CONSTRAINT name CHECK (condition)
|
||||
CONSTRAINT index_is_not_negative CHECK (index >= 0),
|
||||
CONSTRAINT value_is_sane_text CHECK (is_sane_text(value))
|
||||
);
|
||||
|
||||
|
|
|
@ -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))
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue