diff options
author | abrar <> | 2020-11-21 12:20:00 (GMT) |
---|---|---|
committer | hdiff <hdiff@hdiff.luite.com> | 2020-11-21 12:20:00 (GMT) |
commit | efc97f8ce6c16222a52481fbbc6861c4d4af487d (patch) | |
tree | 4c689e93539b3caa95bd78db9a4f5ac3b1b1b681 | |
parent | 17de1369b0b11660f4d8570f8651d38dd95ec035 (diff) |
version 0.1.0.10.1.0.1
-rwxr-xr-x | CHANGELOG.md | 6 | ||||
-rw-r--r-- | README.lhs | 5 | ||||
-rwxr-xr-x | README.md | 5 | ||||
-rw-r--r-- | beam-automigrate.cabal | 8 | ||||
-rw-r--r-- | bench/Main.hs | 6 | ||||
-rw-r--r-- | src/Database/Beam/AutoMigrate/Postgres.hs | 6 |
6 files changed, 23 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c12a8ab..7a744bf 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Revision history for beam-automigrate +## 0.1.0.1 + +* Loosen time version bounds +* readme: Fix warning about a transaction already running +* Support for GHC 8.10 + ## 0.1.0.0 * Initial release. Generate schemas and migrations for beam databases. See limitations in [README.md](README.md) @@ -272,8 +272,9 @@ something like this: > BA.printMigration $ BA.migrate conn hsSchema > > exampleAutoMigration :: IO () -> exampleAutoMigration = readmeDbTransaction $ \conn -> -> BA.tryRunMigrationsWithEditUpdate annotatedDB conn +> exampleAutoMigration = withDb "readme-db" $ \pool -> +> withResource pool $ \conn -> +> BA.tryRunMigrationsWithEditUpdate annotatedDB conn > > main :: IO () > main = do @@ -272,8 +272,9 @@ something like this: > BA.printMigration $ BA.migrate conn hsSchema > > exampleAutoMigration :: IO () -> exampleAutoMigration = readmeDbTransaction $ \conn -> -> BA.tryRunMigrationsWithEditUpdate annotatedDB conn +> exampleAutoMigration = withDb "readme-db" $ \pool -> +> withResource pool $ \conn -> +> BA.tryRunMigrationsWithEditUpdate annotatedDB conn > > main :: IO () > main = do diff --git a/beam-automigrate.cabal b/beam-automigrate.cabal index 2678269..1a1dd04 100644 --- a/beam-automigrate.cabal +++ b/beam-automigrate.cabal @@ -1,5 +1,5 @@ name: beam-automigrate -version: 0.1.0.0 +version: 0.1.0.1 license-file: LICENSE build-type: Simple cabal-version: >=1.10 @@ -22,6 +22,8 @@ extra-source-files: README.md CHANGELOG.md +tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.2 + library exposed-modules: Database.Beam.AutoMigrate @@ -49,14 +51,14 @@ library , microlens >=0.4.10 && <0.6 , mtl >=2.2.2 && <2.4 , postgresql-simple >=0.5.4 && <0.7.0.0 - , pretty-simple >=2.2.0 && <2.3 + , pretty-simple >=2.2.0 && <3.3 , QuickCheck >=2.13 && <2.15 , quickcheck-instances >=0.3 && <0.4 , scientific >=0.3.6 && <0.5 , splitmix >=0.0.3 && <0.1 , string-conv >=0.1.2 && <0.3 , text >=1.2.0.0 && <1.3.0.0 - , time >=1.8.0 && <1.9 + , time >=1.8.0 && <2 , transformers >=0.5.6 && <0.7 , uuid >=1.3 && <1.4 , vector >=0.12.0.3 && <0.13.0.0 diff --git a/bench/Main.hs b/bench/Main.hs index a44286a..d7f1a47 100644 --- a/bench/Main.hs +++ b/bench/Main.hs @@ -6,9 +6,9 @@ import Control.Exception (bracket) import Control.Monad.IO.Class (liftIO) import Criterion.Main import qualified Data.Map.Strict as M -import Database.Beam.Migrate.New -import Database.Beam.Migrate.New.BenchUtil -import Database.Beam.Migrate.New.Postgres (getSchema) +import Database.Beam.AutoMigrate +import Database.Beam.AutoMigrate.BenchUtil +import Database.Beam.AutoMigrate.Postgres (getSchema) import Database.Beam.Postgres (runBeamPostgres) import qualified Database.PostgreSQL.Simple as Pg diff --git a/src/Database/Beam/AutoMigrate/Postgres.hs b/src/Database/Beam/AutoMigrate/Postgres.hs index 6783516..3015d76 100644 --- a/src/Database/Beam/AutoMigrate/Postgres.hs +++ b/src/Database/Beam/AutoMigrate/Postgres.hs @@ -28,7 +28,7 @@ import Database.Beam.AutoMigrate.Types import Database.Beam.Backend.SQL hiding (tableName) import qualified Database.Beam.Backend.SQL.AST as AST import qualified Database.PostgreSQL.Simple as Pg -import Database.PostgreSQL.Simple.FromField (FromField (..), fromField) +import Database.PostgreSQL.Simple.FromField (FromField (..), fromField, returnError) import Database.PostgreSQL.Simple.FromRow (FromRow (..), field) import qualified Database.PostgreSQL.Simple.TypeInfo.Static as Pg import qualified Database.PostgreSQL.Simple.Types as Pg @@ -84,11 +84,11 @@ instance FromField ColumnName where instance FromField SqlRawOtherConstraintType where fromField f dat = do - t <- fromField f dat + t :: String <- fromField f dat case t of "p" -> pure SQL_raw_pk "u" -> pure SQL_raw_unique - _ -> fail ("Unexpected costraint type: " <> t) + _ -> returnError Pg.ConversionFailed f t -- -- Postgres queries to extract the schema out of the DB |