You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a follow-up question from the discussion on #502. I'm interested in manually annotating my migrations with FOREIGN KEY constraints, and couldn't figure out howh to do it in the case of multi-field keys.
I've been successfully writing things like ON DELETE CASCADE constraints by defining them manually like this:
Now, I can stick a Constraint in the individual field parts above, which yields REFERENCES ... ON DELETE CASCADE on the individual fields. But that doesn't work on SQLite to reference a composite key; instead I need a separate constraint to be emitted in the CREATE TABLE command; see here.
This discussion was converted from issue #641 on June 08, 2024 08:59.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This is a follow-up question from the discussion on #502. I'm interested in manually annotating my migrations with FOREIGN KEY constraints, and couldn't figure out howh to do it in the case of multi-field keys.
I've been successfully writing things like
ON DELETE CASCADE
constraints by defining them manually like this:And then when describing the migration for some other table,
However, what if you have a table like this?
Normally I write the migration like this:
Now, I can stick a
Constraint
in the individualfield
parts above, which yieldsREFERENCES ... ON DELETE CASCADE
on the individual fields. But that doesn't work on SQLite to reference a composite key; instead I need a separate constraint to be emitted in theCREATE TABLE
command; see here.Is there some way to accomplish this in Beam?
Beta Was this translation helpful? Give feedback.
All reactions