hpqtypes-extras 1.14.0.0 → 1.14.1.0
raw patch · 4 files changed
+25/−7 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−1
- hpqtypes-extras.cabal +2/−2
- src/Database/PostgreSQL/PQTypes/Checks.hs +15/−4
- test/Main.hs +4/−0
CHANGELOG.md view
@@ -1,5 +1,8 @@+# hpqtypes-extras-1.14.1.0 (2022-01-11)+* Support unmanaged local indexes whose names start with "local_".+ # hpqtypes-extras-1.14.0.0 (2021-12-13)-* Add Support for ON CONFLICT to sqlInsertSelect.+* Add support for ON CONFLICT to sqlInsertSelect. * Remove upper bounds from library dependencies. * Remove kRun* and kWhyNot functions.
hpqtypes-extras.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: hpqtypes-extras-version: 1.14.0.0+version: 1.14.1.0 synopsis: Extra utilities for hpqtypes library description: The following extras for hpqtypes library: .@@ -20,7 +20,7 @@ copyright: Scrive AB category: Database build-type: Simple-tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.3+tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 Source-repository head Type: git
src/Database/PostgreSQL/PQTypes/Checks.hs view
@@ -20,6 +20,7 @@ import Control.Monad.Reader import Data.Int import Data.Function (on)+import Data.List (partition) import Data.Maybe import Data.Monoid import Data.Monoid.Utils@@ -521,10 +522,20 @@ checkIndexes :: [TableIndex] -> [(TableIndex, RawSQL ())] -> ValidationResult- checkIndexes defs indexes = mconcat [- checkEquality "INDEXes" defs (map fst indexes)- , checkNames (indexName tblName) indexes- ]+ checkIndexes defs allIndexes = mconcat+ $ checkEquality "INDEXes" defs (map fst indexes)+ : checkNames (indexName tblName) indexes+ : map localIndexInfo localIndexes+ where+ localIndexInfo (index, name) = validationInfo $ T.concat+ [ "Found a local index '"+ , unRawSQL name+ , "': "+ , T.pack (show index)+ ]++ (localIndexes, indexes) = (`partition` allIndexes) $ \(_, name) ->+ "local_" `T.isPrefixOf` unRawSQL name checkForeignKeys :: [ForeignKey] -> [(ForeignKey, RawSQL ())] -> ValidationResult
test/Main.hs view
@@ -450,6 +450,10 @@ step "Creating the database (schema version 1)..." migrateDatabase defaultExtrasOptions extensions domains composites schema1Tables schema1Migrations++ -- Add a local index that shouldn't trigger validation errors.+ runSQL_ "CREATE INDEX local_idx_bank_name ON bank(name)"+ checkDatabase defaultExtrasOptions composites domains schema1Tables testDBSchema1 :: (String -> TestM ()) -> TestM ([UUID], [UUID])