-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
import Control.Exception
import Control.Monad
-import Control.Monad.Base (liftBase)
-import Control.Monad.Trans.Control (MonadBaseControl)
-import qualified Data.ByteString.Char8 as BSC
-import qualified Database.Postgres.Temp as Temp
-import Generics.SOP (K)
+import Control.Monad.Base (liftBase)
+import qualified Data.ByteString.Char8 as BSC
+import qualified Database.Postgres.Temp as Temp
+import Generics.SOP (K)
import Squeal.PostgreSQL
-import Squeal.PostgreSQL.Migration
import Squeal.PostgreSQL.Pool
import Test.Hspec
-- ^ Pool of 50 connections to the temporary @postgres@
}
-type Migrations schema m a = (MonadBaseControl IO m) =>
- PQ (("schema_migrations" ::: Table MigrationsTable) ': '[])
- (("schema_migrations" ::: Table MigrationsTable) ': schema) m a
-
type Fixtures schema = (Pool (K Connection schema) -> IO ())
type Actions schema a = PoolPQ schema IO a
-type SquealContext (schema :: SchemaType) = TestDB (K Connection schema)
+type SquealContext schema = TestDB (K Connection schema)
-- | Start a temporary @postgres@ process and create a pool of connections to it
setupDB
- :: Migrations schema IO a
+ :: AlignedList (Migration (Terminally PQ IO)) schema0 schema
-> Fixtures schema
-> IO (SquealContext schema)
setupDB migration fixtures = do
singleStripe
keepConnectionForOneHour
poolSizeOfFifty
- withConnection connectionString migration
+ withConnection connectionString (migrateUp migration)
fixtures pool
pure TestDB {..}
--
-- hook for stopping a db.
describeDB
- :: Migrations schema IO a
+ :: AlignedList (Migration (Terminally PQ IO)) schema0 schema
-> Fixtures schema
-> String
-> SpecWith (SquealContext schema)
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
-resolver: lts-12.20
+resolver: lts-13.18
# User packages to be built.
# Various formats can be used as shown in the example below.
# using the same syntax as the packages field.
# (e.g., acme-missiles-0.3)
extra-deps:
- - squeal-postgresql-0.4.0.0
- - records-sop-0.1.0.2
- - tmp-postgres-0.1.1.0
+ - git: https://github.com/morphismtech/squeal
+ commit: cd3de98230645ba763183fcae3f7c38faf119c89
+ subdirs:
+ - squeal-postgresql
+ - unliftio-pool-0.2.1.0@sha256:4de658feb1b10051c5af024c20cd7baa369c777716c54a7b3e2888a73286aecf
+ - records-sop-0.1.0.2
+ - tmp-postgres-0.1.1.0
# Override default flag values for local packages and extra-deps
# flags: {}