dify icon indicating copy to clipboard operation
dify copied to clipboard

fix: in alembic's offline mode (db migrate with --sql option), skip data operations

Open sagarey opened this issue 10 months ago • 1 comments

Description

In some cases where database DDL is limited, SQL operations are controlled independently. Migrations cannot run in the deployment environment, require Alembic generate raw SQL 屏幕截图 2024-04-16 232652 屏幕截图 2024-04-16 232805

flask db upgrade --sql triggered the error.

屏幕截图 2024-04-16 224648

Type of Change

  • [X] Bug fix (non-breaking change which fixes an issue)
  • [X] This change requires a documentation update, included: Dify Document Maybe the docs could mention that when deployment migrations don't work, can use Alembic offline mode to get the raw SQL.

How Has This Been Tested?

  • [X] Testing what the --sql parameter does. 屏幕截图 2024-04-17 004657

  • [X] Testing the migration that's causing the error. 屏幕截图 2024-04-16 235244 屏幕截图 2024-04-16 235501

  • [X] Testing the complete migration. 屏幕截图 2024-04-17 005015

Suggested Checklist:

  • [X] I have performed a self-review of my own code

  • [X] I have commented my code, particularly in hard-to-understand areas image

  • [X] My changes generate no new warnings

  • [X] I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods 屏幕截图 2024-04-17 005643

  • [ ] optional I have made corresponding changes to the documentation

  • [ ] optional I have added tests that prove my fix is effective or that my feature works

  • [ ] optional New and existing unit tests pass locally with my changes

sagarey avatar Apr 16 '24 17:04 sagarey

Nice feature. Reasonable and practical for enterprise deployment and migration.

bowenliang123 avatar Apr 17 '24 13:04 bowenliang123