summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-09-22 01:15:41 -0700
committer=Corey Hulen <corey@hulen.com>2015-09-22 01:15:41 -0700
commit08a3acbb44b043b9bb56f9b96e91432352d06d1a (patch)
treeceb451571691d0530ff2c97a033fcc206c42d3ea /store
parentf05a2c03d5dbf5b0b7d09148a37d2325012b309f (diff)
downloadchat-08a3acbb44b043b9bb56f9b96e91432352d06d1a.tar.gz
chat-08a3acbb44b043b9bb56f9b96e91432352d06d1a.tar.bz2
chat-08a3acbb44b043b9bb56f9b96e91432352d06d1a.zip
Adding team settings to admin console
Diffstat (limited to 'store')
-rw-r--r--store/sql_store.go29
-rw-r--r--store/sql_team_store.go1
-rw-r--r--store/sql_user_store_test.go2
3 files changed, 14 insertions, 18 deletions
diff --git a/store/sql_store.go b/store/sql_store.go
index 7f3b555f1..7f3c59164 100644
--- a/store/sql_store.go
+++ b/store/sql_store.go
@@ -311,26 +311,21 @@ func (ss SqlStore) CreateColumnIfNotExists(tableName string, columnName string,
}
}
-// func (ss SqlStore) RemoveColumnIfExists(tableName string, columnName string) bool {
+func (ss SqlStore) RemoveColumnIfExists(tableName string, columnName string) bool {
-// // XXX TODO FIXME this should be removed after 0.6.0
-// if utils.Cfg.SqlSettings.DriverName == "postgres" {
-// return false
-// }
-
-// if !ss.DoesColumnExist(tableName, columnName) {
-// return false
-// }
+ if !ss.DoesColumnExist(tableName, columnName) {
+ return false
+ }
-// _, err := ss.GetMaster().Exec("ALTER TABLE " + tableName + " DROP COLUMN " + columnName)
-// if err != nil {
-// l4g.Critical("Failed to drop column %v", err)
-// time.Sleep(time.Second)
-// panic("Failed to drop column " + err.Error())
-// }
+ _, err := ss.GetMaster().Exec("ALTER TABLE " + tableName + " DROP COLUMN " + columnName)
+ if err != nil {
+ l4g.Critical("Failed to drop column %v", err)
+ time.Sleep(time.Second)
+ panic("Failed to drop column " + err.Error())
+ }
-// return true
-// }
+ return true
+}
// func (ss SqlStore) RenameColumnIfExists(tableName string, oldColumnName string, newColumnName string, colType string) bool {
diff --git a/store/sql_team_store.go b/store/sql_team_store.go
index d2148c2e3..3d644e577 100644
--- a/store/sql_team_store.go
+++ b/store/sql_team_store.go
@@ -28,6 +28,7 @@ func NewSqlTeamStore(sqlStore *SqlStore) TeamStore {
}
func (s SqlTeamStore) UpgradeSchemaIfNeeded() {
+ s.RemoveColumnIfExists("Teams", "AllowValet")
}
func (s SqlTeamStore) CreateIndexesIfNotExists() {
diff --git a/store/sql_user_store_test.go b/store/sql_user_store_test.go
index ddd7e5bb8..466da2845 100644
--- a/store/sql_user_store_test.go
+++ b/store/sql_user_store_test.go
@@ -42,7 +42,7 @@ func TestUserStoreSave(t *testing.T) {
t.Fatal("should be unique username")
}
- for i := 0; i < 150; i++ {
+ for i := 0; i < 50; i++ {
u1.Id = ""
u1.Email = model.NewId()
u1.Username = model.NewId()