Repository navigation
PersistMarshalError with UTCTime on Sqlite #339
Description
Activity
Can you tell me the exact version of persistent-sqlite you're using? And it would be great to see a short code snippet that reproduces the problem.
I am currently using persistent-2.1.1.2 and persistent-sqlite-2.1.1.1 in a sandbox.
in my
config/modelsfile I have a section, where I define a datatype storing a timestamp in UTCTimeMedium title Text path FP.FilePath thumb FP.FilePath mime Text time UTCTime owner UserId description Textarea tags Texts album AlbumId deriving Eq ShowOne line of code that prodces the is fore example in
Handler/Home.hsof my aforementioned project, where I access all media and sort them by timestamp:recentMedia <- runDB $ selectList [] [Desc MediumTime]When accessing a single medium with
tempMedium <- runDB $ get mediumIdthe server will throw a similar error:
get MediumKey {unMediumKey = SqlBackendKey {unSqlBackendKey = 1}}: field time: Expected UTCTime, received PersistText "2014-12-23T04:01:11.786518"I hope this clarifies the problem I encounter.
And I'm guessing you're loading up data that was written by a previous
version of persistent, correct? Does the problem occur with a fresh
database?On Tue, Dec 23, 2014, 11:45 AM rys ostrovid [email protected]
wrote:I am currently using persistent-2.1.1.2 and persistent-sqlite-2.1.1.1 in a
sandbox.in my config/models file I have a section, where I define a datatype
storing a timestamp in UTCTimeMedium
title Text
path FP.FilePath
thumb FP.FilePath
mime Text
time UTCTime
owner UserId
description Textarea
tags Texts
album AlbumId
deriving Eq ShowOne line of code that prodces the is fore example in Handler/Home.hs of
my aforementioned project, where I access all media and sort them by
timestamp:recentMedia <- runDB $ selectList [] [Desc MediumTime]
When accessing a single medium with
tempMedium <- runDB $ get mediumId
the server will throw a similar error:
get MediumKey {unMediumKey = SqlBackendKey {unSqlBackendKey = 1}}: field time: Expected UTCTime, received PersistText "2014-12-23T04:01:11.786518"
I hope this clarifies the problem I encounter.
—
Reply to this email directly or view it on GitHub
#339 (comment).unfortunately yes.
This is a regression caused by the fix for #328. Should be an easy fix, just a few minutes...
- added a commit that references this issue
on Dec 23, 2014 I've just pushed a commit which tweaks the persistent package to fix it. I'm going through release procedures now, but you can install from the repo directly to give it a shot. (Note: the fix is in persistent, not persistent-sqlite.)
Thank you very much, that fixed the problem.
Hello,
I have encountered a problem after migrating my project eidolon to persistent > 2.0. At runtime yesod throws errors like
although the whole project compiles without errors. Can you help me out, please?