From eda936f158e962a82d39122126d79cdeeb37e823 Mon Sep 17 00:00:00 2001 From: Andrew Farries Date: Fri, 1 Mar 2024 16:02:28 +0000 Subject: [PATCH] Add `rename_constraint` operation to `PgRollOperation` JSON schema definition (#300) Otherwise migrations that include this operation are not valid according to the JSON schema. Fixup to https://github.com/xataio/pgroll/pull/293. --- .../testdata/rename-constraint-1.txtar | 18 ++++++++++++++++++ schema.json | 11 +++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pkg/jsonschema/testdata/rename-constraint-1.txtar diff --git a/pkg/jsonschema/testdata/rename-constraint-1.txtar b/pkg/jsonschema/testdata/rename-constraint-1.txtar new file mode 100644 index 0000000..fcac3b4 --- /dev/null +++ b/pkg/jsonschema/testdata/rename-constraint-1.txtar @@ -0,0 +1,18 @@ +This is a valid 'rename constraint' migration. + +-- rename_constraint.json -- +{ + "name": "migration_name", + "operations": [ + { + "rename_constraint": { + "table": "people", + "from": "name_length", + "to": "name_length_check" + } + } + ] +} + +-- valid -- +true diff --git a/schema.json b/schema.json index 713a42c..ce63764 100644 --- a/schema.json +++ b/schema.json @@ -468,6 +468,17 @@ }, "required": ["drop_constraint"] }, + { + "type": "object", + "description": "Rename constraint operation", + "additionalProperties": false, + "properties": { + "rename_constraint": { + "$ref": "#/$defs/OpRenameConstraint" + } + }, + "required": ["rename_constraint"] + }, { "type": "object", "description": "Drop index operation",