Add SQLite query for v9 migration

This commit is contained in:
Matt Baer 2020-05-06 14:08:48 -04:00
parent b9c467558c
commit 5fe1dd1731

View file

@ -17,7 +17,11 @@ func optimizeDrafts(db *datastore) error {
return err
}
_, err = t.Exec(`ALTER TABLE posts ADD INDEX(owner_id, id)`)
if db.driverName == driverSQLite {
_, err = t.Exec(`CREATE INDEX key_owner_post_id ON posts (owner_id, id)`)
} else {
_, err = t.Exec(`ALTER TABLE posts ADD INDEX(owner_id, id)`)
}
if err != nil {
t.Rollback()
return err