func ForeignKeyConstraint(t *testing.T, repo grimoire.Repo) {
	extra := Extra{}
	repo.From(extras).MustSave(&extra)
	t.Run("ForeignKeyConstraint", func(t *testing.T) {
		err := repo.From(extras).Set("user_id", 1000).Insert(nil)
		assertConstraint(t, err, errors.ForeignKeyConstraint, "user_id")
		err = repo.From(extras).Find(extra.ID).Set("user_id", 1000).Update(nil)
		assertConstraint(t, err, errors.ForeignKeyConstraint, "user_id")
	})
}
ForeignKeyConstraint tests foreign key constraint specifications.
package specs
import (
	"testing"
	"github.com/Fs02/grimoire"
	"github.com/Fs02/grimoire/errors"
)
func UniqueConstraint(t *testing.T, repo grimoire.Repo) {
	extra1 := Extra{}
	extra2 := Extra{}
	repo.From(extras).Set("slug", "slug1").MustInsert(&extra1)
	repo.From(extras).Set("slug", "slug2").MustInsert(&extra2)
	t.Run("UniqueConstraint", func(t *testing.T) {
		err := repo.From(extras).Set("slug", extra1.Slug).Insert(nil)
		assertConstraint(t, err, errors.UniqueConstraint, "slug")
		err = repo.From(extras).Find(extra2.ID).Set("slug", extra1.Slug).Update(nil)
		assertConstraint(t, err, errors.UniqueConstraint, "slug")
	})
}