postgresql-orm-0.5.0: An ORM (Object Relational Mapping) and migrations DSL for PostgreSQL.

Safe HaskellNone



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 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.

Minimal complete definition



gDefTypes :: f p -> [ByteString] Source #


SqlType c => GDefTypes (K1 * i c) Source # 


gDefTypes :: K1 * i c p -> [ByteString] Source #

(GDefTypes a, GDefTypes b) => GDefTypes ((:*:) * a b) Source # 


gDefTypes :: (* :*: a) b p -> [ByteString] Source #

GDefTypes f => GDefTypes (M1 * i c f) Source # 


gDefTypes :: M1 * i c f p -> [ByteString] Source #

jtCreateStatement :: (Model a, Model b) => JoinTable a b -> Query Source #

Create the database table corresponding to a JoinTable.

jtCreate :: (Model a, Model b) => Connection -> JoinTable a b -> IO Int64 Source #

Create a join table in the database.