mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Add possibility to use fields instead of column for unique constraint #6567
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @alexander-schranz on GitHub (Nov 23, 2020).
Currently when using a unique constraint like:
you are forced to define the
columnname for the fields e.g.:if you don't do this and somebody configure another
naming_strategyfor your entity it will not longer work as the column does then not exist.It would be a great feature if you could use unique-constraints based on field name and doctrine orm will read the column name from the configured field e.g.:
What do you think about this?
@beberlei commented on GitHub (Dec 6, 2020):
This is a great idea, there are some caviats.
@beberlei commented on GitHub (Feb 6, 2021):
The logic of resolving Unique Constraint (and Index as well) fields to columns would need to be done in
SchemaTool, because access toNamingStrategyis needed.@Lustmored commented on GitHub (Mar 4, 2021):
I took a shot at this and results are in #8523 - feedback is very welcome :)
@beberlei commented on GitHub (Apr 18, 2021):
Fixed in #8629
@alexander-schranz commented on GitHub (Apr 18, 2021):
@beberlei @Lustmored This is really great to hear! Thank you for implementing this 🙏