From 08a3acbb44b043b9bb56f9b96e91432352d06d1a Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 22 Sep 2015 01:15:41 -0700 Subject: Adding team settings to admin console --- store/sql_store.go | 29 ++++++++++++----------------- store/sql_team_store.go | 1 + store/sql_user_store_test.go | 2 +- 3 files changed, 14 insertions(+), 18 deletions(-) (limited to 'store') 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() -- cgit v1.2.3-1-g7c22