Safe Haskell | None |
---|---|
Language | Haskell2010 |
Support for creating checked databases from Haskell ADTs, using Generic
s.
For more information, see the manual
Synopsis
- defaultMigratableDbSettings :: forall syntax be db. (Generic (CheckedDatabaseSettings be db), GAutoMigratableDb syntax (Rep (CheckedDatabaseSettings be db))) => CheckedDatabaseSettings be db
- class IsSql92DataTypeSyntax dataTypeSyntax => HasDefaultSqlDataType dataTypeSyntax ty where
- class IsSql92ColumnSchemaSyntax columnSchemaSyntax => HasDefaultSqlDataTypeConstraints columnSchemaSyntax ty where
- type Sql92HasDefaultDataType syntax ty = (HasDefaultSqlDataType (Sql92DdlCommandDataTypeSyntax syntax) ty, HasDefaultSqlDataTypeConstraints (Sql92DdlCommandColumnSchemaSyntax syntax) ty)
Default checked database settings
defaultMigratableDbSettings :: forall syntax be db. (Generic (CheckedDatabaseSettings be db), GAutoMigratableDb syntax (Rep (CheckedDatabaseSettings be db))) => CheckedDatabaseSettings be db Source #
Produce a checked database for the given Haskell database type
See the manual for more information on the defaults.
Extending the defaulting sytem
class IsSql92DataTypeSyntax dataTypeSyntax => HasDefaultSqlDataType dataTypeSyntax ty where Source #
Used to define a default SQL data type for a haskell type in a particular data type syntax.
Beam defines instances for several standard SQL types, which are polymorphic
over any standard data type syntax. Backends or extensions which provide
custom types should instantiate instances of this class and
HasDefaultSqlDataTypeConstraints
for any types they provide for which they
would like checked schema migrations
:: Proxy ty | Concrete representation of the type |
-> Bool |
|
-> dataTypeSyntax |
Provide a data type for the given type
Instances
class IsSql92ColumnSchemaSyntax columnSchemaSyntax => HasDefaultSqlDataTypeConstraints columnSchemaSyntax ty where Source #
Certain data types also come along with constraints. For example, SERIAL
types in Postgres generate an automatic DEFAULT
constraint.
You need an instance of this class for any type for which you want beam to be able to infer the SQL data type. If your data type does not have any constraint requirements, you can just declare an empty instance
defaultSqlDataTypeConstraints Source #
:: Proxy ty | Concrete representation of the type |
-> Proxy columnSchemaSyntax | Concrete representation of the syntax |
-> Bool |
|
-> [FieldCheck] |
Provide arbitrary constraints on a field of the requested type. See
FieldCheck
for more information on the formatting of constraints.
Instances
type Sql92HasDefaultDataType syntax ty = (HasDefaultSqlDataType (Sql92DdlCommandDataTypeSyntax syntax) ty, HasDefaultSqlDataTypeConstraints (Sql92DdlCommandColumnSchemaSyntax syntax) ty) Source #
Constraint synonym to use if you want to assert that a particular
IsSql92Syntax
syntax supports defaulting for a particular data type