mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
@@ -21,21 +21,21 @@ func (m *MigrationBase) GetCondition() MigrationCondition {
|
||||
return m.Condition
|
||||
}
|
||||
|
||||
type RawSqlMigration struct {
|
||||
type RawSQLMigration struct {
|
||||
MigrationBase
|
||||
|
||||
sql map[string]string
|
||||
}
|
||||
|
||||
func NewRawSqlMigration(sql string) *RawSqlMigration {
|
||||
m := &RawSqlMigration{}
|
||||
func NewRawSQLMigration(sql string) *RawSQLMigration {
|
||||
m := &RawSQLMigration{}
|
||||
if sql != "" {
|
||||
m.Default(sql)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *RawSqlMigration) Sql(dialect Dialect) string {
|
||||
func (m *RawSQLMigration) SQL(dialect Dialect) string {
|
||||
if m.sql != nil {
|
||||
if val := m.sql[dialect.DriverName()]; val != "" {
|
||||
return val
|
||||
@@ -46,10 +46,10 @@ func (m *RawSqlMigration) Sql(dialect Dialect) string {
|
||||
}
|
||||
}
|
||||
|
||||
return dialect.NoOpSql()
|
||||
return dialect.NoOpSQL()
|
||||
}
|
||||
|
||||
func (m *RawSqlMigration) Set(dialect string, sql string) *RawSqlMigration {
|
||||
func (m *RawSQLMigration) Set(dialect string, sql string) *RawSQLMigration {
|
||||
if m.sql == nil {
|
||||
m.sql = make(map[string]string)
|
||||
}
|
||||
@@ -58,23 +58,23 @@ func (m *RawSqlMigration) Set(dialect string, sql string) *RawSqlMigration {
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *RawSqlMigration) Default(sql string) *RawSqlMigration {
|
||||
func (m *RawSQLMigration) Default(sql string) *RawSQLMigration {
|
||||
return m.Set("default", sql)
|
||||
}
|
||||
|
||||
func (m *RawSqlMigration) Sqlite(sql string) *RawSqlMigration {
|
||||
return m.Set(SQLITE, sql)
|
||||
func (m *RawSQLMigration) SQLite(sql string) *RawSQLMigration {
|
||||
return m.Set(SQLite, sql)
|
||||
}
|
||||
|
||||
func (m *RawSqlMigration) Mysql(sql string) *RawSqlMigration {
|
||||
return m.Set(MYSQL, sql)
|
||||
func (m *RawSQLMigration) Mysql(sql string) *RawSQLMigration {
|
||||
return m.Set(MySQL, sql)
|
||||
}
|
||||
|
||||
func (m *RawSqlMigration) Postgres(sql string) *RawSqlMigration {
|
||||
return m.Set(POSTGRES, sql)
|
||||
func (m *RawSQLMigration) Postgres(sql string) *RawSQLMigration {
|
||||
return m.Set(Postgres, sql)
|
||||
}
|
||||
|
||||
func (m *RawSqlMigration) Mssql(sql string) *RawSqlMigration {
|
||||
func (m *RawSQLMigration) Mssql(sql string) *RawSQLMigration {
|
||||
return m.Set(MSSQL, sql)
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@ func (m *AddColumnMigration) Column(col *Column) *AddColumnMigration {
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *AddColumnMigration) Sql(dialect Dialect) string {
|
||||
return dialect.AddColumnSql(m.tableName, m.column)
|
||||
func (m *AddColumnMigration) SQL(dialect Dialect) string {
|
||||
return dialect.AddColumnSQL(m.tableName, m.column)
|
||||
}
|
||||
|
||||
type AddIndexMigration struct {
|
||||
@@ -121,8 +121,8 @@ func (m *AddIndexMigration) Table(tableName string) *AddIndexMigration {
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *AddIndexMigration) Sql(dialect Dialect) string {
|
||||
return dialect.CreateIndexSql(m.tableName, m.index)
|
||||
func (m *AddIndexMigration) SQL(dialect Dialect) string {
|
||||
return dialect.CreateIndexSQL(m.tableName, m.index)
|
||||
}
|
||||
|
||||
type DropIndexMigration struct {
|
||||
@@ -137,11 +137,11 @@ func NewDropIndexMigration(table Table, index *Index) *DropIndexMigration {
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *DropIndexMigration) Sql(dialect Dialect) string {
|
||||
func (m *DropIndexMigration) SQL(dialect Dialect) string {
|
||||
if m.index.Name == "" {
|
||||
m.index.Name = strings.Join(m.index.Cols, "_")
|
||||
}
|
||||
return dialect.DropIndexSql(m.tableName, m.index)
|
||||
return dialect.DropIndexSQL(m.tableName, m.index)
|
||||
}
|
||||
|
||||
type AddTableMigration struct {
|
||||
@@ -158,8 +158,8 @@ func NewAddTableMigration(table Table) *AddTableMigration {
|
||||
return &AddTableMigration{table: table}
|
||||
}
|
||||
|
||||
func (m *AddTableMigration) Sql(d Dialect) string {
|
||||
return d.CreateTableSql(&m.table)
|
||||
func (m *AddTableMigration) SQL(d Dialect) string {
|
||||
return d.CreateTableSQL(&m.table)
|
||||
}
|
||||
|
||||
type DropTableMigration struct {
|
||||
@@ -171,7 +171,7 @@ func NewDropTableMigration(tableName string) *DropTableMigration {
|
||||
return &DropTableMigration{tableName: tableName}
|
||||
}
|
||||
|
||||
func (m *DropTableMigration) Sql(d Dialect) string {
|
||||
func (m *DropTableMigration) SQL(d Dialect) string {
|
||||
return d.DropTable(m.tableName)
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ func (m *RenameTableMigration) Rename(oldName string, newName string) *RenameTab
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *RenameTableMigration) Sql(d Dialect) string {
|
||||
func (m *RenameTableMigration) SQL(d Dialect) string {
|
||||
return d.RenameTable(m.oldName, m.newName)
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ func NewCopyTableDataMigration(targetTable string, sourceTable string, colMap ma
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *CopyTableDataMigration) Sql(d Dialect) string {
|
||||
func (m *CopyTableDataMigration) SQL(d Dialect) string {
|
||||
return d.CopyTableData(m.sourceTable, m.targetTable, m.sourceCols, m.targetCols)
|
||||
}
|
||||
|
||||
@@ -227,6 +227,6 @@ func NewTableCharsetMigration(tableName string, columns []*Column) *TableCharset
|
||||
return &TableCharsetMigration{tableName: tableName, columns: columns}
|
||||
}
|
||||
|
||||
func (m *TableCharsetMigration) Sql(d Dialect) string {
|
||||
return d.UpdateTableSql(m.tableName, m.columns)
|
||||
func (m *TableCharsetMigration) SQL(d Dialect) string {
|
||||
return d.UpdateTableSQL(m.tableName, m.columns)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user