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

Method TestRunMigrationObjOtherTable

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

Source from the content-addressed store, hash-verified

688}
689
690func (s *SqliteMigrateSuite) TestRunMigrationObjOtherTable(c *C) {
691 migrations := &MemoryMigrationSource{
692 Migrations: sqliteMigrations[:1],
693 }
694
695 ms := MigrationSet{TableName: "other_migrations"}
696 // Executes one migration
697 n, err := ms.Exec(s.Db, "sqlite3", migrations, Up)
698 c.Assert(err, IsNil)
699 c.Assert(n, Equals, 1)
700
701 // Can use table now
702 _, err = s.DbMap.Exec("SELECT * FROM people")
703 c.Assert(err, IsNil)
704
705 // Uses default tableName
706 _, err = s.DbMap.Exec("SELECT * FROM other_migrations")
707 c.Assert(err, IsNil)
708
709 // Shouldn't apply migration again
710 n, err = ms.Exec(s.Db, "sqlite3", migrations, Up)
711 c.Assert(err, IsNil)
712 c.Assert(n, Equals, 0)
713}
714
715func (*SqliteMigrateSuite) TestSetDisableCreateTable(c *C) {
716 c.Assert(migSet.DisableCreateTable, Equals, false)

Callers

nothing calls this directly

Calls 2

ExecMethod · 0.95
ExecMethod · 0.65

Tested by

no test coverage detected