Add examples
This commit is contained in:
parent
eca4794f2f
commit
e4ef43cb72
|
@ -0,0 +1,4 @@
|
||||||
|
BEGIN;
|
||||||
|
DROP TABLE example_texts;
|
||||||
|
DROP TABLE examples;
|
||||||
|
COMMIT;
|
|
@ -0,0 +1,20 @@
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
CREATE TABLE examples (
|
||||||
|
id BIGSERIAL PRIMARY KEY
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE example_texts (
|
||||||
|
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 value_is_sane_text CHECK (is_sane_text(value))
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX example_texts_example_language_index
|
||||||
|
ON example_texts (example_id, language_id, index);
|
||||||
|
|
||||||
|
COMMIT;
|
Loading…
Reference in New Issue