"""use LONGTEXT Revision ID: 65626474a0df Revises: e086ef589d03 Create Date: 2024-05-12 14:24:29.930839 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = '65626474a0df' down_revision = 'e086ef589d03' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('document_drafts', schema=None) as batch_op: batch_op.alter_column('content', existing_type=mysql.VARCHAR(length=128), type_=mysql.LONGTEXT(), existing_nullable=True) batch_op.drop_constraint('fk_1', type_='foreignkey') batch_op.create_foreign_key(None, 'documents', ['document_id'], ['id']) with op.batch_alter_table('document_folders', schema=None) as batch_op: batch_op.drop_constraint('fk_1', type_='foreignkey') batch_op.drop_constraint('fk_2', type_='foreignkey') batch_op.create_foreign_key(None, 'users', ['created_by'], ['id']) batch_op.create_foreign_key(None, 'organizations', ['organization_id'], ['id']) with op.batch_alter_table('documents', schema=None) as batch_op: batch_op.drop_constraint('fk_3', type_='foreignkey') batch_op.drop_constraint('fk_1', type_='foreignkey') batch_op.drop_constraint('fk_2', type_='foreignkey') batch_op.create_foreign_key(None, 'document_folders', ['folder_id'], ['id']) batch_op.create_foreign_key(None, 'organizations', ['organization_id'], ['id']) batch_op.create_foreign_key(None, 'users', ['created_by'], ['id']) with op.batch_alter_table('organization_roles', schema=None) as batch_op: batch_op.drop_constraint('fk_1', type_='foreignkey') batch_op.drop_constraint('fk_2', type_='foreignkey') batch_op.create_foreign_key(None, 'users', ['user_id'], ['id']) batch_op.create_foreign_key(None, 'organizations', ['organization_id'], ['id']) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('organization_roles', schema=None) as batch_op: batch_op.drop_constraint(None, type_='foreignkey') batch_op.drop_constraint(None, type_='foreignkey') batch_op.create_foreign_key('fk_2', 'users', ['user_id'], ['id'], referent_schema='shadow_writer') batch_op.create_foreign_key('fk_1', 'organizations', ['organization_id'], ['id'], referent_schema='shadow_writer') with op.batch_alter_table('documents', schema=None) as batch_op: batch_op.drop_constraint(None, type_='foreignkey') batch_op.drop_constraint(None, type_='foreignkey') batch_op.drop_constraint(None, type_='foreignkey') batch_op.create_foreign_key('fk_2', 'document_folders', ['folder_id'], ['id'], referent_schema='shadow_writer') batch_op.create_foreign_key('fk_1', 'users', ['created_by'], ['id'], referent_schema='shadow_writer') batch_op.create_foreign_key('fk_3', 'organizations', ['organization_id'], ['id'], referent_schema='shadow_writer') with op.batch_alter_table('document_folders', schema=None) as batch_op: batch_op.drop_constraint(None, type_='foreignkey') batch_op.drop_constraint(None, type_='foreignkey') batch_op.create_foreign_key('fk_2', 'organizations', ['organization_id'], ['id'], referent_schema='shadow_writer') batch_op.create_foreign_key('fk_1', 'users', ['created_by'], ['id'], referent_schema='shadow_writer') with op.batch_alter_table('document_drafts', schema=None) as batch_op: batch_op.drop_constraint(None, type_='foreignkey') batch_op.create_foreign_key('fk_1', 'documents', ['document_id'], ['id'], referent_schema='shadow_writer') batch_op.alter_column('content', existing_type=mysql.LONGTEXT(), type_=mysql.VARCHAR(length=128), existing_nullable=True) # ### end Alembic commands ###