-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
create_table
, drop_table
, create_table
sequence of oper…
…ations (#589) Ensure that the following migrations work by changing how `OpDropTable` works: <details> <summary><strong>Create table in one migration, then drop and recreate a table of the same name in the same migration</strong></summary> ```json { "name": "01_create_table", "operations": [ { "create_table": { "name": "items", "columns": [ { "name": "id", "type": "serial", "pk": true }, { "name": "name", "type": "text", "nullable": true } ] } } ] } ``` ```json { "name": "02_drop_table_create_table", "operations": [ { "drop_table": { "name": "items" } }, { "create_table": { "name": "items", "columns": [ { "name": "id", "type": "serial", "pk": true }, { "name": "name", "type": "text", "nullable": true }, { "name": "description", "type": "text", "nullable": true } ] } } ] } ``` </details> <details> <summary><strong>Create a table, drop and recreate a table all in the same migration</strong></summary> ```json { "name": "06_drop_table_create_table", "operations": [ { "create_table": { "name": "items", "columns": [ { "name": "id", "type": "uuid", "default": "gen_random_uuid()", "pk": true }, { "name": "name", "type": "text", "nullable": true } ] } }, { "drop_table": { "name": "items" } }, { "create_table": { "name": "items", "columns": [ { "name": "id", "type": "uuid", "default": "gen_random_uuid()", "pk": true }, { "name": "name", "type": "text", "nullable": true }, { "name": "description", "type": "text", "nullable": true } ] } } ] } ``` </details> `OpDropTable` now 'soft-deletes' tables on migration start by renaming them with a constistent prefix (`pgroll_del_`) to allow subsequent `OpCreateTable` operations in the same migration to create tables with the original name. Part of #239
- Loading branch information
1 parent
5a6f508
commit 5ec28da
Showing
4 changed files
with
189 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters