diff --git a/20230324233151_inflections_index.down.sql b/20230324233151_inflections_index.down.sql new file mode 100644 index 0000000..19f67e1 --- /dev/null +++ b/20230324233151_inflections_index.down.sql @@ -0,0 +1 @@ +ALTER TABLE inflections DROP COLUMN index; diff --git a/20230324233151_inflections_index.up.sql b/20230324233151_inflections_index.up.sql new file mode 100644 index 0000000..52bf39d --- /dev/null +++ b/20230324233151_inflections_index.up.sql @@ -0,0 +1 @@ +ALTER TABLE inflections ADD COLUMN index BIGINT; diff --git a/20230324233457_inflections_index_notnull_positive.down.sql b/20230324233457_inflections_index_notnull_positive.down.sql new file mode 100644 index 0000000..cecdc67 --- /dev/null +++ b/20230324233457_inflections_index_notnull_positive.down.sql @@ -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; diff --git a/20230324233457_inflections_index_notnull_positive.up.sql b/20230324233457_inflections_index_notnull_positive.up.sql new file mode 100644 index 0000000..801ee15 --- /dev/null +++ b/20230324233457_inflections_index_notnull_positive.up.sql @@ -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;