You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{-# LANGUAGE TypeApplications, DeriveGeneric #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE StandaloneDeriving #-}
moduleSharedPrimaryKeyTestwhereimportTemplateTestImportsimportDatabase.PersistimportDatabase.Persist.SqlimportDatabase.Persist.Sql.UtilimportDatabase.Persist.TH
share [ mkPersist sqlSettings ] [persistLowerCase|
User
name String
Profile
Id UserId
email String
|]
specs::Spec
specs = describe "Shared Primary Keys"$do
As of now, this doesn't even compile.
/home/matt/Projects/persistent/persistent-template/test/SharedPrimaryKeyTest.hs:23:51: error:
• Not in scope: type constructor or class ‘UserId’
• In the quasi-quotation:
[persistLowerCase|
User
name String
Profile
Id UserId
email String
|]
|
23 | share [ mkPersist sqlSettings ] [persistLowerCase|
| ^...
Switching Profile to using a userId UserId; Primary userId works. But that's pretty weird, I'd except UserId to have the same resolution with Id as it would for userId.
You can get Clever by doing a (Key User) instead. Then the PersistFieldSql is right, but the actual entityId on the field definition is wrong.
The text was updated successfully, but these errors were encountered:
This module demonstrates the problem.
As of now, this doesn't even compile.
Switching
Profile
to using auserId UserId; Primary userId
works. But that's pretty weird, I'd exceptUserId
to have the same resolution withId
as it would foruserId
.You can get Clever by doing a
(Key User)
instead. Then thePersistFieldSql
is right, but the actualentityId
on the field definition is wrong.The text was updated successfully, but these errors were encountered: