[SQL Server] add validation for disallowed relationships (e.g. cyclic) #4580
Labels
kind/improvement
An improvement to existing feature and code.
team/client
Issue for team Client.
topic: schema
topic: sql server
Microsoft SQL Server
Milestone
By default we render relation fields as a foreign key with an
ON UPDATE CASCADE
clause. This can cause problems with SQL Server as certain kinds of relation setups are not possible. Running migrations for those kinds of schemas results in errors such as:We must add validation to the parser for the following cases in order to show a nice error to the user.
Problem 1: Cyclic relationships
SQL Server does not allow to declare cyclic relationships such as the following.
Another example schema can be found here: #5782 (comment)
Problem 2: Multiple Cascade Paths
If you have more than two relations leaving from a model, they can't cross to the same model anywhere in their path.
Problem 3: Self Relations
This is a special version of problem 1.
The text was updated successfully, but these errors were encountered: