Commits

Luke Plant  committed 8f8dee3

small tweaks

  • Participants
  • Parent commits aa3d82a

Comments (0)

Files changed (1)

File src/Migrate.hs

                      toSql $ P.format_id p,
                      toSql $ P.timestamp p,
                      toSql $ P.comments_open p];
-                    newid <- quickQuery cn "SELECT max(id) FROM posts;" [];
-                    return p { P.id = fromSql $ head $ head newid } ; }
+                    [[newid]] <- quickQuery cn "SELECT max(id) FROM posts;" [];
+                    return p { P.id = fromSql $ newid } ; }
 
 main = handleSqlError $ do
   cn <- DB.connect
   writeItems cn addCategory cats
   origPosts <- readPosts
   newPosts <- writeItems cn addPost origPosts
+  -- we need the new IDs to rewrite comments tables
+  -- and the post/categories m2m
+  commit cn
   return ()