summaryrefslogtreecommitdiffstats
path: root/store/sql_post_store.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-11-06 09:05:32 -0500
committerJoram Wilander <jwawilander@gmail.com>2015-11-06 09:05:32 -0500
commit1ecad4301e6e511a426da5884a54111c5bb7a4fd (patch)
tree114dea884f0a08729f5b6b5f9e45d2e470bedc71 /store/sql_post_store.go
parent6417d4728dc9351d5bf3180e458be8ce6e1e642f (diff)
parent195728b949a4f3aee75e01f4b0e4a0b2f67850da (diff)
downloadchat-1ecad4301e6e511a426da5884a54111c5bb7a4fd.tar.gz
chat-1ecad4301e6e511a426da5884a54111c5bb7a4fd.tar.bz2
chat-1ecad4301e6e511a426da5884a54111c5bb7a4fd.zip
Merge pull request #1327 from florianorben/PLT-857-2
PLT-857: Support `attachments` for Incoming Webhooks
Diffstat (limited to 'store/sql_post_store.go')
-rw-r--r--store/sql_post_store.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index fdae20f60..3460fca92 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -9,8 +9,10 @@ import (
"strconv"
"strings"
+ l4g "code.google.com/p/log4go"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
+ "time"
)
type SqlPostStore struct {
@@ -30,7 +32,7 @@ func NewSqlPostStore(sqlStore *SqlStore) PostStore {
table.ColMap("Message").SetMaxSize(4000)
table.ColMap("Type").SetMaxSize(26)
table.ColMap("Hashtags").SetMaxSize(1000)
- table.ColMap("Props").SetMaxSize(4000)
+ table.ColMap("Props")
table.ColMap("Filenames").SetMaxSize(4000)
}
@@ -38,6 +40,21 @@ func NewSqlPostStore(sqlStore *SqlStore) PostStore {
}
func (s SqlPostStore) UpgradeSchemaIfNeeded() {
+ colType := s.GetColumnDataType("Posts", "Props")
+ if colType != "text" {
+
+ query := "ALTER TABLE Posts MODIFY COLUMN Props TEXT"
+ if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES {
+ query = "ALTER TABLE Posts ALTER COLUMN Props TYPE text"
+ }
+
+ _, err := s.GetMaster().Exec(query)
+ if err != nil {
+ l4g.Critical("Failed to alter column Posts.Props to TEXT: " + err.Error())
+ time.Sleep(time.Second)
+ panic("Failed to alter column Posts.Props to TEXT: " + err.Error())
+ }
+ }
}
func (s SqlPostStore) CreateIndexesIfNotExists() {