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

Safe HaskellNone

Database.PostgreSQL.ORM.CreateTable

Description

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.

Synopsis

Documentation

modelCreateStatement :: forall a. (Model a, Generic a, GDefTypes (Rep a)) => a -> QuerySource

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 Int64Source

Create a the database table for a model.

class GDefTypes f whereSource

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.

Methods

gDefTypes :: f p -> [ByteString]Source

Instances

SqlType c => GDefTypes (K1 i c) 
(GDefTypes a, GDefTypes b) => GDefTypes (:*: a b) 
GDefTypes f => GDefTypes (M1 i c f) 

jtCreateStatement :: (Model a, Model b) => JoinTable a b -> QuerySource

Create the database table corresponding to a JoinTable.

jtCreate :: (Model a, Model b) => Connection -> JoinTable a b -> IO Int64Source

Create a join table in the database.