|
| 1 | +"""cascade delete additional information |
| 2 | +
|
| 3 | +Revision ID: f90eb601dceb |
| 4 | +Revises: 74c313df967b |
| 5 | +Create Date: 2025-02-19 12:01:27.426582 |
| 6 | +
|
| 7 | +""" |
| 8 | + |
| 9 | +from typing import Sequence, Union |
| 10 | + |
| 11 | +import geoalchemy2 |
| 12 | +import sqlalchemy as sa |
| 13 | +from alembic import op |
| 14 | + |
| 15 | +# revision identifiers, used by Alembic. |
| 16 | +revision: str = "f90eb601dceb" |
| 17 | +down_revision: Union[str, None] = "74c313df967b" |
| 18 | +branch_labels: Union[str, Sequence[str], None] = None |
| 19 | +depends_on: Union[str, Sequence[str], None] = None |
| 20 | + |
| 21 | + |
| 22 | +def upgrade() -> None: |
| 23 | + # ### commands auto generated by Alembic - please adjust! ### |
| 24 | + op.drop_constraint( |
| 25 | + "plan_regulation_id_fkey", |
| 26 | + "additional_information", |
| 27 | + schema="hame", |
| 28 | + type_="foreignkey", |
| 29 | + ) |
| 30 | + op.create_foreign_key( |
| 31 | + "plan_regulation_id_fkey", |
| 32 | + "additional_information", |
| 33 | + "plan_regulation", |
| 34 | + ["plan_regulation_id"], |
| 35 | + ["id"], |
| 36 | + source_schema="hame", |
| 37 | + referent_schema="hame", |
| 38 | + ondelete="CASCADE", |
| 39 | + ) |
| 40 | + # ### end Alembic commands ### |
| 41 | + |
| 42 | + |
| 43 | +def downgrade() -> None: |
| 44 | + # ### commands auto generated by Alembic - please adjust! ### |
| 45 | + op.drop_constraint( |
| 46 | + "plan_regulation_id_fkey", |
| 47 | + "additional_information", |
| 48 | + schema="hame", |
| 49 | + type_="foreignkey", |
| 50 | + ) |
| 51 | + op.create_foreign_key( |
| 52 | + "plan_regulation_id_fkey", |
| 53 | + "additional_information", |
| 54 | + "plan_regulation", |
| 55 | + ["plan_regulation_id"], |
| 56 | + ["id"], |
| 57 | + source_schema="hame", |
| 58 | + referent_schema="hame", |
| 59 | + ) |
| 60 | + # ### end Alembic commands ### |
0 commit comments