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

Modify constraints API to support creating foreign key constraints #942

Closed
Tracked by #451
seancolsen opened this issue Jan 5, 2022 · 2 comments · Fixed by #1376
Closed
Tracked by #451

Modify constraints API to support creating foreign key constraints #942

seancolsen opened this issue Jan 5, 2022 · 2 comments · Fixed by #1376
Assignees
Labels
needs: unblocking Blocked by other work type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL

Comments

@seancolsen
Copy link
Contributor

seancolsen commented Jan 5, 2022

Current behavior

  • I can't create FK constraints.
  • I can create a unique constraint with a POST to /tables/{table_id}/constraints/ and type: "unique".

Desired behavior

  • Creating FK constraints should function similarly to creating unique constraints.

Notes

  • The API for creating unique constraints is currently in flux due to Modify constraints API to use column id instead of column name #898. We should be sure to follow the same pattern for FK constraints, which will likely mean requiring the API request to specify all tables and columns by id instead of name.
  • We don't plan to ever support updating FK constraints. If the user wants to change the constraint, they'll need to drop it and add a new one.
  • If it is fairly quick to implement, the API should support as many of the following features as it can, even though there's no UI for them yet. If you do not support these in your PR, please design the API in a way that can be easily extended to support them in the future without breaking changes. It would also be helpful to create separate placeholder issues to track any issues not handled by the PR.
    • Creating deferred FK constraints
    • Setting the ON DELETE attribute to any of the five possible actions.
    • Setting the ON UPDATE attribute to any of the five possible actions.
    • Creating multi-column FKs, including the ability to pass MATCH FULL.

Additional context

@seancolsen seancolsen added status: draft type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL labels Jan 5, 2022
@seancolsen seancolsen added this to the [08] Working with Views milestone Jan 5, 2022
@seancolsen
Copy link
Contributor Author

@kgodey I'm assigning this to you to help answer the above questions and loop others in as needed.

@kgodey
Copy link
Contributor

kgodey commented Jan 10, 2022

@seancolsen I've updated the ticket description to resolve questions. I'm going to mark the ticket as blocked until #898 is resolved and the API for constraints stabilizes.

I'm also going to say this is blocked by #943 since that will define the foreign key constraint response.

@kgodey kgodey added needs: unblocking Blocked by other work and removed status: draft labels Jan 10, 2022
@kgodey kgodey removed their assignment Jan 10, 2022
@kgodey kgodey modified the milestones: [09] Working with Views, [08] Links Between Tables Jan 18, 2022
@silentninja silentninja self-assigned this May 11, 2022
@silentninja silentninja linked a pull request May 11, 2022 that will close this issue
7 tasks
@kgodey kgodey removed this from the [08] Links between Tables milestone Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: unblocking Blocked by other work type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants