mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Add database indexes to timestamp columns (#4314)
* Add database indexes to timestamp columns * add indexes to session table
This commit is contained in:
committed by
Christopher Speller
parent
510291e2e7
commit
5fdb8223fc
@@ -54,6 +54,9 @@ func NewSqlChannelStore(sqlStore *SqlStore) ChannelStore {
|
||||
func (s SqlChannelStore) CreateIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_channels_team_id", "Channels", "TeamId")
|
||||
s.CreateIndexIfNotExists("idx_channels_name", "Channels", "Name")
|
||||
s.CreateIndexIfNotExists("idx_channels_update_at", "Channels", "UpdateAt")
|
||||
s.CreateIndexIfNotExists("idx_channels_create_at", "Channels", "CreateAt")
|
||||
s.CreateIndexIfNotExists("idx_channels_delete_at", "Channels", "DeleteAt")
|
||||
|
||||
s.CreateIndexIfNotExists("idx_channelmembers_channel_id", "ChannelMembers", "ChannelId")
|
||||
s.CreateIndexIfNotExists("idx_channelmembers_user_id", "ChannelMembers", "UserId")
|
||||
|
||||
@@ -36,6 +36,9 @@ func NewSqlCommandStore(sqlStore *SqlStore) CommandStore {
|
||||
|
||||
func (s SqlCommandStore) CreateIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_command_team_id", "Commands", "TeamId")
|
||||
s.CreateIndexIfNotExists("idx_command_update_at", "Commands", "UpdateAt")
|
||||
s.CreateIndexIfNotExists("idx_command_create_at", "Commands", "CreateAt")
|
||||
s.CreateIndexIfNotExists("idx_command_delete_at", "Commands", "DeleteAt")
|
||||
}
|
||||
|
||||
func (s SqlCommandStore) Save(command *model.Command) StoreChannel {
|
||||
|
||||
@@ -27,6 +27,9 @@ func NewSqlEmojiStore(sqlStore *SqlStore) EmojiStore {
|
||||
}
|
||||
|
||||
func (es SqlEmojiStore) CreateIndexesIfNotExists() {
|
||||
es.CreateIndexIfNotExists("idx_emoji_update_at", "Emoji", "UpdateAt")
|
||||
es.CreateIndexIfNotExists("idx_emoji_create_at", "Emoji", "CreateAt")
|
||||
es.CreateIndexIfNotExists("idx_emoji_delete_at", "Emoji", "DeleteAt")
|
||||
}
|
||||
|
||||
func (es SqlEmojiStore) Save(emoji *model.Emoji) StoreChannel {
|
||||
|
||||
@@ -30,6 +30,9 @@ func NewSqlFileInfoStore(sqlStore *SqlStore) FileInfoStore {
|
||||
}
|
||||
|
||||
func (fs SqlFileInfoStore) CreateIndexesIfNotExists() {
|
||||
fs.CreateIndexIfNotExists("idx_fileinfo_update_at", "FileInfo", "UpdateAt")
|
||||
fs.CreateIndexIfNotExists("idx_fileinfo_create_at", "FileInfo", "CreateAt")
|
||||
fs.CreateIndexIfNotExists("idx_fileinfo_delete_at", "FileInfo", "DeleteAt")
|
||||
}
|
||||
|
||||
func (fs SqlFileInfoStore) Save(info *model.FileInfo) StoreChannel {
|
||||
|
||||
@@ -41,6 +41,7 @@ func NewSqlPostStore(sqlStore *SqlStore) PostStore {
|
||||
func (s SqlPostStore) CreateIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_posts_update_at", "Posts", "UpdateAt")
|
||||
s.CreateIndexIfNotExists("idx_posts_create_at", "Posts", "CreateAt")
|
||||
s.CreateIndexIfNotExists("idx_posts_delete_at", "Posts", "DeleteAt")
|
||||
s.CreateIndexIfNotExists("idx_posts_channel_id", "Posts", "ChannelId")
|
||||
s.CreateIndexIfNotExists("idx_posts_root_id", "Posts", "RootId")
|
||||
s.CreateIndexIfNotExists("idx_posts_user_id", "Posts", "UserId")
|
||||
|
||||
@@ -32,6 +32,9 @@ func NewSqlSessionStore(sqlStore *SqlStore) SessionStore {
|
||||
func (me SqlSessionStore) CreateIndexesIfNotExists() {
|
||||
me.CreateIndexIfNotExists("idx_sessions_user_id", "Sessions", "UserId")
|
||||
me.CreateIndexIfNotExists("idx_sessions_token", "Sessions", "Token")
|
||||
me.CreateIndexIfNotExists("idx_sessions_expires_at", "Sessions", "ExpiresAt")
|
||||
me.CreateIndexIfNotExists("idx_sessions_create_at", "Sessions", "CreateAt")
|
||||
me.CreateIndexIfNotExists("idx_sessions_last_activity_at", "Sessions", "LastActivityAt")
|
||||
}
|
||||
|
||||
func (me SqlSessionStore) Save(session *model.Session) StoreChannel {
|
||||
|
||||
@@ -44,9 +44,13 @@ func NewSqlTeamStore(sqlStore *SqlStore) TeamStore {
|
||||
func (s SqlTeamStore) CreateIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_teams_name", "Teams", "Name")
|
||||
s.CreateIndexIfNotExists("idx_teams_invite_id", "Teams", "InviteId")
|
||||
s.CreateIndexIfNotExists("idx_teams_update_at", "Teams", "UpdateAt")
|
||||
s.CreateIndexIfNotExists("idx_teams_create_at", "Teams", "CreateAt")
|
||||
s.CreateIndexIfNotExists("idx_teams_delete_at", "Teams", "DeleteAt")
|
||||
|
||||
s.CreateIndexIfNotExists("idx_teammembers_team_id", "TeamMembers", "TeamId")
|
||||
s.CreateIndexIfNotExists("idx_teammembers_user_id", "TeamMembers", "UserId")
|
||||
s.CreateIndexIfNotExists("idx_teammembers_delete_at", "TeamMembers", "DeleteAt")
|
||||
}
|
||||
|
||||
func (s SqlTeamStore) Save(team *model.Team) StoreChannel {
|
||||
|
||||
@@ -55,6 +55,9 @@ func NewSqlUserStore(sqlStore *SqlStore) UserStore {
|
||||
|
||||
func (us SqlUserStore) CreateIndexesIfNotExists() {
|
||||
us.CreateIndexIfNotExists("idx_users_email", "Users", "Email")
|
||||
us.CreateIndexIfNotExists("idx_users_update_at", "Users", "UpdateAt")
|
||||
us.CreateIndexIfNotExists("idx_users_create_at", "Users", "CreateAt")
|
||||
us.CreateIndexIfNotExists("idx_users_delete_at", "Users", "DeleteAt")
|
||||
|
||||
us.CreateFullTextIndexIfNotExists("idx_users_username_txt", "Users", USER_SEARCH_TYPE_USERNAME)
|
||||
us.CreateFullTextIndexIfNotExists("idx_users_all_names_txt", "Users", USER_SEARCH_TYPE_ALL)
|
||||
|
||||
@@ -44,6 +44,14 @@ func (s SqlWebhookStore) CreateIndexesIfNotExists() {
|
||||
s.CreateIndexIfNotExists("idx_incoming_webhook_user_id", "IncomingWebhooks", "UserId")
|
||||
s.CreateIndexIfNotExists("idx_incoming_webhook_team_id", "IncomingWebhooks", "TeamId")
|
||||
s.CreateIndexIfNotExists("idx_outgoing_webhook_team_id", "OutgoingWebhooks", "TeamId")
|
||||
|
||||
s.CreateIndexIfNotExists("idx_incoming_webhook_update_at", "IncomingWebhooks", "UpdateAt")
|
||||
s.CreateIndexIfNotExists("idx_incoming_webhook_create_at", "IncomingWebhooks", "CreateAt")
|
||||
s.CreateIndexIfNotExists("idx_incoming_webhook_delete_at", "IncomingWebhooks", "DeleteAt")
|
||||
|
||||
s.CreateIndexIfNotExists("idx_outgoing_webhook_update_at", "OutgoingWebhooks", "UpdateAt")
|
||||
s.CreateIndexIfNotExists("idx_outgoing_webhook_create_at", "OutgoingWebhooks", "CreateAt")
|
||||
s.CreateIndexIfNotExists("idx_outgoing_webhook_delete_at", "OutgoingWebhooks", "DeleteAt")
|
||||
}
|
||||
|
||||
func (s SqlWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) StoreChannel {
|
||||
|
||||
Reference in New Issue
Block a user