fix postgres migration error
This commit is contained in:
parent
3ba2c9ab3a
commit
2a512d1448
3 changed files with 6 additions and 5 deletions
|
@ -33,9 +33,9 @@ func Connect() (*db.DB, error) {
|
||||||
driver = "sqlite3"
|
driver = "sqlite3"
|
||||||
config = ":memory:?_foreign_keys=1"
|
config = ":memory:?_foreign_keys=1"
|
||||||
)
|
)
|
||||||
if os.Getenv("DATABASE_DRIVER") != "" {
|
if os.Getenv("DRONE_DATABASE_DRIVER") != "" {
|
||||||
driver = os.Getenv("DATABASE_DRIVER")
|
driver = os.Getenv("DRONE_DATABASE_DRIVER")
|
||||||
config = os.Getenv("DATABASE_CONFIG")
|
config = os.Getenv("DRONE_DATABASE_DATASOURCE")
|
||||||
}
|
}
|
||||||
return db.Connect(driver, config)
|
return db.Connect(driver, config)
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ func Reset(d *db.DB) {
|
||||||
tx.Exec("DELETE FROM perms")
|
tx.Exec("DELETE FROM perms")
|
||||||
tx.Exec("DELETE FROM repos")
|
tx.Exec("DELETE FROM repos")
|
||||||
tx.Exec("DELETE FROM users")
|
tx.Exec("DELETE FROM users")
|
||||||
|
tx.Exec("DELETE FROM orgsecrets")
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -545,7 +545,7 @@ ALTER TABLE builds ADD COLUMN build_cron VARCHAR(50) NOT NULL DEFAULT '';
|
||||||
|
|
||||||
var createTableOrgSecrets = `
|
var createTableOrgSecrets = `
|
||||||
CREATE TABLE IF NOT EXISTS orgsecrets (
|
CREATE TABLE IF NOT EXISTS orgsecrets (
|
||||||
secret_id INTEGER PRIMARY KEY AUTOINCREMENT
|
secret_id SERIAL PRIMARY KEY
|
||||||
,secret_namespace VARCHAR(50)
|
,secret_namespace VARCHAR(50)
|
||||||
,secret_name VARCHAR(200)
|
,secret_name VARCHAR(200)
|
||||||
,secret_type VARCHAR(50)
|
,secret_type VARCHAR(50)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
-- name: create-table-org-secrets
|
-- name: create-table-org-secrets
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS orgsecrets (
|
CREATE TABLE IF NOT EXISTS orgsecrets (
|
||||||
secret_id INTEGER PRIMARY KEY AUTOINCREMENT
|
secret_id SERIAL PRIMARY KEY
|
||||||
,secret_namespace VARCHAR(50)
|
,secret_namespace VARCHAR(50)
|
||||||
,secret_name VARCHAR(200)
|
,secret_name VARCHAR(200)
|
||||||
,secret_type VARCHAR(50)
|
,secret_type VARCHAR(50)
|
||||||
|
|
Loading…
Reference in a new issue