- Remove welcome message from tenant make customisation
- Add possibility to add allowed_languages to tenant make
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
"""Add allowed_languages to TenantMake, introduce TranslationCache
|
||||
|
||||
Revision ID: e47dc002b678
|
||||
Revises: 83d4e90f87c6
|
||||
Create Date: 2025-06-26 13:43:43.719865
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e47dc002b678'
|
||||
down_revision = '83d4e90f87c6'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('translation_cache',
|
||||
sa.Column('cache_key', sa.String(length=16), nullable=False),
|
||||
sa.Column('source_text', sa.Text(), nullable=False),
|
||||
sa.Column('translated_text', sa.Text(), nullable=False),
|
||||
sa.Column('source_language', sa.String(length=2), nullable=False),
|
||||
sa.Column('target_language', sa.String(length=2), nullable=False),
|
||||
sa.Column('context', sa.Text(), nullable=True),
|
||||
sa.Column('prompt_tokens', sa.Integer(), nullable=False),
|
||||
sa.Column('completion_tokens', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('created_by', sa.Integer(), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('updated_by', sa.Integer(), nullable=True),
|
||||
sa.Column('last_used_at', sa.DateTime(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['created_by'], ['public.user.id'], ),
|
||||
sa.ForeignKeyConstraint(['updated_by'], ['public.user.id'], ),
|
||||
sa.PrimaryKeyConstraint('cache_key'),
|
||||
schema='public'
|
||||
)
|
||||
|
||||
with op.batch_alter_table('tenant_make', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('allowed_languages', postgresql.ARRAY(sa.String(length=2)), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('tenant_make', schema=None) as batch_op:
|
||||
batch_op.drop_column('allowed_languages')
|
||||
|
||||
op.drop_table('translation_cache', schema='public')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user