summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
Diffstat (limited to 'store')
-rw-r--r--store/sqlstore/channel_store.go2
-rw-r--r--store/sqlstore/team_store.go2
-rw-r--r--store/sqlstore/upgrade.go12
-rw-r--r--store/sqlstore/user_store.go2
-rw-r--r--store/sqlstore/webhook_store.go4
-rw-r--r--store/storetest/channel_store.go6
-rw-r--r--store/storetest/command_store.go2
-rw-r--r--store/storetest/compliance_store.go10
-rw-r--r--store/storetest/job_store.go1
-rw-r--r--store/storetest/post_store.go28
-rw-r--r--store/storetest/scheme_store.go1
-rw-r--r--store/storetest/team_store.go14
-rw-r--r--store/storetest/webhook_store.go4
13 files changed, 50 insertions, 38 deletions
diff --git a/store/sqlstore/channel_store.go b/store/sqlstore/channel_store.go
index fba37d7cb..1b5ae7ff7 100644
--- a/store/sqlstore/channel_store.go
+++ b/store/sqlstore/channel_store.go
@@ -1864,7 +1864,7 @@ func (s SqlChannelStore) ClearAllCustomRoleAssignments() store.StoreChannel {
lastUserId := strings.Repeat("0", 26)
lastChannelId := strings.Repeat("0", 26)
- for true {
+ for {
var transaction *gorp.Transaction
var err error
diff --git a/store/sqlstore/team_store.go b/store/sqlstore/team_store.go
index d9e33df76..3ea6feced 100644
--- a/store/sqlstore/team_store.go
+++ b/store/sqlstore/team_store.go
@@ -851,7 +851,7 @@ func (s SqlTeamStore) ClearAllCustomRoleAssignments() store.StoreChannel {
lastUserId := strings.Repeat("0", 26)
lastTeamId := strings.Repeat("0", 26)
- for true {
+ for {
var transaction *gorp.Transaction
var err error
diff --git a/store/sqlstore/upgrade.go b/store/sqlstore/upgrade.go
index cd45dfcb3..5f74dbfb1 100644
--- a/store/sqlstore/upgrade.go
+++ b/store/sqlstore/upgrade.go
@@ -15,6 +15,7 @@ import (
)
const (
+ VERSION_5_4_0 = "5.4.0"
VERSION_5_3_0 = "5.3.0"
VERSION_5_2_0 = "5.2.0"
VERSION_5_1_0 = "5.1.0"
@@ -84,6 +85,7 @@ func UpgradeDatabase(sqlStore SqlStore) {
UpgradeDatabaseToVersion51(sqlStore)
UpgradeDatabaseToVersion52(sqlStore)
UpgradeDatabaseToVersion53(sqlStore)
+ UpgradeDatabaseToVersion54(sqlStore)
// If the SchemaVersion is empty this this is the first time it has ran
// so lets set it to the current version.
@@ -487,4 +489,14 @@ func UpgradeDatabaseToVersion53(sqlStore SqlStore) {
if shouldPerformUpgrade(sqlStore, VERSION_5_2_0, VERSION_5_3_0) {
saveSchemaVersion(sqlStore, VERSION_5_3_0)
}
+
+}
+
+func UpgradeDatabaseToVersion54(sqlStore SqlStore) {
+ // TODO: Uncomment following condition when version 5.4.0 is released
+ // if shouldPerformUpgrade(sqlStore, VERSION_5_3_0, VERSION_5_4_0) {
+ sqlStore.AlterColumnTypeIfExists("OutgoingWebhooks", "Description", "varchar(500)", "varchar(500)")
+ sqlStore.AlterColumnTypeIfExists("IncomingWebhooks", "Description", "varchar(500)", "varchar(500)")
+ // saveSchemaVersion(sqlStore, VERSION_5_4_0)
+ // }
}
diff --git a/store/sqlstore/user_store.go b/store/sqlstore/user_store.go
index d8a77cd9d..c89c445ad 100644
--- a/store/sqlstore/user_store.go
+++ b/store/sqlstore/user_store.go
@@ -1255,7 +1255,7 @@ func (us SqlUserStore) ClearAllCustomRoleAssignments() store.StoreChannel {
builtInRoles := model.MakeDefaultRoles()
lastUserId := strings.Repeat("0", 26)
- for true {
+ for {
var transaction *gorp.Transaction
var err error
diff --git a/store/sqlstore/webhook_store.go b/store/sqlstore/webhook_store.go
index f3c572aaf..94eadf836 100644
--- a/store/sqlstore/webhook_store.go
+++ b/store/sqlstore/webhook_store.go
@@ -47,7 +47,7 @@ func NewSqlWebhookStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface)
table.ColMap("ChannelId").SetMaxSize(26)
table.ColMap("TeamId").SetMaxSize(26)
table.ColMap("DisplayName").SetMaxSize(64)
- table.ColMap("Description").SetMaxSize(128)
+ table.ColMap("Description").SetMaxSize(500)
tableo := db.AddTableWithName(model.OutgoingWebhook{}, "OutgoingWebhooks").SetKeys(false, "Id")
tableo.ColMap("Id").SetMaxSize(26)
@@ -58,7 +58,7 @@ func NewSqlWebhookStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface)
tableo.ColMap("TriggerWords").SetMaxSize(1024)
tableo.ColMap("CallbackURLs").SetMaxSize(1024)
tableo.ColMap("DisplayName").SetMaxSize(64)
- tableo.ColMap("Description").SetMaxSize(128)
+ tableo.ColMap("Description").SetMaxSize(500)
tableo.ColMap("ContentType").SetMaxSize(128)
tableo.ColMap("TriggerWhen").SetMaxSize(1)
tableo.ColMap("Username").SetMaxSize(64)
diff --git a/store/storetest/channel_store.go b/store/storetest/channel_store.go
index c827a4226..776434b6e 100644
--- a/store/storetest/channel_store.go
+++ b/store/storetest/channel_store.go
@@ -2287,9 +2287,9 @@ func testChannelStoreGetChannelsByScheme(t *testing.T, ss store.Store) {
Type: model.CHANNEL_OPEN,
}
- c1 = (<-ss.Channel().Save(c1, 100)).Data.(*model.Channel)
- c2 = (<-ss.Channel().Save(c2, 100)).Data.(*model.Channel)
- c3 = (<-ss.Channel().Save(c3, 100)).Data.(*model.Channel)
+ _ = (<-ss.Channel().Save(c1, 100)).Data.(*model.Channel)
+ _ = (<-ss.Channel().Save(c2, 100)).Data.(*model.Channel)
+ _ = (<-ss.Channel().Save(c3, 100)).Data.(*model.Channel)
// Get the channels by a valid Scheme ID.
res1 := <-ss.Channel().GetChannelsByScheme(s1.Id, 0, 100)
diff --git a/store/storetest/command_store.go b/store/storetest/command_store.go
index ffc575563..ba6c26482 100644
--- a/store/storetest/command_store.go
+++ b/store/storetest/command_store.go
@@ -105,7 +105,7 @@ func testCommandStoreGetByTrigger(t *testing.T, ss store.Store) {
o2.Trigger = "trigger1"
o1 = (<-ss.Command().Save(o1)).Data.(*model.Command)
- o2 = (<-ss.Command().Save(o2)).Data.(*model.Command)
+ _ = (<-ss.Command().Save(o2)).Data.(*model.Command)
if r1 := <-ss.Command().GetByTrigger(o1.TeamId, o1.Trigger); r1.Err != nil {
t.Fatal(r1.Err)
diff --git a/store/storetest/compliance_store.go b/store/storetest/compliance_store.go
index f7f095a00..14ed29865 100644
--- a/store/storetest/compliance_store.go
+++ b/store/storetest/compliance_store.go
@@ -108,14 +108,14 @@ func testComplianceExport(t *testing.T, ss store.Store) {
o1a.UserId = u1.Id
o1a.CreateAt = o1.CreateAt + 10
o1a.Message = "zz" + model.NewId() + "b"
- o1a = store.Must(ss.Post().Save(o1a)).(*model.Post)
+ _ = store.Must(ss.Post().Save(o1a)).(*model.Post)
o2 := &model.Post{}
o2.ChannelId = c1.Id
o2.UserId = u1.Id
o2.CreateAt = o1.CreateAt + 20
o2.Message = "zz" + model.NewId() + "b"
- o2 = store.Must(ss.Post().Save(o2)).(*model.Post)
+ _ = store.Must(ss.Post().Save(o2)).(*model.Post)
o2a := &model.Post{}
o2a.ChannelId = c1.Id
@@ -272,21 +272,21 @@ func testComplianceExportDirectMessages(t *testing.T, ss store.Store) {
o1a.UserId = u1.Id
o1a.CreateAt = o1.CreateAt + 10
o1a.Message = "zz" + model.NewId() + "b"
- o1a = store.Must(ss.Post().Save(o1a)).(*model.Post)
+ _ = store.Must(ss.Post().Save(o1a)).(*model.Post)
o2 := &model.Post{}
o2.ChannelId = c1.Id
o2.UserId = u1.Id
o2.CreateAt = o1.CreateAt + 20
o2.Message = "zz" + model.NewId() + "b"
- o2 = store.Must(ss.Post().Save(o2)).(*model.Post)
+ _ = store.Must(ss.Post().Save(o2)).(*model.Post)
o2a := &model.Post{}
o2a.ChannelId = c1.Id
o2a.UserId = u2.Id
o2a.CreateAt = o1.CreateAt + 30
o2a.Message = "zz" + model.NewId() + "b"
- o2a = store.Must(ss.Post().Save(o2a)).(*model.Post)
+ _ = store.Must(ss.Post().Save(o2a)).(*model.Post)
o3 := &model.Post{}
o3.ChannelId = cDM.Id
diff --git a/store/storetest/job_store.go b/store/storetest/job_store.go
index 631df08fd..936999f52 100644
--- a/store/storetest/job_store.go
+++ b/store/storetest/job_store.go
@@ -492,7 +492,6 @@ func testJobUpdateStatusUpdateStatusOptimistically(t *testing.T, ss store.Store)
if received.LastActivityAt <= lastUpdateAt {
t.Fatal("lastActivityAt wasn't updated")
}
- lastUpdateAt = received.LastActivityAt
}
}
diff --git a/store/storetest/post_store.go b/store/storetest/post_store.go
index 235d6f9b7..72819f49e 100644
--- a/store/storetest/post_store.go
+++ b/store/storetest/post_store.go
@@ -514,7 +514,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, ss store.Store) {
o2.Message = "zz" + model.NewId() + "b"
o2.ParentId = o1.Id
o2.RootId = o1.Id
- o2 = (<-ss.Post().Save(o2)).Data.(*model.Post)
+ _ = (<-ss.Post().Save(o2)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o2a := &model.Post{}
@@ -609,7 +609,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, ss store.Store) {
o6.ChannelId = o1.ChannelId
o6.UserId = model.NewId()
o6.Message = "zz" + model.NewId() + "b"
- o6 = (<-ss.Post().Save(o6)).Data.(*model.Post)
+ _ = (<-ss.Post().Save(o6)).Data.(*model.Post)
// Should only be 6 since we hit the cache
r3 := (<-ss.Post().GetPosts(o1.ChannelId, 0, 30, true)).Data.(*model.PostList)
@@ -627,7 +627,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, ss store.Store) {
o0.ChannelId = model.NewId()
o0.UserId = model.NewId()
o0.Message = "zz" + model.NewId() + "b"
- o0 = (<-ss.Post().Save(o0)).Data.(*model.Post)
+ _ = (<-ss.Post().Save(o0)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o1 := &model.Post{}
@@ -677,7 +677,7 @@ func testPostStoreGetPostsBeforeAfter(t *testing.T, ss store.Store) {
o5.Message = "zz" + model.NewId() + "b"
o5.ParentId = o4.Id
o5.RootId = o4.Id
- o5 = (<-ss.Post().Save(o5)).Data.(*model.Post)
+ _ = (<-ss.Post().Save(o5)).Data.(*model.Post)
r1 := (<-ss.Post().GetPostsBefore(o1.ChannelId, o1.Id, 4, 0)).Data.(*model.PostList)
@@ -731,7 +731,7 @@ func testPostStoreGetPostsSince(t *testing.T, ss store.Store) {
o0.ChannelId = model.NewId()
o0.UserId = model.NewId()
o0.Message = "zz" + model.NewId() + "b"
- o0 = (<-ss.Post().Save(o0)).Data.(*model.Post)
+ _ = (<-ss.Post().Save(o0)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o1 := &model.Post{}
@@ -747,7 +747,7 @@ func testPostStoreGetPostsSince(t *testing.T, ss store.Store) {
o2.Message = "zz" + model.NewId() + "b"
o2.ParentId = o1.Id
o2.RootId = o1.Id
- o2 = (<-ss.Post().Save(o2)).Data.(*model.Post)
+ _ = (<-ss.Post().Save(o2)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o2a := &model.Post{}
@@ -865,7 +865,7 @@ func testPostStoreSearch(t *testing.T, ss store.Store) {
o1a.UserId = model.NewId()
o1a.Message = "corey mattermost new york"
o1a.Type = model.POST_JOIN_CHANNEL
- o1a = (<-ss.Post().Save(o1a)).Data.(*model.Post)
+ _ = (<-ss.Post().Save(o1a)).Data.(*model.Post)
o2 := &model.Post{}
o2.ChannelId = c1.Id
@@ -877,7 +877,7 @@ func testPostStoreSearch(t *testing.T, ss store.Store) {
o3.ChannelId = c2.Id
o3.UserId = model.NewId()
o3.Message = "New Jersey is where John is from corey new york"
- o3 = (<-ss.Post().Save(o3)).Data.(*model.Post)
+ _ = (<-ss.Post().Save(o3)).Data.(*model.Post)
o4 := &model.Post{}
o4.ChannelId = c1.Id
@@ -1045,7 +1045,7 @@ func testUserCountsWithPostsByDay(t *testing.T, ss store.Store) {
o1a.UserId = model.NewId()
o1a.CreateAt = o1.CreateAt
o1a.Message = "zz" + model.NewId() + "b"
- o1a = store.Must(ss.Post().Save(o1a)).(*model.Post)
+ _ = store.Must(ss.Post().Save(o1a)).(*model.Post)
o2 := &model.Post{}
o2.ChannelId = c1.Id
@@ -1059,7 +1059,7 @@ func testUserCountsWithPostsByDay(t *testing.T, ss store.Store) {
o2a.UserId = o2.UserId
o2a.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24)
o2a.Message = "zz" + model.NewId() + "b"
- o2a = store.Must(ss.Post().Save(o2a)).(*model.Post)
+ _ = store.Must(ss.Post().Save(o2a)).(*model.Post)
if r1 := <-ss.Post().AnalyticsUserCountsWithPostsByDay(t1.Id); r1.Err != nil {
t.Fatal(r1.Err)
@@ -1103,7 +1103,7 @@ func testPostCountsByDay(t *testing.T, ss store.Store) {
o1a.UserId = model.NewId()
o1a.CreateAt = o1.CreateAt
o1a.Message = "zz" + model.NewId() + "b"
- o1a = store.Must(ss.Post().Save(o1a)).(*model.Post)
+ _ = store.Must(ss.Post().Save(o1a)).(*model.Post)
o2 := &model.Post{}
o2.ChannelId = c1.Id
@@ -1117,7 +1117,7 @@ func testPostCountsByDay(t *testing.T, ss store.Store) {
o2a.UserId = o2.UserId
o2a.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24 * 2)
o2a.Message = "zz" + model.NewId() + "b"
- o2a = store.Must(ss.Post().Save(o2a)).(*model.Post)
+ _ = store.Must(ss.Post().Save(o2a)).(*model.Post)
time.Sleep(1 * time.Second)
@@ -1534,14 +1534,14 @@ func testPostStoreGetPostsCreatedAt(t *testing.T, ss store.Store) {
o2.ParentId = o1.Id
o2.RootId = o1.Id
o2.CreateAt = createTime + 1
- o2 = (<-ss.Post().Save(o2)).Data.(*model.Post)
+ _ = (<-ss.Post().Save(o2)).Data.(*model.Post)
o3 := &model.Post{}
o3.ChannelId = model.NewId()
o3.UserId = model.NewId()
o3.Message = "zz" + model.NewId() + "b"
o3.CreateAt = createTime
- o3 = (<-ss.Post().Save(o3)).Data.(*model.Post)
+ _ = (<-ss.Post().Save(o3)).Data.(*model.Post)
r1 := (<-ss.Post().GetPostsCreatedAt(o1.ChannelId, createTime)).Data.([]*model.Post)
assert.Equal(t, 2, len(r1))
diff --git a/store/storetest/scheme_store.go b/store/storetest/scheme_store.go
index f855ae5d4..a9204fbe2 100644
--- a/store/storetest/scheme_store.go
+++ b/store/storetest/scheme_store.go
@@ -20,6 +20,7 @@ func TestSchemeStore(t *testing.T, ss store.Store) {
t.Run("GetAllPage", func(t *testing.T) { testSchemeStoreGetAllPage(t, ss) })
t.Run("Delete", func(t *testing.T) { testSchemeStoreDelete(t, ss) })
t.Run("PermanentDeleteAll", func(t *testing.T) { testSchemeStorePermanentDeleteAll(t, ss) })
+ t.Run("GetByName", func(t *testing.T) { testSchemeStoreGetByName(t, ss) })
}
func createDefaultRoles(t *testing.T, ss store.Store) {
diff --git a/store/storetest/team_store.go b/store/storetest/team_store.go
index ede1a91d3..1369dc69b 100644
--- a/store/storetest/team_store.go
+++ b/store/storetest/team_store.go
@@ -1088,9 +1088,9 @@ func testGetTeamsByScheme(t *testing.T, ss store.Store) {
Type: model.TEAM_OPEN,
}
- t1 = (<-ss.Team().Save(t1)).Data.(*model.Team)
- t2 = (<-ss.Team().Save(t2)).Data.(*model.Team)
- t3 = (<-ss.Team().Save(t3)).Data.(*model.Team)
+ _ = (<-ss.Team().Save(t1)).Data.(*model.Team)
+ _ = (<-ss.Team().Save(t2)).Data.(*model.Team)
+ _ = (<-ss.Team().Save(t3)).Data.(*model.Team)
// Get the teams by a valid Scheme ID.
res1 := <-ss.Team().GetTeamsByScheme(s1.Id, 0, 100)
@@ -1286,7 +1286,7 @@ func testTeamStoreAnalyticsGetTeamCountForScheme(t *testing.T, ss store.Store) {
Type: model.TEAM_OPEN,
SchemeId: &s1.Id,
}
- t1 = (<-ss.Team().Save(t1)).Data.(*model.Team)
+ _ = (<-ss.Team().Save(t1)).Data.(*model.Team)
count2 := (<-ss.Team().AnalyticsGetTeamCountForScheme(s1.Id)).Data.(int64)
assert.Equal(t, int64(1), count2)
@@ -1298,7 +1298,7 @@ func testTeamStoreAnalyticsGetTeamCountForScheme(t *testing.T, ss store.Store) {
Type: model.TEAM_OPEN,
SchemeId: &s1.Id,
}
- t2 = (<-ss.Team().Save(t2)).Data.(*model.Team)
+ _ = (<-ss.Team().Save(t2)).Data.(*model.Team)
count3 := (<-ss.Team().AnalyticsGetTeamCountForScheme(s1.Id)).Data.(int64)
assert.Equal(t, int64(2), count3)
@@ -1309,7 +1309,7 @@ func testTeamStoreAnalyticsGetTeamCountForScheme(t *testing.T, ss store.Store) {
Email: MakeEmail(),
Type: model.TEAM_OPEN,
}
- t3 = (<-ss.Team().Save(t3)).Data.(*model.Team)
+ _ = (<-ss.Team().Save(t3)).Data.(*model.Team)
count4 := (<-ss.Team().AnalyticsGetTeamCountForScheme(s1.Id)).Data.(int64)
assert.Equal(t, int64(2), count4)
@@ -1322,7 +1322,7 @@ func testTeamStoreAnalyticsGetTeamCountForScheme(t *testing.T, ss store.Store) {
SchemeId: &s1.Id,
DeleteAt: model.GetMillis(),
}
- t4 = (<-ss.Team().Save(t4)).Data.(*model.Team)
+ _ = (<-ss.Team().Save(t4)).Data.(*model.Team)
count5 := (<-ss.Team().AnalyticsGetTeamCountForScheme(s1.Id)).Data.(int64)
assert.Equal(t, int64(2), count5)
diff --git a/store/storetest/webhook_store.go b/store/storetest/webhook_store.go
index 2dfa2ae53..2b30f2d33 100644
--- a/store/storetest/webhook_store.go
+++ b/store/storetest/webhook_store.go
@@ -484,7 +484,7 @@ func testWebhookStoreCountIncoming(t *testing.T, ss store.Store) {
o1.UserId = model.NewId()
o1.TeamId = model.NewId()
- o1 = (<-ss.Webhook().SaveIncoming(o1)).Data.(*model.IncomingWebhook)
+ _ = (<-ss.Webhook().SaveIncoming(o1)).Data.(*model.IncomingWebhook)
if r := <-ss.Webhook().AnalyticsIncomingCount(""); r.Err != nil {
t.Fatal(r.Err)
@@ -502,7 +502,7 @@ func testWebhookStoreCountOutgoing(t *testing.T, ss store.Store) {
o1.TeamId = model.NewId()
o1.CallbackURLs = []string{"http://nowhere.com/"}
- o1 = (<-ss.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
+ _ = (<-ss.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
if r := <-ss.Webhook().AnalyticsOutgoingCount(""); r.Err != nil {
t.Fatal(r.Err)