73a0222e56
- Add original_file_path and processed_file_path columns to FileRecord model
- Create database migration for new fields
- Implement get_unique_filepath_with_counter() with -0001 suffix format
- Update process_document to save immutable copy to /workdir/original
- Add force_cloud_ocr parameter to process_document for forced OCR
- Update embed_metadata to use new collision handling
- Update metadata JSON to include file path references
- Add /files/{file_id}/reprocess-with-cloud-ocr API endpoint
- Update processed_file_path in database during embedding
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
30 lines
919 B
Python
30 lines
919 B
Python
"""Add original_file_path and processed_file_path to FileRecord
|
|
|
|
Revision ID: 002_add_file_paths
|
|
Revises: 001_file_processing_steps
|
|
Create Date: 2026-02-11
|
|
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "002_add_file_paths"
|
|
down_revision: Union[str, None] = "001_file_processing_steps"
|
|
depends_on: Union[str, None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Add original_file_path and processed_file_path columns to files table."""
|
|
op.add_column("files", sa.Column("original_file_path", sa.String(), nullable=True))
|
|
op.add_column("files", sa.Column("processed_file_path", sa.String(), nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Remove original_file_path and processed_file_path columns from files table."""
|
|
op.drop_column("files", "processed_file_path")
|
|
op.drop_column("files", "original_file_path")
|