aboutsummaryrefslogtreecommitdiffstats
path: root/internal/models
diff options
context:
space:
mode:
Diffstat (limited to 'internal/models')
-rw-r--r--internal/models/migration.go15
-rw-r--r--internal/models/migration_test.go7
2 files changed, 4 insertions, 18 deletions
diff --git a/internal/models/migration.go b/internal/models/migration.go
index a449c44..f647a1b 100644
--- a/internal/models/migration.go
+++ b/internal/models/migration.go
@@ -2,7 +2,6 @@ package models
import (
"fmt"
- "strings"
"time"
)
@@ -21,19 +20,13 @@ func NewMigration(timestamp time.Time, message string) *Migration {
return &Migration{Version: version, Message: message, Applied: false}
}
-func (m *Migration) NormalizedMessage() string {
- lowercaseMessage := strings.ToLower(m.Message)
- trimmedMessage := strings.TrimSpace(lowercaseMessage)
- return strings.ReplaceAll(trimmedMessage, " ", "_")
-}
-
func (m *Migration) String() string {
- checked := " "
+ checkmark := " "
if m.Applied {
- checked = "x"
+ checkmark = "x"
}
- message := m.NormalizedMessage()
+ message := m.Message
if len(message) > 0 {
message = fmt.Sprintf("- %s ", message)
}
@@ -42,6 +35,6 @@ func (m *Migration) String() string {
"%s %s- [%s]",
m.Version,
message,
- checked,
+ checkmark,
)
}
diff --git a/internal/models/migration_test.go b/internal/models/migration_test.go
index b25f137..8d1fb06 100644
--- a/internal/models/migration_test.go
+++ b/internal/models/migration_test.go
@@ -27,14 +27,7 @@ func TestAppliedNewMigration(t *testing.T) {
assert.Equal(t, m.String(), "20200101000000 - test_message - [x]")
}
-func TestNewMigrationMessageIsNormalized(t *testing.T) {
- m := models.NewMigration(timestamp, " test MESSAGE ")
- assert.Equal(t, m.NormalizedMessage(), "test_message")
-}
-
func TestEmptyMessageMigration(t *testing.T) {
m := models.NewMigration(timestamp, "")
-
- assert.Equal(t, "", m.NormalizedMessage())
assert.Equal(t, "20200101000000 - [ ]", m.String())
}