Chore: Fix SQL related Go variable naming (#28887)

* Chore: Fix variable naming

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2020-11-11 06:21:08 +01:00
committed by GitHub
parent 7abf0506b1
commit b5379c5335
68 changed files with 377 additions and 376 deletions
@@ -122,17 +122,17 @@ func addDataSourceMigration(mg *Migrator) {
}))
const setVersionToOneWhereZero = `UPDATE data_source SET version = 1 WHERE version = 0`
mg.AddMigration("Update initial version to 1", NewRawSqlMigration(setVersionToOneWhereZero))
mg.AddMigration("Update initial version to 1", NewRawSQLMigration(setVersionToOneWhereZero))
mg.AddMigration("Add read_only data column", NewAddColumnMigration(tableV2, &Column{
Name: "read_only", Type: DB_Bool, Nullable: true,
}))
const migrateLoggingToLoki = `UPDATE data_source SET type = 'loki' WHERE type = 'logging'`
mg.AddMigration("Migrate logging ds to loki ds", NewRawSqlMigration(migrateLoggingToLoki))
mg.AddMigration("Migrate logging ds to loki ds", NewRawSQLMigration(migrateLoggingToLoki))
const setEmptyJSONWhereNullJSON = `UPDATE data_source SET json_data = '{}' WHERE json_data is null`
mg.AddMigration("Update json_data with nulls", NewRawSqlMigration(setEmptyJSONWhereNullJSON))
mg.AddMigration("Update json_data with nulls", NewRawSQLMigration(setEmptyJSONWhereNullJSON))
// add column uid for linking
mg.AddMigration("Add uid column", NewAddColumnMigration(tableV2, &Column{
@@ -142,8 +142,8 @@ func addDataSourceMigration(mg *Migrator) {
// Initialize as id as that is unique already
mg.AddMigration(
"Update uid value",
NewRawSqlMigration("").
Sqlite("UPDATE data_source SET uid=printf('%09d',id);").
NewRawSQLMigration("").
SQLite("UPDATE data_source SET uid=printf('%09d',id);").
Postgres("UPDATE data_source SET uid=lpad('' || id::text,9,'0');").
Mysql("UPDATE data_source SET uid=lpad(id,9,'0');"),
)