Currently, the OnCascade functionality only works on explicit foreign keys.
User
name String
Primary name
Post
user UserId
Foreign User OnDeleteCascade fkuser user
We should also be able to write:
User
name String
Primary name
Post
user UserId OnDeleteCascade
Problem surfaced in #1113
To implement this, we'll need to start with takeCols to parse the OnDeleteand OnUpdate behavior into the column type. However, we don't currently track whether or not this field is a reference yet, so we'll need to figure some other way to propagate the cascade behavior.
- How should we handle cascade behavior on non-foreign key fields? ie:
User
name String OnDeleteCascade
Easiest thing to do is ignore it silently. But throwing an error may work as well.
- We will probably need to update
FieldDef to accept the cascade behavior separately from the reference. Then, in fixForeignkeys, we'll copy that into the new reference.
Currently, the
OnCascadefunctionality only works on explicit foreign keys.We should also be able to write:
Problem surfaced in #1113
To implement this, we'll need to start with
takeColsto parse theOnDeleteandOnUpdatebehavior into the column type. However, we don't currently track whether or not this field is a reference yet, so we'll need to figure some other way to propagate the cascade behavior.errormay work as well.FieldDefto accept the cascade behavior separately from the reference. Then, infixForeignkeys, we'll copy that into the new reference.