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

Method TestAlphaNumericMigrations

toapply_test.go:81–102  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

79}
80
81func (*ToApplyMigrateSuite) TestAlphaNumericMigrations(c *C) {
82 migrations := byId([]*Migration{
83 {Id: "10_abc", Up: nil, Down: nil},
84 {Id: "1_abc", Up: nil, Down: nil},
85 {Id: "efg", Up: nil, Down: nil},
86 {Id: "2_cde", Up: nil, Down: nil},
87 {Id: "35_cde", Up: nil, Down: nil},
88 })
89
90 sort.Sort(migrations)
91
92 toApplyUp := ToApply(migrations, "2_cde", Up)
93 c.Assert(toApplyUp, HasLen, 3)
94 c.Assert(toApplyUp[0].Id, Equals, "10_abc")
95 c.Assert(toApplyUp[1].Id, Equals, "35_cde")
96 c.Assert(toApplyUp[2].Id, Equals, "efg")
97
98 toApplyDown := ToApply(migrations, "2_cde", Down)
99 c.Assert(toApplyDown, HasLen, 2)
100 c.Assert(toApplyDown[0].Id, Equals, "2_cde")
101 c.Assert(toApplyDown[1].Id, Equals, "1_abc")
102}

Callers

nothing calls this directly

Calls 2

byIdTypeAlias · 0.85
ToApplyFunction · 0.85

Tested by

no test coverage detected