mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 05:58:59 +08:00
fix: in alembic's offline mode (db migrate with --sql option), skip data operations (#3533)
This commit is contained in:
parent
b3996b3221
commit
1fb7df12d7
@ -8,7 +8,7 @@ Create Date: 2024-01-21 12:09:04.651394
|
|||||||
from json import dumps, loads
|
from json import dumps, loads
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from alembic import op
|
from alembic import context, op
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = 'de95f5c77138'
|
revision = 'de95f5c77138'
|
||||||
@ -40,8 +40,13 @@ def upgrade():
|
|||||||
{"serpapi_api_key": "$KEY"}
|
{"serpapi_api_key": "$KEY"}
|
||||||
- created_at <- tool_providers.created_at
|
- created_at <- tool_providers.created_at
|
||||||
- updated_at <- tool_providers.updated_at
|
- updated_at <- tool_providers.updated_at
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# in alembic's offline mode (with --sql option), skip data operations and output comments describing the migration to raw sql
|
||||||
|
if context.is_offline_mode():
|
||||||
|
print(f" /*{upgrade.__doc__}*/\n")
|
||||||
|
return
|
||||||
|
|
||||||
# select all tool_providers
|
# select all tool_providers
|
||||||
tool_providers = op.get_bind().execute(
|
tool_providers = op.get_bind().execute(
|
||||||
sa.text(
|
sa.text(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user