doh. fix migration for sqlite

This commit is contained in:
Brad Rydzewski 2017-06-01 14:47:06 +02:00
parent 860c611a37
commit 911e5f41a3

View file

@ -51,12 +51,8 @@ func checkPriorMigration(db *sql.DB) error {
// version 0.7 or higher and will fail. // version 0.7 or higher and will fail.
return errors.New("Please upgrade to 0.6 before upgrading to 0.7+") return errors.New("Please upgrade to 0.6 before upgrading to 0.7+")
} }
if _, err := db.Exec(createMigrationsTable); err != nil { db.Exec(createMigrationsTable)
return err db.Exec(legacyMigrationsImport)
}
if _, err := db.Exec(legacyMigrationsImport); err != nil {
return err
}
return nil return nil
} }
@ -74,7 +70,7 @@ LIMIT 1
` `
var legacyMigrationsImport = ` var legacyMigrationsImport = `
INSERT IGNORE INTO migrations (name) VALUES INSERT INTO migrations (name) VALUES
('create-table-users') ('create-table-users')
,('create-table-repos') ,('create-table-repos')
,('create-table-builds') ,('create-table-builds')
@ -98,7 +94,7 @@ INSERT IGNORE INTO migrations (name) VALUES
` `
var createMigrationsTable = ` var createMigrationsTable = `
CREATE TABLE IF NOT EXISTS migrations ( CREATE TABLE migrations (
name VARCHAR(255) name VARCHAR(255)
,UNIQUE(name) ,UNIQUE(name)
) )