Skip to content

Make NO ACTION the default action for foreign keys #1560

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

samtay
Copy link

@samtay samtay commented Dec 30, 2024

See #1416 for motivation, but tl;dr is that NO ACTION is a more sensible default across the supported databases.


Before submitting your PR, check that you've:

  • Documented new APIs with Haddock markup
  • Added @since declarations to the Haddock
  • Ran stylish-haskell on any changed files.
  • Adhered to the code style (see the .editorconfig file for details)

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Bumped the version number if there isn't an (unreleased) on the Changelog
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

@parsonsmatt
Copy link
Collaborator

Sorry I've taken so long to get to this!

I'm amenable to the rationale for the changes in this, however, I'd like to think through the upgrade path. If we release this as-is, then every persistent user is going to get a new migration suggestion to change their existing RESTRICT foreign key changes to NO ACTION, for every foreign key. While this may be preferable, it's also a pretty harsh UX. We'd essentially be requiring all users to modify all foreign key relationships and specify Restrict instead of using that as an implied default.

Instead, it'd be better to do this in phases:

  1. Introduce the NoAction constructor and type, but Restrict is still default.
  2. Allow the end user to customize the default in settings somewhere. Instead of using Restrict as a hardcoded default, we'll refer to the relevant settings record.
  3. Switch the default to NoAction and publicize the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants