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

✨ Add support for cascade delete relationships: cascade_delete, ondelete, and passive_deletes #983

Merged
merged 34 commits into from
Jul 21, 2024

Conversation

estebanx64
Copy link
Contributor

No description provided.

Copy link
Member

@tiangolo tiangolo left a comment

Choose a reason for hiding this comment

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

Nice! This is looking great! 🚀

sqlmodel/main.py Outdated Show resolved Hide resolved
sqlmodel/main.py Show resolved Hide resolved
sqlmodel/main.py Show resolved Hide resolved
sqlmodel/main.py Outdated Show resolved Hide resolved
sqlmodel/sql/_relationship_types.py Outdated Show resolved Hide resolved
Copy link

@JakNowy JakNowy left a comment

Choose a reason for hiding this comment

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

Looks nice and clean. Very useful feature!

Copy link

📝 Docs preview for commit 65be67c at: https://09764bb3.sqlmodel.pages.dev

Copy link

📝 Docs preview for commit 274b7a7 at: https://da08e328.sqlmodel.pages.dev

Copy link

📝 Docs preview for commit d9579f6 at: https://2593c0e0.sqlmodel.pages.dev

Copy link

📝 Docs preview for commit 6b40aec at: https://4cd9105f.sqlmodel.pages.dev

Copy link

📝 Docs preview for commit 6529045 at: https://a46900e5.sqlmodel.pages.dev

@alejsdev alejsdev added the feature New feature or request label Jul 5, 2024
@tiangolo tiangolo changed the title ✨ Add ondelete and cascade options for relationships ✨ Add support for cascade delete relationships: cascade_delete, ondelete, and passive_deletes Jul 21, 2024
Copy link

📝 Docs preview for commit 6616272 at: https://bd669c99.sqlmodel.pages.dev

Copy link

📝 Docs preview for commit 51c5d00 at: https://9a77e0cc.sqlmodel.pages.dev

@tiangolo
Copy link
Member

Great, thank you @estebanx64! 🚀

I updated the docs and tweaked the implementation to support nullables set with int | None, etc. to avoid needing nullable=True. Also because in most cases nullable=True should not be used, and instead declare the type accepting None.

I also updated/extended the source examples and tests.

This is ready now! 🤓

This will be available in SQLModel 0.0.21, released in the next hours. 🎉

@tiangolo tiangolo merged commit 86ab09f into main Jul 21, 2024
21 checks passed
@tiangolo tiangolo deleted the FL-391-support-ondelete-cascade branch July 21, 2024 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants