Skip to content

Commit

Permalink
remove
Browse files Browse the repository at this point in the history
  • Loading branch information
hwbrzzl committed Jan 6, 2025
1 parent 58f5392 commit 586e4b6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
19 changes: 19 additions & 0 deletions database/migration/migrator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,25 @@ func (s *DefaultMigratorSuite) TestCreate() {
}()
}

func (s *DefaultMigratorSuite) TestFresh() {
// Success
s.mockArtisan.EXPECT().Call("db:wipe --force").Return(nil).Once()
s.mockArtisan.EXPECT().Call("migrate").Return(nil).Once()

s.NoError(s.migrator.Fresh())

// db:wipe returns error
s.mockArtisan.EXPECT().Call("db:wipe --force").Return(assert.AnError).Once()

s.EqualError(s.migrator.Fresh(), assert.AnError.Error())

// migrate returns error
s.mockArtisan.EXPECT().Call("db:wipe --force").Return(nil).Once()
s.mockArtisan.EXPECT().Call("migrate").Return(assert.AnError).Once()

s.EqualError(s.migrator.Fresh(), assert.AnError.Error())
}

func (s *DefaultMigratorSuite) TestGetFilesForRollback() {
tests := []struct {
name string
Expand Down
18 changes: 8 additions & 10 deletions errors/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,14 @@ var (
LogDriverNotSupported = New("invalid driver: %s, only support stack, single, daily, custom").SetModule(ModuleLog)
LogEmptyLogFilePath = New("empty log file path").SetModule(ModuleLog)

MigrationCreateFailed = New("Create migration failed: %v")
MigrationFreshFailed = New("migration fresh failed: %v")
MigrationGetStatusFailed = New("get migration status failed: %v")
MigrationMigrateFailed = New("migrate failed: %v")
MigrationNameIsRequired = New("migration name cannot be empty")
MigrationRefreshFailed = New("migration refresh failed: %v")
MigrationResetFailed = New("migration reset failed: %v")
MigrationRollbackFailed = New("migration rollback failed: %v")
MigrationSqlMigratorInit = New("failed to init sql migration driver: %s")
MigrationUnsupportedDriver = New("unsupported migration driver: %s")
MigrationCreateFailed = New("Create migration failed: %v")
MigrationFreshFailed = New("migration fresh failed: %v")
MigrationGetStatusFailed = New("get migration status failed: %v")
MigrationMigrateFailed = New("migrate failed: %v")
MigrationNameIsRequired = New("migration name cannot be empty")
MigrationRefreshFailed = New("migration refresh failed: %v")
MigrationResetFailed = New("migration reset failed: %v")
MigrationRollbackFailed = New("migration rollback failed: %v")

OrmDatabaseConfigNotFound = New("not found database configuration")
OrmDriverNotSupported = New("invalid driver: %s, only support mysql, postgres, sqlite and sqlserver")
Expand Down

0 comments on commit 586e4b6

Please sign in to comment.