GORM Playground Link
https://github.com/go-gorm/playground/pull/717
Description
Starting with gorm 1.25.6 I can't automatically migrate tables with uniqueIndex constraint. Here's a very simple example with just one model and one field with the constraint. I removed DROP TABLE commands, so the database keeps the data between the test runs.
Now if you run the test the first time - it passes, if you run it again - you get the error:
Failed to auto migrate, but got error Error 1091 (42000): Can't DROP 'uni_entities_name'; check that column/key exists
This is tested with 1.25.9 and fails there. Works fine in 1.25.5, started failing in 1.25.6.
Tested with MySQL and fails there. Seems working OK with sqlite3 though...
Comment From: ov
I updated the test so it doesn't need to be run twice. I now call RunMigration() twice and it fails straight away.
Comment From: ov
My bad. After checking the CI logs from the pull request it looks like it works just fine on your side. I tested it further and it seems like upgrading gorm mysql driver 1.5.2->1.5.6 did the job.
Please ignore the issue. Thank you.
Comment From: diemus
v1.25.9 still have this problem on pg, I have to downgrade to the old version 1.25.1 to pass the automigrate