"""save posts Revision ID: 745e3e985199 Revises: 1c51c3df2770 Create Date: 2024-06-20 21:32:11.695162 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '745e3e985199' down_revision = '1c51c3df2770' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('post_bookmark', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('post_id', sa.Integer(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['post_id'], ['post.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id') ) with op.batch_alter_table('post_bookmark', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_post_bookmark_post_id'), ['post_id'], unique=False) batch_op.create_index(batch_op.f('ix_post_bookmark_user_id'), ['user_id'], unique=False) op.create_table('post_reply_bookmark', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('post_reply_id', sa.Integer(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['post_reply_id'], ['post_reply.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('id') ) with op.batch_alter_table('post_reply_bookmark', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_post_reply_bookmark_post_reply_id'), ['post_reply_id'], unique=False) batch_op.create_index(batch_op.f('ix_post_reply_bookmark_user_id'), ['user_id'], unique=False) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('post_reply_bookmark', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_post_reply_bookmark_user_id')) batch_op.drop_index(batch_op.f('ix_post_reply_bookmark_post_reply_id')) op.drop_table('post_reply_bookmark') with op.batch_alter_table('post_bookmark', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_post_bookmark_user_id')) batch_op.drop_index(batch_op.f('ix_post_bookmark_post_id')) op.drop_table('post_bookmark') # ### end Alembic commands ###