You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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.
The text was updated successfully, but these errors were encountered: