Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NeverNull #81

Open
ghost opened this issue Oct 15, 2018 · 7 comments
Open

NeverNull #81

ghost opened this issue Oct 15, 2018 · 7 comments

Comments

@ghost
Copy link

ghost commented Oct 15, 2018

I defined entity with unique key, autokey disabled. Compiling with ghc-8.6.
Class ‘NeverNull’ does not have a method ‘toPrimitivePersistValue’ (‘fromPrimitivePersistValue’)

@lykahb
Copy link
Owner

lykahb commented Oct 15, 2018

Can you share the definitions?

@ghost
Copy link
Author

ghost commented Oct 16, 2018

definitions:

  • entity: EncryptKey
    autoKey: null
    keys:
    • name: UserId
      default: true
      constructors:
    • name: EncryptKey
      uniques:
      • name: UserId
        type: primary
        fields: [_userId]

@ghost
Copy link
Author

ghost commented Oct 16, 2018

and second definition:
definitions:

  • entity: User
    dbName: bs_user_20180814
    autoKey: null
    keys:
    • name: PrimaryUser_20180814
      default: true
      constructors:
    • name: User
      uniques:
      • name: PrimaryUser_20180814
        type: primary
        fields: [userKey]
      • name: user_uk_20180814
        type: constraint
        fields: [userKey]

@lykahb
Copy link
Owner

lykahb commented Dec 4, 2018

Can you share the datatype definitions too? A gist that produces that error would be helpful.

@emmanueldenloye
Copy link

I am also seeing this error with ghc 8.6. The definition that fails is this (I've also attached the exact error message)

  - entity: BakerDetails
    autoKey: null
    keys:
     - name: BakerDetailsKey
       default: true
    constructors:
     - name: BakerDetails
       uniques:
        - name: BakerDetailsKey
          type: primary
          fields: [_bakerDetails_publicKeyHash]

Error message

backend/src/Backend/Schema.hs:714:1: error:
    • Class ‘NeverNull’ does not have a method ‘toPrimitivePersistValue’
    • In the instance declaration for
        ‘NeverNull (Key BakerDetails (Unique BakerDetailsKey))’

@emmanueldenloye
Copy link

I'll also include the datatype definitions as well.

data BakerDetails = BakerDetails
  { _bakerDetails_publicKeyHash :: !PublicKeyHash
  -- Used to say what block we examined for delegate info, and also for missed baking and endorsing. It would be the same thing per worker
  , _bakerDetails_branch :: !VeryBlockLike
  , _bakerDetails_delegateInfo :: !(Maybe (Json CacheDelegateInfo))
  } deriving (Eq, Ord, Show, Generic, Typeable)
instance HasId BakerDetails where
  type IdData BakerDetails = PublicKeyHash

There are obviously more datatypes but I suspect that we can just go one level deep.

@emmanueldenloye
Copy link

I've found the source of my error. I had mistakenly thought that the version of this codebase I was using was from this repo. It is from another and I found the source of the error I'm pretty sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants