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
When I run this code in already initialized before database in older versions of GORM I got this (place SmthDifferentID instead of FIELD):
[rows:0] ALTER TABLE "<SERVICE>"."<TABLE>" DROP CONSTRAINT "uni_<TABLE>_<FIELD>"
ERR: models automigrating error: ERROR: constraint "uni_<TABLE>_<FIELD>" of relation "<TABLE>" does not exist (SQLSTATE 42704)
After researching the issue, it was discovered that I have an existing record:
ALTERTABLE ONLY "<SERVICE>"."<TABLE>" ADD CONSTRAINT idx_<TABLE>_<FIELD> UNIQUE (<FIELD>);
GORM tries delete the uni_... index instead of idx_...
The text was updated successfully, but these errors were encountered:
GORM Playground Link
<I have no time for write tests for your "playground" while working at office, sorry. Maybe later>
Description
I use
gorm.io/driver/postgres v1.5.9
,gorm.io/gorm v1.25.11
andgo 1.22.6
in our project.Sample environment:
When I run this code in already initialized before database in older versions of GORM I got this (place
SmthDifferentID
instead ofFIELD
):After researching the issue, it was discovered that I have an existing record:
GORM tries delete the
uni_...
index instead ofidx_...
The text was updated successfully, but these errors were encountered: