Skip to content

Commit

Permalink
Remove column on drop_constraint
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Rico <sferadev@gmail.com>
  • Loading branch information
SferaDev committed Nov 5, 2024
1 parent b7f264b commit 39cb2ae
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-shirts-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@xata.io/pgroll': minor
---

[Breaking] Remove `column` from `drop_constraint`
1 change: 0 additions & 1 deletion packages/cli/src/commands/schema/edit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ const testCases: TestCase[] = [
table: 'table2',
down: '"col1"',
up: '"col1"',
column: 'col1',
name: 'table2_col1_unique'
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/schema/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,6 @@ export const editsToMigrations = (command: EditSchema) => {
? {
drop_constraint: {
table: tableName,
column: originalField.name,
name: uniqueConstraintName,
up: `"${originalField.name}"`,
down: `"${originalField.name}"`
Expand Down
6 changes: 1 addition & 5 deletions packages/pgroll/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -351,7 +347,7 @@ export const schema = {
type: 'string'
}
},
required: ['column', 'down', 'name', 'table', 'up'],
required: ['down', 'name', 'table', 'up'],
type: 'object'
},
OpDropIndex: {
Expand Down
1 change: 0 additions & 1 deletion packages/pgroll/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ export const OpDropColumnDefinition = z.object({
export type OpDropConstraint = z.infer<typeof OpDropConstraintDefinition>;

export const OpDropConstraintDefinition = z.object({
column: z.string(),
down: z.string(),
name: z.string(),
table: z.string(),
Expand Down

0 comments on commit 39cb2ae

Please sign in to comment.