GORM Playground Link
https://github.com/go-gorm/playground/pull/651
Description
When AutoMigrate is called concurrently from either one or more binaries, it fails intermittently with one of the following errors:
* table 'test_tables' already exists
* duplicate key value violates unique constraint "pg_class_relname_nsp_index" (SQLSTATE 23505)
It's not possible to protect this from happening using a mutex, because the function may be called at the same time from multiple binaries if using the go test package list mode.
I suggest that we instead acquire a lock on the database before migrating. Is this something that would make sense to add to GORM?
Comment From: zhtiyissr
i think it should expose a configuration that allows CREATE TABLE IF NOT EXIST