diff options
author | "Vincent Ambo ext:(%22) <tazjin@me.com> | 2012-03-12T14·12+0100 |
---|---|---|
committer | "Vincent Ambo ext:(%22) <tazjin@me.com> | 2012-03-12T14·12+0100 |
commit | 1c4db3b576febde673a1b0bb615b6aee174f9cee (patch) | |
tree | b2791dafa7c53be9e1d0f393f8cf4aa916019560 | |
parent | 93268c683cf47db643a13b4a4f3a2291bc4df481 (diff) |
acid-migrate:
* successful conversion and test
-rw-r--r-- | tools/acid-migrate/Acid.hs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tools/acid-migrate/Acid.hs b/tools/acid-migrate/Acid.hs index 756f215e551b..bc360694a64d 100644 --- a/tools/acid-migrate/Acid.hs +++ b/tools/acid-migrate/Acid.hs @@ -160,7 +160,7 @@ getPost eid = latestPosts :: Query Blog [Entry] latestPosts = do b@Blog{..} <- ask - return $ IxSet.toDescList (Proxy :: Proxy UTCTime) $ blogEntries + return $ IxSet.toDescList (Proxy :: Proxy EDate) $ blogEntries addSession :: Text -> User -> UTCTime -> Update Blog Session addSession sId u t = @@ -199,9 +199,10 @@ instance JSON Comment where readJSON val = do obj <- jsonObject val scauthor <- jsonField "cauthor" obj - scdate <- jsonField "cdate" obj - sctext <- jsonField "cdate" obj - return $ Comment (pack scauthor) (pack sctext) (parseSeconds scdate) + jsscdate <- jsonField "cdate" obj :: Result JSValue + let rcdate = stripResult $ jsonInt jsscdate + sctext <- jsonField "ctext" obj + return $ Comment (pack scauthor) (pack sctext) (parseSeconds rcdate) instance JSON Entry where showJSON = undefined @@ -213,11 +214,11 @@ instance JSON Entry where month <- jsonField "month" obj year <- jsonField "year" obj stext <- jsonField "text" obj - --comments <- jsonField "comments" obj + comments <- jsonField "comments" obj oldid <- jsonField "_id" obj let leTime = parseShittyTime year month day oldid return $ Entry (EntryId $ getUnixTime leTime) DE (pack sauthor) (pack $ stitle \\ "\n") (pack stext) (Text.empty) - leTime [] [] + leTime [] comments getUnixTime :: UTCTime -> Integer @@ -268,3 +269,9 @@ convertEntries acid = do forceHack !x = do xy <- pasteToDB acid x return $ show xy + +testThis :: IO () +testThis = do + acid <- openLocalState initialBlogState + allE <- query' acid LatestPosts + putStrLn $ show allE \ No newline at end of file |