"""parent child relations Revision ID: 4b6c6a23c639 Revises: 71386dc42f9b Create Date: 2020-03-18 16:17:09.512280 """ from alembic import op import sqlalchemy as sa import sqlalchemy_utc # revision identifiers, used by Alembic. revision = '4b6c6a23c639' down_revision = '71386dc42f9b' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('post', sa.Column('parent_id', sa.Integer(), nullable=True)) op.create_foreign_key(None, 'post', 'post', ['parent_id'], ['id']) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'post', type_='foreignkey') op.drop_column('post', 'parent_id') # ### end Alembic commands ###