From f5049324c213277c084f750e08ada809e2b251ba Mon Sep 17 00:00:00 2001 From: fabianlindfors Date: Thu, 11 Nov 2021 23:29:02 +0100 Subject: [PATCH] Document remove_column action --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 7cfdc97..28b467f 100644 --- a/README.md +++ b/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