Safe Haskell | None |
---|---|
Language | Haskell2010 |
Functions for creating a table from a model. These are mostly useful in development, for very rigid applications, or to compare what would be created against what is actually in the database. In practice, production settings should create and update tables using migrations.
Note that often it is more interesting to see what would be created than to create an actual table. For that reason, functions creating the statements are exposed.
- modelCreateStatement :: forall a. (Model a, Generic a, GDefTypes (Rep a)) => a -> Query
- modelCreate :: (Model a, Generic a, GDefTypes (Rep a)) => Connection -> a -> IO Int64
- class GDefTypes f where
- gDefTypes :: f p -> [ByteString]
- jtCreateStatement :: (Model a, Model b) => JoinTable a b -> Query
- jtCreate :: (Model a, Model b) => Connection -> JoinTable a b -> IO Int64
Documentation
modelCreateStatement :: forall a. (Model a, Generic a, GDefTypes (Rep a)) => a -> Query Source
Statement for creating the table corresponding to a model. Not strict in its argument.
modelCreate :: (Model a, Generic a, GDefTypes (Rep a)) => Connection -> a -> IO Int64 Source
Create a the database table for a model.
class GDefTypes f where Source
This is a helper class used to extract the row types. You don't
need to use this class. If you are creating custom types, just
declare an instance of SqlType
.
gDefTypes :: f p -> [ByteString] Source