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

Fix cleanupDb when foreign key constraints exist #795

Merged
merged 3 commits into from
Jul 12, 2024

Conversation

ovistoica
Copy link
Contributor

@ovistoica ovistoica commented Jul 12, 2024

PR to address #791

Test Plan

If the npm run setup works as expected, the seeding and the db cleanup works correctly.

To test this fix fully, we'd need to add some data to the database with FK constraints, not have ON DELETE CASCADE on it, and expect cleanupDb to succeed.

Also, another good test would be to monkey patch the cleanupDb to throw inside the transaction and expect foreign_keys to be still on (catch clause reached)

Checklist

  • Tests updated - no tests need updating
  • Docs updated - no need

Screenshots

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thank you for taking the time to contribute back!

tests/db-utils.ts Outdated Show resolved Hide resolved
@kentcdodds kentcdodds merged commit ae5f305 into epicweb-dev:main Jul 12, 2024
5 checks passed
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