MCPcopy Index your code
hub / github.com/rubenv/sql-migrate / TestMigrateDownFull

Method TestMigrateDownFull

migrate_test.go:271–298  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

269}
270
271func (s *SqliteMigrateSuite) TestMigrateDownFull(c *C) {
272 migrations := &FileMigrationSource{
273 Dir: "test-migrations",
274 }
275
276 n, err := Exec(s.Db, "sqlite3", migrations, Up)
277 c.Assert(err, IsNil)
278 c.Assert(n, Equals, 2)
279
280 // Has data
281 id, err := s.DbMap.SelectInt("SELECT id FROM people")
282 c.Assert(err, IsNil)
283 c.Assert(id, Equals, int64(1))
284
285 // Undo the last one
286 n, err = Exec(s.Db, "sqlite3", migrations, Down)
287 c.Assert(err, IsNil)
288 c.Assert(n, Equals, 2)
289
290 // Cannot query it anymore
291 _, err = s.DbMap.SelectInt("SELECT COUNT(*) FROM people")
292 c.Assert(err, Not(IsNil))
293
294 // Nothing left to do.
295 n, err = Exec(s.Db, "sqlite3", migrations, Down)
296 c.Assert(err, IsNil)
297 c.Assert(n, Equals, 0)
298}
299
300func (s *SqliteMigrateSuite) TestMigrateTransaction(c *C) {
301 migrations := &MemoryMigrationSource{

Callers

nothing calls this directly

Calls 1

ExecFunction · 0.85

Tested by

no test coverage detected