Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: golden/go/db/db.go

Issue 813443002: Overhaul database package (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « go/database/testutil/testutil.go ('k') | golden/go/db/db_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: golden/go/db/db.go
diff --git a/golden/go/db/db.go b/golden/go/db/db.go
index 99277cc245e92a5fde5d4d82a83aca8224495493..ca0b0454353b6bf9ec53e79d453ddfd2a61c1571 100644
--- a/golden/go/db/db.go
+++ b/golden/go/db/db.go
@@ -30,9 +30,9 @@ func MigrationSteps() []database.MigrationStep {
// GetConfig returns a DatabaseConfig instance for running in production if a
// metadata server is available. If 'local' is true it will always
-// set the MySQL connection string to "" and thus use a local SQLite database
-// when used with database.NewVersionedDB.
-func GetConfig(mySQLConnStr string, sqlitePath string, local bool) *database.DatabaseConfig {
+// set the MySQL connection string to "" and thus use a local MySQL test
+// database when used with database.NewVersionedDB.
+func GetConfig(mySQLConnStr string, local bool) *database.DatabaseConfig {
useMySQLConnStr := mySQLConnStr
// We are in the production environment, so we look up the password.
@@ -47,15 +47,18 @@ func GetConfig(mySQLConnStr string, sqlitePath string, local bool) *database.Dat
}
// If there is still a placeholder in the connection string, we
- // set it to empty, so that the the local SQLite database kicks in.
+ // set it to empty, so that the the local MySQL test database kicks in.
if strings.Contains(useMySQLConnStr, "%s") {
useMySQLConnStr = ""
}
- return &database.DatabaseConfig{
- MySQLString: useMySQLConnStr,
- SQLiteFilePath: sqlitePath,
- MigrationSteps: migrationSteps,
+ if useMySQLConnStr != "" {
+ return &database.DatabaseConfig{
+ MySQLString: useMySQLConnStr,
+ MigrationSteps: migrationSteps,
+ }
+ } else {
+ return database.LocalTestDatabaseConfig(migrationSteps)
}
}
@@ -97,17 +100,6 @@ var migrationSteps = []database.MigrationStep{
MySQLDown: []string{
`DROP TABLE expectations`,
},
- SQLiteUp: []string{
- `CREATE TABLE expectations (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- userid TEXT NOT NULL,
- ts BIGINT NOT NULL,
- expectations MEDIUXMTEXT NOT NULL
- )`,
- },
- SQLiteDown: []string{
- `DROP TABLE expectations`,
- },
},
// Use this is a template for more migration steps.
@@ -115,7 +107,5 @@ var migrationSteps = []database.MigrationStep{
// {
// MySQLUp: ,
// MySQLDown: ,
- // SQLiteUp: ,
- // SQLiteDown: ,
// },
}
« no previous file with comments | « go/database/testutil/testutil.go ('k') | golden/go/db/db_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698