Commit 26f85897 authored by contabo-server's avatar contabo-server
Browse files

migration with cascade

parent d716fe3d
"""cascading delete
Revision ID: 0b94842d4949
Revises: 6dd5e3c32463
Create Date: 2021-03-05 03:58:52.525550
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '0b94842d4949'
down_revision = '6dd5e3c32463'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_unique_constraint(None, 'Attachment', ['ID'])
op.drop_constraint('Attachment_ShareID_fkey', 'Attachment', type_='foreignkey')
op.create_foreign_key(None, 'Attachment', 'Share', ['ShareID'], ['ID'], ondelete='CASCADE')
op.create_unique_constraint(None, 'Share', ['ID'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'Share', type_='unique')
op.drop_constraint(None, 'Attachment', type_='foreignkey')
op.create_foreign_key('Attachment_ShareID_fkey', 'Attachment', 'Share', ['ShareID'], ['ID'])
op.drop_constraint(None, 'Attachment', type_='unique')
# ### end Alembic commands ###
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment