-
Notifications
You must be signed in to change notification settings - Fork 301
Closed
Labels
Description
I want to use "Change table Id field type"
It works with postgresql.
But relation column type is always Int, so error has occurred at creating Foreign Key.
I had try followings.
- model
User
Id Day default=CURRENT_DATE
ident Text
password Text Maybe
UniqueUser ident
deriving Typeable
Email
email Text
user UserId Maybe
verkey Text Maybe
UniqueEmail email
- log: create table
Migrating: CREATe TABLE "user"("id" DATE PRIMARY KEY UNIQUE DEFAULT CURRENT_DATE,"ident" VARCHAR NOT NULL,"password" VARCHAR NULL)
Migrating: CREATe TABLE "email"("id" SERIAL PRIMARY KEY UNIQUE,"email" VARCHAR NOT NULL,"user" INT8 NULL,"verkey" VARCHAR NULL)
- log: error
Migrating: ALTER TABLE "email" ADD CONSTRAINT "email_user_fkey" FOREIGN KEY("user") REFERENCES "user"("id")
devel.hs: SqlError {sqlState = "42804", sqlExecStatus = FatalError, sqlErrorMsg = "foreign key constraint \"email_user_fkey\" cannot be implemented", sqlErrorDetail = "Key columns \"user\" and \"id\" are of incompatible types: bigint and date.", sqlErrorHint = ""}
Exit code: ExitFailure 1
Is there any workaround?
Thank you.