GORM Playground Link

https://github.com/go-gorm/playground/pull/731

Description

When adding a many2many relationship between models. If one of them has a check constraint, GORM tries to copy it over to the joinTable, where it won't work, since the constraint has a different name for the column (i.e.: email -> user_email)

I'd expect this constraint to either be optionally ignored at schema/relationship.go:

    Tag: removeSettingFromTag(appendSettingFromTag(ownField.StructField.Tag, "primaryKey"),
-       "column", "autoincrement", "index", "unique", "uniqueindex"),
+       "column", "autoincrement", "index", "unique", "uniqueindex", "check"),

or possibly allow users to be able to set the checks on the new reference columns in the struct tags of the field with the many2many relationship.