From 1bb85818ca5d7569c17e56d523d9668b83973e65 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 22 Feb 2016 16:08:40 -0800 Subject: Fixing device id column for droid --- store/sql_session_store.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'store/sql_session_store.go') diff --git a/store/sql_session_store.go b/store/sql_session_store.go index 6532947f4..8dccc0770 100644 --- a/store/sql_session_store.go +++ b/store/sql_session_store.go @@ -22,7 +22,7 @@ func NewSqlSessionStore(sqlStore *SqlStore) SessionStore { table.ColMap("Token").SetMaxSize(26) table.ColMap("UserId").SetMaxSize(26) table.ColMap("TeamId").SetMaxSize(26) - table.ColMap("DeviceId").SetMaxSize(128) + table.ColMap("DeviceId").SetMaxSize(512) table.ColMap("Roles").SetMaxSize(64) table.ColMap("Props").SetMaxSize(1000) } @@ -31,6 +31,11 @@ func NewSqlSessionStore(sqlStore *SqlStore) SessionStore { } func (me SqlSessionStore) UpgradeSchemaIfNeeded() { + // ADDED for 2.1 REMOVE for 2.5 + deviceIdLength := me.GetMaxLengthOfColumnIfExists("Sessions", "DeviceId") + if len(deviceIdLength) > 0 && deviceIdLength != "512" { + me.AlterColumnTypeIfExists("Sessions", "DeviceId", "VARCHAR(512)", "VARCHAR(512)") + } } func (me SqlSessionStore) CreateIndexesIfNotExists() { @@ -239,7 +244,7 @@ func (me SqlSessionStore) UpdateDeviceId(id, deviceId string) StoreChannel { go func() { result := StoreResult{} if _, err := me.GetMaster().Exec("UPDATE Sessions SET DeviceId = :DeviceId WHERE Id = :Id", map[string]interface{}{"DeviceId": deviceId, "Id": id}); err != nil { - result.Err = model.NewLocAppError("SqlSessionStore.UpdateDeviceId", "store.sql_session.update_device_id.app_error", nil, "") + result.Err = model.NewLocAppError("SqlSessionStore.UpdateDeviceId", "store.sql_session.update_device_id.app_error", nil, err.Error()) } else { result.Data = deviceId } -- cgit v1.2.3-1-g7c22