-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SchemaMigrationsHistory to determine unapplied out of order migrations
This commit adds a `SchemaMigrationsHistory` table which: - Provides users with more information about the time and order in which migration scripts were applied to their database. This is exposed via the `wrench migrate history` command - Allows out of order migration scripts to be applied to a database by determining what subset of migrations are yet to be applied in contrast to comparing a single version number. This flexibility allows production hotfixes to be applied on a diverging branch and having those changes merged back to non production environments which may already be ahead of production. In addition to the new functionality around `SchemaMigrationsHistory`, existing users of wrench will have their databases upgraded to use the new tracking table by backfilling the missing history. New users of wrench will have both `SchemaMigrations` and `SchemaMigrationsHistory` from the start and no backfilling is necessary.
Showing
10 changed files
with
570 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,21 @@ | ||
CREATE TABLE Singers ( | ||
SingerID STRING(36) NOT NULL, | ||
FirstName STRING(1024), | ||
LastName STRING(1024), | ||
) PRIMARY KEY(SingerID); | ||
|
||
CREATE TABLE SchemaMigrations ( | ||
Version INT64 NOT NULL, | ||
Dirty BOOL NOT NULL, | ||
) PRIMARY KEY(Version); | ||
|
||
CREATE TABLE SchemaMigrationsHistory ( | ||
Version INT64 NOT NULL, | ||
Dirty BOOL NOT NULL, | ||
Created TIMESTAMP NOT NULL OPTIONS ( | ||
allow_commit_timestamp = true | ||
), | ||
Modified TIMESTAMP NOT NULL OPTIONS ( | ||
allow_commit_timestamp = true | ||
), | ||
) PRIMARY KEY(Version); |
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
Oops, something went wrong.