mirror of
https://github.com/ilyakooo0/reshape.git
synced 2024-11-22 17:26:33 +03:00
Document remove_column action
This commit is contained in:
parent
49aed1a4f4
commit
f5049324c2
17
README.md
17
README.md
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user