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

Somehow prevent unique constraint violations in migration at compile time #28

Open
LHolten opened this issue Jan 15, 2025 · 0 comments
Open

Comments

@LHolten
Copy link
Owner

LHolten commented Jan 15, 2025

Unique constraint violations are already checked at compile time and you need to handle potential conflicts when inserting new rows.
However, currently you don't need to handle unique constraint conflicts in migrations and instead the migration will just panic and roll back when a unique constraint is violated.

It is unclear what would be a good API for migrating columns to a new column with a unique constraint.
There can be many unique constraint violations in these cases, so there would need to be a callback of sorts to handle each one.

It is also unclear what the options of the callback should even be. Migrations are generally not allowed to drop rows because that could violate foreign key constraints.

@LHolten LHolten changed the title Somehow prevent migration unique constraint violations at compile time Somehow prevent unique constraint violations in migration at compile time Jan 15, 2025
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

No branches or pull requests

1 participant