diff --git a/persistence/versions.go b/persistence/versions.go index 1e61744..c3bfc3e 100644 --- a/persistence/versions.go +++ b/persistence/versions.go @@ -64,7 +64,7 @@ func (p Profile) check_and_update_version() error { if ENGINE_DATABASE_VERSION > version { fmt.Printf("Upgrading database from version %d to version %d", version, ENGINE_DATABASE_VERSION) - p.UpgradeFromXToY(version, ENGINE_DATABASE_VERSION) + return p.UpgradeFromXToY(version, ENGINE_DATABASE_VERSION) } return nil diff --git a/persistence/versions_test.go b/persistence/versions_test.go index f229559..d633f25 100644 --- a/persistence/versions_test.go +++ b/persistence/versions_test.go @@ -25,7 +25,10 @@ func TestVersionUpgrade(t *testing.T) { } persistence.MIGRATIONS = append(persistence.MIGRATIONS, test_migration) - profile.UpgradeFromXToY(persistence.ENGINE_DATABASE_VERSION, persistence.ENGINE_DATABASE_VERSION + 1) + err := profile.UpgradeFromXToY(persistence.ENGINE_DATABASE_VERSION, persistence.ENGINE_DATABASE_VERSION + 1) + if err != nil { + panic(err) + } if !profile.IsTweetInDatabase(test_tweet_id) { t.Errorf("Migration should have created the tweet, but it didn't")