Commit Graph

472 Commits

Author SHA1 Message Date
Fintan Halpenny
274b6b2e7c Uncomment test that was failing 2017-08-03 20:50:00 +01:00
Fintan Halpenny
8eab68a8d3 Removed now from typeclass and moved it to PostgreSQL. Testing for DB clock against machine clock 2017-08-03 20:48:42 +01:00
Fintan Halpenny
013dc19b15 Accidentally committed True default for postgres 2017-08-03 20:47:43 +01:00
Fintan Halpenny
a4ebae2345 Use type constraint to constrain a to UTCTime 2017-08-02 16:34:46 +01:00
Fintan Halpenny
161914ddbc Added now_ function. Works in the tests (NOTE: It doesn not work in SQLite). Need to see if there is an answer for constraining the in to only know about time 2017-08-02 13:48:21 +01:00
Chris Allen
9c73a6f517 Merge pull request #43 from bitemyapp/FintanH/errors
Cleaning up Esqueleto errors
2017-07-31 10:49:17 -05:00
Chris Allen
bf66a49beb Spurious ruler 2017-07-31 10:48:03 -05:00
Chris Allen
36acb1e1c2 Move Exception closer to EsqueletoError 2017-07-31 10:36:19 -05:00
Chris Allen
b7df667d3e Fix spurious Exception instances 2017-07-31 10:36:10 -05:00
Fintan Halpenny
431080611d Broke out the error types into three seperate sum types with one sum type enumerating them
Identified and rewrote all error sections
2017-07-31 10:35:55 -05:00
Fintan Halpenny
b77a0c3e71 Missed some error calls in:
*) unsafeSqlBinOpComposite
*) sqlSelectProcessRow in the instance of SqlSelect (SqlExpr InsertFinal) InsertFinal
2017-07-31 10:35:42 -05:00
Fintan Halpenny
0beec06559 Added EsqueletoProblem for throwing internal esqueleto problems.
Replaced all "error" calls to use throw instead.
2017-07-31 10:34:55 -05:00
Chris Allen
2867517729 Export From 2017-07-25 13:53:20 -05:00
Chris Allen
ff87a31951 Export From 2017-07-25 13:48:19 -05:00
Chris Allen
9109d327c3 postgres database 2017-07-25 13:29:56 -05:00
Chris Allen
9350894518 derp, no sudo 2017-07-25 13:26:30 -05:00
Chris Allen
cf342648cd Minor test cleanup 2017-07-25 13:15:40 -05:00
Chris Allen
e67422a803 Merge pull request #40 from FintanH/examples
Examples
2017-07-25 11:25:14 -05:00
Fintan Halpenny
de2d9f8a0b Got a working example of cascading delete but it requires a select followed by a delete 2017-07-23 23:49:34 +01:00
Fintan Halpenny
9fc64131b0 Added comments and cleaned up some code 2017-07-22 18:09:13 +01:00
Fintan Halpenny
cbb69420f0 Separated BlogT Monad into its own file and renaming the main to Main.hs 2017-07-22 17:16:11 +01:00
Fintan Halpenny
5b047567f7 Moved to using postgresql with working example of put persons 2017-07-22 16:50:27 +01:00
Fintan Halpenny
93e861cd1b Trying to figure out why deleteYoungsters is throwing an ErrorConstraint. Been trying Cascade Deletes but it doesn't seem to help 2017-07-17 21:37:15 +01:00
Fintan Halpenny
743ab2a92b First commit. Have a draft of separating the README examples into functions and running them on a test sqlite DB 2017-07-17 09:20:22 +01:00
Chris Allen
e173a19f13 Revert "unsafeSqlOrderBy"
Fixing EOrderRandom is the proper way to do this.
2017-07-13 18:20:32 -05:00
Chris Allen
b7bbe98c11 unsafeSqlOrderBy 2017-07-13 18:09:05 -05:00
Chris Allen
df485bb029 Merge pull request #30 from parsonsmatt/matt/fix-selectSource
release key with selectSource
2017-06-21 23:37:06 -05:00
Matt Parsons
40c966bc75 add stack test 2017-06-21 12:23:24 -06:00
Matt Parsons
6a435f53b4 redundant import 2017-06-21 11:46:38 -06:00
Matt Parsons
28ceb892eb remove comment 2017-06-21 11:28:46 -06:00
Matt Parsons
338f5a3c47 fixes the test failure 2017-06-21 11:26:47 -06:00
Matt Parsons
e330f3326f comment out '
solution', add repro to test suite
2017-06-21 11:25:56 -06:00
Matt Parsons
2fa9760d51 release key 2017-06-21 11:09:37 -06:00
Chris Allen
0c6bba7026 Formatting the Cabal file 2017-05-25 12:07:28 -05:00
Chris Allen
78eaf83859 Whitespace cleanup 2017-05-25 12:00:00 -05:00
Chris Allen
ee4d0d5e35 Merge pull request #28 from bitemyapp/fix-group-by-composite-key
Fixing composite key support for group by
2017-05-25 11:51:56 -05:00
Chris Allen
96cc3a546b Merge pull request #20 from ncaq/master
use persistent-sqlite >= 2.1.3
2017-05-25 11:21:18 -05:00
Chris Allen
7488003444 Merge pull request #26 from psibi/persistent-version
Allow persistent 2.7.0
2017-05-25 11:21:01 -05:00
Chris Allen
14a28ab32d Cleanup 2017-05-25 11:19:41 -05:00
Chris Allen
5609d78de4 Helps if you vary the primary key 2017-05-04 21:45:35 -05:00
Chris Allen
43813cdfe2 Test suite still broken 2017-04-28 00:08:05 -05:00
Chris Allen
5a78c156c2 Fixing composite key support for group by 2017-04-27 22:49:48 -05:00
Sibi Prabakaran
52a442fb98
Allow persistent 2.7.0 2017-04-15 18:14:13 +05:30
Chris Allen
60a6a394aa Merge pull request #24 from hvr/patch-1
Tighten version bound on base
2017-03-23 16:04:41 -05:00
Herbert Valerio Riedel
3e1d3deede Tighten version bound on base
Given that CI only seems to test against GHC 7.10 & GHC 8.0 it's safe to say that only
`base >= 4.8` is officially supported. And empirically, GHC 7.8.4 runs into the compile error below

```
Configuring component lib from esqueleto-2.5.0...
Preprocessing library esqueleto-2.5.0...
[1 of 5] Compiling Database.Esqueleto.Internal.PersistentImport ( src/Database/Esqueleto/Internal/PersistentImport.hs, /tmp/matrix-worker/1485112890/dist-newstyle/build/x86_64-linux/ghc-7.8.4/esqueleto-2.5.0/build/Database/Esqueleto/Internal/PersistentImport.o )

src/Database/Esqueleto/Internal/PersistentImport.hs:7:1: Warning:
    The import item ‘PersistQuery(..)’ suggests that
    ‘PersistQuery’ has (in-scope) constructors or class methods,
    but it has none
[2 of 5] Compiling Database.Esqueleto.Internal.Language ( src/Database/Esqueleto/Internal/Language.hs, /tmp/matrix-worker/1485112890/dist-newstyle/build/x86_64-linux/ghc-7.8.4/esqueleto-2.5.0/build/Database/Esqueleto/Internal/Language.o )

src/Database/Esqueleto/Internal/Language.hs:55:1: Warning:
    The qualified import of ‘Data.ByteString.Lazy’ is redundant
      except perhaps to import instances from ‘Data.ByteString.Lazy’
    To import instances alone, use: import Data.ByteString.Lazy()
[3 of 5] Compiling Database.Esqueleto.Internal.Sql ( src/Database/Esqueleto/Internal/Sql.hs, /tmp/matrix-worker/1485112890/dist-newstyle/build/x86_64-linux/ghc-7.8.4/esqueleto-2.5.0/build/Database/Esqueleto/Internal/Sql.o )

src/Database/Esqueleto/Internal/Sql.hs:761:32:
    Could not deduce (Functor m1) arising from a use of ‘<$>’
    from the context (SqlSelect a r, MonadIO m1, MonadIO m2)
      bound by the type signature for
                 rawSelectSource :: (SqlSelect a r, MonadIO m1, MonadIO m2) =>
                                    Mode -> SqlQuery a -> SqlReadT m1 (Acquire (C.Source m2 r))
      at src/Database/Esqueleto/Internal/Sql.hs:(753,20)-(758,57)
    or from (SqlBackendCanRead backend)
      bound by the type signature for
                 rawSelectSource :: (SqlBackendCanRead backend) =>
                                    Mode
                                    -> SqlQuery a -> R.ReaderT backend m1 (Acquire (C.Source m2 r))
      at src/Database/Esqueleto/Internal/Sql.hs:(759,1)-(778,35)
    Possible fix:
      add (Functor m1) to the context of
        the type signature for
          rawSelectSource :: (SqlBackendCanRead backend) =>
                             Mode
                             -> SqlQuery a -> R.ReaderT backend m1 (Acquire (C.Source m2 r))
        or the type signature for
             rawSelectSource :: (SqlSelect a r, MonadIO m1, MonadIO m2) =>
                                Mode -> SqlQuery a -> SqlReadT m1 (Acquire (C.Source m2 r))
    In a stmt of a 'do' block: conn <- persistBackend <$> R.ask
    In the expression:
      do { conn <- persistBackend <$> R.ask;
           res <- run conn;
           return $ (C.$= massage) `fmap` res }
    In an equation for ‘rawSelectSource’:
        rawSelectSource mode query
          = do { conn <- persistBackend <$> R.ask;
                 res <- run conn;
                 return $ (C.$= massage) `fmap` res }
          where
              run conn
                = uncurry rawQueryRes
                  $ first builderToText
                    $ toRawSql mode (conn, initialIdentState) query
              massage
                = do { mrow <- C.await;
                       .... }
              process = sqlSelectProcessRow

src/Database/Esqueleto/Internal/Sql.hs:882:26:
    Could not deduce (Functor m) arising from a use of ‘<$>’
    from the context (MonadIO m, SqlSelect a r, IsSqlBackend backend)
      bound by the type signature for
                 rawEsqueleto :: (MonadIO m, SqlSelect a r, IsSqlBackend backend) =>
                                 Mode -> SqlQuery a -> R.ReaderT backend m Int64
      at src/Database/Esqueleto/Internal/Sql.hs:(877,17)-(880,39)
    Possible fix:
      add (Functor m) to the context of
        the type signature for
          rawEsqueleto :: (MonadIO m, SqlSelect a r, IsSqlBackend backend) =>
                          Mode -> SqlQuery a -> R.ReaderT backend m Int64
    In a stmt of a 'do' block: conn <- persistBackend <$> R.ask
    In the expression:
      do { conn <- persistBackend <$> R.ask;
           uncurry rawExecuteCount
           $ first builderToText
             $ toRawSql mode (conn, initialIdentState) query }
    In an equation for ‘rawEsqueleto’:
        rawEsqueleto mode query
          = do { conn <- persistBackend <$> R.ask;
                 uncurry rawExecuteCount
                 $ first builderToText
                   $ toRawSql mode (conn, initialIdentState) query }
```
2017-03-21 22:07:03 +01:00
Chris Allen
a28198ed92 Merge pull request #18 from ChrisCoffey/fix-postgres-tests
Fix postgres tests
2017-02-04 15:02:41 -06:00
Chris Coffey
9604b25833 Fix postgres tests 2017-02-04 13:02:09 -05:00
Chris Allen
75bf47936d stack setup for screwdriver 2017-01-25 16:29:53 -06:00
Chris Allen
5b89568833 Testing Screwdriver 2017-01-25 16:16:47 -06:00
Chris Allen
6e2b880488 Makefile, LTS for 8.0, bump version 2017-01-22 12:55:05 -06:00