Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefine on delete cascades #450

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Redefine on delete cascades #450

wants to merge 9 commits into from

Conversation

LKajan
Copy link
Contributor

@LKajan LKajan commented Feb 18, 2025

This is based on #452, merge that before this one.

Removed cascade delete from:

  • codes.lifecycle_status -> hame.lifecycle_date

Added cascade delete to:

  • land_use_area, land_use_point, other_area, line, other_point -> lifecycle_date
  • plan_regulation, plan_proposition -> lifecycle_date
  • regulation group -> plan_regulation, plan_proposition
  • plan_regulation -> additional_information

Plan object tables has still on_delete=NO ACTION on their foreign keys to the plan table to prevent accidentally deleting the whole plan with objects.

Resolves #436, GispoCoding/arho-feature-template#193

@LKajan LKajan requested a review from Rikuoja February 18, 2025 12:44
Copy link
Contributor

@Rikuoja Rikuoja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good! Maybe just combine the migrations or name them to explain why they are separate?

@LKajan LKajan force-pushed the fix-cascade-delete branch 2 times, most recently from 082df01 to 09effca Compare February 19, 2025 10:03
@LKajan LKajan force-pushed the fix-cascade-delete branch from 09effca to ba97c14 Compare February 19, 2025 12:31
@LKajan
Copy link
Contributor Author

LKajan commented Feb 19, 2025

@Rikuoja

Really good! Maybe just combine the migrations or name them to explain why they are separate?

I intentionally kept the commits small and logically separated.
I tried to name those before but forgot to give the name using the name= parameter of the make command. Now yhose should be named.

@LKajan
Copy link
Contributor Author

LKajan commented Feb 19, 2025

Included also tests to check cascade deletions using both ORM and SQL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redefine all foreign key on deletes
2 participants