"""topic_queue Revision ID: 8fe7f6bcb985 Revises: 62caafe1eb73 Create Date: 2025-01-08 10:45:17.704137 """ from alembic import op import sqlalchemy as sa from tidb_vector.sqlalchemy import VectorType from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = '8fe7f6bcb985' down_revision = '62caafe1eb73' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('topic_queue', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('topic', mysql.LONGTEXT(), nullable=True), sa.Column('outline', mysql.LONGTEXT(), nullable=True), sa.Column('status', sa.Enum('PENDING', 'PROCESSING', 'COMPLETED', name='topicqueuestatus'), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id') ) with op.batch_alter_table('auto_written', schema=None) as batch_op: batch_op.add_column(sa.Column('topic_queue_id', sa.Integer(), nullable=True)) batch_op.execute("ALTER TABLE auto_written MODIFY COLUMN topic_from ENUM('keyword', 'igniter', 'topic_queue') NOT NULL") batch_op.create_foreign_key('fk_topic_queue', 'topic_queue', ['topic_queue_id'], ['id']) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('auto_written', schema=None) as batch_op: batch_op.execute("ALTER TABLE auto_written MODIFY COLUMN topic_from ENUM('keyword', 'igniter') NOT NULL") batch_op.drop_constraint('fk_topic_queue', type_='foreignkey') batch_op.drop_column('topic_queue_id') op.drop_table('topic_queue') # ### end Alembic commands ###