From d85240335bef8888faac9b93cd33b68f9c9ff2e3 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Tue, 2 Apr 2019 13:17:55 +0800 Subject: [PATCH] Annotate models. --- app/models/category.rb | 8 +++++--- app/models/group_request.rb | 17 +++++++++++++++++ app/models/ignored_user.rb | 2 ++ app/models/post_action.rb | 9 +++++---- app/models/search_log.rb | 4 ++++ app/models/site_setting.rb | 4 ++++ app/models/user_second_factor.rb | 3 ++- 7 files changed, 39 insertions(+), 8 deletions(-) diff --git a/app/models/category.rb b/app/models/category.rb index 767b35077e7..98399c282ac 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -732,10 +732,12 @@ end # suppress_from_latest :boolean default(FALSE) # minimum_required_tags :integer default(0), not null # navigate_to_first_post_after_read :boolean default(FALSE), not null +# search_priority :integer default(0) # # Indexes # -# index_categories_on_email_in (email_in) UNIQUE -# index_categories_on_topic_count (topic_count) -# unique_index_categories_on_name (COALESCE(parent_category_id, '-1'::integer), name) UNIQUE +# index_categories_on_email_in (email_in) UNIQUE +# index_categories_on_search_priority (search_priority) +# index_categories_on_topic_count (topic_count) +# unique_index_categories_on_name (COALESCE(parent_category_id, '-1'::integer), name) UNIQUE # diff --git a/app/models/group_request.rb b/app/models/group_request.rb index 0977ada1575..1d21414acf6 100644 --- a/app/models/group_request.rb +++ b/app/models/group_request.rb @@ -2,3 +2,20 @@ class GroupRequest < ActiveRecord::Base belongs_to :group belongs_to :user end + +# == Schema Information +# +# Table name: group_requests +# +# id :bigint(8) not null, primary key +# group_id :integer +# user_id :integer +# reason :text +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_group_requests_on_group_id (group_id) +# index_group_requests_on_user_id (user_id) +# diff --git a/app/models/ignored_user.rb b/app/models/ignored_user.rb index 58853f8c63b..588a7a9b786 100644 --- a/app/models/ignored_user.rb +++ b/app/models/ignored_user.rb @@ -12,6 +12,8 @@ end # ignored_user_id :integer not null # created_at :datetime not null # updated_at :datetime not null +# summarized_at :datetime +# expiring_at :datetime # # Indexes # diff --git a/app/models/post_action.rb b/app/models/post_action.rb index 343964b8997..d7abf01391a 100644 --- a/app/models/post_action.rb +++ b/app/models/post_action.rb @@ -259,8 +259,9 @@ end # # Indexes # -# idx_unique_actions (user_id,post_action_type_id,post_id,targets_topic) UNIQUE WHERE ((deleted_at IS NULL) AND (disagreed_at IS NULL) AND (deferred_at IS NULL)) -# idx_unique_flags (user_id,post_id,targets_topic) UNIQUE WHERE ((deleted_at IS NULL) AND (disagreed_at IS NULL) AND (deferred_at IS NULL) AND (post_action_type_id = ANY (ARRAY[3, 4, 7, 8]))) -# index_post_actions_on_post_id (post_id) -# index_post_actions_on_user_id_and_post_action_type_id (user_id,post_action_type_id) WHERE (deleted_at IS NULL) +# idx_unique_actions (user_id,post_action_type_id,post_id,targets_topic) UNIQUE WHERE ((deleted_at IS NULL) AND (disagreed_at IS NULL) AND (deferred_at IS NULL)) +# idx_unique_flags (user_id,post_id,targets_topic) UNIQUE WHERE ((deleted_at IS NULL) AND (disagreed_at IS NULL) AND (deferred_at IS NULL) AND (post_action_type_id = ANY (ARRAY[3, 4, 7, 8]))) +# index_post_actions_on_post_action_type_id_and_disagreed_at (post_action_type_id,disagreed_at) WHERE (disagreed_at IS NULL) +# index_post_actions_on_post_id (post_id) +# index_post_actions_on_user_id_and_post_action_type_id (user_id,post_action_type_id) WHERE (deleted_at IS NULL) # diff --git a/app/models/search_log.rb b/app/models/search_log.rb index 5d2a7d716f4..b0774b93f73 100644 --- a/app/models/search_log.rb +++ b/app/models/search_log.rb @@ -185,3 +185,7 @@ end # created_at :datetime not null # search_result_type :integer # +# Indexes +# +# index_search_logs_on_created_at (created_at) +# diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb index e641fba8fe2..fb9d11472c7 100644 --- a/app/models/site_setting.rb +++ b/app/models/site_setting.rb @@ -212,3 +212,7 @@ end # created_at :datetime not null # updated_at :datetime not null # +# Indexes +# +# index_site_settings_on_name (name) UNIQUE +# diff --git a/app/models/user_second_factor.rb b/app/models/user_second_factor.rb index 6c39e8c9fa0..4dea44f7ae7 100644 --- a/app/models/user_second_factor.rb +++ b/app/models/user_second_factor.rb @@ -37,5 +37,6 @@ end # # Indexes # -# index_user_second_factors_on_user_id (user_id) +# index_user_second_factors_on_method_and_enabled (method,enabled) +# index_user_second_factors_on_user_id (user_id) #