Merge branch 'master' into editable_false
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gosimple/slug"
|
||||
"github.com/dalu/slug"
|
||||
)
|
||||
|
||||
// Typed errors
|
||||
|
||||
@@ -86,4 +86,10 @@ func addDashboardMigration(mg *Migrator) {
|
||||
}))
|
||||
|
||||
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))
|
||||
addTableIndicesMigrations(mg, "v5", snapshotV5)
|
||||
|
||||
// change column type of dashboard
|
||||
mg.AddMigration("alter dashboard_snapshot to mediumtext v2", new(RawSqlMigration).
|
||||
Sqlite("SELECT 0 WHERE 0;").
|
||||
Postgres("SELECT 0;").
|
||||
Mysql("ALTER TABLE dashboard_snapshot MODIFY dashboard MEDIUMTEXT;"))
|
||||
}
|
||||
|
||||
@@ -25,8 +25,9 @@ func (m *MigrationBase) GetCondition() MigrationCondition {
|
||||
type RawSqlMigration struct {
|
||||
MigrationBase
|
||||
|
||||
sqlite string
|
||||
mysql string
|
||||
sqlite string
|
||||
mysql string
|
||||
postgres string
|
||||
}
|
||||
|
||||
func (m *RawSqlMigration) Sql(dialect Dialect) string {
|
||||
@@ -35,6 +36,8 @@ func (m *RawSqlMigration) Sql(dialect Dialect) string {
|
||||
return m.mysql
|
||||
case SQLITE:
|
||||
return m.sqlite
|
||||
case POSTGRES:
|
||||
return m.postgres
|
||||
}
|
||||
|
||||
panic("db type not supported")
|
||||
@@ -50,6 +53,11 @@ func (m *RawSqlMigration) Mysql(sql string) *RawSqlMigration {
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *RawSqlMigration) Postgres(sql string) *RawSqlMigration {
|
||||
m.postgres = sql
|
||||
return m
|
||||
}
|
||||
|
||||
type AddColumnMigration struct {
|
||||
MigrationBase
|
||||
tableName string
|
||||
|
||||
Reference in New Issue
Block a user