remove unused index on primary keys (#2754)
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
"""remove unused index on primary key
|
||||
|
||||
Revision ID: 2d2f165170f1
|
||||
Revises: a9fd7a08469c
|
||||
Create Date: 2025-06-19 20:02:06.061884+00:00
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "2d2f165170f1"
|
||||
down_revision: Union[str, None] = "a9fd7a08469c"
|
||||
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_actions_action_id", table_name="actions")
|
||||
op.drop_index("ix_artifacts_ai_suggestion_id", table_name="artifacts")
|
||||
op.drop_index("ix_artifacts_artifact_id", table_name="artifacts")
|
||||
op.drop_index("ix_aws_secret_parameters_aws_secret_parameter_id", table_name="aws_secret_parameters")
|
||||
op.drop_index("ix_credential_parameters_credential_parameter_id", table_name="credential_parameters")
|
||||
op.drop_index(
|
||||
"ix_onepassword_credential_parameters_onepassword_creden_aba8", table_name="onepassword_credential_parameters"
|
||||
)
|
||||
op.drop_index("ix_organizations_organization_id", table_name="organizations")
|
||||
op.drop_index("ix_output_parameters_output_parameter_id", table_name="output_parameters")
|
||||
op.drop_index("ix_steps_step_id", table_name="steps")
|
||||
op.drop_index("ix_tasks_task_id", table_name="tasks")
|
||||
op.drop_index("ix_workflow_parameters_workflow_parameter_id", table_name="workflow_parameters")
|
||||
op.drop_index("ix_workflow_runs_workflow_run_id", table_name="workflow_runs")
|
||||
op.drop_index("ix_workflows_workflow_id", table_name="workflows")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index("ix_workflows_workflow_id", "workflows", ["workflow_id"], unique=False)
|
||||
op.create_index("ix_workflow_runs_workflow_run_id", "workflow_runs", ["workflow_run_id"], unique=False)
|
||||
op.create_index(
|
||||
"ix_workflow_parameters_workflow_parameter_id", "workflow_parameters", ["workflow_parameter_id"], unique=False
|
||||
)
|
||||
op.create_index("ix_tasks_task_id", "tasks", ["task_id"], unique=False)
|
||||
op.create_index("ix_steps_step_id", "steps", ["step_id"], unique=False)
|
||||
op.create_index(
|
||||
"ix_output_parameters_output_parameter_id", "output_parameters", ["output_parameter_id"], unique=False
|
||||
)
|
||||
op.create_index("ix_organizations_organization_id", "organizations", ["organization_id"], unique=False)
|
||||
op.create_index(
|
||||
"ix_onepassword_credential_parameters_onepassword_creden_aba8",
|
||||
"onepassword_credential_parameters",
|
||||
["onepassword_credential_parameter_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
"ix_credential_parameters_credential_parameter_id",
|
||||
"credential_parameters",
|
||||
["credential_parameter_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
"ix_aws_secret_parameters_aws_secret_parameter_id",
|
||||
"aws_secret_parameters",
|
||||
["aws_secret_parameter_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index("ix_artifacts_artifact_id", "artifacts", ["artifact_id"], unique=False)
|
||||
op.create_index("ix_artifacts_ai_suggestion_id", "artifacts", ["ai_suggestion_id"], unique=False)
|
||||
op.create_index("ix_actions_action_id", "actions", ["action_id"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
@@ -59,7 +59,7 @@ class TaskModel(Base):
|
||||
__tablename__ = "tasks"
|
||||
__table_args__ = (Index("idx_tasks_org_created", "organization_id", "created_at"),)
|
||||
|
||||
task_id = Column(String, primary_key=True, index=True, default=generate_task_id)
|
||||
task_id = Column(String, primary_key=True, default=generate_task_id)
|
||||
organization_id = Column(String, ForeignKey("organizations.organization_id"))
|
||||
status = Column(String, index=True)
|
||||
webhook_callback_url = Column(String)
|
||||
@@ -108,7 +108,7 @@ class StepModel(Base):
|
||||
Index("created_at_org_index", "created_at", "organization_id"),
|
||||
)
|
||||
|
||||
step_id = Column(String, primary_key=True, index=True, default=generate_step_id)
|
||||
step_id = Column(String, primary_key=True, default=generate_step_id)
|
||||
organization_id = Column(String, ForeignKey("organizations.organization_id"))
|
||||
task_id = Column(String, ForeignKey("tasks.task_id"), index=True)
|
||||
status = Column(String)
|
||||
@@ -133,7 +133,7 @@ class StepModel(Base):
|
||||
class OrganizationModel(Base):
|
||||
__tablename__ = "organizations"
|
||||
|
||||
organization_id = Column(String, primary_key=True, index=True, default=generate_org_id)
|
||||
organization_id = Column(String, primary_key=True, default=generate_org_id)
|
||||
organization_name = Column(String, nullable=False)
|
||||
webhook_callback_url = Column(UnicodeText)
|
||||
max_steps_per_run = Column(Integer, nullable=True)
|
||||
@@ -179,13 +179,13 @@ class ArtifactModel(Base):
|
||||
__tablename__ = "artifacts"
|
||||
__table_args__ = (Index("org_task_step_index", "organization_id", "task_id", "step_id"),)
|
||||
|
||||
artifact_id = Column(String, primary_key=True, index=True, default=generate_artifact_id)
|
||||
artifact_id = Column(String, primary_key=True, default=generate_artifact_id)
|
||||
organization_id = Column(String, ForeignKey("organizations.organization_id"))
|
||||
workflow_run_id = Column(String, index=True)
|
||||
workflow_run_block_id = Column(String, index=True)
|
||||
observer_cruise_id = Column(String, index=True)
|
||||
observer_thought_id = Column(String, index=True)
|
||||
ai_suggestion_id = Column(String, index=True)
|
||||
ai_suggestion_id = Column(String)
|
||||
task_id = Column(String)
|
||||
step_id = Column(String, index=True)
|
||||
artifact_type = Column(String)
|
||||
@@ -213,7 +213,7 @@ class WorkflowModel(Base):
|
||||
Index("workflow_oid_status_idx", "organization_id", "status"),
|
||||
)
|
||||
|
||||
workflow_id = Column(String, primary_key=True, index=True, default=generate_workflow_id)
|
||||
workflow_id = Column(String, primary_key=True, default=generate_workflow_id)
|
||||
organization_id = Column(String, ForeignKey("organizations.organization_id"))
|
||||
title = Column(String, nullable=False)
|
||||
description = Column(String, nullable=True)
|
||||
@@ -246,7 +246,7 @@ class WorkflowRunModel(Base):
|
||||
__tablename__ = "workflow_runs"
|
||||
__table_args__ = (Index("idx_workflow_runs_org_created", "organization_id", "created_at"),)
|
||||
|
||||
workflow_run_id = Column(String, primary_key=True, index=True, default=generate_workflow_run_id)
|
||||
workflow_run_id = Column(String, primary_key=True, default=generate_workflow_run_id)
|
||||
workflow_id = Column(String, nullable=False)
|
||||
workflow_permanent_id = Column(String, nullable=False, index=True)
|
||||
# workfow runs with parent_workflow_run_id are nested workflow runs which won't show up in the workflow run history
|
||||
@@ -278,7 +278,7 @@ class WorkflowRunModel(Base):
|
||||
class WorkflowParameterModel(Base):
|
||||
__tablename__ = "workflow_parameters"
|
||||
|
||||
workflow_parameter_id = Column(String, primary_key=True, index=True, default=generate_workflow_parameter_id)
|
||||
workflow_parameter_id = Column(String, primary_key=True, default=generate_workflow_parameter_id)
|
||||
workflow_parameter_type = Column(String, nullable=False)
|
||||
key = Column(String, nullable=False)
|
||||
description = Column(String, nullable=True)
|
||||
@@ -297,7 +297,7 @@ class WorkflowParameterModel(Base):
|
||||
class OutputParameterModel(Base):
|
||||
__tablename__ = "output_parameters"
|
||||
|
||||
output_parameter_id = Column(String, primary_key=True, index=True, default=generate_output_parameter_id)
|
||||
output_parameter_id = Column(String, primary_key=True, default=generate_output_parameter_id)
|
||||
key = Column(String, nullable=False)
|
||||
description = Column(String, nullable=True)
|
||||
workflow_id = Column(String, index=True, nullable=False)
|
||||
@@ -314,7 +314,7 @@ class OutputParameterModel(Base):
|
||||
class AWSSecretParameterModel(Base):
|
||||
__tablename__ = "aws_secret_parameters"
|
||||
|
||||
aws_secret_parameter_id = Column(String, primary_key=True, index=True, default=generate_aws_secret_parameter_id)
|
||||
aws_secret_parameter_id = Column(String, primary_key=True, default=generate_aws_secret_parameter_id)
|
||||
workflow_id = Column(String, index=True, nullable=False)
|
||||
key = Column(String, nullable=False)
|
||||
description = Column(String, nullable=True)
|
||||
@@ -411,7 +411,7 @@ class BitwardenCreditCardDataParameterModel(Base):
|
||||
class CredentialParameterModel(Base):
|
||||
__tablename__ = "credential_parameters"
|
||||
|
||||
credential_parameter_id = Column(String, primary_key=True, index=True, default=generate_credential_parameter_id)
|
||||
credential_parameter_id = Column(String, primary_key=True, default=generate_credential_parameter_id)
|
||||
workflow_id = Column(String, index=True, nullable=False)
|
||||
key = Column(String, nullable=False)
|
||||
description = Column(String, nullable=True)
|
||||
@@ -427,7 +427,7 @@ class OnePasswordCredentialParameterModel(Base):
|
||||
__tablename__ = "onepassword_credential_parameters"
|
||||
|
||||
onepassword_credential_parameter_id = Column(
|
||||
String, primary_key=True, index=True, default=generate_onepassword_credential_parameter_id
|
||||
String, primary_key=True, default=generate_onepassword_credential_parameter_id
|
||||
)
|
||||
workflow_id = Column(String, index=True, nullable=False)
|
||||
key = Column(String, nullable=False)
|
||||
@@ -542,7 +542,7 @@ class ActionModel(Base):
|
||||
Index("action_org_created_at_index", "organization_id", desc("created_at")),
|
||||
)
|
||||
|
||||
action_id = Column(String, primary_key=True, index=True, default=generate_action_id)
|
||||
action_id = Column(String, primary_key=True, default=generate_action_id)
|
||||
action_type = Column(String, nullable=False)
|
||||
source_action_id = Column(String, nullable=True, index=True)
|
||||
organization_id = Column(String, nullable=True)
|
||||
|
||||
Reference in New Issue
Block a user