From 7e3b53c37be8d9959fbffb23b6c6eb965386c5fd Mon Sep 17 00:00:00 2001 From: Florian Orben Date: Fri, 6 Nov 2015 00:07:44 +0100 Subject: fix alter table command for postgres --- store/sql_post_store.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'store/sql_post_store.go') 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) -- cgit v1.2.3-1-g7c22