mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
MySQL: Dashboard.data column type changed to mediumtext (sql migration added), Fixes #1863
This commit is contained in:
parent
d92fae07a5
commit
8526025792
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
**Fixes**
|
**Fixes**
|
||||||
- [Issue #1857](https://github.com/grafana/grafana/issues/1857). /api/login/ping Fix for issue when behind reverse proxy and subpath
|
- [Issue #1857](https://github.com/grafana/grafana/issues/1857). /api/login/ping Fix for issue when behind reverse proxy and subpath
|
||||||
|
- [Issue #1863](https://github.com/grafana/grafana/issues/1863). MySQL: Dashboard.data column type changed to mediumtext (sql migration added)
|
||||||
|
|
||||||
# 2.0.2 (2015-04-22)
|
# 2.0.2 (2015-04-22)
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ import (
|
|||||||
func InitTestDB(t *testing.T) {
|
func InitTestDB(t *testing.T) {
|
||||||
|
|
||||||
t.Log("InitTestDB")
|
t.Log("InitTestDB")
|
||||||
x, err := xorm.NewEngine(sqlutil.TestDB_Sqlite3.DriverName, sqlutil.TestDB_Sqlite3.ConnStr)
|
//x, err := xorm.NewEngine(sqlutil.TestDB_Sqlite3.DriverName, sqlutil.TestDB_Sqlite3.ConnStr)
|
||||||
//x, err := xorm.NewEngine(sqlutil.TestDB_Mysql.DriverName, sqlutil.TestDB_Mysql.ConnStr)
|
//x, err := xorm.NewEngine(sqlutil.TestDB_Mysql.DriverName, sqlutil.TestDB_Mysql.ConnStr)
|
||||||
//x, err := xorm.NewEngine(sqlutil.TestDB_Postgres.DriverName, sqlutil.TestDB_Postgres.ConnStr)
|
x, err := xorm.NewEngine(sqlutil.TestDB_Postgres.DriverName, sqlutil.TestDB_Postgres.ConnStr)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to init in memory sqllite3 db %v", err)
|
t.Fatalf("Failed to init in memory sqllite3 db %v", err)
|
||||||
|
@ -86,4 +86,10 @@ func addDashboardMigration(mg *Migrator) {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
mg.AddMigration("drop table dashboard_v1", NewDropTableMigration("dashboard_v1"))
|
mg.AddMigration("drop table dashboard_v1", NewDropTableMigration("dashboard_v1"))
|
||||||
|
|
||||||
|
// change column type of dashboard.data
|
||||||
|
mg.AddMigration("alter dashboard.data to mediumtext v1", new(RawSqlMigration).
|
||||||
|
Sqlite("SELECT 0 WHERE 0;").
|
||||||
|
Postgres("SELECT 0;").
|
||||||
|
Mysql("ALTER TABLE dashboard MODIFY data MEDIUMTEXT;"))
|
||||||
}
|
}
|
||||||
|
@ -48,4 +48,10 @@ func addDashboardSnapshotMigrations(mg *Migrator) {
|
|||||||
|
|
||||||
mg.AddMigration("create dashboard_snapshot table v5 #2", NewAddTableMigration(snapshotV5))
|
mg.AddMigration("create dashboard_snapshot table v5 #2", NewAddTableMigration(snapshotV5))
|
||||||
addTableIndicesMigrations(mg, "v5", snapshotV5)
|
addTableIndicesMigrations(mg, "v5", snapshotV5)
|
||||||
|
|
||||||
|
// ncrease data type
|
||||||
|
mg.AddMigration("alter dashboard_snapshot.data to mediumtext v1", new(RawSqlMigration).
|
||||||
|
Sqlite("SELECT 0 WHERE 0;").
|
||||||
|
Postgres("SELECT 0;").
|
||||||
|
Mysql("ALTER TABLE dashboard_snapshot.data MODIFY data MEDIUMTEXT;"))
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,9 @@ func (m *MigrationBase) GetCondition() MigrationCondition {
|
|||||||
type RawSqlMigration struct {
|
type RawSqlMigration struct {
|
||||||
MigrationBase
|
MigrationBase
|
||||||
|
|
||||||
sqlite string
|
sqlite string
|
||||||
mysql string
|
mysql string
|
||||||
|
postgres string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *RawSqlMigration) Sql(dialect Dialect) string {
|
func (m *RawSqlMigration) Sql(dialect Dialect) string {
|
||||||
@ -35,6 +36,8 @@ func (m *RawSqlMigration) Sql(dialect Dialect) string {
|
|||||||
return m.mysql
|
return m.mysql
|
||||||
case SQLITE:
|
case SQLITE:
|
||||||
return m.sqlite
|
return m.sqlite
|
||||||
|
case POSTGRES:
|
||||||
|
return m.postgres
|
||||||
}
|
}
|
||||||
|
|
||||||
panic("db type not supported")
|
panic("db type not supported")
|
||||||
@ -50,6 +53,11 @@ func (m *RawSqlMigration) Mysql(sql string) *RawSqlMigration {
|
|||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *RawSqlMigration) Postgres(sql string) *RawSqlMigration {
|
||||||
|
m.postgres = sql
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
type AddColumnMigration struct {
|
type AddColumnMigration struct {
|
||||||
MigrationBase
|
MigrationBase
|
||||||
tableName string
|
tableName string
|
||||||
|
Loading…
Reference in New Issue
Block a user