refactor: standardize runtime annotation types across multiple files
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import sys
|
||||
from logging.config import fileConfig
|
||||
from pathlib import Path
|
||||
@@ -14,8 +15,8 @@ PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
||||
if str(PROJECT_ROOT) not in sys.path:
|
||||
sys.path.append(str(PROJECT_ROOT))
|
||||
|
||||
from app import models # noqa: E402,F401
|
||||
from app.core.config import settings # noqa: E402
|
||||
importlib.import_module("app.models")
|
||||
settings = importlib.import_module("app.core.config").settings
|
||||
|
||||
config = context.config
|
||||
configure_logger = config.attributes.get("configure_logger", True)
|
||||
|
||||
@@ -8,7 +8,6 @@ Create Date: 2026-02-09 00:41:55.760624
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
# ruff: noqa: INP001
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
from alembic import op
|
||||
@@ -20,8 +19,17 @@ branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None: # noqa: PLR0915
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Create initial schema objects."""
|
||||
_upgrade_part_1()
|
||||
_upgrade_part_2()
|
||||
_upgrade_part_3()
|
||||
_upgrade_part_4()
|
||||
|
||||
|
||||
def _upgrade_part_1() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table(
|
||||
"organizations",
|
||||
@@ -183,6 +191,9 @@ def upgrade() -> None: # noqa: PLR0915
|
||||
op.f("ix_boards_organization_id"), "boards", ["organization_id"], unique=False,
|
||||
)
|
||||
op.create_index(op.f("ix_boards_slug"), "boards", ["slug"], unique=False)
|
||||
|
||||
|
||||
def _upgrade_part_2() -> None:
|
||||
op.create_table(
|
||||
"organization_invites",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
@@ -366,6 +377,9 @@ def upgrade() -> None: # noqa: PLR0915
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(op.f("ix_agents_status"), "agents", ["status"], unique=False)
|
||||
|
||||
|
||||
def _upgrade_part_3() -> None:
|
||||
op.create_table(
|
||||
"board_memory",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
@@ -532,6 +546,9 @@ def upgrade() -> None: # noqa: PLR0915
|
||||
)
|
||||
op.create_index(op.f("ix_tasks_priority"), "tasks", ["priority"], unique=False)
|
||||
op.create_index(op.f("ix_tasks_status"), "tasks", ["status"], unique=False)
|
||||
|
||||
|
||||
def _upgrade_part_4() -> None:
|
||||
op.create_table(
|
||||
"activity_events",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
@@ -686,8 +703,14 @@ def upgrade() -> None: # noqa: PLR0915
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None: # noqa: PLR0915
|
||||
def downgrade() -> None:
|
||||
"""Drop initial schema objects."""
|
||||
_downgrade_part_1()
|
||||
_downgrade_part_2()
|
||||
_downgrade_part_3()
|
||||
|
||||
|
||||
def _downgrade_part_1() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(
|
||||
op.f("ix_task_fingerprints_fingerprint_hash"), table_name="task_fingerprints",
|
||||
@@ -745,6 +768,9 @@ def downgrade() -> None: # noqa: PLR0915
|
||||
op.drop_index(op.f("ix_board_memory_is_chat"), table_name="board_memory")
|
||||
op.drop_index(op.f("ix_board_memory_board_id"), table_name="board_memory")
|
||||
op.drop_table("board_memory")
|
||||
|
||||
|
||||
def _downgrade_part_2() -> None:
|
||||
op.drop_index(op.f("ix_agents_status"), table_name="agents")
|
||||
op.drop_index(op.f("ix_agents_provision_confirm_token_hash"), table_name="agents")
|
||||
op.drop_index(op.f("ix_agents_provision_action"), table_name="agents")
|
||||
@@ -795,6 +821,9 @@ def downgrade() -> None: # noqa: PLR0915
|
||||
op.drop_index(op.f("ix_boards_board_type"), table_name="boards")
|
||||
op.drop_index(op.f("ix_boards_board_group_id"), table_name="boards")
|
||||
op.drop_table("boards")
|
||||
|
||||
|
||||
def _downgrade_part_3() -> None:
|
||||
op.drop_index(
|
||||
op.f("ix_board_group_memory_is_chat"), table_name="board_group_memory",
|
||||
)
|
||||
|
||||
1
backend/migrations/versions/__init__.py
Normal file
1
backend/migrations/versions/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Alembic migration version modules."""
|
||||
Reference in New Issue
Block a user