0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 21:45:25 +08:00
discourse/plugins/discourse-ai/db/migrate
Natalie Tay 9349e06001
FEATURE: Add category scope for AI translations (#41585)
We have switched AI translations settings first from public categories,
to "include" categories, then to "exclude" categories.

This is not great. Some admins prefer one, and some prefer others. 

This PR allows admins to do either. This also updates default categories
to be "public" only, when the original default was "all" (public +
private).

The migration covers moving existing users to 
- if has selected categories -> "exclude strict" + their selected
categories
- if no selected categories + feature enabled -> "all" to maintain
status quo



https://github.com/user-attachments/assets/607f2340-8fa6-4059-b13d-07d1938ad74f
2026-07-10 09:39:20 +08:00
..
20230224165056_create_classification_results_table.rb
20230307125342_created_model_accuracy_table.rb
20230314184514_migrate_discourse_ai_reviewables.rb
20230316160714_create_completion_prompt_table.rb
20230320122645_delete_duplicated_seeded_prompts.rb
20230320185619_multi_message_completion_prompts.rb
20230320191928_drop_completion_prompt_value.rb
20230322142028_make_dropped_value_column_nullable.rb
20230406135943_add_provider_to_completion_prompts.rb
20230424055354_create_ai_api_audit_logs.rb
20230519003106_post_custom_prompts.rb
20230710171141_enable_pg_vector_extension.rb FIX: Check for pgvector before CREATE EXTENSION (#35070) 2025-12-01 12:42:32 -03:00
20230710171142_create_ai_topic_embeddings_table.rb
20230710171143_migrate_embeddings_from_dedicated_database.rb
20230727170222_create_multilingual_topic_embeddings_table.rb
20230831033812_rename_ai_helper_add_ai_pm_to_header_setting.rb
20231003155701_create_bge_topic_embeddings_table.rb
20231031050538_add_topic_id_post_id_to_ai_audit_log.rb
20231109011155_create_ai_personas.rb
20231117050928_add_system_and_priority_to_ai_personas.rb
20231120033747_remove_site_settings.rb
20231123224203_switch_to_generic_completion_prompts.rb
20231128151234_recreate_generate_titles_prompt.rb
20231202013850_convert_ai_personas_commands_to_json.rb
20231227223301_create_gemini_topic_embeddings_table.rb
20231228213036_create_ai_post_embeddings_tables.rb
20240104013944_add_params_to_completion_prompt.rb
20240119152348_explicit_provider_backwards_compat.rb
20240126013358_create_openai_text_embedding_tables.rb
20240202010752_add_temperature_top_p_to_ai_personas.rb
20240207144910_fix_llm_backed_setting_defaults.rb
20240209044519_add_user_id_mentionable_default_llm_to_ai_personas.rb
20240213051213_add_limits_to_ai_persona.rb
20240309034751_add_shared_ai_conversations.rb
20240309034752_create_rag_document_fragment_table.rb
20240313165121_embedding_tables_for_rag_uploads.rb
20240322035907_add_images_to_ai_personas.rb
20240404000838_add_metadata_to_rag_document_frament.rb
20240409035951_add_rag_params_to_ai_persona.rb
20240410170000_add_embeddings_tablesfor_bge_m3.rb
20240424220101_add_auto_image_caption_to_user_options.rb
20240429065155_add_consolidated_question_llm_to_ai_persona.rb
20240503034946_add_allow_chat_to_ai_persona.rb
20240503042558_add_chat_message_custom_prompt.rb
20240504222307_create_llm_model_table.rb
20240514001334_add_feature_name_to_ai_api_audit_log.rb
20240514171609_add_endpoint_data_to_llm_model.rb
20240527054218_add_language_model_to_ai_audit_logs.rb
20240528132059_add_companion_user_to_llm_model.rb
20240528144216_seed_open_ai_models.rb
20240531205234_seed_claude_models.rb
20240603133432_seed_other_propietary_models.rb
20240603143158_seed_oss_models.rb
20240606151348_create_ai_summaries_table.rb
20240606152117_copy_summary_sections_to_ai_summaries.rb
20240609061418_tool_details_and_command_removal.rb
20240609232736_drop_commands_from_ai_personas.rb
20240610232040_copy_summarization_strategy_to_ai_summarization_strategy.rb
20240610232546_copy_custom_summarization_allowed_groups_to_ai_custom_summarization_allowed_groups.rb
20240611170904_upgrade_pgvector_070.rb
20240611170905_move_embeddings_to_single_table_per_type.rb FIX: Remove old code reference on Discourse AI migration (#33943) 2025-07-29 18:08:36 -03:00
20240611170906_drop_old_embeddings_tables.rb
20240618080148_create_ai_tools.rb
20240619193057_choose_llm_model_setting_migration.rb
20240619211337_update_automation_script_models.rb
20240624135356_llm_model_custom_params.rb
20240624202602_add_provider_specific_params_to_llm_models.rb
20240703135444_llm_models_for_summarization.rb
20240704020102_reset_identity_on_ai_summary.rb
20240708193243_fix_vllm_model_name.rb
20240719143453_llm_model_vision_enabled.rb
20240724174343_migrate_vision_llms.rb DEV: Promote historic core plugins post_deploy migrations (#34274) 2025-08-13 15:52:19 +08:00
20240726164937_fix_ai_summaries_sequence.rb DEV: Enable Style/RedundantBegin rubocop rule (#40096) 2026-05-19 18:44:54 +02:00
20240729202857_migrate_persona_llm_override.rb DEV: Promote historic core plugins post_deploy migrations (#34274) 2025-08-13 15:52:19 +08:00
20240807150605_add_default_to_provider_params.rb
20240809162837_rename_ai_helper_enabled_setting.rb DEV: Promote historic core plugins post_deploy migrations (#34274) 2025-08-13 15:52:19 +08:00
20240809163303_rename_ai_helper_allowed_groups_setting.rb DEV: Promote historic core plugins post_deploy migrations (#34274) 2025-08-13 15:52:19 +08:00
20240909180908_add_ai_summary_type_column.rb
20240912052713_add_target_to_rag_document_fragment.rb
20240912055831_drop_persona_id_from_rag_document_fragments.rb DEV: Promote historic core plugins post_deploy migrations (#34274) 2025-08-13 15:52:19 +08:00
20240913054440_add_rag_columns_to_ai_tools.rb
20241008054440_create_binary_indexes_for_embeddings.rb
20241008055831_drop_old_embeddings_indexes.rb DEV: Promote historic core plugins post_deploy migrations (#34274) 2025-08-13 15:52:19 +08:00
20241009230724_add_forced_tool_count_to_ai_personas.rb
20241014010245_ai_persona_chat_topic_refactor.rb
20241014041242_ai_persona_post_migrate_drop_cols.rb DEV: Promote historic core plugins post_deploy migrations (#34274) 2025-08-13 15:52:19 +08:00
20241020010245_add_tool_name_to_ai_tools.rb
20241023033955_add_feature_context_to_ai_api_log.rb
20241023041242_add_unique_constraint_to_ai_tools.rb
20241025135522_alter_ai_ids_to_bigint.rb
20241028034232_add_unique_ai_stream_conversation_user_id_index.rb
20241031041242_migrate_sentiment_classification_result_format.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20241031145203_track_ai_summary_origin.rb
20241031180044_set_origin_for_existing_ai_summaries.rb
20241104053017_add_ai_artifacts.rb
20241125132452_unique_ai_summaries.rb
20241126033812_rename_ai_gist_batch_setting.rb
20241128010221_add_cached_tokens_to_ai_api_audit_log.rb
20241129190708_fix_classification_data.rb
20241130003808_add_artifact_versions.rb
20241206030229_add_ai_moderation_settings.rb
20241206051225_add_ai_spam_logs.rb
20241206115958_rebake_shared_ai_conversation_oneboxes.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20241217164540_create_embedding_definitions.rb
20241230153300_new_embeddings_tables.rb
20241230153301_add_index_to_ai_topics_embeddings.rb
20250102035341_add_llm_quota_tables.rb
20250110114305_embedding_config_data_migration.rb
20250113171444_drop_old_embedding_tables.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20250114160417_backfill_topic_embeddings.rb
20250114160446_backfill_post_embeddings.rb
20250114160500_backfill_rag_embeddings.rb
20250114184356_drop_old_embedding_tables2.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20250115173456_add_highest_target_number_to_ai_summary.rb
20250115181147_drop_ai_summaries_content_range.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20250121162520_configurable_embeddings_prefixes.rb
20250122003035_add_duration_to_ai_api_log.rb
20250122131007_matryoshka_dimensions_support.rb
20250125162658_fix_broken_open_ai_embeddings_config.rb
20250127145305_clean_unused_embedding_search_indexes.rb
20250210024600_add_rag_llm_model.rb
20250210032345_migrate_persona_to_llm_model_id.rb
20250210032351_post_migrate_persona_to_llm_model_id.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20250211021037_add_error_to_ai_spam_log.rb
20250310172527_add_ai_search_discoveries_to_user_options.rb
20250404045050_migrate_users_to_email_group.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20250407125756_set_correct_default_for_short_summarizer_persona.rb
20250411121705_add_response_format_json_to_personass.rb
20250416215039_add_cost_metrics_to_llm_model.rb
20250417194503_add_max_output_tokens_to_llm_model.rb
20250424035234_remove_old_settings.rb
20250424163718_set_ai_bot_pm_custom_fields.rb
20250429060311_move_dall_e_url.rb
20250501002657_renamed_experimental_ai_bot_setting.rb
20250508154953_add_examples_to_personas.rb
20250508182047_create_inferred_concepts_table.rb
20250508183456_create_inferred_concept_topics.rb
20250509000001_create_inferred_concept_posts.rb
20250607071239_create_ai_artifacts_key_values.rb
20250619105705_add_persona_to_ai_moderation_settings.rb
20250620073222_specify_rate_frequency_in_backfill_setting.rb
20250702073222_rename_mixtral_tokenizer_to_mistral_tokenizer.rb
20250710173803_seed_ai_default_llm_model.rb FEATURE: configure a default LLM model for all features (#33752) 2025-07-28 16:08:00 -03:00
20250710180401_copy_ai_summarization_model_to_persona_default.rb FEATURE: configure a default LLM model for all features (#33752) 2025-07-28 16:08:00 -03:00
20250710181656_copy_ai_helper_model_to_persona_default.rb FEATURE: configure a default LLM model for all features (#33752) 2025-07-28 16:08:00 -03:00
20250710215720_copy_hyde_model_to_persona.rb FEATURE: configure a default LLM model for all features (#33752) 2025-07-28 16:08:00 -03:00
20250715165701_update_open_ai_embeddings_tokenizer.rb
20250716005451_copy_translation_model_to_persona.rb FEATURE: configure a default LLM model for all features (#33752) 2025-07-28 16:08:00 -03:00
20250716005855_copy_ai_image_caption_model_to_persona_default.rb FEATURE: configure a default LLM model for all features (#33752) 2025-07-28 16:08:00 -03:00
20250717075002_set_translation_backfill_max_age.rb
20250721080444_seed_personas_from_triage_scripts.rb FIX: Truncate seeded persona's names to fit name length constraint (#34393) 2025-08-18 18:08:43 -03:00
20250721192553_enable_ai_if_already_installed.rb
20250805134853_report_runner_model_field_cleanup.rb FIX: 'custom' prefix was removed. Cleanup llm_report's model field (#34099) 2025-08-05 13:11:40 -03:00
20250917185050_enable_discover_feature_if_configured.rb FEATURE: Promote Discover to a dedicated feature. (#34846) 2025-09-23 14:01:45 -03:00
20251001000001_add_llm_credit_allocation_system.rb FEATURE: Hosted LLM credit system (#35162) 2025-10-14 07:48:20 -07:00
20251002171950_upgrade_pgvector080.rb DEV: Revert PG Vector 0.8.0 upgrade (#35220) 2025-10-06 17:27:50 -03:00
20251007123645_upgrade_pg_vector080_take2.rb DEV: Re-introduce PG Vector 0.8.0 upgrade (#35233) 2025-10-13 10:55:03 -03:00
20251009141725_remove_ai_bot_enable_dedicated_ux_setting.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20251016143343_remove_ai_problem_check_trackers_without_targets.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20251017150024_delete_ai_problem_check_trackers.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20251105174002_refactor_llm_credit_allocation_to_monthly_usage.rb FIX: Move post_migration to migration instead to ensure monthly_usage is created (#35902) 2025-11-07 15:50:05 +08:00
20251105174003_remove_old_credit_columns_from_llm_credit_allocations.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20251106143458_update_summarizer_persona_to_trust_level_1.rb FEATURE: Lower summarization default access to trust level 1 (#35874) 2025-11-06 15:41:07 -03:00
20251113040027_add_show_thinking_to_ai_personas.rb FEATURE: support thinking summary on responses API (#36013) 2025-11-18 07:54:14 +11:00
20251113040028_migrate_tool_details_to_show_thinking.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20251113174112_update_post_illustrator_system_prompt.rb FEATURE: add image generation tools (#35946) 2025-11-18 07:47:49 -08:00
20251113174215_add_is_image_generation_tool_to_ai_tools.rb FEATURE: add image generation tools (#35946) 2025-11-18 07:47:49 -08:00
20251117000001_add_daily_credits_to_llm_credit_allocations.rb DEV: Apply credit system on daily schedule instead of monthly (#36066) 2025-11-18 09:38:28 -08:00
20251117000002_add_daily_usage_to_llm_credit_allocations.rb FIX: migration issues with AI credits (#36089) 2025-11-18 16:42:21 -08:00
20251117000003_drop_monthly_credit_columns.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20251118000001_split_cache_pricing_for_read_and_write.rb FEATURE: add support for tracking write tokens and anthropic caching and Gemini Pro 3 (#36113) 2025-11-21 07:42:54 +11:00
20251118000500_drop_cached_tokens_from_ai_api_audit_logs.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20251119101732_add_user_id_index_to_ai_api_audit_logs.rb FEATURE: add support for tracking write tokens and anthropic caching and Gemini Pro 3 (#36113) 2025-11-21 07:42:54 +11:00
20251120090000_add_llm_id_to_ai_api_audit_logs.rb FEATURE: improve performance of llm usage report (#36177) 2025-11-25 06:27:35 +11:00
20251120090500_create_ai_api_request_stats.rb FEATURE: improve performance of llm usage report (#36177) 2025-11-25 06:27:35 +11:00
20251121131136_delete_summaries_with_hidden_tags.rb FIX: Prevent hidden tags from leaking in AI summaries (#36167) 2025-11-21 17:03:47 -03:00
20251122000000_backfill_ai_api_request_stats.rb FEATURE: improve performance of llm usage report (#36177) 2025-11-25 06:27:35 +11:00
20251124000000_backfill_llm_id_on_ai_api_request_stats.rb FIX: don't join on llm name, causes dupe records in report (#36206) 2025-11-25 10:22:33 +11:00
20251201225314_create_llm_credit_daily_usages.rb DEV: Move AI credits daily usage to it's own table (#36369) 2025-12-02 11:54:58 -08:00
20251201225946_backfill_llm_credit_daily_usages.rb DEV: Move AI credits daily usage to it's own table (#36369) 2025-12-02 11:54:58 -08:00
20251202090012_add_allowed_attachment_types_to_llm_models.rb FEATURE: native support for attachments in llms (#36415) 2025-12-09 17:28:52 +11:00
20251203115747_add_response_status_to_ai_api_audit_log.rb FEATURE: Use a log based heuristic to check for LLM problems. (#36432) 2025-12-04 13:57:23 -03:00
20251203180046_add_reason_to_ai_spam_logs.rb FEATURE: Add reasoning to spam detection (#36431) 2025-12-05 16:07:35 -03:00
20251209180201_drop_daily_usage_from_llm_credit_allocations.rb DEV: Promote old post-deploy migrations to pre-deploy (#38595) 2026-03-13 19:09:30 +00:00
20251212144720_populate_ai_bot_enabled_llms_setting.rb DEV: migrate enabled_chat_bot column to a setting (#36707) 2025-12-17 09:26:19 -08:00
20260108002529_rename_github_pull_request_diff_to_github_diff.rb FEATURE: allow Github Helper access to commits (#36999) 2026-01-08 12:38:01 +11:00
20260206013735_create_ai_secrets.rb FEATURE: add centralized AI secrets management (#37592) 2026-02-11 10:09:52 +11:00
20260206013736_add_ai_secret_id_to_llm_and_embedding.rb FEATURE: add centralized AI secrets management (#37592) 2026-02-11 10:09:52 +11:00
20260218000000_add_secret_contracts_to_ai_tools.rb FEATURE: add credential bindings for AI tools (#37891) 2026-02-20 07:56:15 +11:00
20260223032030_disable_native_structured_output_for_old_claude_models.rb FEATURE: add native structured output support for Claude 4+ (#37975) 2026-02-23 18:30:13 +11:00
20260304063335_add_agentic_fields_to_ai_personas.rb FEATURE: add agentic execution mode for AI personas (#38230) 2026-03-05 15:06:54 +11:00
20260306000001_rename_ai_personas_to_ai_agents.rb DEV: Flip ai_agents table rename strategy (#38592) 2026-03-13 18:13:56 +00:00
20260310121612_create_ai_tool_actions.rb FEATURE: Add human-in-the-loop approval queue for AI agent tool actions (#38446) 2026-03-13 12:46:59 -03:00
20260310121613_add_require_approval_to_ai_agents.rb FEATURE: Add human-in-the-loop approval queue for AI agent tool actions (#38446) 2026-03-13 12:46:59 -03:00
20260316071736_rename_ai_api_key_scope_resource.rb DEV: Tidy plugin API key scope resource names (#38640) 2026-03-17 13:03:42 +11:00
20260319000000_create_ai_mcp_servers.rb FEATURE: Add MCP server integration to AI agents (#38706) 2026-03-25 17:32:27 +11:00
20260319000001_create_ai_agent_mcp_servers.rb FEATURE: Add MCP server integration to AI agents (#38706) 2026-03-25 17:32:27 +11:00
20260319033623_add_oauth_fields_to_ai_mcp_servers.rb FEATURE: Add MCP server integration to AI agents (#38706) 2026-03-25 17:32:27 +11:00
20260319055039_create_ai_mcp_oauth_tokens.rb FEATURE: Add MCP server integration to AI agents (#38706) 2026-03-25 17:32:27 +11:00
20260319070000_add_selected_tool_names_to_ai_agent_mcp_servers.rb FEATURE: Add MCP server integration to AI agents (#38706) 2026-03-25 17:32:27 +11:00
20260326000000_add_registration_endpoint_to_ai_mcp_servers.rb FIX: Improve MCP OAuth callback error handling (#38889) 2026-03-27 07:34:24 +11:00
20260327040745_add_oauth_advanced_options_to_ai_mcp_servers.rb FEATURE: Add advanced OAuth options for MCP servers (#38913) 2026-04-01 08:47:23 +11:00
20260331024139_split_translation_public_content_setting.rb FEATURE: Expand AI translation settings to allow choosing specific categories instead of just 'all public content' (#39000) 2026-03-31 22:53:37 +08:00
20260420014648_add_post_id_index_to_ai_api_audit_logs.rb PERF: add index for audit log post ids (#39365) 2026-04-20 12:09:44 +10:00
20260422062938_add_localization_candidate_index_to_posts.rb PERF: Run candidate query once instead of per-locale in LocalizePosts (#39442) 2026-04-22 16:21:04 +08:00
20260422102523_add_locale_detection_candidate_index_to_posts.rb PERF: Add index and optimisations for localization jobs (#39454) 2026-04-22 22:58:31 +08:00
20260422130653_add_localization_indexes_to_topics.rb PERF: Add index and optimisations for localization jobs (#39454) 2026-04-22 22:58:31 +08:00
20260504211108_backfill_reviewable_ai_tool_action_scope.rb FIX: Scope ReviewableAiToolAction to target post's topic and category (#39716) 2026-05-05 10:24:19 -03:00
20260510232238_create_ai_bot_conversation_stars.rb FEATURE: Star AI bot conversations in sidebar (#39869) 2026-05-14 15:04:31 +10:00
20260513162531_convert_ai_translation_target_categories_to_excluded_categories.rb FEATURE: Switch from opt-in to opt-out for categories in AI translations (#40169) 2026-05-26 14:51:04 -04:00
20260626055145_add_oauth_token_endpoint_auth_methods_to_ai_mcp_servers.rb DEV: Support other OAuth token auth methods (#41219) 2026-06-26 20:30:53 +08:00
20260629022603_add_request_attempts_to_ai_api_audit_logs.rb FEATURE: retry transient and rate-limited LLM completion requests (#41237) 2026-06-30 09:45:26 +10:00
20260629233141_add_cost_to_llm_quotas_and_ai_usage.rb FEATURE: add cost limits to LLM quotas (#41277) 2026-06-30 15:59:24 +10:00
20260630034050_add_thinking_effort_to_ai_agents.rb FEATURE: add AI agent thinking effort (#41280) 2026-07-01 17:03:19 -03:00
20260708080308_convert_ai_translation_excluded_categories_to_category_scope.rb FEATURE: Add category scope for AI translations (#41585) 2026-07-10 09:39:20 +08:00