b87f52d28bb9_page_add_parent.py 582 B

1234567891011121314151617181920212223242526
  1. """page_add_parent
  2. Revision ID: b87f52d28bb9
  3. Revises: 476b167aef80
  4. Create Date: 2019-02-19 22:38:47.415942
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. # revision identifiers, used by Alembic.
  9. revision = 'b87f52d28bb9'
  10. down_revision = '476b167aef80'
  11. branch_labels = None
  12. depends_on = None
  13. def upgrade():
  14. op.add_column('page', sa.Column('parent_id', sa.Integer(), nullable=True))
  15. op.create_foreign_key(None, 'page', 'page', ['parent_id'], ['id'])
  16. def downgrade():
  17. op.drop_constraint(None, 'page', type_='foreignkey')
  18. op.drop_column('page', 'parent_id')