diff --git a/store/shared/db/dbtest/dbtest.go b/store/shared/db/dbtest/dbtest.go index b2e43b65..0fb780a8 100644 --- a/store/shared/db/dbtest/dbtest.go +++ b/store/shared/db/dbtest/dbtest.go @@ -33,9 +33,9 @@ func Connect() (*db.DB, error) { driver = "sqlite3" config = ":memory:?_foreign_keys=1" ) - if os.Getenv("DATABASE_DRIVER") != "" { - driver = os.Getenv("DATABASE_DRIVER") - config = os.Getenv("DATABASE_CONFIG") + if os.Getenv("DRONE_DATABASE_DRIVER") != "" { + driver = os.Getenv("DRONE_DATABASE_DRIVER") + config = os.Getenv("DRONE_DATABASE_DATASOURCE") } return db.Connect(driver, config) } @@ -51,6 +51,7 @@ func Reset(d *db.DB) { tx.Exec("DELETE FROM perms") tx.Exec("DELETE FROM repos") tx.Exec("DELETE FROM users") + tx.Exec("DELETE FROM orgsecrets") return nil }) } diff --git a/store/shared/migrate/postgres/ddl_gen.go b/store/shared/migrate/postgres/ddl_gen.go index 08ac0450..7246dad7 100644 --- a/store/shared/migrate/postgres/ddl_gen.go +++ b/store/shared/migrate/postgres/ddl_gen.go @@ -545,7 +545,7 @@ ALTER TABLE builds ADD COLUMN build_cron VARCHAR(50) NOT NULL DEFAULT ''; var createTableOrgSecrets = ` CREATE TABLE IF NOT EXISTS orgsecrets ( - secret_id INTEGER PRIMARY KEY AUTOINCREMENT + secret_id SERIAL PRIMARY KEY ,secret_namespace VARCHAR(50) ,secret_name VARCHAR(200) ,secret_type VARCHAR(50) diff --git a/store/shared/migrate/postgres/files/012_create_table_org_secrets.sql b/store/shared/migrate/postgres/files/012_create_table_org_secrets.sql index 269f7aed..7541ff06 100644 --- a/store/shared/migrate/postgres/files/012_create_table_org_secrets.sql +++ b/store/shared/migrate/postgres/files/012_create_table_org_secrets.sql @@ -1,7 +1,7 @@ -- name: create-table-org-secrets CREATE TABLE IF NOT EXISTS orgsecrets ( - secret_id INTEGER PRIMARY KEY AUTOINCREMENT + secret_id SERIAL PRIMARY KEY ,secret_namespace VARCHAR(50) ,secret_name VARCHAR(200) ,secret_type VARCHAR(50)