summaryrefslogtreecommitdiffstats
path: root/store/sql_session_store.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-02-23 09:47:38 -0500
committerJoram Wilander <jwawilander@gmail.com>2016-02-23 09:47:38 -0500
commit490e64352536336548ecbaea5f1ba1c0209fe2f7 (patch)
tree61141e22591cd6c928b8276877a9c1d50d8d814e /store/sql_session_store.go
parent3f3718a007fb824bbb50199813fdaa83ad17c7eb (diff)
parent28ab0d835878bf1ad72dbae914ca112acfbe490d (diff)
downloadchat-490e64352536336548ecbaea5f1ba1c0209fe2f7.tar.gz
chat-490e64352536336548ecbaea5f1ba1c0209fe2f7.tar.bz2
chat-490e64352536336548ecbaea5f1ba1c0209fe2f7.zip
Merge pull request #2217 from mattermost/fix-droid
Fixing device id column for droid
Diffstat (limited to 'store/sql_session_store.go')
-rw-r--r--store/sql_session_store.go9
1 files changed, 7 insertions, 2 deletions
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
}