mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-10 08:05:22 +02:00
63 lines
2.7 KiB
Python
63 lines
2.7 KiB
Python
"""Fix Migrations
|
|
|
|
Revision ID: d0060de90c18
|
|
Revises: 37d0a90fccba
|
|
Create Date: 2025-09-08 13:19:03.854682
|
|
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "d0060de90c18"
|
|
down_revision: Union[str, None] = "37d0a90fccba"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index("ix_api_keys_key_hash", table_name="api_keys")
|
|
op.create_index(op.f("ix_api_keys_key_hash"), "api_keys", ["key_hash"], unique=True)
|
|
|
|
# remove redundant id indexes that got created
|
|
op.drop_index("ix_api_keys_id", table_name="api_keys")
|
|
op.drop_index("ix_users_id", table_name="users")
|
|
op.drop_index("ix_organizations_id", table_name="organizations")
|
|
op.drop_index("ix_workflows_id", table_name="workflows")
|
|
op.drop_index("ix_workflow_definitions_id", table_name="workflow_definitions")
|
|
op.drop_index("ix_workflow_templates_id", table_name="workflow_templates")
|
|
op.drop_index("ix_workflow_runs_id", table_name="workflow_runs")
|
|
op.drop_index("ix_campaigns_id", table_name="campaigns")
|
|
op.drop_index("ix_integrations_id", table_name="integrations")
|
|
op.drop_index("ix_queued_runs_id", table_name="queued_runs")
|
|
op.drop_index("ix_user_configurations_id", table_name="user_configurations")
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f("ix_api_keys_key_hash"), table_name="api_keys")
|
|
op.create_index("ix_api_keys_key_hash", "api_keys", ["key_hash"], unique=False)
|
|
|
|
# Recreate all the redundant id indexes (reverting to the incorrect state)
|
|
op.create_index(
|
|
"ix_user_configurations_id", "user_configurations", ["id"], unique=False
|
|
)
|
|
op.create_index("ix_queued_runs_id", "queued_runs", ["id"], unique=False)
|
|
op.create_index("ix_integrations_id", "integrations", ["id"], unique=False)
|
|
op.create_index("ix_campaigns_id", "campaigns", ["id"], unique=False)
|
|
op.create_index("ix_workflow_runs_id", "workflow_runs", ["id"], unique=False)
|
|
op.create_index(
|
|
"ix_workflow_templates_id", "workflow_templates", ["id"], unique=False
|
|
)
|
|
op.create_index(
|
|
"ix_workflow_definitions_id", "workflow_definitions", ["id"], unique=False
|
|
)
|
|
op.create_index("ix_workflows_id", "workflows", ["id"], unique=False)
|
|
op.create_index("ix_organizations_id", "organizations", ["id"], unique=False)
|
|
op.create_index("ix_users_id", "users", ["id"], unique=False)
|
|
op.create_index("ix_api_keys_id", "api_keys", ["id"], unique=False)
|
|
# ### end Alembic commands ###
|