| 44 | } |
| 45 | |
| 46 | func (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 | |
| 66 | func (s *SqliteMigrateSuite) TestRunMigrationEscapeTable(c *C) { |
| 67 | migrations := &MemoryMigrationSource{ |