When you run printSQL (up . migration $ mig) you get:
CREATE SCHEMA "bookstore";
CREATE TABLE "bookstore"."books" ("id" int8 NOT NULL, CONSTRAINT "pk_book" PRIMARY KEY ("id"));
CREATE TABLE "bookstore"."reviews" ("book" int8 NOT NULL, CONSTRAINT "fk_book" FOREIGN KEY ("book") REFERENCES "books" ("id") ON DELETE CASCADE ON UPDATE RESTRICT);
This is expected behavior, but not valid, because "books" does not exist, only "bookstore"."books". The expected fix is for ForeignKey constraints to have the tables they reference scoped by schemas at the type level and the term level.
When you run
printSQL (up . migration $ mig)
you get:This is expected behavior, but not valid, because "books" does not exist, only "bookstore"."books". The expected fix is for
ForeignKey
constraints to have the tables they reference scoped by schemas at the type level and the term level.