-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a migration that fails telling the user that upgrade is not supported #711
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #711 +/- ##
===========================================
- Coverage 53.03% 53.03% -0.01%
===========================================
Files 23 23
Lines 3622 3624 +2
===========================================
+ Hits 1921 1922 +1
- Misses 1444 1445 +1
Partials 257 257
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea
@@ -199,8 +201,13 @@ func sqlMigration(db *IndexerDb, state *types.MigrationState, sqlLines []string) | |||
const unsupportedMigrationErrorMsg = "unsupported migration: please downgrade to %s to run this migration" | |||
|
|||
// disabled creates a simple migration handler for unsupported migrations. | |||
//lint:ignore U1000 this function might be used in the future | |||
func disabled(version string) func(db *IndexerDb, migrationState *types.MigrationState) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOL, that was short-lived.
idb/postgres/postgres_migrations.go
Outdated
func disabled(version string) func(db *IndexerDb, migrationState *types.MigrationState) error { | ||
return func(_ *IndexerDb, _ *types.MigrationState) error { | ||
return fmt.Errorf(unsupportedMigrationErrorMsg, version) | ||
} | ||
} | ||
|
||
func upgradeNotSupported(db *IndexerDb, migrationState *types.MigrationState) error { | ||
return errors.New("upgrading to Indexer 2.7 is not supported; create a new database") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is slightly more accurate and would still be correct when we reach 2.8.
return errors.New("upgrading to Indexer 2.7 is not supported; create a new database") | |
return errors.New("upgrading from this version is not supported; create a new database") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea
No description provided.