refactor: ApplyMigration > Apply, remove naming redundancy
This commit is contained in:
parent
0dc457ec9c
commit
455054add2
3 changed files with 5 additions and 5 deletions
|
@ -39,7 +39,7 @@ var up = &cobra.Command{
|
|||
migrationHistory, _ := migrationGraph.GetLinearHistory()
|
||||
for _, migration := range migrationHistory {
|
||||
log.Printf("%s", migration.Name)
|
||||
if err := migration.ApplyMigration(db); err != nil {
|
||||
if err := migration.Apply(db); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ func TestMigrateRunsSqlOnDBConnection(t *testing.T) {
|
|||
|
||||
migrationGraph, _ := NewMigrationGraphFromDirectory(root)
|
||||
migrations, err := migrationGraph.GetLinearHistory()
|
||||
err = migrations[0].ApplyMigration(mockDb)
|
||||
err = migrations[0].Apply(mockDb)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Expected no error returned, got %#v", err)
|
||||
|
@ -186,7 +186,7 @@ func TestMigrateReturnsErrorOnFailToReadMigrationFile(t *testing.T) {
|
|||
migrationPath := filepath.Join(root, "0001.sql")
|
||||
|
||||
migration := NewMigration(migrationPath, "0001.sql", "")
|
||||
err := migration.ApplyMigration(mockDb)
|
||||
err := migration.Apply(mockDb)
|
||||
|
||||
if err == nil {
|
||||
t.Errorf("Expected error returned, got nil")
|
||||
|
@ -203,7 +203,7 @@ func TestMigrateReturnsErrorOnFailToRunSQL(t *testing.T) {
|
|||
migrationGraph, _ := NewMigrationGraphFromDirectory(root)
|
||||
migrations, err := migrationGraph.GetLinearHistory()
|
||||
|
||||
err = migrations[0].ApplyMigration(mockDb)
|
||||
err = migrations[0].Apply(mockDb)
|
||||
|
||||
if err == nil {
|
||||
t.Errorf("Expected error returned, got nil")
|
||||
|
|
|
@ -47,7 +47,7 @@ func (m *Migration) Sql() (string, error) {
|
|||
//
|
||||
// If an error is returned while trying to read the migration file
|
||||
// or execute the SQL it contains, the error is returned.
|
||||
func (m *Migration) ApplyMigration(db DB) error {
|
||||
func (m *Migration) Apply(db DB) error {
|
||||
migrationSql, err := m.Sql()
|
||||
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue