-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
testutils/db: use schema provided by migrate data during export #445
Conversation
internal/testutil/db.go
Outdated
@@ -672,6 +672,8 @@ func TestMigrate(t *testing.T, lastVersion uint, dataFixtures DataFixtures, setu | |||
|
|||
assert.Assert(t, len(diff) == 0, "schema of db created at version %d and db migrated from version %d to version %d is different:\n %s", migrateVersion, createVersion, migrateVersion, diff) | |||
|
|||
dc.Schema = createDC.Schema |
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.
please add a comment explaining the reason of this change.
internal/testutil/db.go
Outdated
@@ -672,6 +672,8 @@ func TestMigrate(t *testing.T, lastVersion uint, dataFixtures DataFixtures, setu | |||
|
|||
assert.Assert(t, len(diff) == 0, "schema of db created at version %d and db migrated from version %d to version %d is different:\n %s", migrateVersion, createVersion, migrateVersion, diff) | |||
|
|||
dc.Schema = createDC.Schema |
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'll prefer to use the source variable:
dc.Schema = createDataCreate.Tables
63b42b6
to
1456af2
Compare
internal/testutil/db.go
Outdated
@@ -672,6 +672,9 @@ func TestMigrate(t *testing.T, lastVersion uint, dataFixtures DataFixtures, setu | |||
|
|||
assert.Assert(t, len(diff) == 0, "schema of db created at version %d and db migrated from version %d to version %d is different:\n %s", migrateVersion, createVersion, migrateVersion, diff) | |||
|
|||
// MigrateToVersion update the db schema but not change the DBContext |
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.
// set the db schema at the migrated version.
1456af2
to
fd0e079
Compare
When exporting, use schema provided by migrate data and not the create data since the migration change the db shema to the migrate version.
fd0e079
to
1b4e220
Compare
When exporting, use schema provided by migrate data and not the create data since the migration change the db shema to the migrate version.