dify/api/migrations/versions
QuantumGhost 9565fe9b1b
fix(api): fix alembic offline mode (#19285)
Alembic's offline mode generates SQL from SQLAlchemy migration operations,
providing developers with a clear view of database schema changes without
requiring an active database connection.

However, some migration versions (specifically bbadea11becb and d7999dfa4aae)
were performing database schema introspection, which fails in offline mode
since it requires an actual database connection.

This commit:
- Adds offline mode support by detecting context.is_offline_mode()
- Skips introspection steps when in offline mode
- Adds warning messages in SQL output to inform users that assumptions were made
- Prompts users to review the generated SQL for accuracy

These changes ensure migrations work consistently in both online and offline modes.

Close #19284.
2025-05-06 18:05:19 +08:00
..
00bacef91f18_rename_api_provider_description.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
2a3aebbbf4bb_add_app_tracing.py Feat/add-remote-file-upload-api (#9906) 2024-11-01 15:51:22 +08:00
2beac44e5f5f_add_is_universal_in_apps.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
2c8af9671032_add_qa_document_language.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
2e9819ca5b28_add_tenant_id_in_api_token.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
3b18fea55204_add_tool_label_bings.py feat/enhance the multi-modal support (#8818) 2024-10-21 10:43:49 +08:00
3c7cac9521c6_add_tags_and_binding_table.py Knowledge optimization (#3755) 2024-04-24 15:02:29 +08:00
3ef9b2b6bee6_add_assistant_app.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
03f98355ba0e_add_workflow_tool_label_and_tool_.py chore: cleanup pycodestyle E rules (#8269) 2024-09-11 18:55:00 +08:00
4bcffcd64aa4_update_dataset_model_field_null_.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
04c602f5dc9b_update_appmodelconfig_and_add_table_.py Feat/add-remote-file-upload-api (#9906) 2024-11-01 15:51:22 +08:00
4e99a8df00ff_add_load_balancing.py feat/enhance the multi-modal support (#8818) 2024-10-21 10:43:49 +08:00
4ff534e1eb11_add_workflow_to_site.py feat: option to hide workflow steps (#5436) 2024-06-21 12:51:10 +08:00
5fda94355fce_custom_disclaimer.py fix: workaround db migration error when adding custom_disclaimer column to recommended_apps (#4518) 2024-05-20 12:33:21 +08:00
6dcb43972bdc_add_dataset_retriever_resource.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
6e2cfb077b04_add_dataset_collection_binding.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
6e957a32015b_add_embedding_cache_created_at_index.py update clean embedding cache query logic (#6483) 2024-07-20 01:29:25 +08:00
7b45942e39bb_add_api_key_auth_binding.py feat/enhance the multi-modal support (#8818) 2024-10-21 10:43:49 +08:00
7bdef072e63a_add_workflow_tool.py feat/enhance the multi-modal support (#8818) 2024-10-21 10:43:49 +08:00
7ce5a52e4eee_add_tool_providers.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
7e6a8693e07a_add_table_dataset_permissions.py feat/enhance the multi-modal support (#8818) 2024-10-21 10:43:49 +08:00
8ae9bc661daa_add_tool_conversation_variables_idx.py enhancement: introduce Ruff for Python linter for reordering and removing unused imports with automated pre-commit and sytle check (#2366) 2024-02-06 13:21:13 +08:00
8d2d099ceb74_add_qa_model_support.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
8e5588e6412e_add_environment_variable_to_workflow_.py Feat/environment variables in workflow (#6515) 2024-07-22 15:29:39 +08:00
8ec536f3c800_rename_api_provider_credentails.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
8fe468ba0ca5_add_gpt4v_supports.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
9e98fbaffb88_add_workflow_tool_version.py chore: cleanup pycodestyle E rules (#8269) 2024-09-11 18:55:00 +08:00
9f4e3427ea84_add_created_by_role.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
9fafbd60eca1_add_message_file_belongs_to.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
16fa53d9faec_add_provider_model_support.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
17b5ab037c40_add_keyworg_table_storage_type.py add keyword table s3 storage support (#3065) 2024-04-01 20:19:30 +08:00
23db93619b9d_add_message_files_into_agent_thought.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
42e85ed5564d_conversation_columns_set_nullable.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
47cc7df8c4f3_modify_default_model_name_length.py fix: system default model name length (#4245) (#4246) 2024-05-10 18:12:18 +08:00
53bf8af60645_update_model.py Fix/6615 40 varchar limit on model name (#6623) 2024-07-24 16:23:16 +08:00
053da0c1d756_add_api_tool_privacy.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
63f9175e515b_merge_branches.py FR: #4048 - Add color customization to the chatbot (#4885) 2024-06-26 17:51:00 +08:00
64a70a7aab8b_add_workflow_run_index.py fix: workflow run sequence number slow sql (#4737) 2024-05-28 20:41:52 +08:00
64b051264f32_init.py Enhance Code Consistency Across Repository with `.editorconfig` (#19023) 2025-04-29 18:04:33 +08:00
77e83833755c_add_app_config_retriever_resource.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
89c7899ca936_.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
114eed84c228_remove_tool_id_from_model_invoke.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
161cadc1af8d_add_dataset_permission_tenant_id.py fix dataset operator (#6064) 2024-07-09 17:47:54 +08:00
246ba09cbbdb_add_app_anntation_setting.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
380c6aa5a70d_add_tool_labels_to_agent_thought.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
563cf8bf777b_enable_tool_file_without_conversation_id.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
614f77cecc48_add_last_active_at.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
675b5321501b_add_node_execution_id_into_node_.py feat: Parallel Execution of Nodes in Workflows (#8192) 2024-09-10 15:23:16 +08:00
714aafe25d39_add_anntation_history_match_response.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
853f9b9cd3b6_add_message_price_unit.py enhancement: introduce Ruff for Python linter for reordering and removing unused imports with automated pre-commit and sytle check (#2366) 2024-02-06 13:21:13 +08:00
968fff4c0ab9_add_api_based_extension.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
2024_08_09_0801-1787fbae959a_update_tools_original_url_length.py Feat/update tools length (#7141) 2024-08-09 16:07:37 +08:00
2024_08_13_0633-63a83fcf12ba_support_conversation_variables.py Feat: conversation variable & variable assigner node (#7222) 2024-08-13 14:44:10 +08:00
2024_08_14_1354-8782057ff0dc_add_conversations_dialogue_count.py feat(api/workflow): Add `Conversation.dialogue_count` (#7275) 2024-08-15 10:53:05 +08:00
2024_08_15_0956-0251a1c768cc_add_tidb_auth_binding.py add tidb on qdrant type (#9831) 2024-10-25 13:57:03 +08:00
2024_08_15_1001-a6be81136580_app_and_site_icon_type.py feat: custom app icon (#7196) 2024-08-19 09:16:33 +08:00
2024_08_20_0455-2dbe42621d96_rename_workflow__conversation_variables_.py chore(database): Rename table name from `workflow__conversation_variables` to `workflow_conversation_variables`. (#7432) 2024-08-20 14:34:03 +08:00
2024_08_25_0441-d0187d6a88dd_add_created_by_and_updated_by_to_app_.py feat: store created_by and updated_by for apps, modelconfigs, and sites (#7613) 2024-08-28 08:47:30 +08:00
2024_09_01_1255-030f4915f36a_add_use_icon_as_answer_icon_fields_for_.py feat: allow users to use the app icon as the answer icon (#7888) 2024-09-02 20:00:41 +08:00
2024_09_11_1012-d57ba9ebb251_add_parent_message_id_to_messages.py feat: regenerate in `Chat`, `agent` and `Chatflow` app (#7661) 2024-09-22 03:15:11 +08:00
2024_09_24_0922-6af6a521a53e_update_retrieval_resource.py external knowledge api (#8913) 2024-09-30 15:38:43 +08:00
2024_09_25_0434-33f5fac87f29_external_knowledge_api.py external knowledge api (#8913) 2024-09-30 15:38:43 +08:00
2024_09_29_0835-ddcc8bbef391_increase_max_length_of_builtin_tool_provider.py Introduce Plugins (#13836) 2025-02-17 17:05:13 +08:00
2024_10_09_1329-d8e744d88ed6_fix_wrong_service_api_history.py fix(migrations): correct schema reference in service API history migration (#10452) 2024-11-08 17:47:57 +08:00
2024_10_10_0516-bbadea11becb_add_name_and_size_to_tool_files.py fix(api): fix alembic offline mode (#19285) 2025-05-06 18:05:19 +08:00
2024_10_22_0959-43fa78bc3b7d_add_white_list.py add tidb on qdrant type (#9831) 2024-10-25 13:57:03 +08:00
2024_10_28_0720-08ec4f75af5e_add_tenant_plugin_permisisons.py Introduce Plugins (#13836) 2025-02-17 17:05:13 +08:00
2024_11_01_0434-d3f6769a94a3_add_upload_files_source_url.py Feat/add-remote-file-upload-api (#9906) 2024-11-01 15:51:22 +08:00
2024_11_01_0449-93ad8c19c40b_rename_conversation_variables_index_name.py Feat/add-remote-file-upload-api (#9906) 2024-11-01 15:51:22 +08:00
2024_11_01_0540-f4d7ce70a7ca_update_upload_files_source_url.py Feat/add-remote-file-upload-api (#9906) 2024-11-01 15:51:22 +08:00
2024_11_01_0622-d07474999927_update_type_of_custom_disclaimer_to_text.py Feat/add-remote-file-upload-api (#9906) 2024-11-01 15:51:22 +08:00
2024_11_01_0623-09a8d1878d9b_update_workflows_graph_features_and_.py refactor(migration/model): update column types for workflow schema (#10160) 2024-11-01 16:10:55 +08:00
2024_11_12_0925-01d6889832f7_add_created_at_index_for_messages.py Feat/clean message records (#10588) 2024-11-18 16:57:39 +08:00
2024_11_22_0701-e19037032219_parent_child_index.py Feat/support parent child chunk (#12092) 2024-12-25 19:49:07 +08:00
2024_11_28_0553-cf8f4fc45278_add_exceptions_count_field_to_.py Feat: continue on error (#11458) 2024-12-11 14:22:42 +08:00
2024_12_19_1746-11b07f66c737_remove_unused_tool_providers.py chore(db): use a better way to export models and remove unused table (#11838) 2024-12-20 14:12:29 +08:00
2024_12_20_0628-e1944c35e15e_add_retry_index_field_to_node_execution_.py Enhance Code Consistency Across Repository with `.editorconfig` (#19023) 2025-04-29 18:04:33 +08:00
2024_12_23_1154-d7999dfa4aae_remove_workflow_node_executions_retry_.py fix(api): fix alembic offline mode (#19285) 2025-05-06 18:05:19 +08:00
2024_12_25_1137-923752d42eb6_add_auto_disabled_dataset_logs.py Feat/support parent child chunk (#12092) 2024-12-25 19:49:07 +08:00
2025_01_01_2000-a91b476a53de_change_workflow_runs_total_tokens_to_.py fix(models): use bigint on workflow_runs.total_tokens (#12279) 2025-01-02 09:49:34 +08:00
2025_01_14_0617-f051706725cc_add_rate_limit_logs.py fix db migration (#15422) 2025-03-11 00:24:57 +08:00
2025_02_27_0917-d20049ed0af6_add_metadata_function.py Support knowledge metadata filter (#15982) 2025-03-18 16:42:19 +08:00
2025_03_03_0304-4413929e1ec2_extend_provider_name_column.py fix: (psycopg2.errors.StringDataRightTruncation) value too long for type character varying(40) Fixes #14593 (#14597) 2025-03-03 13:16:51 +08:00
2025_03_03_1436-ee79d9b1c156_add_marked_name_and_marked_comment_in_.py feat(workflow_service): workflow version control api. (#14860) 2025-03-10 13:34:31 +08:00
2025_03_07_0315-5511c782ee4c_extend_provider_column.py Fix: psycopg2.errors.StringDataRightTruncation value too long for type character varying(40) (#15179) 2025-03-07 12:15:52 +08:00
2025_03_29_2227-6a9f914f656c_change_documentsegment_and_childchunk_.py Fix Performance Issues: (#17083) 2025-04-09 11:22:53 +08:00
4823da1d26cf_add_tool_file.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
4829e54d2fee_change_message_chain_id_to_nullable.py enhancement: introduce Ruff for Python linter for reordering and removing unused imports with automated pre-commit and sytle check (#2366) 2024-02-06 13:21:13 +08:00
16830a790f0f_.py enhancement: introduce Ruff for Python linter for reordering and removing unused imports with automated pre-commit and sytle check (#2366) 2024-02-06 13:21:13 +08:00
46976cc39132_add_annotation_histoiry_score.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
88072f0caa04_add_custom_config_in_tenant.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
187385f442fc_modify_provider_model_name_length.py enhancement: introduce Ruff for Python linter for reordering and removing unused imports with automated pre-commit and sytle check (#2366) 2024-02-06 13:21:13 +08:00
408176b91ad3_add_max_active_requests.py feat: app rate limit (#5844) 2024-07-10 21:31:35 +08:00
5022897aaceb_add_model_name_in_embedding.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
a5b56fb053ef_app_config_add_speech_to_text.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
a8d7385a7b66_add_embeddings_provider_name.py add embedding cache and clean embedding cache job (#3087) 2024-04-02 20:46:24 +08:00
a8f9b3c45e4a_add_tenant_id_db_index.py add tenant id index for document and document_segment table (#2873) 2024-03-18 14:34:32 +08:00
a45f4dfde53b_add_language_to_recommend_apps.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
a9836e3baeee_add_external_data_tools_in_app_model_.py enhancement: introduce Ruff for Python linter for reordering and removing unused imports with automated pre-commit and sytle check (#2366) 2024-02-06 13:21:13 +08:00
ab23c11305d4_add_dataset_query_variable_at_app_model_.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
ad472b61a054_add_api_provider_icon.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
b3a09c049e8e_add_advanced_prompt_templates.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
b24be59fbb04_.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
b69ca54b9208_add_chatbot_color_theme.py FR: #4048 - Add color customization to the chatbot (#4885) 2024-06-26 17:51:00 +08:00
b289e2408ee2_add_workflow.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
b2602e131636_add_workflow_run_id_index_for_message.py fix: slow sql of ops tracing (#5749) 2024-06-29 20:28:30 +08:00
b5429b71023c_messages_columns_set_nullable.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
bf0aec5ba2cf_add_provider_order.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
c031d46af369_remove_app_model_config_trace_config_.py Feat/add-remote-file-upload-api (#9906) 2024-11-01 15:51:22 +08:00
c3311b089690_add_tool_meta.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
c71211c8f604_add_tool_invoke_model_log.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
cc04d0998d4d_set_model_config_column_nullable.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
d3d503a3471c_add_is_deleted_to_conversations.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
de95f5c77138_migration_serpapi_api_key.py Enhance Code Consistency Across Repository with `.editorconfig` (#19023) 2025-04-29 18:04:33 +08:00
dfb3b7f477da_add_tool_index.py enhancement: introduce Ruff for Python linter for reordering and removing unused imports with automated pre-commit and sytle check (#2366) 2024-02-06 13:21:13 +08:00
e2eacc9a1b63_add_status_for_message.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
e32f6ccb87c6_e08af0a69ccefbb59fa80c778efee300bb780980.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
e35ed59becda_modify_quota_limit_field_type.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
e1901f623fd0_add_annotation_reply.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
e8883b0148c9_add_dataset_model_name.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
eeb2e349e6ac_increase_max_model_name_length.py Fix/6615 40 varchar limit on DatasetCollectionBinding and Embedding model name (#6723) 2024-07-28 09:42:58 +08:00
f2a6fc85e260_add_anntation_history_message_id.py improve: introduce isort for linting Python imports (#1983) 2024-01-12 12:34:01 +08:00
f9107f83abab_add_desc_for_apps.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
f25003750af4_add_created_updated_at.py bump version to 0.5.3 (#2306) 2024-02-01 18:11:57 +08:00
fca025d3b60f_add_dataset_retrival_model.py external knowledge api (#8913) 2024-09-30 15:38:43 +08:00
fecff1c3da27_remove_extra_tracing_app_config_table .py Feat/add-remote-file-upload-api (#9906) 2024-11-01 15:51:22 +08:00