From 39cb2ae50a8430d4bef6bf55c18014419b76f186 Mon Sep 17 00:00:00 2001 From: Alexis Rico Date: Tue, 5 Nov 2024 18:07:11 +0100 Subject: [PATCH] Remove `column` on `drop_constraint` Signed-off-by: Alexis Rico --- .changeset/forty-shirts-hug.md | 5 +++++ packages/cli/src/commands/schema/edit.test.ts | 1 - packages/cli/src/commands/schema/edit.ts | 1 - packages/pgroll/src/schema.ts | 6 +----- packages/pgroll/src/types.ts | 1 - 5 files changed, 6 insertions(+), 8 deletions(-) create mode 100644 .changeset/forty-shirts-hug.md diff --git a/.changeset/forty-shirts-hug.md b/.changeset/forty-shirts-hug.md new file mode 100644 index 000000000..1b727ee6e --- /dev/null +++ b/.changeset/forty-shirts-hug.md @@ -0,0 +1,5 @@ +--- +'@xata.io/pgroll': minor +--- + +[Breaking] Remove `column` from `drop_constraint` diff --git a/packages/cli/src/commands/schema/edit.test.ts b/packages/cli/src/commands/schema/edit.test.ts index d13ac6953..b24b4f603 100644 --- a/packages/cli/src/commands/schema/edit.test.ts +++ b/packages/cli/src/commands/schema/edit.test.ts @@ -441,7 +441,6 @@ const testCases: TestCase[] = [ table: 'table2', down: '"col1"', up: '"col1"', - column: 'col1', name: 'table2_col1_unique' } } diff --git a/packages/cli/src/commands/schema/edit.ts b/packages/cli/src/commands/schema/edit.ts index 6eee99330..78a77192c 100644 --- a/packages/cli/src/commands/schema/edit.ts +++ b/packages/cli/src/commands/schema/edit.ts @@ -962,7 +962,6 @@ export const editsToMigrations = (command: EditSchema) => { ? { drop_constraint: { table: tableName, - column: originalField.name, name: uniqueConstraintName, up: `"${originalField.name}"`, down: `"${originalField.name}"` diff --git a/packages/pgroll/src/schema.ts b/packages/pgroll/src/schema.ts index cdc3ce5b9..30426af83 100644 --- a/packages/pgroll/src/schema.ts +++ b/packages/pgroll/src/schema.ts @@ -329,10 +329,6 @@ export const schema = { additionalProperties: false, description: 'Drop constraint operation', properties: { - column: { - description: 'Name of the column', - type: 'string' - }, down: { default: '', description: 'SQL expression for down migration', @@ -351,7 +347,7 @@ export const schema = { type: 'string' } }, - required: ['column', 'down', 'name', 'table', 'up'], + required: ['down', 'name', 'table', 'up'], type: 'object' }, OpDropIndex: { diff --git a/packages/pgroll/src/types.ts b/packages/pgroll/src/types.ts index 96d3126bc..a159fb876 100644 --- a/packages/pgroll/src/types.ts +++ b/packages/pgroll/src/types.ts @@ -90,7 +90,6 @@ export const OpDropColumnDefinition = z.object({ export type OpDropConstraint = z.infer; export const OpDropConstraintDefinition = z.object({ - column: z.string(), down: z.string(), name: z.string(), table: z.string(),