diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2024-01-19 23:27:27 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2024-01-19 23:27:27 -0500 |
| commit | db7de4b31b1836abed822077840665639f0d66da (patch) | |
| tree | d58769374a346778ffff35e6cf56a27e6067f237 /internal/repositories/migration_db_repo_test.go | |
| parent | Fix typo in output when a user has no migrations (diff) | |
| download | cli-db7de4b31b1836abed822077840665639f0d66da.zip | |
Add ability to use sequential or timestamp-based versions
Diffstat (limited to 'internal/repositories/migration_db_repo_test.go')
| -rw-r--r-- | internal/repositories/migration_db_repo_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/repositories/migration_db_repo_test.go b/internal/repositories/migration_db_repo_test.go index 55b8eb2..dc635b0 100644 --- a/internal/repositories/migration_db_repo_test.go +++ b/internal/repositories/migration_db_repo_test.go @@ -131,7 +131,7 @@ func TestMigrationDBRepo_Apply(t *testing.T) { repo, err := repositories.NewMigrationDBRepo(db) assert.NilError(t, err) - migration := models.NewMigration(time.Now(), "test") + migration := models.NewTimestampMigration(time.Now(), "test") err = repo.Apply(`CREATE TABLE tmp(id INT NOT NULL PRIMARY KEY)`, migration) assert.NilError(t, err) assert.Equal(t, migration.Applied, true) @@ -158,7 +158,7 @@ func TestMigrationDBRepo_Revert(t *testing.T) { _, err = db.Exec(`CREATE TABLE tmp(id INT NOT NULL PRIMARY KEY)`) assert.NilError(t, err) - migration := models.NewMigration(time.Now(), "test") + migration := models.NewTimestampMigration(time.Now(), "test") _, err = db.Exec( `INSERT INTO bolt_migrations(version) VALUES ($1);`, migration.Version, @@ -194,7 +194,7 @@ func TestMigrationDBRepo_ApplyAndRevertWithoutTransaction(t *testing.T) { _, err = db.Exec("CREATE TABLE tmp(id INT PRIMARY KEY, id2 INT, id3 INT)") assert.NilError(t, err) - migration := models.NewMigration(time.Now(), "test") + migration := models.NewTimestampMigration(time.Now(), "test") // CREATE INDEX CONCURRENTLY cannot run inside a transaction. err = repo.Apply( `-- bolt: no-transaction\CREATE INDEX CONCURRENTLY i1 ON tmp(id2);`, @@ -215,7 +215,7 @@ func TestMigrationDBRepo_ApplyMalformedSql(t *testing.T) { db := bolttest.NewTestDB(t, "postgres") repo, err := repositories.NewMigrationDBRepo(db) assert.NilError(t, err) - migration := models.NewMigration(time.Now(), "test") + migration := models.NewTimestampMigration(time.Now(), "test") err = repo.Apply("this is not SQL", migration) assert.ErrorContains(t, err, "syntax error") @@ -230,7 +230,7 @@ func TestMigrationDBRepo_RevertMalformedSql(t *testing.T) { db := bolttest.NewTestDB(t, "postgres") repo, err := repositories.NewMigrationDBRepo(db) assert.NilError(t, err) - migration := models.NewMigration(time.Now(), "test") + migration := models.NewTimestampMigration(time.Now(), "test") migration.Applied = true err = repo.Revert("this is not SQL", migration) |