DEV: annotate models (#11047)

This commit is contained in:
Arpit Jalan 2020-10-27 23:42:33 +05:30 committed by GitHub
parent 35cfca1f3f
commit c6bf70c870
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 56 additions and 33 deletions

View File

@ -998,9 +998,9 @@ end
# Indexes # Indexes
# #
# index_categories_on_email_in (email_in) UNIQUE # index_categories_on_email_in (email_in) UNIQUE
# index_categories_on_forum_thread_count (topic_count)
# index_categories_on_reviewable_by_group_id (reviewable_by_group_id) # index_categories_on_reviewable_by_group_id (reviewable_by_group_id)
# index_categories_on_search_priority (search_priority) # 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 # unique_index_categories_on_name (COALESCE(parent_category_id, '-1'::integer), name) UNIQUE
# unique_index_categories_on_slug (COALESCE(parent_category_id, '-1'::integer), slug) UNIQUE WHERE ((slug)::text <> ''::text) # unique_index_categories_on_slug (COALESCE(parent_category_id, '-1'::integer), slug) UNIQUE WHERE ((slug)::text <> ''::text)
# #

View File

@ -196,6 +196,7 @@ end
# updated_at :datetime not null # updated_at :datetime not null
# owner :boolean default(FALSE), not null # owner :boolean default(FALSE), not null
# notification_level :integer default(2), not null # notification_level :integer default(2), not null
# first_unread_pm_at :datetime not null
# #
# Indexes # Indexes
# #

View File

@ -42,8 +42,8 @@ end
# Table name: imap_sync_logs # Table name: imap_sync_logs
# #
# id :bigint not null, primary key # id :bigint not null, primary key
# level :integer # level :integer not null
# message :string # message :string not null
# group_id :bigint # group_id :bigint
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null

View File

@ -17,6 +17,7 @@ end
# #
# Indexes # Indexes
# #
# idx_recent_regular_post_search_data (search_data) WHERE ((NOT private_message) AND (post_id >= 0)) USING gin
# idx_search_post (search_data) USING gin # idx_search_post (search_data) USING gin
# index_post_search_data_on_post_id_and_version_and_locale (post_id,version,locale) # index_post_search_data_on_post_id_and_version_and_locale (post_id,version,locale)
# #

View File

@ -90,6 +90,6 @@ end
# #
# Indexes # Indexes
# #
# index_screened_emails_on_email (email) UNIQUE # index_blocked_emails_on_email (email) UNIQUE
# index_screened_emails_on_last_match_at (last_match_at) # index_blocked_emails_on_last_match_at (last_match_at)
# #

View File

@ -98,12 +98,13 @@ end
# #
# Table name: theme_modifier_sets # Table name: theme_modifier_sets
# #
# id :bigint not null, primary key # id :bigint not null, primary key
# theme_id :bigint not null # theme_id :bigint not null
# serialize_topic_excerpts :boolean # serialize_topic_excerpts :boolean
# csp_extensions :string is an Array # csp_extensions :string is an Array
# svg_icons :string is an Array # svg_icons :string is an Array
# topic_thumbnail_sizes :string is an Array # discourse_teams_sidebar_disabled :boolean
# topic_thumbnail_sizes :string is an Array
# #
# Indexes # Indexes
# #

View File

@ -1770,7 +1770,6 @@ end
# archetype :string default("regular"), not null # archetype :string default("regular"), not null
# featured_user4_id :integer # featured_user4_id :integer
# notify_moderators_count :integer default(0), not null # notify_moderators_count :integer default(0), not null
# slow_mode_seconds :integer default(0), not null
# spam_count :integer default(0), not null # spam_count :integer default(0), not null
# pinned_at :datetime # pinned_at :datetime
# score :float # score :float
@ -1788,13 +1787,14 @@ end
# featured_link :string # featured_link :string
# reviewable_score :float default(0.0), not null # reviewable_score :float default(0.0), not null
# image_upload_id :bigint # image_upload_id :bigint
# slow_mode_seconds :integer default(0), not null
# #
# Indexes # Indexes
# #
# idx_topics_front_page (deleted_at,visible,archetype,category_id,id) # idx_topics_front_page (deleted_at,visible,archetype,category_id,id)
# idx_topics_user_id_deleted_at (user_id) WHERE (deleted_at IS NULL) # idx_topics_user_id_deleted_at (user_id) WHERE (deleted_at IS NULL)
# idxtopicslug (slug) WHERE ((deleted_at IS NULL) AND (slug IS NOT NULL)) # idxtopicslug (slug) WHERE ((deleted_at IS NULL) AND (slug IS NOT NULL))
# index_topics_on_bumped_at (bumped_at) # index_forum_threads_on_bumped_at (bumped_at)
# index_topics_on_created_at_and_visible (created_at,visible) WHERE ((deleted_at IS NULL) AND ((archetype)::text <> 'private_message'::text)) # index_topics_on_created_at_and_visible (created_at,visible) WHERE ((deleted_at IS NULL) AND ((archetype)::text <> 'private_message'::text))
# index_topics_on_id_and_deleted_at (id,deleted_at) # index_topics_on_id_and_deleted_at (id,deleted_at)
# index_topics_on_id_filtered_banner (id) UNIQUE WHERE (((archetype)::text = 'banner'::text) AND (deleted_at IS NULL)) # index_topics_on_id_filtered_banner (id) UNIQUE WHERE (((archetype)::text = 'banner'::text) AND (deleted_at IS NULL))
@ -1802,5 +1802,6 @@ end
# index_topics_on_lower_title (lower((title)::text)) # index_topics_on_lower_title (lower((title)::text))
# index_topics_on_pinned_at (pinned_at) WHERE (pinned_at IS NOT NULL) # index_topics_on_pinned_at (pinned_at) WHERE (pinned_at IS NOT NULL)
# index_topics_on_pinned_globally (pinned_globally) WHERE pinned_globally # index_topics_on_pinned_globally (pinned_globally) WHERE pinned_globally
# index_topics_on_timestamps_private (bumped_at,created_at,updated_at) WHERE ((deleted_at IS NULL) AND ((archetype)::text = 'private_message'::text))
# index_topics_on_updated_at_public (updated_at,visible,highest_staff_post_number,highest_post_number,category_id,created_at,id) WHERE (((archetype)::text <> 'private_message'::text) AND (deleted_at IS NULL)) # index_topics_on_updated_at_public (updated_at,visible,highest_staff_post_number,highest_post_number,category_id,created_at,id) WHERE (((archetype)::text <> 'private_message'::text) AND (deleted_at IS NULL))
# #

View File

@ -17,7 +17,8 @@ end
# #
# Indexes # Indexes
# #
# idx_topic_custom_fields_topic_post_event_starts_at (name,topic_id) UNIQUE WHERE ((name)::text = 'TopicEventStartsAt'::text) # idx_topic_custom_fields_accepted_answer (topic_id) UNIQUE WHERE ((name)::text = 'accepted_answer_post_id'::text)
# index_topic_custom_fields_on_topic_id_and_name (topic_id,name) # index_topic_custom_fields_on_topic_id (topic_id) UNIQUE WHERE ((name)::text = 'vote_count'::text)
# topic_custom_fields_value_key_idx (value,name) WHERE ((value IS NOT NULL) AND (char_length(value) < 400)) # index_topic_custom_fields_on_topic_id_and_name (topic_id,name)
# topic_custom_fields_value_key_idx (value,name) WHERE ((value IS NOT NULL) AND (char_length(value) < 400))
# #

View File

@ -402,10 +402,10 @@ end
# #
# Indexes # Indexes
# #
# index_topic_links_on_extension (extension) # index_forum_thread_links_on_forum_thread_id (topic_id)
# index_topic_links_on_link_post_id_and_reflection (link_post_id,reflection) # index_forum_thread_links_on_forum_thread_id_and_post_id_and_url (topic_id,post_id,url) UNIQUE
# index_topic_links_on_post_id (post_id) # index_topic_links_on_extension (extension)
# index_topic_links_on_topic_id (topic_id) # index_topic_links_on_link_post_id_and_reflection (link_post_id,reflection)
# index_topic_links_on_user_id (user_id) # index_topic_links_on_post_id (post_id)
# unique_post_links (topic_id,post_id,url) UNIQUE # index_topic_links_on_user_id (user_id)
# #

View File

@ -128,5 +128,5 @@ end
# #
# Indexes # Indexes
# #
# by_link (topic_link_id) # index_forum_thread_link_clicks_on_forum_thread_link_id (topic_link_id)
# #

View File

@ -495,7 +495,6 @@ end
# posted :boolean default(FALSE), not null # posted :boolean default(FALSE), not null
# last_read_post_number :integer # last_read_post_number :integer
# highest_seen_post_number :integer # highest_seen_post_number :integer
# last_posted_at :datetime
# last_visited_at :datetime # last_visited_at :datetime
# first_visited_at :datetime # first_visited_at :datetime
# notification_level :integer default(1), not null # notification_level :integer default(1), not null
@ -507,9 +506,10 @@ end
# last_emailed_post_number :integer # last_emailed_post_number :integer
# liked :boolean default(FALSE) # liked :boolean default(FALSE)
# bookmarked :boolean default(FALSE) # bookmarked :boolean default(FALSE)
# last_posted_at :datetime
# #
# Indexes # Indexes
# #
# index_topic_users_on_topic_id_and_user_id (topic_id,user_id) UNIQUE # index_forum_thread_users_on_forum_thread_id_and_user_id (topic_id,user_id) UNIQUE
# index_topic_users_on_user_id_and_topic_id (user_id,topic_id) UNIQUE # index_topic_users_on_user_id_and_topic_id (user_id,topic_id) UNIQUE
# #

View File

@ -464,9 +464,9 @@ end
# #
# idx_unique_rows (action_type,user_id,target_topic_id,target_post_id,acting_user_id) UNIQUE # idx_unique_rows (action_type,user_id,target_topic_id,target_post_id,acting_user_id) UNIQUE
# idx_user_actions_speed_up_user_all (user_id,created_at,action_type) # idx_user_actions_speed_up_user_all (user_id,created_at,action_type)
# index_user_actions_on_acting_user_id (acting_user_id) # index_actions_on_acting_user_id (acting_user_id)
# index_actions_on_user_id_and_action_type (user_id,action_type)
# index_user_actions_on_action_type_and_created_at (action_type,created_at) # index_user_actions_on_action_type_and_created_at (action_type,created_at)
# index_user_actions_on_target_post_id (target_post_id) # index_user_actions_on_target_post_id (target_post_id)
# index_user_actions_on_target_user_id (target_user_id) WHERE (target_user_id IS NOT NULL) # index_user_actions_on_target_user_id (target_user_id) WHERE (target_user_id IS NOT NULL)
# index_user_actions_on_user_id_and_action_type (user_id,action_type)
# #

View File

@ -79,7 +79,6 @@ end
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# revoked_at :datetime # revoked_at :datetime
# scopes :text default([]), not null, is an Array
# last_used_at :datetime not null # last_used_at :datetime not null
# key_hash :string not null # key_hash :string not null
# #

View File

@ -17,5 +17,8 @@ end
# #
# Indexes # Indexes
# #
# index_user_custom_fields_on_user_id_and_name (user_id,name) # idx_user_custom_fields_last_reminded_at (name,user_id) UNIQUE WHERE ((name)::text = 'last_reminded_at'::text)
# idx_user_custom_fields_remind_assigns_frequency (name,user_id) UNIQUE WHERE ((name)::text = 'remind_assigns_frequency'::text)
# idx_user_custom_fields_user_notes_count (name,user_id) UNIQUE WHERE ((name)::text = 'user_notes_count'::text)
# index_user_custom_fields_on_user_id_and_name (user_id,name)
# #

View File

@ -304,10 +304,10 @@ end
# #
# Indexes # Indexes
# #
# index_staff_action_logs_on_action_and_id (action,id)
# index_staff_action_logs_on_subject_and_id (subject,id)
# index_staff_action_logs_on_target_user_id_and_id (target_user_id,id)
# index_user_histories_on_acting_user_id_and_action_and_id (acting_user_id,action,id) # index_user_histories_on_acting_user_id_and_action_and_id (acting_user_id,action,id)
# index_user_histories_on_action_and_id (action,id)
# index_user_histories_on_category_id (category_id) # index_user_histories_on_category_id (category_id)
# index_user_histories_on_subject_and_id (subject,id)
# index_user_histories_on_target_user_id_and_id (target_user_id,id)
# index_user_histories_on_topic_id_and_target_user_id_and_action (topic_id,target_user_id,action) # index_user_histories_on_topic_id_and_target_user_id_and_action (topic_id,target_user_id,action)
# #

View File

@ -6,3 +6,18 @@ class UserIpAddressHistory < ActiveRecord::Base
validates :user_id, presence: true validates :user_id, presence: true
validates :ip_address, presence: true, uniqueness: { scope: :user_id } validates :ip_address, presence: true, uniqueness: { scope: :user_id }
end end
# == Schema Information
#
# Table name: user_ip_address_histories
#
# id :bigint not null, primary key
# user_id :integer not null
# ip_address :inet not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_user_ip_address_histories_on_user_id_and_ip_address (user_id,ip_address) UNIQUE
#

View File

@ -290,5 +290,6 @@ end
# flags_ignored :integer default(0), not null # flags_ignored :integer default(0), not null
# first_unread_at :datetime not null # first_unread_at :datetime not null
# distinct_badge_count :integer default(0), not null # distinct_badge_count :integer default(0), not null
# first_unread_pm_at :datetime not null
# digest_attempted_at :datetime # digest_attempted_at :datetime
# #