beam-postgres 0.5.3.1 → 0.5.4.0
raw patch · 10 files changed
+189/−59 lines, 10 filesdep +testcontainersdep −tmp-postgresnew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: testcontainers
Dependencies removed: tmp-postgres
API changes (from Hackage documentation)
- Database.Beam.Postgres.Full: -- table <tt>tbl</tt> that violates a constraint.
- Database.Beam.Postgres.Full: -- to occur
- Database.Beam.Postgres.Full: -- | What to do when an <tt>INSERT</tt> statement inserts a row into the
- Database.Beam.Postgres.Full: data family SqlConflictAction be (table :: Type -> Type -> Type);
- Database.Beam.Postgres.Full: instance GHC.Base.Monoid (Database.Beam.Postgres.Full.PgLockedTables s)
- Database.Beam.Postgres.Full: instance GHC.Base.Semigroup (Database.Beam.Postgres.Full.PgLockedTables s)
- Database.Beam.Postgres.Syntax: instance Data.String.IsString (Database.Beam.Query.CustomSQL.CustomSqlSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax)
- Database.Beam.Postgres.Syntax: instance Data.String.IsString Database.Beam.Postgres.Syntax.PgSyntaxPrim
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.ByteString.Internal.ByteString
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Int.Int16
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Int.Int32
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Int.Int64
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Int.Int8
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Word.Word16
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Word.Word32
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Word.Word64
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Word.Word8
- Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax x => Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax (GHC.Maybe.Maybe x)
- Database.Beam.Postgres.Syntax: instance GHC.Base.Functor Database.Beam.Postgres.Syntax.PgSyntaxF
- Database.Beam.Postgres.Syntax: instance GHC.Base.Monoid (Database.Beam.Query.CustomSQL.CustomSqlSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax)
- Database.Beam.Postgres.Syntax: instance GHC.Base.Monoid Database.Beam.Postgres.Syntax.PgSyntax
- Database.Beam.Postgres.Syntax: instance GHC.Base.Semigroup (Database.Beam.Query.CustomSQL.CustomSqlSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax)
- Database.Beam.Postgres.Syntax: instance GHC.Base.Semigroup Database.Beam.Postgres.Syntax.PgSyntax
- Database.Beam.Postgres.Syntax: instance GHC.Enum.Bounded Database.Beam.Postgres.Syntax.PgEscapeType
- Database.Beam.Postgres.Syntax: instance GHC.Enum.Enum Database.Beam.Postgres.Syntax.PgEscapeType
- Database.Beam.Postgres.Syntax: instance GHC.Generics.Generic Database.Beam.Postgres.Syntax.PgDataTypeDescr
- Database.Beam.Postgres.Syntax: instance GHC.Generics.Generic Database.Beam.Postgres.Syntax.PgHasEnum
- Database.Beam.Postgres.Syntax: instance GHC.Generics.Generic Database.Beam.Postgres.Syntax.PgNullOrdering
- Database.Beam.Postgres.Syntax: instance GHC.Generics.Generic Database.Beam.Postgres.Syntax.PgSelectLockingOptions
- Database.Beam.Postgres.Syntax: instance GHC.Generics.Generic Database.Beam.Postgres.Syntax.PgSelectLockingStrength
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgColumnConstraintDefinitionSyntax
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgColumnSchemaSyntax
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgCommandType
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgDataTypeDescr
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgDataTypeSyntax
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgEscapeType
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgHasEnum
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgNullOrdering
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgSelectLockingOptions
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgSelectLockingStrength
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgSyntax
- Database.Beam.Postgres.Syntax: instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgSyntaxPrim
+ Database.Beam.Postgres.Full: data SqlConflictAction be (table :: Type -> Type -> Type);
+ Database.Beam.Postgres.Full: data SqlConflictTarget be (table :: Type -> Type -> Type);
+ Database.Beam.Postgres.Full: instance GHC.Internal.Base.Monoid (Database.Beam.Postgres.Full.PgLockedTables s)
+ Database.Beam.Postgres.Full: instance GHC.Internal.Base.Semigroup (Database.Beam.Postgres.Full.PgLockedTables s)
+ Database.Beam.Postgres.Migrate: instance Database.PostgreSQL.Simple.FromRow.FromRow Database.Beam.Postgres.Migrate.SchemaName
+ Database.Beam.Postgres.Migrate: instance GHC.Internal.Generics.Generic Database.Beam.Postgres.Migrate.SchemaName
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.ByteString.Internal.Type.ByteString
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Internal.Int.Int16
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Internal.Int.Int32
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Internal.Int.Int64
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Internal.Int.Int8
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Internal.Word.Word16
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Internal.Word.Word32
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Internal.Word.Word64
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Internal.Word.Word8
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax x => Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax (GHC.Internal.Maybe.Maybe x)
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.IsSql92SchemaNameSyntax Database.Beam.Postgres.Syntax.PgSchemaNameSyntax
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.IsSql92SchemaNameSyntax Database.Beam.Postgres.Syntax.PgSchemaNameSyntax => Database.Beam.Migrate.SQL.SQL92.IsSql92CreateSchemaSyntax Database.Beam.Postgres.Syntax.PgCreateSchemaSyntax
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Backend.SQL.SQL92.IsSql92SchemaNameSyntax Database.Beam.Postgres.Syntax.PgSchemaNameSyntax => Database.Beam.Migrate.SQL.SQL92.IsSql92DropSchemaSyntax Database.Beam.Postgres.Syntax.PgDropSchemaSyntax
+ Database.Beam.Postgres.Syntax: instance Database.Beam.Migrate.SQL.SQL92.IsSql92DdlSchemaCommandSyntax Database.Beam.Postgres.Syntax.PgCommandSyntax
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Base.Functor Database.Beam.Postgres.Syntax.PgSyntaxF
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Base.Monoid (Database.Beam.Query.CustomSQL.CustomSqlSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax)
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Base.Monoid Database.Beam.Postgres.Syntax.PgSyntax
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Base.Semigroup (Database.Beam.Query.CustomSQL.CustomSqlSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax)
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Base.Semigroup Database.Beam.Postgres.Syntax.PgSyntax
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Data.String.IsString (Database.Beam.Query.CustomSQL.CustomSqlSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax)
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Data.String.IsString Database.Beam.Postgres.Syntax.PgSyntaxPrim
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Enum.Bounded Database.Beam.Postgres.Syntax.PgEscapeType
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Enum.Enum Database.Beam.Postgres.Syntax.PgEscapeType
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Generics.Generic Database.Beam.Postgres.Syntax.PgDataTypeDescr
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Generics.Generic Database.Beam.Postgres.Syntax.PgHasEnum
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Generics.Generic Database.Beam.Postgres.Syntax.PgNullOrdering
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Generics.Generic Database.Beam.Postgres.Syntax.PgSelectLockingOptions
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Generics.Generic Database.Beam.Postgres.Syntax.PgSelectLockingStrength
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgColumnConstraintDefinitionSyntax
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgColumnSchemaSyntax
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgCommandType
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgDataTypeDescr
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgDataTypeSyntax
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgEscapeType
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgHasEnum
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgNullOrdering
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgSelectLockingOptions
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgSelectLockingStrength
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgSyntax
+ Database.Beam.Postgres.Syntax: instance GHC.Internal.Show.Show Database.Beam.Postgres.Syntax.PgSyntaxPrim
- Database.Beam.Postgres: PgEmptyRange :: PgRange (n :: *) a
+ Database.Beam.Postgres: PgEmptyRange :: PgRange n a
- Database.Beam.Postgres: PgJSONEach :: C f Text -> C f valType -> PgJSONEach valType f
+ Database.Beam.Postgres: PgJSONEach :: C f Text -> C f valType -> PgJSONEach valType (f :: Type -> Type)
- Database.Beam.Postgres: PgJSONElement :: C f a -> PgJSONElement a f
+ Database.Beam.Postgres: PgJSONElement :: C f a -> PgJSONElement a (f :: Type -> Type)
- Database.Beam.Postgres: PgJSONKey :: C f Text -> PgJSONKey f
+ Database.Beam.Postgres: PgJSONKey :: C f Text -> PgJSONKey (f :: Type -> Type)
- Database.Beam.Postgres: PgRange :: PgRangeBound a -> PgRangeBound a -> PgRange (n :: *) a
+ Database.Beam.Postgres: PgRange :: PgRangeBound a -> PgRangeBound a -> PgRange n a
- Database.Beam.Postgres: [pgJsonEachKey] :: PgJSONEach valType f -> C f Text
+ Database.Beam.Postgres: [pgJsonEachKey] :: PgJSONEach valType (f :: Type -> Type) -> C f Text
- Database.Beam.Postgres: [pgJsonEachValue] :: PgJSONEach valType f -> C f valType
+ Database.Beam.Postgres: [pgJsonEachValue] :: PgJSONEach valType (f :: Type -> Type) -> C f valType
- Database.Beam.Postgres: [pgJsonElement] :: PgJSONElement a f -> C f a
+ Database.Beam.Postgres: [pgJsonElement] :: PgJSONElement a (f :: Type -> Type) -> C f a
- Database.Beam.Postgres: [pgJsonKey] :: PgJSONKey f -> C f Text
+ Database.Beam.Postgres: [pgJsonKey] :: PgJSONKey (f :: Type -> Type) -> C f Text
- Database.Beam.Postgres: arrayOf_ :: Q Postgres db s (QExpr Postgres s a) -> QGenExpr context Postgres s (Vector a)
+ Database.Beam.Postgres: arrayOf_ :: forall (db :: (Type -> Type) -> Type) s a context. Q Postgres db s (QExpr Postgres s a) -> QGenExpr context Postgres s (Vector a)
- Database.Beam.Postgres: array_ :: forall context f s a. (PgIsArrayContext context, Foldable f) => f (QGenExpr context Postgres s a) -> QGenExpr context Postgres s (Vector a)
+ Database.Beam.Postgres: array_ :: (PgIsArrayContext context, Foldable f) => f (QGenExpr context Postgres s a) -> QGenExpr context Postgres s (Vector a)
- Database.Beam.Postgres: class IsPgJSON (json :: * -> *)
+ Database.Beam.Postgres: class IsPgJSON (json :: Type -> Type)
- Database.Beam.Postgres: class PgIsArrayContext ctxt
+ Database.Beam.Postgres: class PgIsArrayContext (ctxt :: k)
- Database.Beam.Postgres: class PgIsRange n
+ Database.Beam.Postgres: class PgIsRange (n :: k)
- Database.Beam.Postgres: data PgJSONEach valType f
+ Database.Beam.Postgres: data PgJSONEach valType (f :: Type -> Type)
- Database.Beam.Postgres: data PgJSONElement a f
+ Database.Beam.Postgres: data PgJSONElement a (f :: Type -> Type)
- Database.Beam.Postgres: data PgJSONKey f
+ Database.Beam.Postgres: data PgJSONKey (f :: Type -> Type)
- Database.Beam.Postgres: data PgRange (n :: *) a
+ Database.Beam.Postgres: data PgRange n a
- Database.Beam.Postgres: data PgSetOf (tbl :: (* -> *) -> *)
+ Database.Beam.Postgres: data PgSetOf (tbl :: Type -> Type -> Type)
- Database.Beam.Postgres: fromPgIntegral :: forall a. (FromField a, Integral a, Typeable a) => FromBackendRowM Postgres a
+ Database.Beam.Postgres: fromPgIntegral :: (FromField a, Integral a, Typeable a) => FromBackendRowM Postgres a
- Database.Beam.Postgres: getPgExtension :: DatabaseEntity Postgres db (PgExtensionEntity extension) -> extension
+ Database.Beam.Postgres: getPgExtension :: forall (db :: (Type -> Type) -> Type) extension. DatabaseEntity Postgres db (PgExtensionEntity extension) -> extension
- Database.Beam.Postgres: pgCreateExtension :: forall extension db. IsPgExtension extension => Migration Postgres (CheckedDatabaseEntity Postgres db (PgExtensionEntity extension))
+ Database.Beam.Postgres: pgCreateExtension :: forall extension (db :: (Type -> Type) -> Type). IsPgExtension extension => Migration Postgres (CheckedDatabaseEntity Postgres db (PgExtensionEntity extension))
- Database.Beam.Postgres: pgDropExtension :: forall extension. CheckedDatabaseEntityDescriptor Postgres (PgExtensionEntity extension) -> Migration Postgres ()
+ Database.Beam.Postgres: pgDropExtension :: CheckedDatabaseEntityDescriptor Postgres (PgExtensionEntity extension) -> Migration Postgres ()
- Database.Beam.Postgres: pgNubBy_ :: (Projectible Postgres key, Projectible Postgres r) => (r -> key) -> Q Postgres db s r -> Q Postgres db s r
+ Database.Beam.Postgres: pgNubBy_ :: forall key r (db :: (Type -> Type) -> Type) s. (Projectible Postgres key, Projectible Postgres r) => (r -> key) -> Q Postgres db s r -> Q Postgres db s r
- Database.Beam.Postgres: pgRegexpSplitToTable :: BeamSqlBackendIsString Postgres text => QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s PgRegex -> Q Postgres db s (QExpr Postgres s Text)
+ Database.Beam.Postgres: pgRegexpSplitToTable :: forall text ctxt s (db :: (Type -> Type) -> Type). BeamSqlBackendIsString Postgres text => QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s PgRegex -> Q Postgres db s (QExpr Postgres s Text)
- Database.Beam.Postgres: pgUnnest :: forall tbl db s. Beamable tbl => QExpr Postgres s (PgSetOf tbl) -> Q Postgres db s (QExprTable Postgres s tbl)
+ Database.Beam.Postgres: pgUnnest :: forall tbl (db :: (Type -> Type) -> Type) s. Beamable tbl => QExpr Postgres s (PgSetOf tbl) -> Q Postgres db s (QExprTable Postgres s tbl)
- Database.Beam.Postgres: pgUnnestArray :: QExpr Postgres s (Vector a) -> Q Postgres db s (QExpr Postgres s a)
+ Database.Beam.Postgres: pgUnnestArray :: forall s a (db :: (Type -> Type) -> Type). QExpr Postgres s (Vector a) -> Q Postgres db s (QExpr Postgres s a)
- Database.Beam.Postgres: pgUnnestArrayWithOrdinality :: QExpr Postgres s (Vector a) -> Q Postgres db s (QExpr Postgres s Int64, QExpr Postgres s a)
+ Database.Beam.Postgres: pgUnnestArrayWithOrdinality :: forall s a (db :: (Type -> Type) -> Type). QExpr Postgres s (Vector a) -> Q Postgres db s (QExpr Postgres s Int64, QExpr Postgres s a)
- Database.Beam.Postgres: unboundedArray :: forall a. Typeable a => DataType Postgres a -> DataType Postgres (Vector a)
+ Database.Beam.Postgres: unboundedArray :: Typeable a => DataType Postgres a -> DataType Postgres (Vector a)
- Database.Beam.Postgres.Conduit: runDelete :: MonadIO m => Connection -> SqlDelete Postgres tbl -> m Int64
+ Database.Beam.Postgres.Conduit: runDelete :: forall m (tbl :: (Type -> Type) -> Type). MonadIO m => Connection -> SqlDelete Postgres tbl -> m Int64
- Database.Beam.Postgres.Conduit: runInsert :: MonadIO m => Connection -> SqlInsert Postgres tbl -> m Int64
+ Database.Beam.Postgres.Conduit: runInsert :: forall m (tbl :: (Type -> Type) -> Type). MonadIO m => Connection -> SqlInsert Postgres tbl -> m Int64
- Database.Beam.Postgres.Conduit: runUpdate :: MonadIO m => Connection -> SqlUpdate Postgres tbl -> m Int64
+ Database.Beam.Postgres.Conduit: runUpdate :: forall m (tbl :: (Type -> Type) -> Type). MonadIO m => Connection -> SqlUpdate Postgres tbl -> m Int64
- Database.Beam.Postgres.Conduit: streamingRunDeleteReturning :: (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> PgDeleteReturning a -> ConduitT () a m ()
+ Database.Beam.Postgres.Conduit: streamingRunDeleteReturning :: forall (m :: Type -> Type) a. (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> PgDeleteReturning a -> ConduitT () a m ()
- Database.Beam.Postgres.Conduit: streamingRunInsertReturning :: (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> PgInsertReturning a -> ConduitT () a m ()
+ Database.Beam.Postgres.Conduit: streamingRunInsertReturning :: forall (m :: Type -> Type) a. (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> PgInsertReturning a -> ConduitT () a m ()
- Database.Beam.Postgres.Conduit: streamingRunQueryReturning :: (MonadResource m, MonadFail m, FromBackendRow Postgres r) => Connection -> PgSyntax -> ConduitT () r m ()
+ Database.Beam.Postgres.Conduit: streamingRunQueryReturning :: forall (m :: Type -> Type) r. (MonadResource m, MonadFail m, FromBackendRow Postgres r) => Connection -> PgSyntax -> ConduitT () r m ()
- Database.Beam.Postgres.Conduit: streamingRunSelect :: (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> SqlSelect Postgres a -> ConduitT () a m ()
+ Database.Beam.Postgres.Conduit: streamingRunSelect :: forall (m :: Type -> Type) a. (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> SqlSelect Postgres a -> ConduitT () a m ()
- Database.Beam.Postgres.Conduit: streamingRunUpdateReturning :: (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> PgUpdateReturning a -> ConduitT () a m ()
+ Database.Beam.Postgres.Conduit: streamingRunUpdateReturning :: forall (m :: Type -> Type) a. (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> PgUpdateReturning a -> ConduitT () a m ()
- Database.Beam.Postgres.CustomTypes: beamTypeForCustomPg :: CheckedDatabaseEntity Postgres db (PgType a) -> DataType Postgres a
+ Database.Beam.Postgres.CustomTypes: beamTypeForCustomPg :: forall (db :: (Type -> Type) -> Type) a. CheckedDatabaseEntity Postgres db (PgType a) -> DataType Postgres a
- Database.Beam.Postgres.CustomTypes: createEnum :: forall a db. (HasSqlValueSyntax PgValueSyntax a, Enum a, Bounded a) => Text -> Migration Postgres (CheckedDatabaseEntity Postgres db (PgType a))
+ Database.Beam.Postgres.CustomTypes: createEnum :: forall a (db :: (Type -> Type) -> Type). (HasSqlValueSyntax PgValueSyntax a, Enum a, Bounded a) => Text -> Migration Postgres (CheckedDatabaseEntity Postgres db (PgType a))
- Database.Beam.Postgres.Extensions.UuidOssp: UuidOssp :: (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s (UUID -> Text -> UUID)) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s (UUID -> Text -> UUID)) -> UuidOssp
+ Database.Beam.Postgres.Extensions.UuidOssp: UuidOssp :: (forall ctxt s. () => LiftPg ctxt s UUID) -> (forall ctxt s. () => LiftPg ctxt s UUID) -> (forall ctxt s. () => LiftPg ctxt s UUID) -> (forall ctxt s. () => LiftPg ctxt s UUID) -> (forall ctxt s. () => LiftPg ctxt s UUID) -> (forall ctxt s. () => LiftPg ctxt s UUID) -> (forall ctxt s. () => LiftPg ctxt s UUID) -> (forall ctxt s. () => LiftPg ctxt s (UUID -> Text -> UUID)) -> (forall ctxt s. () => LiftPg ctxt s UUID) -> (forall ctxt s. () => LiftPg ctxt s (UUID -> Text -> UUID)) -> UuidOssp
- Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidGenerateV1Mc] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID
+ Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidGenerateV1Mc] :: UuidOssp -> forall ctxt s. () => LiftPg ctxt s UUID
- Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidGenerateV1] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID
+ Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidGenerateV1] :: UuidOssp -> forall ctxt s. () => LiftPg ctxt s UUID
- Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidGenerateV3] :: UuidOssp -> forall ctxt s. LiftPg ctxt s (UUID -> Text -> UUID)
+ Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidGenerateV3] :: UuidOssp -> forall ctxt s. () => LiftPg ctxt s (UUID -> Text -> UUID)
- Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidGenerateV4] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID
+ Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidGenerateV4] :: UuidOssp -> forall ctxt s. () => LiftPg ctxt s UUID
- Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidGenerateV5] :: UuidOssp -> forall ctxt s. LiftPg ctxt s (UUID -> Text -> UUID)
+ Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidGenerateV5] :: UuidOssp -> forall ctxt s. () => LiftPg ctxt s (UUID -> Text -> UUID)
- Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidNil] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID
+ Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidNil] :: UuidOssp -> forall ctxt s. () => LiftPg ctxt s UUID
- Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidNsDns] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID
+ Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidNsDns] :: UuidOssp -> forall ctxt s. () => LiftPg ctxt s UUID
- Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidNsOid] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID
+ Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidNsOid] :: UuidOssp -> forall ctxt s. () => LiftPg ctxt s UUID
- Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidNsUrl] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID
+ Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidNsUrl] :: UuidOssp -> forall ctxt s. () => LiftPg ctxt s UUID
- Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidNsX500] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID
+ Database.Beam.Postgres.Extensions.UuidOssp: [pgUuidNsX500] :: UuidOssp -> forall ctxt s. () => LiftPg ctxt s UUID
- Database.Beam.Postgres.Full: PgInsertOnConflict :: (tbl (QField QInternal) -> PgInsertOnConflictSyntax) -> PgInsertOnConflict (tbl :: (* -> *) -> *)
+ Database.Beam.Postgres.Full: PgInsertOnConflict :: (tbl (QField QInternal) -> PgInsertOnConflictSyntax) -> PgInsertOnConflict (tbl :: (Type -> Type) -> Type)
- Database.Beam.Postgres.Full: class PgReturning cmd where {
+ Database.Beam.Postgres.Full: class PgReturning (cmd :: Type -> Type -> Type -> Type -> Type) where {
- Database.Beam.Postgres.Full: conflictingConstraint :: Text -> SqlConflictTarget Postgres tbl
+ Database.Beam.Postgres.Full: conflictingConstraint :: forall (tbl :: (Type -> Type) -> Type). Text -> SqlConflictTarget Postgres tbl
- Database.Beam.Postgres.Full: deleteReturning :: Projectible Postgres a => DatabaseEntity Postgres be (TableEntity table) -> (forall s. table (QExpr Postgres s) -> QExpr Postgres s Bool) -> (table (QExpr Postgres PostgresInaccessible) -> a) -> PgDeleteReturning (QExprToIdentity a)
+ Database.Beam.Postgres.Full: deleteReturning :: forall a (be :: (Type -> Type) -> Type) table. Projectible Postgres a => DatabaseEntity Postgres be (TableEntity table) -> (forall s. () => table (QExpr Postgres s) -> QExpr Postgres s Bool) -> (table (QExpr Postgres PostgresInaccessible) -> a) -> PgDeleteReturning (QExprToIdentity a)
- Database.Beam.Postgres.Full: insert :: DatabaseEntity Postgres db (TableEntity table) -> SqlInsertValues Postgres (table (QExpr Postgres s)) -> PgInsertOnConflict table -> SqlInsert Postgres table
+ Database.Beam.Postgres.Full: insert :: forall (db :: (Type -> Type) -> Type) table s. DatabaseEntity Postgres db (TableEntity table) -> SqlInsertValues Postgres (table (QExpr Postgres s)) -> PgInsertOnConflict table -> SqlInsert Postgres table
- Database.Beam.Postgres.Full: insertReturning :: Projectible Postgres a => DatabaseEntity Postgres be (TableEntity table) -> SqlInsertValues Postgres (table (QExpr Postgres s)) -> PgInsertOnConflict table -> Maybe (table (QExpr Postgres PostgresInaccessible) -> a) -> PgInsertReturning (QExprToIdentity a)
+ Database.Beam.Postgres.Full: insertReturning :: forall a (be :: (Type -> Type) -> Type) table s. Projectible Postgres a => DatabaseEntity Postgres be (TableEntity table) -> SqlInsertValues Postgres (table (QExpr Postgres s)) -> PgInsertOnConflict table -> Maybe (table (QExpr Postgres PostgresInaccessible) -> a) -> PgInsertReturning (QExprToIdentity a)
- Database.Beam.Postgres.Full: lateral_ :: forall s a b db. (ThreadRewritable s a, ThreadRewritable (QNested s) b, Projectible Postgres b) => a -> (WithRewrittenThread s (QNested s) a -> Q Postgres db (QNested s) b) -> Q Postgres db s (WithRewrittenThread (QNested s) s b)
+ Database.Beam.Postgres.Full: lateral_ :: forall s a b (db :: (Type -> Type) -> Type). (ThreadRewritable s a, ThreadRewritable (QNested s) b, Projectible Postgres b) => a -> (WithRewrittenThread s (QNested s) a -> Q Postgres db (QNested s) b) -> Q Postgres db s (WithRewrittenThread (QNested s) s b)
- Database.Beam.Postgres.Full: locked_ :: (Beamable tbl, Database Postgres db) => DatabaseEntity Postgres db (TableEntity tbl) -> Q Postgres db s (PgLockedTables s, tbl (QExpr Postgres s))
+ Database.Beam.Postgres.Full: locked_ :: forall tbl (db :: (Type -> Type) -> Type) s. (Beamable tbl, Database Postgres db) => DatabaseEntity Postgres db (TableEntity tbl) -> Q Postgres db s (PgLockedTables s, tbl (QExpr Postgres s))
- Database.Beam.Postgres.Full: lockingAllTablesFor_ :: (Database Postgres db, Projectible Postgres a, ThreadRewritable (QNested s) a) => PgSelectLockingStrength -> Maybe PgSelectLockingOptions -> Q Postgres db (QNested s) a -> Q Postgres db s (WithRewrittenThread (QNested s) s a)
+ Database.Beam.Postgres.Full: lockingAllTablesFor_ :: forall (db :: (Type -> Type) -> Type) a s. (Database Postgres db, Projectible Postgres a, ThreadRewritable (QNested s) a) => PgSelectLockingStrength -> Maybe PgSelectLockingOptions -> Q Postgres db (QNested s) a -> Q Postgres db s (WithRewrittenThread (QNested s) s a)
- Database.Beam.Postgres.Full: lockingFor_ :: forall a db s. (Database Postgres db, Projectible Postgres a, ThreadRewritable (QNested s) a) => PgSelectLockingStrength -> Maybe PgSelectLockingOptions -> Q Postgres db (QNested s) (PgWithLocking (QNested s) a) -> Q Postgres db s (WithRewrittenThread (QNested s) s a)
+ Database.Beam.Postgres.Full: lockingFor_ :: forall a (db :: (Type -> Type) -> Type) s. (Database Postgres db, Projectible Postgres a, ThreadRewritable (QNested s) a) => PgSelectLockingStrength -> Maybe PgSelectLockingOptions -> Q Postgres db (QNested s) (PgWithLocking (QNested s) a) -> Q Postgres db s (WithRewrittenThread (QNested s) s a)
- Database.Beam.Postgres.Full: newtype PgInsertOnConflict (tbl :: (* -> *) -> *)
+ Database.Beam.Postgres.Full: newtype PgInsertOnConflict (tbl :: Type -> Type -> Type)
- Database.Beam.Postgres.Full: onConflict :: Beamable tbl => SqlConflictTarget Postgres tbl -> SqlConflictAction Postgres tbl -> PgInsertOnConflict tbl
+ Database.Beam.Postgres.Full: onConflict :: forall (tbl :: (Type -> Type) -> Type). Beamable tbl => SqlConflictTarget Postgres tbl -> SqlConflictAction Postgres tbl -> PgInsertOnConflict tbl
- Database.Beam.Postgres.Full: onConflictDefault :: PgInsertOnConflict tbl
+ Database.Beam.Postgres.Full: onConflictDefault :: forall (tbl :: (Type -> Type) -> Type). PgInsertOnConflict tbl
- Database.Beam.Postgres.Full: onConflictUpdateAll :: forall be (table :: (Type -> Type) -> TYPE LiftedRep). (BeamHasInsertOnConflict be, Beamable table) => SqlConflictAction be table
+ Database.Beam.Postgres.Full: onConflictUpdateAll :: forall be (table :: (Type -> Type) -> Type). (BeamHasInsertOnConflict be, Beamable table) => SqlConflictAction be table
- Database.Beam.Postgres.Full: type PgReturningType cmd :: * -> *;
+ Database.Beam.Postgres.Full: type PgReturningType (cmd :: Type -> Type -> Type -> Type -> Type) :: Type -> Type;
- Database.Beam.Postgres.Full: updateReturning :: Projectible Postgres a => DatabaseEntity Postgres be (TableEntity table) -> (forall s. table (QField s) -> QAssignment Postgres s) -> (forall s. table (QExpr Postgres s) -> QExpr Postgres s Bool) -> (table (QExpr Postgres PostgresInaccessible) -> a) -> PgUpdateReturning (QExprToIdentity a)
+ Database.Beam.Postgres.Full: updateReturning :: forall a (be :: (Type -> Type) -> Type) table. Projectible Postgres a => DatabaseEntity Postgres be (TableEntity table) -> (forall s. () => table (QField s) -> QAssignment Postgres s) -> (forall s. () => table (QExpr Postgres s) -> QExpr Postgres s Bool) -> (table (QExpr Postgres PostgresInaccessible) -> a) -> PgUpdateReturning (QExprToIdentity a)
- Database.Beam.Postgres.Migrate: unboundedArray :: forall a. Typeable a => DataType Postgres a -> DataType Postgres (Vector a)
+ Database.Beam.Postgres.Migrate: unboundedArray :: Typeable a => DataType Postgres a -> DataType Postgres (Vector a)
- Database.Beam.Postgres.PgCrypto: PgCrypto :: (forall ctxt s. LiftPg ctxt s (Text -> Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (Text -> Text -> Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (Text -> Text -> Text)) -> (forall ctxt s. LiftPg ctxt s (Text -> Maybe Int32 -> Text)) -> (forall ctxt s. LiftPg ctxt s (Text -> Text -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> Text)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (Text -> ByteString -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> Text)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text)) -> (forall ctxt s. PgExpr ctxt s ByteString -> Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text)) -> PgExpr ctxt s Text) -> (forall ctxt s. LiftPg ctxt s (Text -> ByteString)) -> (forall ctxt s i. Integral i => PgExpr ctxt s i -> PgExpr ctxt s ByteString) -> (forall ctxt s. PgExpr ctxt s UUID) -> PgCrypto
+ Database.Beam.Postgres.PgCrypto: PgCrypto :: (forall ctxt s. () => LiftPg ctxt s (Text -> Text -> ByteString)) -> (forall ctxt s. () => LiftPg ctxt s (ByteString -> Text -> ByteString)) -> (forall ctxt s. () => LiftPg ctxt s (Text -> Text -> Text -> ByteString)) -> (forall ctxt s. () => LiftPg ctxt s (ByteString -> Text -> Text -> ByteString)) -> (forall ctxt s. () => LiftPg ctxt s (Text -> Text -> Text)) -> (forall ctxt s. () => LiftPg ctxt s (Text -> Maybe Int32 -> Text)) -> (forall ctxt s. () => LiftPg ctxt s (Text -> Text -> Maybe Text -> ByteString)) -> (forall ctxt s. () => LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)) -> (forall ctxt s. () => LiftPg ctxt s (ByteString -> Text -> Maybe Text -> Text)) -> (forall ctxt s. () => LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)) -> (forall ctxt s. () => LiftPg ctxt s (Text -> ByteString -> Maybe Text -> ByteString)) -> (forall ctxt s. () => LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> ByteString)) -> (forall ctxt s. () => LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> Text)) -> (forall ctxt s. () => LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> ByteString)) -> (forall ctxt s. () => LiftPg ctxt s (ByteString -> Text)) -> (forall ctxt s. () => PgExpr ctxt s ByteString -> Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text)) -> PgExpr ctxt s Text) -> (forall ctxt s. () => LiftPg ctxt s (Text -> ByteString)) -> (forall ctxt s i. Integral i => PgExpr ctxt s i -> PgExpr ctxt s ByteString) -> (forall ctxt s. () => PgExpr ctxt s UUID) -> PgCrypto
- Database.Beam.Postgres.PgCrypto: [pgCryptoArmor] :: PgCrypto -> forall ctxt s. PgExpr ctxt s ByteString -> Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text)) -> PgExpr ctxt s Text
+ Database.Beam.Postgres.PgCrypto: [pgCryptoArmor] :: PgCrypto -> forall ctxt s. () => PgExpr ctxt s ByteString -> Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text)) -> PgExpr ctxt s Text
- Database.Beam.Postgres.PgCrypto: [pgCryptoCrypt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> Text -> Text)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoCrypt] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (Text -> Text -> Text)
- Database.Beam.Postgres.PgCrypto: [pgCryptoDearmor] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> ByteString)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoDearmor] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (Text -> ByteString)
- Database.Beam.Postgres.PgCrypto: [pgCryptoDigestBytes] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text -> ByteString)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoDigestBytes] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (ByteString -> Text -> ByteString)
- Database.Beam.Postgres.PgCrypto: [pgCryptoDigestText] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> Text -> ByteString)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoDigestText] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (Text -> Text -> ByteString)
- Database.Beam.Postgres.PgCrypto: [pgCryptoGenRandomUUID] :: PgCrypto -> forall ctxt s. PgExpr ctxt s UUID
+ Database.Beam.Postgres.PgCrypto: [pgCryptoGenRandomUUID] :: PgCrypto -> forall ctxt s. () => PgExpr ctxt s UUID
- Database.Beam.Postgres.PgCrypto: [pgCryptoGenSalt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> Maybe Int32 -> Text)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoGenSalt] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (Text -> Maybe Int32 -> Text)
- Database.Beam.Postgres.PgCrypto: [pgCryptoHmacBytes] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Text -> ByteString)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoHmacBytes] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (ByteString -> Text -> Text -> ByteString)
- Database.Beam.Postgres.PgCrypto: [pgCryptoHmacText] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> Text -> Text -> ByteString)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoHmacText] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (Text -> Text -> Text -> ByteString)
- Database.Beam.Postgres.PgCrypto: [pgCryptoPgpKeyId] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoPgpKeyId] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (ByteString -> Text)
- Database.Beam.Postgres.PgCrypto: [pgCryptoPgpPubDecryptBytea] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> ByteString)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoPgpPubDecryptBytea] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> ByteString)
- Database.Beam.Postgres.PgCrypto: [pgCryptoPgpPubDecrypt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> Text)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoPgpPubDecrypt] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> Text)
- Database.Beam.Postgres.PgCrypto: [pgCryptoPgpPubEncryptBytea] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> ByteString)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoPgpPubEncryptBytea] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> ByteString)
- Database.Beam.Postgres.PgCrypto: [pgCryptoPgpPubEncrypt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> ByteString -> Maybe Text -> ByteString)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoPgpPubEncrypt] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (Text -> ByteString -> Maybe Text -> ByteString)
- Database.Beam.Postgres.PgCrypto: [pgCryptoPgpSymDecryptBytea] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoPgpSymDecryptBytea] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)
- Database.Beam.Postgres.PgCrypto: [pgCryptoPgpSymDecrypt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> Text)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoPgpSymDecrypt] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (ByteString -> Text -> Maybe Text -> Text)
- Database.Beam.Postgres.PgCrypto: [pgCryptoPgpSymEncryptBytea] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoPgpSymEncryptBytea] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)
- Database.Beam.Postgres.PgCrypto: [pgCryptoPgpSymEncrypt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> Text -> Maybe Text -> ByteString)
+ Database.Beam.Postgres.PgCrypto: [pgCryptoPgpSymEncrypt] :: PgCrypto -> forall ctxt s. () => LiftPg ctxt s (Text -> Text -> Maybe Text -> ByteString)
- Database.Beam.Postgres.Syntax: [EmitBuilder] :: Builder -> f -> PgSyntaxF f
+ Database.Beam.Postgres.Syntax: [EmitBuilder] :: forall f. Builder -> f -> PgSyntaxF f
- Database.Beam.Postgres.Syntax: [EmitByteString] :: ByteString -> f -> PgSyntaxF f
+ Database.Beam.Postgres.Syntax: [EmitByteString] :: forall f. ByteString -> f -> PgSyntaxF f
- Database.Beam.Postgres.Syntax: [EscapeBytea] :: ByteString -> f -> PgSyntaxF f
+ Database.Beam.Postgres.Syntax: [EscapeBytea] :: forall f. ByteString -> f -> PgSyntaxF f
- Database.Beam.Postgres.Syntax: [EscapeIdentifier] :: ByteString -> f -> PgSyntaxF f
+ Database.Beam.Postgres.Syntax: [EscapeIdentifier] :: forall f. ByteString -> f -> PgSyntaxF f
- Database.Beam.Postgres.Syntax: [EscapeString] :: ByteString -> f -> PgSyntaxF f
+ Database.Beam.Postgres.Syntax: [EscapeString] :: forall f. ByteString -> f -> PgSyntaxF f
Files
- ChangeLog.md +14/−3
- Database/Beam/Postgres.hs +3/−2
- Database/Beam/Postgres/Connection.hs +8/−4
- Database/Beam/Postgres/Full.hs +4/−2
- Database/Beam/Postgres/Migrate.hs +38/−18
- Database/Beam/Postgres/PgSpecific.hs +6/−5
- Database/Beam/Postgres/Syntax.hs +27/−4
- beam-postgres.cabal +8/−8
- test/Database/Beam/Postgres/Test/Migrate.hs +41/−0
- test/Main.hs +40/−13
ChangeLog.md view
@@ -1,17 +1,28 @@+# 0.5.4.0++## Added features++ * Better error messages on column type mismatches (#696).+ * Added support for creating and dropping database schemas and associated tables with `createDatabaseSchema`, `dropDatabaseSchema`, `` and `createTableWithSchema` (#716).++## Documentation+ + * Make `runBeamPostgres` and `runBeamPostgresDebug` easier to find (#663).+ # 0.5.3.1 -# Added features+## Added features * Loosen some version bounds # 0.5.3.0 -# Bug fixes+## Bug fixes * Make sure lateral join names do not overlap * Fix `bool_or` -# Addded features+## Addded features * Add `runSelectReturningFirst` * `IN (SELECT ...)` syntax via `inQuery_`
Database/Beam/Postgres.hs view
@@ -21,6 +21,9 @@ ( -- * Beam Postgres backend Postgres(..), Pg, liftIOWithHandle + -- ** Executing actions against the backend+ , runBeamPostgres, runBeamPostgresDebug+ -- ** Postgres syntax , PgCommandSyntax, PgSyntax , PgSelectSyntax, PgInsertSyntax@@ -40,8 +43,6 @@ , smallserial, serial, bigserial , module Database.Beam.Postgres.PgSpecific-- , runBeamPostgres, runBeamPostgresDebug -- ** Postgres extension support , PgExtensionEntity, IsPgExtension(..)
Database/Beam/Postgres/Connection.hs view
@@ -154,12 +154,14 @@ case pgErr of Pg.ConversionFailed { Pg.errSQLType = sql , Pg.errHaskellType = hs- , Pg.errMessage = msg } ->- pure (ColumnTypeMismatch hs sql msg)+ , Pg.errMessage = msg+ , Pg.errSQLField = field } ->+ pure (ColumnTypeMismatch hs sql ("Conversion failed for field'" <> field <> "': " <> msg)) Pg.Incompatible { Pg.errSQLType = sql , Pg.errHaskellType = hs- , Pg.errMessage = msg } ->- pure (ColumnTypeMismatch hs sql msg)+ , Pg.errMessage = msg+ , Pg.errSQLField = field } ->+ pure (ColumnTypeMismatch hs sql ("Incompatible field: '" <> field <> "': " <> msg)) Pg.UnexpectedNull {} -> pure ColumnUnexpectedNull in pure (Left (BeamRowReadError (Just (fromIntegral curCol)) err))@@ -307,6 +309,8 @@ -- @beam-postgres@ also provides functions that let you run queries without -- 'MonadBeam'. These functions may be more efficient and offer a conduit -- API. See "Database.Beam.Postgres.Conduit" for more information.+--+-- You can execute 'Pg' actions using 'runBeamPostgres' or 'runBeamPostgresDebug'. newtype Pg a = Pg { runPg :: F PgF a } deriving (Monad, Applicative, Functor, MonadFree PgF)
Database/Beam/Postgres/Full.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE TupleSections #-} {-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE TypeOperators #-} -- | Module providing (almost) full support for Postgres query and data -- manipulation statements. These functions shadow the functions in@@ -64,6 +65,7 @@ import Control.Monad.Free.Church +import Data.Kind (Type) import Data.Proxy (Proxy(..)) import qualified Data.Text as T #if !MIN_VERSION_base(4, 11, 0)@@ -229,7 +231,7 @@ -- | What to do when an @INSERT@ statement inserts a row into the table @tbl@ -- that violates a constraint.-newtype PgInsertOnConflict (tbl :: (* -> *) -> *) =+newtype PgInsertOnConflict (tbl :: (Type -> Type) -> Type) = PgInsertOnConflict (tbl (QField QInternal) -> PgInsertOnConflictSyntax) -- | Postgres @LATERAL JOIN@ support@@ -397,7 +399,7 @@ -- * General @RETURNING@ support class PgReturning cmd where- type PgReturningType cmd :: * -> *+ type PgReturningType cmd :: Type -> Type returning :: (Beamable tbl, Projectible Postgres a) => cmd Postgres tbl -> (tbl (QExpr Postgres PostgresInaccessible) -> a)
Database/Beam/Postgres/Migrate.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE DeriveAnyClass #-}+{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-}@@ -29,7 +31,7 @@ ) where import Database.Beam.Backend.SQL-import Database.Beam.Migrate.Actions (defaultActionProvider)+import Database.Beam.Migrate.Actions (defaultActionProvider, defaultSchemaActionProvider) import qualified Database.Beam.Migrate.Backend as Tool import qualified Database.Beam.Migrate.Checks as Db import qualified Database.Beam.Migrate.SQL as Db@@ -77,6 +79,8 @@ #endif import Data.Word (Word64) +import GHC.Generics ( Generic )+ -- | Top-level migration backend for use by @beam-migrate@ tools migrationBackend :: Tool.BeamMigrationBackend Postgres Pg migrationBackend = Tool.BeamMigrationBackend@@ -95,8 +99,12 @@ postgresDataTypeDeserializers <> Db.beamCheckDeserializers) (BCL.unpack . (<> ";") . pgRenderSyntaxScript . fromPgCommand) "postgres.sql"- pgPredConverter (defaultActionProvider <> pgExtensionActionProvider <>- pgCustomEnumActionProvider)+ pgPredConverter (mconcat [ defaultActionProvider+ , defaultSchemaActionProvider+ , pgExtensionActionProvider+ , pgCustomEnumActionProvider+ ]+ ) (\options action -> bracket (Pg.connectPostgreSQL (fromString options)) Pg.close $ \conn -> left show <$> withPgDebug (\_ -> pure ()) conn action)@@ -321,27 +329,37 @@ PgDataTypeSyntax (PgDataTypeDescrOid oid pgMod) (emit "{- UNKNOWN -}") (pgDataTypeJSON (object [ "oid" .= (fromIntegral oid' :: Word), "mod" .= pgMod ])) --- * Create constraints from a connection +newtype SchemaName = MkSchemaName T.Text+ deriving (Generic, Pg.FromRow)++-- * Create constraints from a connection getDbConstraints :: Pg.Connection -> IO [ Db.SomeDatabasePredicate ]-getDbConstraints = getDbConstraintsForSchemas Nothing+getDbConstraints conn = do + schemata <- Pg.query_ conn "SELECT schema_name FROM information_schema.schemata WHERE schema_name NOT LIKE '%pg_%' AND schema_name <> 'information_schema' AND schema_name <> 'public';"+ case schemata of+ [] -> getDbConstraintsForSchemas Nothing conn+ schemata' -> + (++) <$> getDbConstraintsForSchemas (Just ((\(MkSchemaName nm) -> T.unpack nm) <$> schemata')) conn+ <*> getDbConstraintsForSchemas Nothing conn getDbConstraintsForSchemas :: Maybe [String] -> Pg.Connection -> IO [ Db.SomeDatabasePredicate ] getDbConstraintsForSchemas subschemas conn =- do tbls <- case subschemas of- Nothing -> Pg.query_ conn "SELECT cl.oid, relname FROM pg_catalog.pg_class \"cl\" join pg_catalog.pg_namespace \"ns\" on (ns.oid = relnamespace) where nspname = any (current_schemas(false)) and relkind='r'"- Just ss -> Pg.query conn "SELECT cl.oid, relname FROM pg_catalog.pg_class \"cl\" join pg_catalog.pg_namespace \"ns\" on (ns.oid = relnamespace) where nspname IN ? and relkind='r'" (Pg.Only (Pg.In ss))- let tblsExist = map (\(_, tbl) -> Db.SomeDatabasePredicate (Db.TableExistsPredicate (Db.QualifiedName Nothing tbl))) tbls-+ do (tbls :: [(Pg.Oid, Maybe T.Text, T.Text)]) <- case subschemas of+ Nothing -> Pg.query_ conn "SELECT cl.oid, NULL, relname FROM pg_catalog.pg_class \"cl\" join pg_catalog.pg_namespace \"ns\" on (ns.oid = relnamespace) where nspname = any (current_schemas(false)) and relkind='r'"+ Just ss -> Pg.query conn "SELECT cl.oid, nspname, relname FROM pg_catalog.pg_class \"cl\" join pg_catalog.pg_namespace \"ns\" on (ns.oid = relnamespace) where nspname IN ? and relkind='r'" (Pg.Only (Pg.In ss))+ let tblsExist = map (\(_, mschema, tbl) -> Db.SomeDatabasePredicate (Db.TableExistsPredicate (Db.QualifiedName mschema tbl))) tbls+ schemaChecks = fromMaybe [] $ (fmap (Db.SomeDatabasePredicate . Db.SchemaExistsPredicate . T.pack)) <$> subschemas enumerationData <- Pg.query_ conn (fromString (unlines [ "SELECT t.typname, t.oid, array_agg(e.enumlabel ORDER BY e.enumsortorder)" , "FROM pg_enum e JOIN pg_type t ON t.oid = e.enumtypid"- , "GROUP BY t.typname, t.oid" ]))+ , "GROUP BY t.typname, t.oid" + ])) columnChecks <-- fmap mconcat . forM tbls $ \(oid, tbl) ->+ fmap mconcat . forM tbls $ \(oid, mschema, tbl) -> do columns <- Pg.query conn "SELECT attname, atttypid, atttypmod, attnotnull, pg_catalog.format_type(atttypid, atttypmod) FROM pg_catalog.pg_attribute att WHERE att.attrelid=? AND att.attnum>0 AND att.attisdropped='f'" (Pg.Only (oid :: Pg.Oid)) let columnChecks = map (\(nm, typId :: Pg.Oid, typmod, _, typ :: ByteString) ->@@ -351,24 +369,26 @@ pgDataTypeFromAtt typ typId typmod' <|> pgEnumerationTypeFromAtt enumerationData typ typId typmod' - in Db.SomeDatabasePredicate (Db.TableHasColumn (Db.QualifiedName Nothing tbl) nm pgDataType :: Db.TableHasColumn Postgres)) columns+ in Db.SomeDatabasePredicate (Db.TableHasColumn (Db.QualifiedName mschema tbl) nm pgDataType :: Db.TableHasColumn Postgres)) columns notNullChecks = concatMap (\(nm, _, _, isNotNull, _) -> if isNotNull then- [Db.SomeDatabasePredicate (Db.TableColumnHasConstraint (Db.QualifiedName Nothing tbl) nm (Db.constraintDefinitionSyntax Nothing Db.notNullConstraintSyntax Nothing)+ [Db.SomeDatabasePredicate (Db.TableColumnHasConstraint (Db.QualifiedName mschema tbl) nm (Db.constraintDefinitionSyntax Nothing Db.notNullConstraintSyntax Nothing) :: Db.TableColumnHasConstraint Postgres)] else [] ) columns - pure (columnChecks ++ notNullChecks)+ pure (columnChecks ++ notNullChecks ++ schemaChecks) primaryKeys <-- map (\(relnm, cols) -> Db.SomeDatabasePredicate (Db.TableHasPrimaryKey (Db.QualifiedName Nothing relnm) (V.toList cols))) <$>- Pg.query_ conn (fromString (unlines [ "SELECT c.relname, array_agg(a.attname ORDER BY k.n ASC)"+ map (\(schema, relnm, cols) -> Db.SomeDatabasePredicate (Db.TableHasPrimaryKey (Db.QualifiedName schema relnm) (V.toList cols))) <$>+ -- We nullify the 'public' schema, which is the implicit default in Postgres+ Pg.query_ conn (fromString (unlines [ "SELECT NULLIF(ns.nspname, 'public'), c.relname, array_agg(a.attname ORDER BY k.n ASC)" , "FROM pg_index i" , "CROSS JOIN unnest(i.indkey) WITH ORDINALITY k(attid, n)" , "JOIN pg_attribute a ON a.attnum=k.attid AND a.attrelid=i.indrelid" , "JOIN pg_class c ON c.oid=i.indrelid" , "JOIN pg_namespace ns ON ns.oid=c.relnamespace"- , "WHERE ns.nspname = any (current_schemas(false)) AND c.relkind='r' AND i.indisprimary GROUP BY relname, i.indrelid" ]))+ -- Recall that schema of the form 'pg_' are Postgres internal tables that should not be taken into account+ , "WHERE nspname NOT LIKE '%pg_%' AND c.relkind='r' AND i.indisprimary GROUP BY nspname, relname, i.indrelid" ])) let enumerations = map (\(enumNm, _, options) -> Db.SomeDatabasePredicate (PgHasEnum enumNm (V.toList options))) enumerationData
Database/Beam/Postgres/PgSpecific.hs view
@@ -141,6 +141,7 @@ import Data.Functor import Data.Hashable import Data.Int+import Data.Kind (Type) import qualified Data.List.NonEmpty as NE import Data.Proxy import Data.Scientific (Scientific, formatScientific, FPFormat(Fixed))@@ -308,10 +309,10 @@ -> QGenExpr context Postgres s text arrayDims_ (QExpr v) = QExpr (fmap (\(PgExpressionSyntax v') -> PgExpressionSyntax (emit "array_dims(" <> v' <> emit ")")) v) -type family CountDims (v :: *) :: Nat where+type family CountDims (v :: Type) :: Nat where CountDims (V.Vector a) = 1 + CountDims a CountDims a = 0-type family WithinBounds (dim :: Nat) (v :: *) :: Constraint where+type family WithinBounds (dim :: Nat) (v :: Type) :: Constraint where WithinBounds dim v = If ((dim <=? CountDims v) && (1 <=? dim)) (() :: Constraint)@@ -486,7 +487,7 @@ -- -- A reasonable example might be @Range PgInt8Range Int64@. -- This represents a range of Haskell @Int64@ values stored as a range of 'bigint' in Postgres.-data PgRange (n :: *) a+data PgRange (n :: Type) a = PgEmptyRange | PgRange (PgRangeBound a) (PgRangeBound a) deriving (Eq, Show, Generic)@@ -789,7 +790,7 @@ -- section on -- <https://www.postgresql.org/docs/current/static/functions-json.html JSON>. ---class IsPgJSON (json :: * -> *) where+class IsPgJSON (json :: Type -> Type) where -- | The @json_each@ or @jsonb_each@ function. Values returned as @json@ or -- @jsonb@ respectively. Use 'pgUnnest' to join against the result pgJsonEach :: QGenExpr ctxt Postgres s (json a)@@ -1392,7 +1393,7 @@ -- ** Set-valued functions -data PgSetOf (tbl :: (* -> *) -> *)+data PgSetOf (tbl :: (Type -> Type) -> Type) pgUnnest' :: forall tbl db s . Beamable tbl
Database/Beam/Postgres/Syntax.hs view
@@ -251,6 +251,7 @@ newtype PgAggregationSetQuantifierSyntax = PgAggregationSetQuantifierSyntax { fromPgAggregationSetQuantifier :: PgSyntax } newtype PgSelectSetQuantifierSyntax = PgSelectSetQuantifierSyntax { fromPgSelectSetQuantifier :: PgSyntax } newtype PgFromSyntax = PgFromSyntax { fromPgFrom :: PgSyntax }+newtype PgSchemaNameSyntax = PgSchemaNameSyntax { fromPgSchemaName :: PgSyntax } newtype PgTableNameSyntax = PgTableNameSyntax { fromPgTableName :: PgSyntax } newtype PgComparisonQuantifierSyntax = PgComparisonQuantifierSyntax { fromPgComparisonQuantifier :: PgSyntax } newtype PgExtractFieldSyntax = PgExtractFieldSyntax { fromPgExtractField :: PgSyntax }@@ -335,6 +336,9 @@ hashWithSalt salt (PgDataTypeDescrDomain t) = hashWithSalt salt (1 :: Int, t) +newtype PgCreateSchemaSyntax = PgCreateSchemaSyntax { fromPgCreateSchema :: PgSyntax }+newtype PgDropSchemaSyntax = PgDropSchemaSyntax { fromPgDropSchema :: PgSyntax }+ newtype PgCreateTableSyntax = PgCreateTableSyntax { fromPgCreateTable :: PgSyntax } data PgTableOptionsSyntax = PgTableOptionsSyntax PgSyntax PgSyntax newtype PgColumnSchemaSyntax = PgColumnSchemaSyntax { fromPgColumnSchema :: PgSyntax } deriving (Show, Eq)@@ -410,6 +414,13 @@ deleteCmd = PgCommandSyntax PgCommandTypeDataUpdate . coerce updateCmd = PgCommandSyntax PgCommandTypeDataUpdate . coerce +instance IsSql92DdlSchemaCommandSyntax PgCommandSyntax where+ type Sql92DdlCommandCreateSchemaSyntax PgCommandSyntax = PgCreateSchemaSyntax+ type Sql92DdlCommandDropSchemaSyntax PgCommandSyntax = PgDropSchemaSyntax++ createSchemaCmd = PgCommandSyntax PgCommandTypeDdl . coerce+ dropSchemaCmd = PgCommandSyntax PgCommandTypeDdl . coerce+ instance IsSql92DdlCommandSyntax PgCommandSyntax where type Sql92DdlCommandCreateTableSyntax PgCommandSyntax = PgCreateTableSyntax type Sql92DdlCommandDropTableSyntax PgCommandSyntax = PgDropTableSyntax@@ -419,6 +430,9 @@ dropTableCmd = PgCommandSyntax PgCommandTypeDdl . coerce alterTableCmd = PgCommandSyntax PgCommandTypeDdl . coerce +instance IsSql92SchemaNameSyntax PgSchemaNameSyntax where+ schemaName s = PgSchemaNameSyntax (pgQuotedIdentifier s)+ instance IsSql92TableNameSyntax PgTableNameSyntax where tableName Nothing t = PgTableNameSyntax (pgQuotedIdentifier t) tableName (Just s) t = PgTableNameSyntax (pgQuotedIdentifier s <> emit "." <> pgQuotedIdentifier t)@@ -677,13 +691,10 @@ instance IsCustomSqlSyntax PgExpressionSyntax where newtype CustomSqlSyntax PgExpressionSyntax = PgCustomExpressionSyntax { fromPgCustomExpression :: PgSyntax }- deriving Monoid+ deriving (Semigroup, Monoid) customExprSyntax = PgExpressionSyntax . fromPgCustomExpression renderSyntax = PgCustomExpressionSyntax . pgParens . fromPgExpression -instance Semigroup (CustomSqlSyntax PgExpressionSyntax) where- (<>) = mappend- instance IsString (CustomSqlSyntax PgExpressionSyntax) where fromString = PgCustomExpressionSyntax . emit . fromString @@ -1043,6 +1054,18 @@ instance IsSql92AlterColumnActionSyntax PgAlterColumnActionSyntax where setNullSyntax = PgAlterColumnActionSyntax (emit "DROP NOT NULL") setNotNullSyntax = PgAlterColumnActionSyntax (emit "SET NOT NULL")++instance IsSql92SchemaNameSyntax PgSchemaNameSyntax => IsSql92CreateSchemaSyntax PgCreateSchemaSyntax where+ type Sql92CreateSchemaSchemaNameSyntax PgCreateSchemaSyntax = PgSchemaNameSyntax++ createSchemaSyntax schemaName = PgCreateSchemaSyntax $+ emit "CREATE SCHEMA " <> fromPgSchemaName schemaName++instance IsSql92SchemaNameSyntax PgSchemaNameSyntax => IsSql92DropSchemaSyntax PgDropSchemaSyntax where+ type Sql92DropSchemaSchemaNameSyntax PgDropSchemaSyntax = PgSchemaNameSyntax++ dropSchemaSyntax schemaName = PgDropSchemaSyntax $+ emit "DROP SCHEMA " <> fromPgSchemaName schemaName instance IsSql92CreateTableSyntax PgCreateTableSyntax where type Sql92CreateTableTableNameSyntax PgCreateTableSyntax = PgTableNameSyntax
beam-postgres.cabal view
@@ -1,5 +1,5 @@ name: beam-postgres-version: 0.5.3.1+version: 0.5.4.0 synopsis: Connection layer between beam and postgres description: Beam driver for <https://www.postgresql.org/ PostgreSQL>, an advanced open-source RDBMS homepage: https://haskell-beam.github.io/beam/user-guide/backends/beam-postgres@@ -36,11 +36,11 @@ beam-core >=0.10 && <0.11, beam-migrate >=0.5 && <0.6, - postgresql-libpq >=0.8 && <0.10,- postgresql-simple >=0.5 && <0.7,+ postgresql-libpq >=0.8 && <0.12,+ postgresql-simple >=0.5 && <0.8, - text >=1.0 && <2.1,- bytestring >=0.10 && <0.12,+ text >=1.0 && <2.2,+ bytestring >=0.10 && <0.13, attoparsec >=0.13 && <0.15, hashable >=1.1 && <1.5,@@ -48,9 +48,9 @@ free >=4.12 && <5.3, time >=1.6 && <1.13, monad-control >=1.0 && <1.1,- mtl >=2.1 && <2.3,+ mtl >=2.1 && <2.4, conduit >=1.2 && <1.4,- aeson >=0.11 && <2.2,+ aeson >=0.11 && <2.3, uuid-types >=1.0 && <1.1, case-insensitive >=1.2 && <1.3, scientific >=0.3 && <0.4,@@ -90,7 +90,7 @@ tasty-hunit, tasty, text,- tmp-postgres,+ testcontainers, uuid, vector default-language: Haskell2010
test/Database/Beam/Postgres/Test/Migrate.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE LambdaCase #-} module Database.Beam.Postgres.Test.Migrate where import Database.Beam@@ -22,6 +23,8 @@ , charWidthVerification postgresConn "CHAR" char , charNoWidthVerification postgresConn "CHAR" char , extensionVerification postgresConn+ , createTableWithSchemaWorks postgresConn+ , dropSchemaWorks postgresConn ] data CharT f@@ -96,3 +99,41 @@ case resAfter of VerificationSucceeded -> return () VerificationFailed failures -> fail ("Verification failed: " ++ show failures)+++-- | Verifies that 'createTableWithSchema' correctly creates a table+-- with a schema.+createTableWithSchemaWorks :: IO ByteString -> TestTree+createTableWithSchemaWorks pgConn =+ testCase ("createTableWithSchema works correctly") $ do+ withTestPostgres "create_table_with_schema" pgConn $ \conn -> do+ res <- runBeamPostgres conn $ do+ db <- executeMigration runNoReturn $ do+ internalSchema <- createDatabaseSchema "internal_schema"+ (CharDb <$> createTableWithSchema (Just internalSchema) "char_test"+ (CharT (field "key" (varchar Nothing) notNull)))++ verifySchema migrationBackend db++ case res of+ VerificationSucceeded -> return ()+ VerificationFailed failures -> fail ("Verification failed: " ++ show failures)+++-- | Verifies that creating a schema and dropping it works+dropSchemaWorks :: IO ByteString -> TestTree+dropSchemaWorks pgConn =+ testCase ("dropDatabaseSchema works correctly") $ do+ withTestPostgres "drop_schema" pgConn $ \conn -> do+ runBeamPostgres conn $ do+ db <- executeMigration runNoReturn $ do+ internalSchema <- createDatabaseSchema "internal_schema"+ willBeDroppedSchema <- createDatabaseSchema "will_be_dropped"+ db <- (CharDb <$> createTableWithSchema (Just internalSchema) "char_test"+ (CharT (field "key" (varchar Nothing) notNull)))+ dropDatabaseSchema willBeDroppedSchema+ pure db++ verifySchema migrationBackend db >>= \case+ VerificationFailed failures -> fail ("Verification failed: " ++ show failures)+ VerificationSucceeded -> pure ()
test/Main.hs view
@@ -1,23 +1,50 @@ module Main where -import qualified Database.Postgres.Temp as TempDb+import Data.ByteString ( ByteString )+import Data.Text ( unpack )+import qualified Data.Text.Lazy as TL+ import Test.Tasty+import qualified TestContainers.Tasty as TC import qualified Database.Beam.Postgres.Test.Select as Select import qualified Database.Beam.Postgres.Test.Marshal as Marshal import qualified Database.Beam.Postgres.Test.DataTypes as DataType import qualified Database.Beam.Postgres.Test.Migrate as Migrate+import Database.PostgreSQL.Simple ( ConnectInfo(..), defaultConnectInfo )+import qualified Database.PostgreSQL.Simple as Postgres main :: IO ()-main = defaultMain $ withDb $ \getDb ->- let getConnStr = TempDb.toConnectionString <$> getDb- in testGroup "beam-postgres tests"- [ Marshal.tests getConnStr- , Select.tests getConnStr- , DataType.tests getConnStr- , Migrate.tests getConnStr- ]- where- withDb = withResource- (either (\e -> error $ "Failed to start DB: " <> show e) pure =<< TempDb.startConfig mempty)- TempDb.stop+main = defaultMain + $ TC.withContainers setupTempPostgresDB + $ \getConnStr -> + testGroup "beam-postgres tests"+ [ Marshal.tests getConnStr+ , Select.tests getConnStr+ , DataType.tests getConnStr+ , Migrate.tests getConnStr+ ]+++setupTempPostgresDB :: TC.MonadDocker m => m ByteString+setupTempPostgresDB = do+ let user = "postgres"+ password = "root"+ db = "testdb"++ timescaleContainer <- TC.run $ TC.containerRequest (TC.fromTag "postgres:16.4")+ TC.& TC.setExpose [ 5432 ]+ TC.& TC.setEnv [ ("POSTGRES_USER", user)+ , ("POSTGRES_PASSWORD", password)+ , ("POSTGRES_DB", db)+ ]+ TC.& TC.setWaitingFor (TC.waitForLogLine TC.Stderr ("database system is ready to accept connections" `TL.isInfixOf`))+ + pure $ Postgres.postgreSQLConnectionString + ( defaultConnectInfo { connectHost = "localhost"+ , connectUser = unpack user + , connectPassword = unpack password+ , connectDatabase = unpack db+ , connectPort = fromIntegral $ TC.containerPort timescaleContainer 5432+ }+ )