]> gitweb.michael.orlitzky.com - dead/htsn-import.git/commitdiff
Replace all raw DELETE queries with deleteAll.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 20 Apr 2014 22:29:28 +0000 (18:29 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 20 Apr 2014 22:29:28 +0000 (18:29 -0400)
Set a new lower bound on groundhog for the deleteAll function.

doc/TODO
htsn-import.cabal
src/TSN/XML/AutoRacingSchedule.hs
src/TSN/XML/Injuries.hs
src/TSN/XML/InjuriesDetail.hs
src/TSN/XML/News.hs
src/TSN/XML/Odds.hs
src/TSN/XML/Scores.hs
src/TSN/XML/Weather.hs

index 4f22e0cae6d1ded2b3d7a81843389bcd9a7d7cd0..ade3c5ca9d6987f1fbba1e9b9b5a948e2d88919f 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -20,4 +20,3 @@
 
 6. Replace boilerplate with regular-xmlpickler.
 
-7. Replace inline SQL queries with deleteAll.
index b7922477be5c5c3fde8eb4c4c4725d77d0aa72b8..a38aa346120ec13e0b556b6d94c26e76e966ff5e 100644 (file)
@@ -81,7 +81,8 @@ executable htsn-import
     hslogger                    == 1.2.*,
     htsn-common                 == 0.0.1,
     hxt                         == 9.3.*,
-    groundhog                   == 0.4.*,
+   -- deleteAll showed up in 0.4.1
+    groundhog                   >= 0.4.1,
     groundhog-postgresql        == 0.4.*,
     groundhog-sqlite            == 0.4.*,
     groundhog-th                == 0.4.*,
index ab1c29ef01db05be044eabb0055eb91635558039..aeb8745a505029991fa314acbbb34a833e11c204 100644 (file)
@@ -29,7 +29,7 @@ import Data.Time ( UTCTime(..) )
 import Data.Tuple.Curry ( uncurryN )
 import Database.Groundhog (
   countAll,
-  executeRaw,
+  deleteAll,
   migrate,
   runMigration,
   silentMigrationLogger )
@@ -555,8 +555,7 @@ test_on_delete_cascade = testGroup "cascading delete tests"
                     migrate b
                     migrate c
                   _ <- dbimport sched
-                  -- No idea how 'delete' works, so do this instead.
-                  executeRaw False "DELETE FROM auto_racing_schedules;" []
+                  deleteAll a
                   count_a <- countAll a
                   count_b <- countAll b
                   count_c <- countAll c
index af1bc377466d078e71dff41cd73da393d4840200..6ae9118ed7bfdba3084275d0f5d3636f928f7258 100644 (file)
@@ -32,7 +32,7 @@ import Data.Time ( UTCTime )
 import Data.Typeable ( Typeable )
 import Database.Groundhog (
   countAll,
-  executeRaw,
+  deleteAll,
   migrate,
   runMigration,
   silentMigrationLogger )
@@ -346,8 +346,7 @@ test_on_delete_cascade =
                   migrate a
                   migrate b
                 _ <- dbimport inj
-                -- No idea how 'delete' works, so do this instead.
-                executeRaw False "DELETE FROM injuries;" []
+                deleteAll a
                 count_a <- countAll a
                 count_b <- countAll b
                 return $ count_a + count_b
index 4356eb60be9c344267eaea850092d5aed632cac5..fbb938e4268fc107e2d8e8a83d9b56fdef1a60c5 100644 (file)
@@ -30,7 +30,7 @@ import Data.Tuple.Curry ( uncurryN )
 import Database.Groundhog (
   DefaultKey,
   countAll,
-  executeRaw,
+  deleteAll,
   migrate,
   runMigration,
   silentMigrationLogger )
@@ -463,8 +463,7 @@ test_on_delete_cascade = testGroup "cascading delete tests"
                     migrate b
                     migrate c
                   _ <- dbimport inj
-                  -- No idea how 'delete' works, so do this instead.
-                  executeRaw False "DELETE FROM injuries_detail;" []
+                  deleteAll a
                   count_a <- countAll a
                   count_b <- countAll b
                   count_c <- countAll c
index 49be37e932ea3d7414cdb1ab6b9b1d0263243a5d..c42b931cf88e8df1fed92f46c10d6597cad4ef6b 100644 (file)
@@ -31,7 +31,7 @@ import Data.Tuple.Curry ( uncurryN )
 import Data.Typeable ( Typeable )
 import Database.Groundhog (
   countAll,
-  executeRaw,
+  deleteAll,
   insert_,
   migrate,
   runMigration,
@@ -530,8 +530,7 @@ test_on_delete_cascade = testGroup "cascading delete tests"
                     migrate d
                     migrate e
                   _ <- dbimport news
-                  -- No idea how 'delete' works, so do this instead.
-                  executeRaw False "DELETE FROM news;" []
+                  deleteAll a
                   count_a <- countAll a
                   count_b <- countAll b
                   count_c <- countAll c
index 52b7b9f025f5fc1981443523a777776467b954f5..b8888af2052d62f7fd5e85fdc61f907d9aaae20d 100644 (file)
@@ -33,7 +33,7 @@ import Database.Groundhog (
   (=.),
   (==.),
   countAll,
-  executeRaw,
+  deleteAll,
   insert_,
   migrate,
   runMigration,
@@ -837,8 +837,7 @@ test_on_delete_cascade = testGroup "cascading delete tests"
                     migrate e
                     migrate f
                   _ <- dbimport odds
-                  -- No idea how 'delete' works, so do this instead.
-                  executeRaw False "DELETE FROM odds;" []
+                  deleteAll a
                   count_a <- countAll a
                   count_b <- countAll b
                   count_c <- countAll c
index 6044fe7b6055631ebb7d5b771566d8629fb314e6..571f6b383833da7c5edba1f146b25cb6fe7e15f0 100644 (file)
@@ -30,7 +30,7 @@ import Data.Tuple.Curry ( uncurryN )
 import Data.Typeable ( Typeable )
 import Database.Groundhog (
   countAll,
-  executeRaw,
+  deleteAll,
   insert,
   insert_,
   migrate,
@@ -618,7 +618,7 @@ test_on_delete_cascade = testGroup "cascading delete tests"
                     migrate f
                   _ <- dbimport score
                   -- No idea how 'delete' works, so do this instead.
-                  executeRaw False "DELETE FROM scores;" []
+                  deleteAll a
                   count_a <- countAll a
                   count_b <- countAll b
                   count_c <- countAll c
index 03bb83d51c3ac3d45dbf9b2f5f974f5968f1d60b..bda29ee2541005efb4ca1eaedcccf77d1231d201 100644 (file)
@@ -26,7 +26,7 @@ import Data.Time ( UTCTime )
 import Data.Tuple.Curry ( uncurryN )
 import Database.Groundhog (
   countAll,
-  executeRaw,
+  deleteAll,
   migrate,
   runMigration,
   silentMigrationLogger )
@@ -412,8 +412,7 @@ test_on_delete_cascade =
                   migrate b
                   migrate c
                 _ <- dbimport weather
-                -- No idea how 'delete' works, so do this instead.
-                executeRaw False "DELETE FROM weather;" []
+                deleteAll a
                 count_a <- countAll a
                 count_b <- countAll b
                 count_c <- countAll c