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;
|
BEGIN;
|
||||||
|
|
||||||
CREATE TABLE languages (
|
CREATE TABLE languages (
|
||||||
|
-- name type constraints
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
code VARCHAR(2) NOT NULL,
|
code VARCHAR(2) NOT NULL,
|
||||||
english_name VARCHAR NOT NULL,
|
english_name VARCHAR NOT NULL,
|
||||||
self_name VARCHAR NOT NULL,
|
self_name VARCHAR NOT NULL,
|
||||||
|
|
||||||
|
-- CONSTRAINT name CHECK (condition)
|
||||||
CONSTRAINT code_is_language_code CHECK (is_language_code(code)),
|
CONSTRAINT code_is_language_code CHECK (is_language_code(code)),
|
||||||
CONSTRAINT english_name_is_sane_text CHECK (is_sane_text(english_name)),
|
CONSTRAINT english_name_is_sane_text CHECK (is_sane_text(english_name)),
|
||||||
CONSTRAINT self_name_is_sane_text CHECK (is_sane_text(self_name))
|
CONSTRAINT self_name_is_sane_text CHECK (is_sane_text(self_name))
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
BEGIN;
|
BEGIN;
|
||||||
|
|
||||||
CREATE TABLE examples (
|
CREATE TABLE examples (
|
||||||
|
-- name type constraints
|
||||||
id BIGSERIAL PRIMARY KEY
|
id BIGSERIAL PRIMARY KEY
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE example_texts (
|
CREATE TABLE example_texts (
|
||||||
|
-- name type constraints
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
example_id BIGINT NOT NULL REFERENCES examples (id),
|
example_id BIGINT NOT NULL REFERENCES examples (id),
|
||||||
language_id BIGINT NOT NULL REFERENCES languages (id),
|
language_id BIGINT NOT NULL REFERENCES languages (id),
|
||||||
index BIGINT NOT NULL,
|
index BIGINT NOT NULL,
|
||||||
value TEXT NOT NULL,
|
value TEXT NOT NULL,
|
||||||
|
|
||||||
|
-- CONSTRAINT name CHECK (condition)
|
||||||
CONSTRAINT index_is_not_negative CHECK (index >= 0),
|
CONSTRAINT index_is_not_negative CHECK (index >= 0),
|
||||||
CONSTRAINT value_is_sane_text CHECK (is_sane_text(value))
|
CONSTRAINT value_is_sane_text CHECK (is_sane_text(value))
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,16 +1,22 @@
|
||||||
BEGIN;
|
BEGIN;
|
||||||
|
|
||||||
CREATE TABLE words (
|
CREATE TABLE words (
|
||||||
|
-- name type constraints
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
language_id BIGINT NOT NULL REFERENCES languages (id),
|
language_id BIGINT NOT NULL REFERENCES languages (id),
|
||||||
primary_form VARCHAR NOT NULL,
|
primary_form VARCHAR NOT NULL,
|
||||||
|
|
||||||
|
-- CONSTRAINT name CHECK (condition)
|
||||||
CONSTRAINT primary_form_is_sane_text CHECK (is_sane_text(primary_form))
|
CONSTRAINT primary_form_is_sane_text CHECK (is_sane_text(primary_form))
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE word_forms (
|
CREATE TABLE word_forms (
|
||||||
|
-- name type constraints
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
word_id BIGINT NOT NULL REFERENCES words (id),
|
word_id BIGINT NOT NULL REFERENCES words (id),
|
||||||
value VARCHAR NOT NULL,
|
value VARCHAR NOT NULL,
|
||||||
|
|
||||||
|
-- CONSTRAINT name CHECK (condition)
|
||||||
CONSTRAINT value_is_sane_text CHECK (is_sane_text(value))
|
CONSTRAINT value_is_sane_text CHECK (is_sane_text(value))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue