039_speech_to_text_registry.py
1 """Speech-to-text model registry. 2 3 New `speech_to_text` table managed via the dedicated admin page. Local 4 workers (auto-seeded from `restai/audio/workers/*.py`) sit alongside 5 external providers (OpenAI Whisper, Google STT, Deepgram, AssemblyAI), 6 each with its own encrypted credentials in `options`. 7 8 The legacy `Audio Gen` menu entry is removed in this same release; team 9 grants in `teams_audio_generators` continue to work unchanged (still 10 keyed by the generator's `name`). 11 12 MySQL-safety notes (see 035 for the full story): 13 - TEXT columns drop `server_default` — MySQL rejects defaults on 14 TEXT/BLOB. `options` is set explicitly by the application on insert. 15 - The broad try/except around `create_table` was removed. 16 """ 17 import sqlalchemy as sa 18 from alembic import op 19 20 21 revision = '039' 22 down_revision = '038' 23 branch_labels = None 24 depends_on = None 25 26 27 def upgrade(): 28 op.create_table( 29 'speech_to_text', 30 sa.Column('id', sa.Integer(), primary_key=True, index=True), 31 sa.Column('name', sa.String(255), nullable=False, unique=True, index=True), 32 sa.Column('class_name', sa.String(64), nullable=False), 33 sa.Column('options', sa.Text(), nullable=True), 34 sa.Column('privacy', sa.String(32), nullable=False, server_default='public'), 35 sa.Column('description', sa.Text(), nullable=True), 36 sa.Column('enabled', sa.Boolean(), nullable=False, server_default='1'), 37 sa.Column('created_at', sa.DateTime(), nullable=True), 38 sa.Column('updated_at', sa.DateTime(), nullable=True), 39 ) 40 41 42 def downgrade(): 43 op.drop_table('speech_to_text')