tortoise / tortoise/tortoise-orm

Allow setting ON UPDATE ... for foreign keys

Open
#852 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.6k
Forks
516
Avg merge
2d 21h
Merged PRs (30d)
9

Description

Is your feature request related to a problem? Please describe.
When I try to update a foreign key field, I would like it to change the other field, but Postgres refuses to do that, since ON UPDATE CASCADE was not applied.

Describe the solution you'd like
I would like to be able to control updates, just like deletes. Make it similar to the on_delete param as well for foreign keys.

Describe alternatives you've considered
N/A

Additional context
N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by locating foreign-key option handling and schema-generation paths for the supported databases, then compare them with on_delete. Done means an on_update option is consistently represented in generated constraints and covered by backend-specific tests, including PostgreSQL behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.