Skip to content

Commit

Permalink
Update drop column
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Rico <[email protected]>
  • Loading branch information
SferaDev committed Dec 4, 2024
1 parent f957f45 commit ecbb96c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 62 deletions.
2 changes: 1 addition & 1 deletion docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
{
"title": "Drop Column",
"href": "/operations/drop_column",
"file": "docs/operations/drop_column.md"
"file": "docs/operations/drop_column.mdx"
},
{
"title": "Drop Constraint (deprecated)",
Expand Down
28 changes: 0 additions & 28 deletions docs/operations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,3 @@
"operations": [...]
}
```

See the [examples](../../examples) directory for examples of each kind of operation.

`pgroll` supports the following migration operations:

- [Add column](./add_column.md)
- [Alter column](./alter_column.md)
- [Rename column](./rename_column.md)
- [Change type](./change_type.md)
- [Change default](./change_default.md)
- [Change comment](./change_comment.md)
- [Add check constraint](./add_check_constraint.md)
- [Add foreign key](./add_foreign_key.md)
- [Add not null constraint](./add_not_null_constraint.md)
- [Drop not null constraint](./drop_not_null_constraint.md)
- [Add unique constraint](./add_unique_constraint.md)
- [Create index](./create_index.md)
- [Create table](./create_table.md)
- [Create constraint](./create_constraint.md)
- [Drop column](./drop_column.md)
- [Drop constraint](./drop_constraint.md)
- [Drop multi-column constraint](./drop_multi_column_constraint.md)
- [Drop index](./drop_index.md)
- [Drop table](./drop_table.md)
- [Raw SQL](./raw_sql.md)
- [Rename table](./rename_table.md)
- [Rename constraint](./rename_constraint.md)
- [Set replica identity](./set_replica_identity.md)
10 changes: 0 additions & 10 deletions docs/operations/alter_column/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,3 @@
An alter column operation alters the properties of a column. The operation supports several sub-operations, described below.

An alter column operation may contain multiple sub-operations. For example, a single alter column operation may rename a column, change its type, and add a check constraint.

- [Rename column](./rename_column.md)
- [Change type](./change_type.md)
- [Change default](./change_default.md)
- [Change comment](./change_comment.md)
- [Add check constraint](./add_check_constraint.md)
- [Add foreign key](./add_foreign_key.md)
- [Add not null constraint](./add_not_null_constraint.md)
- [Drop not null constraint](./drop_not_null_constraint.md)
- [Add unique constraint](./add_unique_constraint.md)
23 changes: 0 additions & 23 deletions docs/operations/drop_column.md

This file was deleted.

25 changes: 25 additions & 0 deletions docs/operations/drop_column.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Drop column

## Structure

A drop column operation drops a column from an existing table.

```json
{
"drop_column": {
"table": "name of table",
"column": "name of column to drop",
"down": "SQL expression"
}
}
```

The `down` field above is required in order to backfill the previous version of the schema during an active migration.

## Examples

### Drop a column with a default value

If a new row is inserted against the new schema without a `price` column, the old schema `price` column will be set to `0`.

<ExampleSnippet example="09_drop_column.json" />

0 comments on commit ecbb96c

Please sign in to comment.