"""initial

Revision ID: 19789aa5361c
Revises: 
Create Date: 2022-05-04 18:33:29.940781

"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = '19789aa5361c'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cascade_delete_parent',
                    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
                    sa.Column('name', sa.Integer(), nullable=False),
                    sa.PrimaryKeyConstraint('id')
                    )
    op.create_table('cascade_delete_child',
                    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
                    sa.Column('parent_id', sa.Integer(), nullable=True),
                    sa.ForeignKeyConstraint(['parent_id'], ['cascade_delete_parent.id'], ondelete='CASCADE'),
                    sa.PrimaryKeyConstraint('id')
                    )
    op.execute("INSERT INTO cascade_delete_parent (id, name) VALUES (1, 666)")
    op.execute("INSERT INTO cascade_delete_child (id, parent_id) VALUES (1, 1)")
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('cascade_delete_child')
    op.drop_table('cascade_delete_parent')
    # ### end Alembic commands ###
