Automated Action 2bc28761f5 Create file upload and download API
- Set up FastAPI project structure
- Implement database models and migrations for file metadata
- Create file upload endpoint with size validation
- Implement file download and listing functionality
- Add health check and API information endpoints
- Create comprehensive documentation
2025-06-09 13:33:57 +00:00

40 lines
1.1 KiB
Python

"""create files table
Revision ID: 001
Revises:
Create Date: 2023-08-15 10:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "001"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"files",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("filename", sa.String(), nullable=False),
sa.Column("original_filename", sa.String(), nullable=False),
sa.Column("content_type", sa.String(), nullable=False),
sa.Column("file_size", sa.Integer(), nullable=False),
sa.Column("file_path", sa.String(), nullable=False),
sa.Column("created_at", sa.DateTime(), nullable=True),
sa.Column("updated_at", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("file_path"),
)
op.create_index(op.f("ix_files_id"), "files", ["id"], unique=False)
def downgrade():
op.drop_index(op.f("ix_files_id"), table_name="files")
op.drop_table("files")