fix: deployment — resolve dependency conflicts, add initial migration, CI/CD webhook
- Fix httpx/pydantic/redis version conflicts for litellm/aiogram/celery compatibility - Add PYTHONPATH=/app to Dockerfile for alembic module resolution - Skip Telegram webhook setup when URL is not HTTPS - Fix FileUpload prop type mismatch in RecordingsPage - Add alembic script.py.mako template and initial migration - Configure docker-compose: port 8081, built frontend, no exposed internal ports - Add deploy.sh and webhook-server.js for Gitea CI/CD auto-deploy Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
"""initial
|
||||
|
||||
Revision ID: a7d968fceaaf
|
||||
Revises:
|
||||
Create Date: 2026-04-06 17:59:05.406839
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'a7d968fceaaf'
|
||||
down_revision: Union[str, None] = None
|
||||
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.create_table('prompt_templates',
|
||||
sa.Column('name', sa.String(length=255), nullable=False),
|
||||
sa.Column('description', sa.String(length=1000), nullable=False),
|
||||
sa.Column('type', sa.Enum('client_survey', 'client_intro', 'internal', 'custom', name='templatetype'), nullable=False),
|
||||
sa.Column('system_prompt', sa.Text(), nullable=False),
|
||||
sa.Column('user_prompt', sa.Text(), nullable=False),
|
||||
sa.Column('output_schema', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
|
||||
sa.Column('is_default', sa.Boolean(), nullable=False),
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('users',
|
||||
sa.Column('username', sa.String(length=150), nullable=False),
|
||||
sa.Column('email', sa.String(length=255), nullable=False),
|
||||
sa.Column('password_hash', sa.String(length=255), nullable=False),
|
||||
sa.Column('role', sa.Enum('admin', 'user', name='userrole'), nullable=False),
|
||||
sa.Column('is_active', sa.Boolean(), nullable=False),
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
|
||||
op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
|
||||
op.create_table('recordings',
|
||||
sa.Column('user_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('title', sa.String(length=500), nullable=False),
|
||||
sa.Column('file_path', sa.String(length=1000), nullable=False),
|
||||
sa.Column('file_size', sa.BigInteger(), nullable=False),
|
||||
sa.Column('duration', sa.Float(), nullable=True),
|
||||
sa.Column('format', sa.String(length=20), nullable=False),
|
||||
sa.Column('source', sa.Enum('web', 'telegram', 'lensa', name='recordingsource'), nullable=False),
|
||||
sa.Column('status', sa.Enum('uploaded', 'processing', 'done', 'error', name='recordingstatus'), nullable=False),
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('transcriptions',
|
||||
sa.Column('recording_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('text', sa.Text(), nullable=False),
|
||||
sa.Column('segments', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
|
||||
sa.Column('language', sa.String(length=10), nullable=True),
|
||||
sa.Column('whisper_model', sa.String(length=50), nullable=False),
|
||||
sa.Column('processing_time', sa.Float(), nullable=True),
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['recording_id'], ['recordings.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('recording_id')
|
||||
)
|
||||
op.create_table('protocols',
|
||||
sa.Column('transcription_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('template_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('content', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
|
||||
sa.Column('raw_text', sa.Text(), nullable=False),
|
||||
sa.Column('llm_model', sa.String(length=100), nullable=False),
|
||||
sa.Column('status', sa.Enum('generating', 'done', 'error', name='protocolstatus'), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['template_id'], ['prompt_templates.id'], ),
|
||||
sa.ForeignKeyConstraint(['transcription_id'], ['transcriptions.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('export_files',
|
||||
sa.Column('protocol_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('format', sa.Enum('docx', 'pdf', 'md', name='exportformat'), nullable=False),
|
||||
sa.Column('file_path', sa.String(length=1000), nullable=False),
|
||||
sa.Column('file_size', sa.BigInteger(), nullable=False),
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['protocol_id'], ['protocols.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('export_files')
|
||||
op.drop_table('protocols')
|
||||
op.drop_table('transcriptions')
|
||||
op.drop_table('recordings')
|
||||
op.drop_index(op.f('ix_users_username'), table_name='users')
|
||||
op.drop_index(op.f('ix_users_email'), table_name='users')
|
||||
op.drop_table('users')
|
||||
op.drop_table('prompt_templates')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user