Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Apr 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from json import dumps, loads

import sqlalchemy as sa
from alembic import op
from alembic import context, op

# revision identifiers, used by Alembic.
revision = 'de95f5c77138'
Expand Down Expand Up @@ -40,8 +40,13 @@ def upgrade():
{"serpapi_api_key": "$KEY"}
- created_at <- tool_providers.created_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
tool_providers = op.get_bind().execute(
sa.text(
Expand Down