Skip to content

A platform for community discussion. Free, open, simple.

DEV: Load all bundled plugins when running `annotate:clean` (#39978)

David Taylor993f94d54cef
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 952e0c75838..eee43e43ce8 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -239,6 +239,8 @@ jobs:
- name: Check Annotations
if: matrix.build_type == 'backend' && (matrix.target == 'core' || matrix.target == 'plugins')
+ env:
+ LOAD_PLUGINS: ""
run: |
directories=""
if [ "${{ matrix.target }}" = "core" ]; then
diff --git a/app/models/directory_item.rb b/app/models/directory_item.rb
index adc04c0be70..01f1d43577a 100644
--- a/app/models/directory_item.rb
+++ b/app/models/directory_item.rb
@@ -242,18 +242,20 @@ end
#
# Table name: directory_items
#
-# id :integer not null, primary key
-# days_visited :integer default(0), not null
-# likes_given :integer not null
-# likes_received :integer not null
-# period_type :integer not null
-# post_count :integer not null
-# posts_read :integer default(0), not null
-# topic_count :integer not null
-# topics_entered :integer not null
-# created_at :datetime
-# updated_at :datetime
-# user_id :integer not null
+# id :integer not null, primary key
+# days_visited :integer default(0), not null
+# gamification_score :integer default(0)
+# likes_given :integer not null
+# likes_received :integer not null
+# period_type :integer not null
+# post_count :integer not null
+# posts_read :integer default(0), not null
+# solutions :integer default(0)
+# topic_count :integer not null
+# topics_entered :integer not null
+# created_at :datetime
+# updated_at :datetime
+# user_id :integer not null
#
# Indexes
#
diff --git a/app/models/group.rb b/app/models/group.rb
index 8fcb3480f22..7d3357854be 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -1238,6 +1238,7 @@ end
# id :integer not null, primary key
# allow_membership_requests :boolean default(FALSE), not null
# allow_unknown_sender_topic_replies :boolean default(FALSE), not null
+# assignable_level :integer default(0), not null
# automatic :boolean default(FALSE), not null
# automatic_membership_email_domains :text
# bio_cooked :text
diff --git a/app/models/post.rb b/app/models/post.rb
index cbc4473b9c4..5a039627dd6 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -1285,6 +1285,7 @@ end
# post_number :integer not null
# post_type :integer default(1), not null
# public_version :integer default(1), not null
+# qa_vote_count :integer default(0)
# quote_count :integer default(0), not null
# raw :text not null
# raw_email :text
@@ -1332,6 +1333,8 @@ end
# index_posts_on_topic_id_and_post_number (topic_id,post_number) UNIQUE
# index_posts_on_topic_id_and_reply_to_post_number (topic_id,reply_to_post_number)
# index_posts_on_topic_id_and_sort_order (topic_id,sort_order)
+# index_posts_on_updated_at_for_locale_detection (updated_at) WHERE ((deleted_at IS NULL) AND (user_id > 0) AND (locale IS NULL))
+# index_posts_on_updated_at_for_localization (updated_at) WHERE ((deleted_at IS NULL) AND (user_id > 0) AND (locale IS NOT NULL))
# index_posts_on_user_id_and_created_at (user_id,created_at)
# index_posts_user_and_likes (user_id,like_count DESC,created_at DESC) WHERE (post_number > 1)
#
diff --git a/app/models/post_custom_field.rb b/app/models/post_custom_field.rb
index 945cdbea222..b0ec9013f50 100644
--- a/app/models/post_custom_field.rb
+++ b/app/models/post_custom_field.rb
@@ -19,9 +19,10 @@ end
#
# Indexes
#
-# index_post_custom_fields_on_name_and_value (name, "left"(value, 200))
-# index_post_custom_fields_on_notice (post_id) UNIQUE WHERE ((name)::text = 'notice'::text)
-# index_post_custom_fields_on_post_id (post_id) UNIQUE WHERE ((name)::text = 'missing uploads'::text)
-# index_post_custom_fields_on_post_id_and_name (post_id,name)
-# index_post_id_where_missing_uploads_ignored (post_id) UNIQUE WHERE ((name)::text = 'missing uploads ignored'::text)
+# index_post_custom_fields_on_name_and_value (name, "left"(value, 200))
+# index_post_custom_fields_on_notice (post_id) UNIQUE WHERE ((name)::text = 'notice'::text)
+# index_post_custom_fields_on_post_id (post_id) UNIQUE WHERE ((name)::text = 'missing uploads'::text)
+# index_post_custom_fields_on_post_id_and_name (post_id,name)
+# index_post_custom_fields_on_stalled_wiki_triggered_at (post_id) UNIQUE WHERE ((name)::text = 'stalled_wiki_triggered_at'::text)
+# index_post_id_where_missing_uploads_ignored (post_id) UNIQUE WHERE ((name)::text = 'missing uploads ignored'::text)
#
diff --git a/app/models/topic.rb b/app/models/topic.rb
index 3193b086820..f232268f45e 100644
--- a/app/models/topic.rb
+++ b/app/models/topic.rb
@@ -2330,21 +2330,23 @@ end
#
# Indexes
#
-# idx_topics_front_page (deleted_at,visible,archetype,category_id,id)
-# 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))
-# index_topics_on_bannered_until (bannered_until) WHERE (bannered_until IS NOT NULL)
-# index_topics_on_bumped_at_public (bumped_at) WHERE ((deleted_at IS NULL) AND ((archetype)::text <> 'private_message'::text))
-# index_topics_on_category_id (category_id) 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_external_id (external_id) UNIQUE WHERE (external_id IS NOT NULL)
-# 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_image_upload_id (image_upload_id)
-# 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_globally (pinned_globally) WHERE pinned_globally
-# index_topics_on_pinned_until (pinned_until) WHERE (pinned_until IS NOT NULL)
-# 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))
+# idx_topics_front_page (deleted_at,visible,archetype,category_id,id)
+# 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))
+# index_topics_on_bannered_until (bannered_until) WHERE (bannered_until IS NOT NULL)
+# index_topics_on_bumped_at_public (bumped_at) WHERE ((deleted_at IS NULL) AND ((archetype)::text <> 'private_message'::text))
+# index_topics_on_category_id (category_id) 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_external_id (external_id) UNIQUE WHERE (external_id IS NOT NULL)
+# 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_image_upload_id (image_upload_id)
+# 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_globally (pinned_globally) WHERE pinned_globally
+# index_topics_on_pinned_until (pinned_until) WHERE (pinned_until IS NOT NULL)
+# 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_for_locale_detection (updated_at) WHERE ((deleted_at IS NULL) AND (user_id > 0) AND (locale IS NULL))
+# index_topics_on_updated_at_for_localization (updated_at) WHERE ((deleted_at IS NULL) AND (user_id > 0) AND (locale IS NOT 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))
#
diff --git a/app/models/topic_custom_field.rb b/app/models/topic_custom_field.rb
index a5d17a93167..fdfcc1b5940 100644
--- a/app/models/topic_custom_field.rb
+++ b/app/models/topic_custom_field.rb
@@ -19,6 +19,13 @@ end
#
# Indexes
#
-# 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))
+# idx_topic_custom_fields_accepted_answer (topic_id) UNIQUE WHERE ((name)::text = 'accepted_answer_post_id'::text)
+# idx_topic_custom_fields_auto_responder_triggered_ids_partial (topic_id,value) UNIQUE WHERE ((name)::text = 'auto_responder_triggered_ids'::text)
+# idx_topic_custom_fields_topic_post_event_all_day (name,topic_id) UNIQUE WHERE ((name)::text = 'TopicEventAllDay'::text)
+# idx_topic_custom_fields_topic_post_event_ends_at (name,topic_id) UNIQUE WHERE ((name)::text = 'TopicEventEndsAt'::text)
+# idx_topic_custom_fields_topic_post_event_starts_at (name,topic_id) UNIQUE WHERE ((name)::text = 'TopicEventStartsAt'::text)
+# index_topic_custom_fields_on_topic_id (topic_id) UNIQUE WHERE ((name)::text = 'vote_count'::text)
+# index_topic_custom_fields_on_topic_id_and_name (topic_id,name)
+# index_topic_custom_fields_on_topic_id_and_slack_thread_id (topic_id,name) UNIQUE WHERE ((name)::text ~~ 'slack_thread_id_%'::text)
+# topic_custom_fields_value_key_idx (value,name) WHERE ((value IS NOT NULL) AND (char_length(value) < 400))
#
diff --git a/app/models/user_custom_field.rb b/app/models/user_custom_field.rb
index 178bcd90159..f1d82f3f052 100644
--- a/app/models/user_custom_field.rb
+++ b/app/models/user_custom_field.rb
@@ -29,5 +29,10 @@ end
#
# 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_on_holiday (name,user_id) UNIQUE WHERE ((name)::text = 'on_holiday'::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)
+# index_user_custom_fields_on_value (value) UNIQUE WHERE ((name)::text = 'ai-stream-conversation-unique-id'::text)
#
diff --git a/app/models/user_option.rb b/app/models/user_option.rb
index 143f6f59a0b..b23c5b9c83f 100644
--- a/app/models/user_option.rb
+++ b/app/models/user_option.rb
@@ -263,55 +263,76 @@ end
#
# Table name: user_options
#
-# allow_private_messages :boolean default(TRUE), not null
-# auto_track_topics_after_msecs :integer
-# automatically_unpin_topics :boolean default(TRUE), not null
-# bookmark_auto_delete_preference :integer default(3), not null
-# composition_mode :integer default(1), not null
-# default_calendar :integer default("none_selected"), not null
-# digest_after_minutes :integer
-# dynamic_favicon :boolean default(FALSE), not null
-# email_digests :boolean
-# email_in_reply_to :boolean default(TRUE), not null
-# email_level :integer default(1), not null
-# email_messages_level :integer default(0), not null
-# email_previous_replies :integer default(2), not null
-# enable_allowed_pm_users :boolean default(FALSE), not null
-# enable_defer :boolean default(FALSE), not null
-# enable_markdown_monospace_font :boolean default(TRUE), not null
-# enable_quoting :boolean default(TRUE), not null
-# enable_smart_lists :boolean default(TRUE), not null
-# external_links_in_new_tab :boolean default(FALSE), not null
-# hide_presence :boolean default(FALSE), not null
-# hide_profile :boolean default(FALSE), not null
-# hide_profile_and_presence :boolean default(FALSE), not null
-# include_tl0_in_digests :boolean default(FALSE)
-# interface_color_mode :integer default(1), not null
-# last_redirected_to_top_at :datetime
-# like_notification_frequency :integer default(1), not null
-# mailing_list_mode :boolean default(FALSE), not null
-# mailing_list_mode_frequency :integer default(1), not null
-# new_topic_duration_minutes :integer
-# notification_level_when_replying :integer
-# notify_on_linked_posts :boolean default(TRUE), not null
-# oldest_search_log_date :datetime
-# seen_popups :integer is an Array
-# show_original_content :boolean default(FALSE), not null
-# sidebar_link_to_filtered_list :boolean default(FALSE), not null
-# sidebar_show_count_of_new_items :boolean default(FALSE), not null
-# skip_new_user_tips :boolean default(FALSE), not null
-# text_size_key :integer default(0), not null
-# text_size_seq :integer default(0), not null
-# theme_ids :integer default([]), not null, is an Array
-# theme_key_seq :integer default(0), not null
-# timezone :string
-# title_count_mode_key :integer default(0), not null
-# topics_unread_when_closed :boolean default(TRUE), not null
-# watched_precedence_over_muted :boolean default(FALSE), not null
-# color_scheme_id :integer
-# dark_scheme_id :integer
-# homepage_id :integer
-# user_id :integer not null, primary key
+# ai_search_discoveries :boolean default(TRUE), not null
+# allow_private_messages :boolean default(TRUE), not null
+# auto_image_caption :boolean default(FALSE), not null
+# auto_track_topics_after_msecs :integer
+# automatically_unpin_topics :boolean default(TRUE), not null
+# bookmark_auto_delete_preference :integer default(3), not null
+# chat_email_frequency :integer default("when_away"), not null
+# chat_enabled :boolean default(TRUE), not null
+# chat_header_indicator_preference :integer default("all_new"), not null
+# chat_quick_reaction_type :integer default("frequent"), not null
+# chat_quick_reactions_custom :string
+# chat_send_shortcut :integer default("enter"), not null
+# chat_separate_sidebar_mode :integer default("default"), not null
+# chat_sound :string
+# composition_mode :integer default(1), not null
+# default_calendar :integer default("none_selected"), not null
+# digest_after_minutes :integer
+# discourse_rewind_dismissed_at :datetime
+# discourse_rewind_enabled :boolean default(TRUE), not null
+# discourse_rewind_share_publicly :boolean default(FALSE), not null
+# dismissed_channel_retention_reminder :boolean
+# dismissed_dm_retention_reminder :boolean
+# dynamic_favicon :boolean default(FALSE), not null
+# email_digests :boolean
+# email_in_reply_to :boolean default(TRUE), not null
+# email_level :integer default(1), not null
+# email_messages_level :integer default(0), not null
+# email_previous_replies :integer default(2), not null
+# enable_allowed_pm_users :boolean default(FALSE), not null
+# enable_defer :boolean default(FALSE), not null
+# enable_markdown_monospace_font :boolean default(TRUE), not null
+# enable_quoting :boolean default(TRUE), not null
+# enable_smart_lists :boolean default(TRUE), not null
+# external_links_in_new_tab :boolean default(FALSE), not null
+# hide_presence :boolean default(FALSE), not null
+# hide_profile :boolean default(FALSE), not null
+# hide_profile_and_presence :boolean default(FALSE), not null
+# ignore_channel_wide_mention :boolean
+# include_tl0_in_digests :boolean default(FALSE)
+# interface_color_mode :integer default(1), not null
+# last_redirected_to_top_at :datetime
+# like_notification_frequency :integer default(1), not null
+# mailing_list_mode :boolean default(FALSE), not null
+# mailing_list_mode_frequency :integer default(1), not null
+# new_topic_duration_minutes :integer
+# notification_level_when_assigned :integer default("watch_topic"), not null
+# notification_level_when_replying :integer
+# notify_on_linked_posts :boolean default(TRUE), not null
+# notify_on_solved :boolean default(TRUE), not null
+# oldest_search_log_date :datetime
+# only_chat_push_notifications :boolean
+# policy_email_frequency :integer default("never"), not null
+# seen_popups :integer is an Array
+# show_original_content :boolean default(FALSE), not null
+# show_thread_title_prompts :boolean default(TRUE), not null
+# sidebar_link_to_filtered_list :boolean default(FALSE), not null
+# sidebar_show_count_of_new_items :boolean default(FALSE), not null
+# skip_new_user_tips :boolean default(FALSE), not null
+# text_size_key :integer default(0), not null
+# text_size_seq :integer default(0), not null
+# theme_ids :integer default([]), not null, is an Array
+# theme_key_seq :integer default(0), not null
+# timezone :string
+# title_count_mode_key :integer default(0), not null
+# topics_unread_when_closed :boolean default(TRUE), not null
+# watched_precedence_over_muted :boolean default(FALSE), not null
+# color_scheme_id :integer
+# dark_scheme_id :integer
+# homepage_id :integer
+# user_id :integer not null, primary key
#
# Indexes
#
diff --git a/lib/tasks/annotate.rake b/lib/tasks/annotate.rake
index 754b556711f..15f9759b60a 100644
--- a/lib/tasks/annotate.rake
+++ b/lib/tasks/annotate.rake
@@ -40,12 +40,19 @@ end
desc "regenerate core model annotations using a temporary database"
task "annotate:clean" => :environment do |task, args|
- load_plugins = ENV["LOAD_PLUGINS"].presence || "0"
+ load_plugins = ENV["LOAD_PLUGINS"].presence || bundled_plugins_list
model_dir = ENV["MODEL_DIR"].presence || "app/models"
annotate_in_temp_db(load_plugins: load_plugins, annotaterb_args: ["--model-dir", model_dir])
STDERR.puts "Annotate executed successfully"
end
+def bundled_plugins_list
+ require "open3"
+ output, status = Open3.capture2("script/list_bundled_plugins")
+ raise "script/list_bundled_plugins failed (#{status.exitstatus})" unless status.success?
+ output.split("\n").map { |p| File.basename(p.strip) }.reject(&:empty?).join(",")
+end
+
desc "regenerate plugin model annotations using a temporary database"
task "annotate:clean:plugins", [:plugin] => :environment do |task, args|
annotaterb_args = []