Folders, Persistent Import Progress Tracking & UX Enhancements (#3841)
Co-authored-by: Jonathan Dobson <jon.m.dobson@gmail.com>
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
"""add_folders_table
|
||||
|
||||
Revision ID: 541870962332
|
||||
Revises: d135e472622c
|
||||
Create Date: 2025-10-30 14:14:37.593691+00:00
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "541870962332"
|
||||
down_revision: Union[str, None] = "d135e472622c"
|
||||
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! ###
|
||||
# Step 1: Create folders table
|
||||
op.create_table(
|
||||
"folders",
|
||||
sa.Column("folder_id", sa.String(), nullable=False),
|
||||
sa.Column("organization_id", sa.String(), nullable=False),
|
||||
sa.Column("title", sa.String(), nullable=False),
|
||||
sa.Column("description", sa.String(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("modified_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("deleted_at", sa.DateTime(), nullable=True),
|
||||
sa.PrimaryKeyConstraint("folder_id"),
|
||||
sa.ForeignKeyConstraint(
|
||||
["organization_id"],
|
||||
["organizations.organization_id"],
|
||||
ondelete="CASCADE",
|
||||
),
|
||||
)
|
||||
|
||||
# Create indexes on folders table
|
||||
op.create_index(
|
||||
"folder_organization_id_idx",
|
||||
"folders",
|
||||
["organization_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
"folder_organization_title_idx",
|
||||
"folders",
|
||||
["organization_id", "title"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
# Step 2: Add folder_id to workflows table
|
||||
op.add_column("workflows", sa.Column("folder_id", sa.String(), nullable=True))
|
||||
|
||||
# Create index on workflows.folder_id
|
||||
op.create_index(
|
||||
"workflow_folder_id_idx",
|
||||
"workflows",
|
||||
["folder_id"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
# Create foreign key constraint
|
||||
op.create_foreign_key(
|
||||
"fk_workflows_folder_id",
|
||||
"workflows",
|
||||
"folders",
|
||||
["folder_id"],
|
||||
["folder_id"],
|
||||
ondelete="SET NULL",
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
# Step 1: Remove folder_id from workflows table (must be done before dropping folders table)
|
||||
op.drop_constraint("fk_workflows_folder_id", "workflows", type_="foreignkey")
|
||||
op.drop_index("workflow_folder_id_idx", table_name="workflows")
|
||||
op.drop_column("workflows", "folder_id")
|
||||
|
||||
# Step 2: Drop folders table
|
||||
op.drop_index("folder_organization_title_idx", table_name="folders")
|
||||
op.drop_index("folder_organization_id_idx", table_name="folders")
|
||||
op.drop_table("folders")
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,30 @@
|
||||
"""add_import_tracking_to_workflows
|
||||
|
||||
Revision ID: b61cf349aa4b
|
||||
Revises: 541870962332
|
||||
Create Date: 2025-10-30 14:25:37.010446+00:00
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "b61cf349aa4b"
|
||||
down_revision: Union[str, None] = "541870962332"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Add import_error column to workflows table for tracking import failures
|
||||
# Note: status column is a String, not an enum, so no schema changes needed for new status values
|
||||
op.add_column("workflows", sa.Column("import_error", sa.String(), nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# Remove import_error column from workflows table
|
||||
op.drop_column("workflows", "import_error")
|
||||
@@ -0,0 +1,23 @@
|
||||
"""merge migration heads
|
||||
|
||||
Revision ID: 2c34dee3304e
|
||||
Revises: b61cf349aa4b, 7fbf463be9a7
|
||||
Create Date: 2025-11-05 15:23:24.380086+00:00
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "2c34dee3304e"
|
||||
down_revision: Union[str, None] = ("b61cf349aa4b", "7fbf463be9a7")
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
pass
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
pass
|
||||
Reference in New Issue
Block a user