1
0
Fork 0
database/20230220084415_word_form_example_texts_validate.up.sql

7 lines
278 B
PL/PgSQL

BEGIN;
ALTER TABLE word_form_example_texts ALTER COLUMN pos SET NOT NULL;
ALTER TABLE word_form_example_texts ADD CONSTRAINT pos_is_not_negative
CHECK (pos >= 0);
CREATE UNIQUE INDEX word_form_example_texts_pos
ON word_form_example_texts (example_text_id, pos);
COMMIT;