"""Removing DocumentLanguage (user_context and system_context correct on DocumentVersion) Revision ID: 217938792642 Revises: 53fee8f13cdb Create Date: 2024-06-06 14:16:03.288734 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '217938792642' down_revision = '53fee8f13cdb' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('document_version_doc_lang_id_fkey', 'document_version', type_='foreignkey') op.drop_table('document_language') op.add_column('document_version', sa.Column('doc_id', sa.Integer(), nullable=False)) op.add_column('document_version', sa.Column('language', sa.String(length=2), nullable=False)) op.add_column('document_version', sa.Column('user_context', sa.Text(), nullable=True)) op.add_column('document_version', sa.Column('system_context', sa.Text(), nullable=True)) op.create_foreign_key(None, 'document_version', 'document', ['doc_id'], ['id']) op.drop_column('document_version', 'doc_lang_id') # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('document_version', sa.Column('doc_lang_id', sa.INTEGER(), autoincrement=False, nullable=False)) op.drop_constraint(None, 'document_version', type_='foreignkey') op.create_foreign_key('document_version_doc_lang_id_fkey', 'document_version', 'document_language', ['doc_lang_id'], ['id']) op.drop_column('document_version', 'system_context') op.drop_column('document_version', 'user_context') op.drop_column('document_version', 'language') op.drop_column('document_version', 'doc_id') op.create_table('document_language', sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), sa.Column('document_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('language', sa.VARCHAR(length=2), autoincrement=False, nullable=False), sa.Column('created_at', postgresql.TIMESTAMP(), server_default=sa.text('now()'), autoincrement=False, nullable=False), sa.Column('created_by', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('updated_at', postgresql.TIMESTAMP(), server_default=sa.text('now()'), autoincrement=False, nullable=False), sa.Column('updated_by', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('latest_version_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('user_context', sa.TEXT(), autoincrement=False, nullable=True), sa.Column('system_context', sa.TEXT(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['created_by'], ['public.user.id'], name='document_language_created_by_fkey'), sa.ForeignKeyConstraint(['document_id'], ['document.id'], name='document_language_document_id_fkey'), sa.ForeignKeyConstraint(['latest_version_id'], ['document_version.id'], name='document_language_latest_version_id_fkey'), sa.ForeignKeyConstraint(['updated_by'], ['public.user.id'], name='document_language_updated_by_fkey'), sa.PrimaryKeyConstraint('id', name='document_language_pkey') ) # ### end Alembic commands ###