migrate
migrate copied to clipboard
m.Drop() throws error with sqlite databases
I get this error when running m.Drop()
:
table sqlite_sequence may not be dropped in line 0: DROP TABLE sqlite_sequence in line 0: DROP TABLE sqlite_sequence
package main
import (
"database/sql"
"log"
"github.com/mattes/migrate"
"github.com/mattes/migrate/database/sqlite3"
_ "github.com/mattes/migrate/source/file"
)
func main() {
db, _ := sql.Open("sqlite3", "test.sqlite3?_foreign_keys=1")
driver, _ := sqlite3.WithInstance(db, &sqlite3.Config{})
m, _ := migrate.NewWithDatabaseInstance(
"file://",
"sqlite3", driver)
m.Up()
err := m.Drop()
log.Println(err)
}
So maybe .Drop()
should exclude the sqlite_sequence
table?
There's something else needed to trigger this bug (?). I'm trying tonight to find out what exactly.