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

Method TestRunMigration

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

Source from the content-addressed store, hash-verified

44}
45
46func (s *SqliteMigrateSuite) TestRunMigration(c *C) {
47 migrations := &MemoryMigrationSource{
48 Migrations: sqliteMigrations[:1],
49 }
50
51 // Executes one migration
52 n, err := Exec(s.Db, "sqlite3", migrations, Up)
53 c.Assert(err, IsNil)
54 c.Assert(n, Equals, 1)
55
56 // Can use table now
57 _, err = s.DbMap.Exec("SELECT * FROM people")
58 c.Assert(err, IsNil)
59
60 // Shouldn't apply migration again
61 n, err = Exec(s.Db, "sqlite3", migrations, Up)
62 c.Assert(err, IsNil)
63 c.Assert(n, Equals, 0)
64}
65
66func (s *SqliteMigrateSuite) TestRunMigrationEscapeTable(c *C) {
67 migrations := &MemoryMigrationSource{

Callers

nothing calls this directly

Calls 2

ExecFunction · 0.85
ExecMethod · 0.65

Tested by

no test coverage detected