Document remove_column action

This commit is contained in:
fabianlindfors 2021-11-11 23:29:02 +01:00
parent 49aed1a4f4
commit f5049324c2

View File

@ -18,6 +18,7 @@ Reshape is an easy-to-use, zero-downtime schema migration tool for Postgres. It
- [Columns](#columns)
- [Add column](#add-column)
- [Alter column](#alter-column)
- [Remove column](#remove-column)
- [Indices](#indices)
- [Add index](#add-index)
- [Commands and options](#commands-and-options)
@ -275,6 +276,22 @@ down = "index - 1" # Decrement to revert for old schema
```
#### Remove column
The `remove_column` action will remove an existing column from a table. You can optionally provide a `down` setting. This should be an SQL expression which will be used to determine values for the old schema when inserting or updating rows using the new schema. The `down` setting must be provided when the removed column is `NOT NULL` or doesn't have a default value.
*Example: remove column `name` from table `users`*
```toml
[[actions]]
type = "remove_column"
table = "users"
column = "name"
# Use a default value of "N/A" for the old schema when inserting/updating rows
down = "'N/A'"
```
### Indices
#### Add index