yesodweb/persistent — Issue #26: persistent-postgresql generates erroneus REFERENCES clause when using sql= entity attribute
Author: portnov
Created: 2011-10-28 11:04:42+00:00
State: open

For example, having following entites declarations:

Submission sql=submission
host String
....

Record sql=record
submission SubmissionId
....

persistent-postgresql generates:

Migrating: CREATE TABLE "submission"(id SERIAL PRIMARY KEY UNIQUE,"host" VARCHAR NOT NULL, ....
Migrating: CREATE TABLE "record"(id SERIAL PRIMARY KEY UNIQUE,"submission" INT8 NOT NULL REFERENCES "Submission", ....

Note that it REFERENCES "Submission", not "submission". So, next we have

SqlError {seState = "42P01", seNativeError = 7, seErrorMsg = "execute: PGRES_FATAL_ERROR: ERROR: relation \"Submission\" does not exist\n"}