MCPcopy
hub / github.com/rubenv/sql-migrate / Less

Method Less

migrate.go:136–147  ·  view source on GitHub ↗
(other *Migration)

Source from the content-addressed store, hash-verified

134}
135
136func (m Migration) Less(other *Migration) bool {
137 switch {
138 case m.isNumeric() && other.isNumeric() && m.VersionInt() != other.VersionInt():
139 return m.VersionInt() < other.VersionInt()
140 case m.isNumeric() && !other.isNumeric():
141 return true
142 case !m.isNumeric() && other.isNumeric():
143 return false
144 default:
145 return m.Id < other.Id
146 }
147}
148
149func (m Migration) isNumeric() bool {
150 return len(m.NumberPrefixMatches()) > 0

Callers

nothing calls this directly

Calls 2

isNumericMethod · 0.95
VersionIntMethod · 0.95

Tested by

no test coverage detected