mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
doh. fix migration for sqlite
This commit is contained in:
parent
860c611a37
commit
911e5f41a3
1 changed files with 4 additions and 8 deletions
|
@ -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)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue