Translate parts of speech
This commit is contained in:
parent
60502f9b77
commit
1c84d9deb4
2 changed files with 22 additions and 0 deletions
3
20230218100109_translate_parts.down.sql
Normal file
3
20230218100109_translate_parts.down.sql
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
BEGIN;
|
||||||
|
DROP TABLE part_names;
|
||||||
|
COMMIT;
|
19
20230218100109_translate_parts.up.sql
Normal file
19
20230218100109_translate_parts.up.sql
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
CREATE TABLE part_names (
|
||||||
|
-- name type constraints
|
||||||
|
id BIGSERIAL PRIMARY KEY,
|
||||||
|
part_id BIGINT NOT NULL REFERENCES parts (id),
|
||||||
|
name_lang_id BIGINT NOT NULL REFERENCES languages (id),
|
||||||
|
value VARCHAR NOT NULL,
|
||||||
|
|
||||||
|
-- CONSTRAINT name CHECK (condition)
|
||||||
|
CONSTRAINT value_is_sane_text CHECK (is_sane_text(value))
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX part_names_part_name_lang
|
||||||
|
ON part_names (part_id, name_lang_id);
|
||||||
|
CREATE UNIQUE INDEX part_names_name_lang_value
|
||||||
|
ON part_names (name_lang_id, value);
|
||||||
|
|
||||||
|
COMMIT;
|
Loading…
Reference in a new issue