Add parts of speech
This commit is contained in:
parent
672bdd2f9a
commit
494f8810b7
2 changed files with 22 additions and 0 deletions
4
20230218073436_parts.down.sql
Normal file
4
20230218073436_parts.down.sql
Normal file
|
@ -0,0 +1,4 @@
|
|||
BEGIN;
|
||||
ALTER TABLE words DROP COLUMN part_id;
|
||||
DROP TABLE parts;
|
||||
COMMIT;
|
18
20230218073436_parts.up.sql
Normal file
18
20230218073436_parts.up.sql
Normal file
|
@ -0,0 +1,18 @@
|
|||
BEGIN;
|
||||
|
||||
CREATE TABLE parts (
|
||||
-- name type constraints
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
language_id BIGINT NOT NULL REFERENCES languages (id),
|
||||
english_name VARCHAR NOT NULL,
|
||||
|
||||
-- CONSTRAINT name CHECK (condition)
|
||||
CONSTRAINT english_name_is_sane_text CHECK (is_sane_text(english_name))
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX parts_language_english_name
|
||||
ON parts (language_id, english_name);
|
||||
|
||||
ALTER TABLE words ADD COLUMN part_id BIGINT REFERENCES parts (id);
|
||||
|
||||
COMMIT;
|
Loading…
Add table
Reference in a new issue