forked from Snowflake-Labs/schemachange
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Taking inspiration from Flyway, this commits adds the undo subcommand to the application, with the `--step <n>` flag. Undo scripts will have the `U` prefix, with the same name and version as their corresponding versioned script. It will attempt to undo <n> amount of versioned scripts until it finishes, or no corresponding undo script is found. Under the hood, the application is removing the `V` script from the change history table, so when the `deploy` command is ran, the versioned script can be applied again. Algorithm: * Fetch all applied `V` migrations * Fetch all `U` migrations * Get `U` migration of last `V` migration. * IF `V` migration has no `U` migration, process stops * Apply `U` script * Delete `V` script from the change_history_table related to `U` This commit closes issue Snowflake-Labs#19
- Loading branch information
1 parent
f5dad1a
commit 69600d8
Showing
6 changed files
with
282 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- Set the database and schema context | ||
USE SCHEMA SCHEMACHANGE_DEMO.PUBLIC; | ||
|
||
TRUNCATE TABLE TRIPS; | ||
|
||
TRUNCATE TABLE WEATHER; |
Oops, something went wrong.