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

Merged
merged 7 commits into from
Feb 24, 2025
Merged

Redefine on delete cascades #450

merged 7 commits into from
Feb 24, 2025

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 3 times, most recently 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.

@LKajan LKajan force-pushed the fix-cascade-delete branch from 598b372 to 4ad5489 Compare February 24, 2025 10:49
@LKajan LKajan merged commit 6f10b5e into main Feb 24, 2025
2 checks passed
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