1
0
Fork 0

Add column inflections.index

This commit is contained in:
Alex Kotov 2023-03-25 03:37:17 +04:00
parent cfa8d26d49
commit da1407ea50
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1 @@
ALTER TABLE inflections DROP COLUMN index;

View file

@ -0,0 +1 @@
ALTER TABLE inflections ADD COLUMN index BIGINT;

View file

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE inflections ALTER COLUMN index DROP NOT NULL;
ALTER TABLE inflections DROP CONSTRAINT index_is_not_negative;
DROP INDEX inflections_part_id_index;
COMMIT;

View file

@ -0,0 +1,5 @@
BEGIN;
ALTER TABLE inflections ALTER COLUMN index SET NOT NULL;
ALTER TABLE inflections ADD CONSTRAINT index_is_not_negative CHECK (index >= 0);
CREATE UNIQUE INDEX inflections_part_id_index ON inflections (part_id, index);
COMMIT;