Merge pull request #1199 from hmhealey/plt600
PLT-600 Renamed channel description to channel header and added channel purpose field
Этот коммит содержится в:
@@ -25,7 +25,8 @@ func NewSqlChannelStore(sqlStore *SqlStore) ChannelStore {
|
||||
table.ColMap("DisplayName").SetMaxSize(64)
|
||||
table.ColMap("Name").SetMaxSize(64)
|
||||
table.SetUniqueTogether("Name", "TeamId")
|
||||
table.ColMap("Description").SetMaxSize(1024)
|
||||
table.ColMap("Header").SetMaxSize(1024)
|
||||
table.ColMap("Purpose").SetMaxSize(128)
|
||||
table.ColMap("CreatorId").SetMaxSize(26)
|
||||
|
||||
tablem := db.AddTableWithName(model.ChannelMember{}, "ChannelMembers").SetKeys(false, "ChannelId", "UserId")
|
||||
@@ -83,6 +84,11 @@ func (s SqlChannelStore) UpgradeSchemaIfNeeded() {
|
||||
|
||||
s.RemoveColumnIfExists("ChannelMembers", "NotifyLevel")
|
||||
}
|
||||
|
||||
// BEGIN REMOVE AFTER 1.2.0
|
||||
s.RenameColumnIfExists("Channels", "Description", "Header", "varchar(1024)")
|
||||
s.CreateColumnIfNotExists("Channels", "Purpose", "varchar(1024)", "varchar(1024)", "")
|
||||
// END REMOVE AFTER 1.2.0
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) CreateIndexesIfNotExists() {
|
||||
|
||||
@@ -364,27 +364,26 @@ func (ss SqlStore) RemoveColumnIfExists(tableName string, columnName string) boo
|
||||
return true
|
||||
}
|
||||
|
||||
// func (ss SqlStore) RenameColumnIfExists(tableName string, oldColumnName string, newColumnName string, colType string) bool {
|
||||
func (ss SqlStore) RenameColumnIfExists(tableName string, oldColumnName string, newColumnName string, colType string) bool {
|
||||
if !ss.DoesColumnExist(tableName, oldColumnName) {
|
||||
return false
|
||||
}
|
||||
|
||||
// // XXX TODO FIXME this should be removed after 0.6.0
|
||||
// if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES {
|
||||
// return false
|
||||
// }
|
||||
var err error
|
||||
if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_MYSQL {
|
||||
_, err = ss.GetMaster().Exec("ALTER TABLE " + tableName + " CHANGE " + oldColumnName + " " + newColumnName + " " + colType)
|
||||
} else if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES {
|
||||
_, err = ss.GetMaster().Exec("ALTER TABLE " + tableName + " RENAME COLUMN " + oldColumnName + " TO " + newColumnName)
|
||||
}
|
||||
|
||||
// if !ss.DoesColumnExist(tableName, oldColumnName) {
|
||||
// return false
|
||||
// }
|
||||
if err != nil {
|
||||
l4g.Critical("Failed to rename column %v", err)
|
||||
time.Sleep(time.Second)
|
||||
panic("Failed to drop column " + err.Error())
|
||||
}
|
||||
|
||||
// _, err := ss.GetMaster().Exec("ALTER TABLE " + tableName + " CHANGE " + oldColumnName + " " + newColumnName + " " + colType)
|
||||
|
||||
// if err != nil {
|
||||
// l4g.Critical("Failed to rename column %v", err)
|
||||
// time.Sleep(time.Second)
|
||||
// panic("Failed to drop column " + err.Error())
|
||||
// }
|
||||
|
||||
// return true
|
||||
// }
|
||||
return true
|
||||
}
|
||||
|
||||
func (ss SqlStore) CreateIndexIfNotExists(indexName string, tableName string, columnName string) {
|
||||
ss.createIndexIfNotExists(indexName, tableName, columnName, INDEX_TYPE_DEFAULT)
|
||||
|
||||
Ссылка в новой задаче
Block a user