summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Orben <florian.orben@gmail.com>2015-11-06 00:07:44 +0100
committerFlorian Orben <florian.orben@gmail.com>2015-11-06 00:24:39 +0100
commit7e3b53c37be8d9959fbffb23b6c6eb965386c5fd (patch)
treeb5c365a441d4af0b286699325a107a81a2e1633b
parent17a17c336c6650148388f1d8430f97bd17098409 (diff)
downloadchat-7e3b53c37be8d9959fbffb23b6c6eb965386c5fd.tar.gz
chat-7e3b53c37be8d9959fbffb23b6c6eb965386c5fd.tar.bz2
chat-7e3b53c37be8d9959fbffb23b6c6eb965386c5fd.zip
fix alter table command for postgres
-rw-r--r--store/sql_post_store.go8
-rw-r--r--web/web.go1
2 files changed, 8 insertions, 1 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index 7978408a2..a523b3320 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -42,7 +42,13 @@ func NewSqlPostStore(sqlStore *SqlStore) PostStore {
func (s SqlPostStore) UpgradeSchemaIfNeeded() {
colType := s.GetColumnDataType("Posts", "Props")
if colType != "text" {
- _, err := s.GetMaster().Exec("ALTER TABLE Posts MODIFY COLUMN Props 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)
diff --git a/web/web.go b/web/web.go
index bd0154542..1b2f5f742 100644
--- a/web/web.go
+++ b/web/web.go
@@ -992,6 +992,7 @@ func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) {
channelName := parsedRequest.ChannelName
webhookType := parsedRequest.Type
+ //attachments is in here for slack compatibility
if parsedRequest.Attachments != nil {
if len(parsedRequest.Props) == 0 {
parsedRequest.Props = make(model.StringInterface)