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

(schema validation): Warn against referential action choices that do not make sense #7909

Open
tomhoule opened this issue Jun 28, 2021 · 2 comments
Labels
kind/feature A request for a new feature. team/schema Issue for team Schema. topic: referential actions

Comments

@tomhoule
Copy link
Contributor

Problem

With the referentialActions preview feature, some combinations of relations and relational actions make more sense than others. For example, SetNull on a required relation will (should) always fail at runtime. Restrict on a nullable relation is possible, but tricky to justify.

Suggested solution

The schema validation should display a warning when one of these actions does not make sense, through the editor extension.

Alternatives

We could make this a validation error, but since the databases we support accept these combinations, it would mean that introspection would result in broken schemas.

Additional context

@janpio janpio added kind/feature A request for a new feature. process/candidate labels Jun 29, 2021
@Sytten
Copy link
Contributor

Sytten commented Jun 29, 2021

I don't agree with:

Restrict on a nullable relation is possible, but tricky to justify.

When testing the feature yesterday I had a lot of nullable restrict for one client. The reasoning is yes it might be optional, but once it is set it must not be removed. A simple example is a tax applied to an item.

@tomhoule
Copy link
Contributor Author

Addition: set default on MySQL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for a new feature. team/schema Issue for team Schema. topic: referential actions
Projects
None yet
Development

No branches or pull requests

3 participants