|      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                 Safe-Inferred  Column name Error description      Trustworthy ?An identifier is a table or column name. When rendered into a  SQL query by (, it will be double-quoted, rather than  single-quoted. For example: @fmtSql "select * from ? where name = ?" (Id "MyTable", "A Name")3"select * from \"MyTable\" where name = E'A Name'";Quote an identifier using unicode quoting syntax. This is D necessary for identifiers containing a question mark, as otherwise  PostgreSQL.Simple'.s naive formatting code will attempt to match # the question mark to a paremeter. ;Build a quoted identifier. Generally you will want to use   0, and for repeated use it will be faster to use   .   , but this internal function is  exposed in case it is useful. 9Quote an identifier such as a table or column name using D double-quote characters. Note this has nothing to do with quoting  values:, which must be quoted using single quotes. (Anyway, all  values should be quoted by  or .) This function * uses a unicode escape sequence to escape '?' characters, which  would otherwise be expanded by , , or . +S8.putStrLn $ quoteIdent "hello \"world\"!""hello ""world""!"+S8.putStrLn $ quoteIdent "hello \"world\"?" U&"hello ""world""\003f"3Note that this quoting function is correct only if  client_encoding is  SQL_ASCII,  client_coding is UTF8 , or the A identifier contains no multi-byte characters. For other coding B schemes, this function may erroneously duplicate bytes that look = like quote characters but are actually part of a multi-byte A character code. In such cases, maliciously crafted identifiers E will, even after quoting, allow injection of arbitrary SQL commands  to the server. DThe upshot is that it is unwise to use this function on identifiers ? provided by untrustworthy sources. Note this is true anyway,  regardless of client_encoding setting, because certain "system  column" names (e.g., oid, tableoid, xmin, cmin, xmax,  cmax, ctid5) are likely to produce unexpected results even when  properly quoted. See  7 for a convenient way to include quoted identifiers in  parameter lists. =Bad things will happen if the argument is greater than 0xff. A lower-level function used by  and . You  probably don't need to call it directly. A builder version of #, possibly useful if you are about C to concatenate various individually formatted query fragments and ; want to save the work of concatenating each individually. Take a SQL template containing '?' characters and a list of 2 paremeters whose length must match the number of '?' characters, % and format the result as an escaped  that can be used  as a query. Like 0, this function is naive about the placement of  '?': characters and will expand all of them, even ones within & quotes. To avoid this, you must use   on identifiers  containing question marks.  Also like , '?' characters touching other '?' A characters or quoted strings may do the wrong thing, and end up / doubling a quote, so avoid substrings such as "??" or  "?string"(, as these could get expanded to, e.g.,  "'param ''string'"), which is a single string containing an 3 apostrophe, when you probably wanted two strings.          NoneCreates a PostgreSQL   using the  DATABASE_URL environment A variable, if it exists. If it does, it should match the format:    postgresql:// [[USERNAME@PASSWORD]HOSTNAME[:PORT]]/[DBNAME] 0If it is not present, the environment variables  PG_DBNAME PG_HOST etc,  are used. ERuns the SQL file at the given path, relative to the current working  directory. 4Returns a column defition by quoting the given name Creates a table. See # for constructing the column list.  Returns a !$ that creates a table, for example:   create_table "posts"  [ column "title" "VARCHAR(255) NOT NULL"  , column "body" "text"] Drops a table  Returns a ! that drops a table /Adds a column to the given table. For example,    add_column "posts" "title" " VARCHAR(255)" adds a varchar column called "title" to the table "posts".  Returns a !5 that adds a column to the given table. For example,    add_column "posts" "title" " VARCHAR(255)" Returns the query   ALTER TABLE "posts" add "title" VARCHAR(255); 2Drops a column from the given table. For example,    drop_column "posts" "title" drops the column "title" from the "posts" table.  Returns a !8 that drops a column from the given table. For example,    drop_column "posts" "title" Returns the query   ALTER TABLE "posts" add "title"; !2Renames a column in the given table. For example,    rename_column "posts" "title" "name" renames the column "title" in the "posts" table to "name". " Returns a !8 that renames a column in the given table. For example,    rename_column "posts" "title" "name" Returns the query   ALTER TABLE "posts" RENAME "title" TO "name"; #1Alters a column in the given table. For example,    change_column "posts" "title" " DROP DEFAULT" %drops the default constraint for the "title" column in the "posts"  table. $ Returns a !7 that alters a column in the given table. For example,    change_column "posts" "title" " DROP DEFAULT" Returns the query   ALTER TABLE "posts" ALTER "title" DROP DEFAULT; %'Creates an index for efficient lookup. &-Creates a unique index for efficient lookup. ' Returns a !: that creates an index for the given columns on the given  table. For example,    create_index_stmt "post_owner_index" "posts" "owner" Returns the query   CREATE INDEX "post_owner_index" ON "posts" ("owner") (Drops an index. ) Returns a ! that drops an index.    drop_index_stmt "post_owner_index" Returns the query   DROP INDEX "post_owner_index" "#$%&'name type, definition, constraints  Table name Column definitions  Table name Column definitions  Table name  Column name Column definition  Table name  Column name Column definition  Table name  Column name  Table name  Column name ! Table name Old column name New column name " Table name Old column name New column name # Table name  Column name Action $ Table name  Column name Action % Index name  Table name  Column names & Index name  Table name  Column names 'Unique index?  Index name  Table name  Column names ( Index name ) Index name (*Migration function Rollback function  !"#$%&'()**%&(!#' )"$"#$%&' !"#$%&'()(*None01The default relative path containing migrations: "./dir/ migrations" 14Dumps the database schema to the given file handle. %This is a wrapper around the utility pg_dump that comes with postgresql.  Therefore, pg_dump" must be installed on the system. 2'Initializes the database by creating a "schema-migrations" table. 6 This table must exist before running any migrations. 3;Runs all new migrations in a given directory and dumps the  resulting schema to a file " schema.sql" in the migrations  directory. MDetermining which migrations to run is done by querying the database for the  largest version in the schema_migrations table, and choosing all 9 migrations in the given directory with higher versions. )JRun a migration. The returned exit code denotes the success or failure of  the migration. *JRun a migration. The returned exit code denotes the success or failure of  the migration. +,-./0123Log output (probably stdout) (Path to directory containing migrations )4*+,- +,-./01234 23410+,-./ +,-./0123)4*+,-None7<Internal column number used by PostgreSQL. Generally these > will be consecutive starting from 1, but this may not be the 5 case if you have altered a table to delete columns. 8Name of the column 9Type of the column :If .+, the database cannot contain null. (This ( constraint should always be accurate.) ;.7 if this column (and only this column) constitutes the # primary key of the table. Always / if the primary key : comprises multiple columns (even if this is one of those  columns). <.5 if there is a uniqueness constraint on this column.  Not .3 if this column is part of a uniqueness constraint < involving multiple columns. (Such multi-column uniqueness 2 constraints are not reported by this interface.) =>If this there is a foreign key constraint on this column (and < the constraint does not span multiple columns), report the " table referenced by this column. >Returns a list of 5$ structures for a particular table. @ Not all information about a table is returned. In particular, , constraints that span columns are ignored. 56789:;<=0> 56789:;<=> 56789:;<=>56789:;<=0>None?:Set configuration parameters on a database by editing the  postgresql.conf3 file. Takes the database directory and a list of  ( parameter,  full-line)$ pairs. For example, when creating @ a throw-away database cluster you later intend to discard, you  might say:  1 configLocalDB dbpath [("fsync", "fsync = off")] :Note that the second element of each pair is the complete 0 configuration line. It is not correct to say: 8 configLocalDB dbpath [("fsync", "off")] -- INCORRECT @9Create a directory for a local database cluster entirely ? self-contained within one directory. This is accomplished by A creating a new PostgreSQL database cluster in the directory and 0 setting the following configuration options in postgresql.conf:  unix_socket_directory* is set to the database directory itself, E so that no permissions are required on global directories such as  /var/run.  listen_address is set to empty (i.e., ''), so that no TCP E socket is bound, avoiding conflicts with any other running instaces  of PostgreSQL.  logging_collector is set to yes, so that all message logs are  kept in the pg_log. subdirectory of the directory you specified. Note this function does not start a postgres server after @ creating the directory. You will seperately need to start the  server using A or B. (And note that  B already calls  createLocalDB if the directory does C not exist or is empty. Hence the primary use of this function is  if you want to call ? between @ and  A.) A=Start a local database if the server is not already running. ( Otherwise, does nothing, but returns a 1 in either D case. The database server will continue running after the current  process exits (but see C). BA combination of @ and A. CThe parameter is a PostgreSQL data directory. If the directory is ? empty or does not exist, this function creates a new database  cluster (via @&). Then, if a database server is not @ already running for the directory, starts a server. No matter  what, returns a 1! that will connect to the server ! running on this local database.  Note that if  initLocalDB& starts a postgres server, the server = process will continue running after the process that called   initLocalDB7 exits. This is normally fine. Since multiple client C processes may access the same PostgreSQL database, it makes sense C for the first client to start the database and no one to stop it.  See C3 if you wish to stop the server process (which you = should always do before deleting a test cluster). See also  E3 to create a temporary cluster for the purposes of  running a test suite. C6Stop the server for a local database cluster entirely A self-contained within one directory. You must call this before ? deleting the directory, or else stray postgres processes will E linger forever. If the argument is the empty string, looks for the  database directory in the PGDATA environment variable. D?Set environment variables to make a local database cluster the E default. Also returns shell commands you can eval or cut-and-paste  into your shell to make pg_ctl and psql access a local database  cluster. EBRun a function with a completely fresh database cluster that gets B deleted on return. Since the entire database is blown away when  the function returns,  withTempDB is obviously only useful for  test suites. FAReset a connection to its default state before re-cycling it for  another thread or request. 23?4@5ABCDEF?@ABCDEF@?ABCDEF 23?4@5ABCDEF Safe-InferredG=The point of this class is to ensure that you are using data , types defined with record selectors (i.e., data Foo = Foo { unFoo  :: Int } as opposed to data Foo = Foo Int). Unfortunately,  GHC.Generics makes the 6 type a member  of the 7- class. Hence, if you want to ensure a type a  is not 6, use the context (RequireSelector a) =>. )If you see a compilation error involving RequireSelector or  IntentionallyCauseError', it means you failed to define one of . your datatypes using record selector syntax. 8BThere are intentionally no members of this class, so that placing - it in a context will always cause an error. G89:GGG89: NoneNHA newtype wrapper in the ; class, which marshalls every E field except the primary key, followed by the primary key. For use  with c. JA newtype wrapper in the ; class, which marshalls every - field except the primary key. For use with d. LA newtype wrapper in the < class, permitting every model / to be used as the result of a database query. O The newtype As0 can be wrapped around an existing type to give C it a table name alias in a query. This is necessary when a model < is being joined with itself, to distinguish the two joined  instances of the same table.  For example: {-# LANGUAGE OverloadedStrings #-}   data X = X  instance R X where rowAliasName = const "x"    ...  r <- dbSelect c $ addWhere_ "bar.bar_key = x.bar_parent" modelDBSelect  :: IO [Bar :. As X Bar] R2The class of types that can be used as tags in as O alias. C Such types should be unit types--in other words, have exactly one C constructor where the constructor is nullary (take no arguments). ' The reason for this class is that the T instance for O D requires a way to extract the name of the row alias without having ; a concrete instance of the type. This is provided by the  S$ method (which must be non-strict). S?Return the SQL identifier for the row alias. This method must > be non-strict in its argument. Hence, it should discard the : argument and return the name of the alias. For example:  $ {-# LANGUAGE OverloadedStrings #-}   data My_alias = My_alias > instance RowAlias My_alias where rowAliasName _ = "my_alias" ;Keep in mind that PostgreSQL folds unquoted identifiers to : lower-case. However, this library quotes row aliases in SELECT B statements, thereby preserving case. Hence, if you want to call  construct a WHERE. clause without double-quoting row aliases in  your !3, you should avoid capital letters in alias names. A default implementation of  rowAliasName exists for unit types - (as well as empty data declarations) in the = class. The : default converts the first character of the type name to $ lower-case, following the logic of . T?The class of data types that represent a database table. This < class conveys information necessary to move a Haskell data E structure in and out of a database table. The most important field  is U0, which describes the database table and column  names. U- has a reasonable default implementation for  types that are members of the = class (using GHC's   DeriveGeneric5 extension), provided the following conditions hold:  > The data type must have a single constructor that is defined $ using record selector syntax. 1 The very first field of the data type must be a  to < represent the primary key. Other orders will cause a  compilation error. : Every field of the data structure must be an instance of  > and ?. ?If these three conditions hold and your database naming scheme  follows the conventions of --namely that the B table name is the same as the type name with the first character C downcased, and the field names are the same as the column names-- E then it is reasonable to have a completely empty (default) instance  declaration:  * data MyType = MyType { myKey :: !DBKey 2 , myName :: !S.ByteString . , myCamelCase :: !Int  , ... 3 } deriving (Show, Generic)  instance Model MyType  The default U method is called . You E may wish to use almost all of the defaults, but tweak a few things. ? This is easily accomplished by overriding a few fields of the D default structure. For example, suppose your database columns use D exactly the same name as your Haskell field names, but the name of E your database table is not the same as the name of the Haskell data 8 type. You can override the database table name (field  u) as follows:   instance Model MyType where ? modelInfo = defaultModelInfo { modelTable = "my_type" } 4Finally, if you dislike the conventions followed by  1, you can simply implement an alternate pattern.  An example of this is , which strips a prefix A off every field name and converts everything from camel-case to  underscore notation:   instance Model MyType where , modelInfo = underscoreModelInfo "my" The above code will associate MyType with a database table  my_type having column names key, name,  camel_case, etc. &You can implement other patterns like  by  calling  and modifying the results. E Alternatively, you can directly call the lower-level functions from  which  is built (,  , ). U modelInfo1 provides information about how the Haskell data 2 type is stored in the database, in the form of a s data C structure. Among other things, this structure specifies the name : of the database table, the names of the database columns = corresponding to the Haskell data structure fields, and the B position of the primary key in both the database columns and the  Haskell data structure. VV. contains the table and column names verbatim B as they should be inserted into SQL queries. For normal models, & these are simply double-quoted (with  ) versions of  the names in U), with the column names qualified by the ? double-quoted table name. However, for special cases such as  join relations (with ) or row aliases (with O),  V- can modify the table name with unquoted SQL  identifiers (such as JOIN and AS) and change the qualified  column names appropriately. W modelRead converts from a database  result to the  Haskell data type of the Model , namely a. Note that if type  a is an instance of <, a fine definition of  modelRead  is modelRead = fromRow%. The default is to construct a row  parser using the =% class. However, it is crucial that @ the columns be parsed in the same order they are listed in the  v field of a's s structure, and this < should generally be the same order they are defined in the  Haskell data structure. Hence  modelRead should generally look  like:   -- Call @0 as many times as there are fields in your type  modelRead = Constructor <$> @ <*> @ <*> @ XMarshal all fields of a except the primary key. As with  W6, the fields must be marshalled in the same order the % corresponding columns are listed in v, only with the + primary key (generally column 0) deleted. Do not define this as A , even if a is an instance of  ; , because A would include the primary key.  Similarly, do not define this as . On the other  hand, it is reasonable for  modelWrite to return an error for 8 degenerate models (such as joins) that should never be d. Y modelQueries provides pre-formatted ! templates for  , , and . The default Y  value is generated from V and should not be B modified. However, for degenerate tables (such as joins created  with ), it is reasonable to make Y always throw B an exception, thereby disallowing ordinary queries and requiring & use of more general query functions. @This method should either throw an exception or use the default  implementation. Z)Extra constraints, if any, to place in a  CREATE TABLE  statement. Only used by #Database.PostgreSQL.ORM.CreateTable. [;Perform a validation of the model, returning any errors if  it is invalid. \Extra information for #Database.PostgreSQL.ORM.CreateTable. You  probably don't need to use this. ^:A list of (column-name, type) pairs for which you want to  override the default. _-Extra constraints to stick at the end of the  CREATE TABLE  statement. `Standard CRUD (create/read/update/delete) queries on a model. b<A query template for looking up a model by its primary key. . Expects a single query parameter, namely the  or |  being looked up. c*A query template for updating an existing T in the A database. Expects as query parameters a value for every column  of the model except* the primary key, followed by the primary = key. (The primary key is not written to the database, just $ used to select the row to change.) d%A query template for inserting a new T in the database. 1 The query parameters are values for all columns except the ? primary key. The query returns the full row as stored in the ? database (including the values of fields, such as the primary 5 key, that have been chosen by the database server). e A query template for deleting a T from the database. 2 Should have a single query parameter, namely the  of the  row to delete. f@SQL table and column identifiers that should be copied verbatim ? into queries. For normal models, these will simply be quoted - versions of the fields in the corresponding s . However, = for special cases, the fields of this structure can contain  unquoted SQL including JOIN" keywords. In the case of joins,  different elements of i may be qualified by different  table names.  Note that i and j both contain  table-qualified names (e.g., "\"my_type\".\"key\""),  while k( contains only the quoted column names. h'Literal SQL for the name of the table. i.Literal SQL for each, table-qualified column. jLiteral SQL for the model's table-qualified primary key  column. k8Literal SQL for all the columns except the primary key. 5 These are the columns that should be included in an INSERT or  UPDATE3. Note that unlike the other fields, these column  names should not be table-qualified. lWhen all columns in i are qualified by the same ! table name, this field contains B the table name.  For the 1 type (in which different columns have different & table qualifications), this field is C. 3For normal models, this field will be identical to  h. However, for O models, h will  contain unquoted SQL such as "\"MyType\" AS  \"my_alias\"", in which case modelQualifier will  contain B "\"my_alias\"". m:The original, unquoted name of the table representing the @ model in the database. Ordinarily, this should be the same as  u in s, but in the case of O aliases,  the u is an alias, and m is the  original table. C for joins. pAThis class extracts the first field in a data structure when the  field is of type *. If you get a compilation error because  of this class, then move the  first in your data structure. qFThis class extracts the field names of a Haskell data structure. Only F defined for types with a single constructor that uses record syntax. r+This class returns the name of a datatype. sA  ModelInfo T0 contains the information necessary for mapping  T to a database table. Each T type has a single   ModelInfo, associated with it, accessible through the U  method of the T. class. Note the table and column names must ? all be unquoted in this data structure, as they will later be  quoted using   by the V method. u<The name of the database table corresponding to this model.  The default U instance uses , ; which is the name of your data type with the first letter  downcased. v=The names of the database columns corresponding to fields of = this model. The column names should appear in the order in 7 which the fields are defined in the Haskell data type a * (which should also be the order in which W parses  them to an a and X marshalls them). @Note that all queries generated by the library specify explicit < column names. Hence the order of columns does not need to ? match their order in the database table. They should instead : match the order of fields in the Haskell data structure. The default, given by , is to use the  Haskell field names for a%. This default will fail to compile  if a% is not defined using record syntax. w/The 0-based index of the primary key column in  v,. This should be 0 when your data structure's  first field is its & (highly recommended, and required by  %). If you customize this field, you  must also customize x--no check is made that  the two are consistent. x;Return the primary key of a particular model instance. If 3 you customize this field, you must also customize  w$--no check is made that the two are  consistent. yA  DBRefUnique T9 represents a one-to-one relationship between types. For  example, if type A contains a  DBRefUnique B , then each A is associated  with one (or at most one) B , and each B has one (or at most one) A  associated with it. By contrast, a |( represents a many-to-one relationship. zPhantom type for instantiating  that represents a one-to-one  relationship between tables. |A DBRef T; represents a many-to-one relationship between tables. For  example, if type A contains a DBRef B , then each B is associated  with many A's. By contrast, a y represents a one-to-one  relationship. DBRef is a type alias of kind * -> * . The type DBRef T  references an instance of type T by the primary key of its ! database row. The type argument T should be an instance of  T. }Phantom type for instantiating  that represents a one-to-many  relationship between tables. "Many operations can take either a | or a y ( (both of which consist internally of a ). Hence, these A two types are just type aliases to a generalized reference type  GDBRef, where GDBRef's first type argument, reftype, is a 0 phantom type denoting the flavor of reference (} or  z). ?The type of the Haskell data structure field containing a model's  primary key. Every T must have exactly one DBKey , and the DBKey must  be the T'+s very first field in the Haskel data type + definition. (The ordering is enforced by  , which, through use of the   DeriveGeneric5 extension, fails to compile when the first field is  not a DBKey.) Each T6 stored in the database should have a unique non-null > primary key. However, the key is determined at the time the  T< is inserted into the database. While you are constructing  a new T3 to insert, you will not have its key. Hence, you  should use the value NullKey$ to let the database chose the key. If you wish to store a T' s primary key as a reference in  another T, do not copy the  structure. Use   to convert the T'*s primary key to a foreign key reference. ?A type large enough to hold database primary keys. Do not use 2 this type directly in your data structures. Use  to hold a  T's primary key and |! to reference the primary key of  another model. Returns . when a  is . +Create a reference to the primary key of a T, suitable for  storing in a | or y field of a different T. BThe default name of the database table corresponding to a Haskell @ type. The default is the same as the type name with the first A letter converted to lower-case. (The rationale is that Haskell C requires types to start with a capital letter, but all-lower-case = table names are easier to use in queries because PostgreSQL 0 generally does not require them to be quoted.) 5Returns the Haskell field names in a data structure.  Extract the primary key of type  from a model when the  7 is the first element of the data structure. Fails to + compile if the first field is not of type . This function provides a D function for = types,  suitable as a default of the < class. This module uses it " as the default implementation of W. This function provides a A function for = types E that marshalls each field of the data type in the order in which it 3 appears in the type definition. This function is not a suitable  implementation of X% (since it marshals the primary key, @ which is not supposed to be written). However, it is required  internally by , and exposed in the unlikely ) event it is of use to alternate generic X functions.  You probably don't want to call this function. EBRemoves a single element from the list at the position specified.  (Internal) Returns a series of F#s serializing each field of a data > structure (in the order of the Haskell datatype definition),  except8 the primary key, since the primary key should never be < written to a database. Every field must be an instance of  ?. The default definition of U. See the documentation at  T for more information. Sets u to the name of the > type with the first character converted to lower-case. Sets  v4 to the names of the Haskell field selectors. Sets  w to 0% and extracts the first field of the  structure for x. Will fail to compile unless E the data structure is defined with record syntax and that its first  field is of type . >Note that defaults for the individual fields are available in  separate functions (e.g., ) with fewer class E requirements in the context, in case you want to make piecemeal use  of defaults. The default for w is 0. If you , overwrite that, you will need to overwrite x as  well (and likely vice versa).  An alternate T) pattern in which Haskell type and field B names are converted from camel-case to underscore notation. The B first argument is a prefix to be removed from field names (since D Haskell requires field names to be unique across data types, while C SQL allows the same column names to be used in different tables).  For example:   data Bar = Bar {  barId :: !DBKey  , barNameOfBar :: !String ' , barParent :: !(Maybe (DBRef Bar))  } deriving (Show, Generic)  @ instance Model Bar where modelInfo = underscoreModelInfo "bar" would associate type Bar with a database table called bar with  fields id,  name_of_bar, and parent. G7Convert a name from camel-case to underscore notation.  I.e., names of the form  MSizeForm are changed to  MSize_From.   skipFirst5 determines if the first character should be ignored  in the conversion. The default simply quotes the U and v  fields of s using  . &Default SQL lookup query for a model. &Default SQL update query for a model. &Default SQL insert query for a model. &Default SQL delete query for a model. The default value of Y. A \ that doesn'!t imply any extra constraints or  exceptions. HDegenerate instances of T for types in the ; class  are to enable extra ; types to be included with  in the  result of dbSelect queries. fromAs extracts the row from an O alias row, but  constrains the type of alias& to be the same as its first argument ; (which is non-strict). This can save you from explicitly ! specifying types. For example:  data X = X deriving (Generic) 4 instance RowAlias X where rowAliasName = const "x"   ... 3 r <- map (\(b1 :. b2) -> (b1, fromAs X b2)) <$> J dbSelect c $ addWhere \"bar.bar_key = x.bar_parent\" modelDBSelect %A type-restricted wrapper around the O constructor, under the  same rationale as %. Not strict in its first argument.  Lookup the u of a T (modelName _ = u  (U :: s a)). Lookup the primary key of a T. Generate a SQL SELECT statement with no WHERE predicate. For  example,  consists of  modelSelectFragment followed by "WHERE  primary-key = ?". BDump an entire model. Useful for development and debugging only, D as every row will be read into memory before the function returns. ANote that unlike the other primary model operations, it is OK to  call # even on degenerate models such as O and .  Follow a | or y and fetch the target row from  the database into a T type r. Like  but instead of returning an I , throws a   if the T is invalid. Write a T) to the database. If the primary key is  , the item is written with an INSERT query, read back E from the database, and returned with its primary key filled in. If  the primary key is not  , then the T is written with  an UPDATE query and returned as-is. If the T& is invalid (i.e. the return value of [ is  non-empty), a list of  is returned instead. ARemove the row corresponding to a particular data structure from C the database. This function only looks at the primary key in the > data structure. It is an error to call this function if the  primary key is not set. :Remove a row from the database without fetching it first. %Print to stdout the query statement. JA degenerate instance of T" that re-names the row with a SQL  AS> keyword. This is primarily useful when joining a model with & itself. Hence, standard operations (, , )  are not allowed on O models. KBA degenerate instance of model representing a database join. The  9 instance does not allow normal model operations such as  , , and ". Attempts to use such functions  will result in an exception. HIJKLMNOPQRSLMTUVWXYZ[\]^_`abcdefghijklmnNoOpPqQrRstuvwxyz{|}~EGHSTUVWXJYZ[\K]^_`abcdefghijklmnopqrstuvwxyz{|}~[ HIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~[TUVWXYZ[stuvwxfghijklm`abcde|yLMNHIJKOPQRS }~z{\]^_pqroneHIJKLMNOPQRSLMTUVWXYZ[\]^_`abcdefghijklmnNoOpPqQrRstuvwxyz{|}~EGHSTUVWXJYZ[\K]^_`abcdefghijklmnopqrstuvwxyz{|}~  Trustworthy8A deconstructed SQL select statement that allows easier C manipulation of individual terms. Several functions are provided  to combine the , , and  clauses of  muliple DBSelect2 structures. Other clauses may be discarded when C combining queries with join operations. Hence it is advisable to C set the other clauses at the end (or, if you set these fields, to  collapse your ! structure into a subquery using  ).  By default "SELECT", but might usefully be set to  something else such as "SELECT DISTINCT" in some  situations. Empty by default, but set to "WHERE" if any WHERE  clauses are added to the  field. As it's name would suggest, a  FromClause is the part of a query  between the FROM keyword and the WHERE keyword. It can consist  of simple table names, JOIN operations, and parenthesized  subqueries. ?From clauses are represented in a more structured way than the @ other fields so as to allow the possibility of collapsing join # relations. For instance, given a  (A :. B) and a   (B :. C)+, it is desirable to be able to generate a   (A :. B :. C)' in which each pair of terms involving  B; in the three-way relation is constrained according to the : original two queries. This functionality is provided by   and 4, but it requires the ability to locate and replace  the instance of type B in one  with the  FromClause of  the other . The 2 field is a canonical name of each type, which by E convention is the quoted and fully-qualified table name. Comparing  0 is somewhat of a hack, and happens entirely at C runtime. It would be nicer to do this at compile time, but doing . so would require language extensions such as GADTs of  FunctionalDependencies. Usually "JOIN" ON or USING clause (or empty)  Verbatim SQL for a table, table AS # alias, or parenthesized subquery. <Canonical name of the table or join relation represented by  this term. For JOIN terms, this is always the  CROSS JOIN  of the canonical names of  and . This means $ one can locate a join given only it's type (e.g., the canonical  name for A :. B is always "a CROSS JOIN b"), but it does ; mean you have to be careful not accidentally to merge two ? different joins on the same types. For this reason it may be  safest always to have type b be a single table in   and . A  structure with keyword "SELECT" and everything  else empty. A 5 for one or more comma-separated expressions, rather 4 than for a table. For example, to issue the query "SELECT  lastval()":  & lastval :: DBSelect (Only DBKeyType) + lastval = expressionDBSelect "lastval ()"   ... / [just_inserted_id] <- dbSelect conn lastval COn the other hand, for such a simple expression, you might as well  call  directly.  Create a  for a rendered version of a . This @ can save one string copy if you want to embed one query inside # another as a subquery, as done by , and thus need to B parenthesize it. However, the function is probably not a useful  for end users. Turn a  into a ! suitable for the  or   functions. !Add a where clause verbatim to a . The clause must  not contain the WHERE* keyword (which is added automatically by   addWhere_ if needed). If the DBSelect has existing WHERE * clauses, the new clause is appended with AND. If the query  contains any '?', characters, they will be rendered into the E query and matching parameters will later have to be filled in via a  call to . @Add a where clause, and pre-render parameters directly into the  clause. The argument p+ must have exactly as many fields as there  are '?' characters in the ! . Example: ? bars <- dbSelect c $ addWhere "bar_id = ?" (Only target_id) $ 6 (modelDBSelect :: DBSelect Bar) Set the ORDER BY clause of a  . Example: ? dbSelect c $ setOrderBy "\"employeeName\" DESC NULLS FIRST" $  modelDBSelect Set the LIMIT clause of a . Set the OFFSET clause of a . /Add one or more comma-separated expressions to  that A produce column values without any corresponding relation in the  FROM clause. Type r* is the type into which the expression is 6 to be parsed. Generally this will be an instance of < that  is a degenerate model (e.g., , or a tuple). *For example, to rank results by the field value and compute the , fraction of overall value they contribute: ! r <- dbSelect c $ addExpression I "rank() OVER (ORDER BY value), value::float4/SUM(value) OVER ()"  modelDBSelect ' :: IO [Bar :. (Int, Double)] A # that returns all rows of a model. Run a % query on parameters. The number of '?' . characters embedeed in various fields of the  must 6 exactly match the number of fields in parameter type p . Note the % order of arguments is such that the  can be pre-rendered @ and the parameters supplied later. Hence, you should use this  version when the & is static. For dynamically modified   structures, you may prefer . Run a ( query and return the resulting models. Create a join of the , , and   clauses of two ) queries. Other fields are simply taken  from the second , meaning fields such as ,  , and  in the in the first  are  entirely ignored.  A version of  that uses  for the joined  tables. <Restrict the fields returned by a DBSelect to be those of a  single T a%. It only makes sense to do this if a is part  of something_containing_a(, but no static check is performed that  this is the case. If you  dbProject a type that doesn't make C sense, you will get a runtime error from a failed database query. Like , but renders the entire input  as a D subquery. Hence, you can no longer mention fields of models other  than a9 that might be involved in joins. The two advantages of B this approach are 1) that you can once again join to tables that E were part of the original query without worrying about row aliases,  and 2) that all terms of the  will be faithrully rendered E into the subquery (whereas otherwise they could get dropped by join 4 operations). Generally you will still want to use , but   dbProject' is available when needed. Nest two type-compatible JOIN queries. As with ,  fields of the first JOIN (the  (a :. b) ) other than  , , and  are entirely ignored. Like $, but projects away the middle type b. 9 First table Join keyword ("JOIN", " LEFT JOIN", etc.)  Second table Predicate (if any) including ON or USING keyword  Join keyword ON or USING predicate )*#  None?The class of Haskell types that can be converted to and from a C particular SQL type. For most instances, you only need to define  . 7The name of the SQL type corresponding to Haskell type a,  when a value of a+ can be null. This is the SQL type to and  from which a  a will be converted (where C % corresponds to the SQL value null). 7The name of the SQL type corresponding to Haskell type a,  when a is not wrapped in  and hence cannot be null. If  sqlType* is unspecified, the default is to append "NOT NULL"  to .  Retreive the 0 corresponding to a type. You can subsequently  use the  to call  getTypeInfo for more information on the  type. #  Safe &An extractor that matches either type r or type Maybe r, and,  in the former case, wraps Just" around the value so as always to  return type Maybe r. /An extractor that matches an exact field type. "Extract the single field matching  f r from a  = data structure a with exactly one constructor. :Extract the 0-based position of the single field matching   f r within = data structure a.  Non-strict in both arguments. (Generlized extraction of a field from a = data structure.  Argument rep should generally be the type  t for some data  type t$ whose fields you want to extract. r is the result type % you want back from the extraction. f should be defined such that  there is an instance of  f a r THasOne for each type  a you want to convert to r and extract. .Returns zero, one, or multiple values of type f wrapped in  , , or  respectively. Returns (total, positions) where total is the total number 2 of fields (matching or not) in the structure and  positions is a @ list of zero-based field numbers of the fields matching target  type f r. (Class of types used as tag arguments to  and  . f# should be a new unit type of kind * -> *, D used to designate the type of extraction you want. Then instances * should be defined to transform each type a you want to extract to  some type r, with g set to .  For example,  is a type to convert types a and  Maybe a both to type Maybe a (i.e., type argument r is Maybe  a).  $ data ExtractMaybe a = ExtractMaybe ; instance Extractor ExtractMaybe a (Maybe a) THasOne where  extract _ = THasOne . Just C instance Extractor ExtractMaybe (Maybe a) (Maybe a) THasOne where  extract _ = THasOne @Note that there is already a default general instance returning  9. Hence, you do not need to define one. Otherwise, you 7 would have to define an overlapping instance such as:  B instance Extractor ExtractMaybe a b THasZero where -- Incorrect  extract _ = THasNone (Except the above wouldn'(t quite work anyway given the rules for B overlapping instances.) So just assume that any instance you don't  explicitly define for your  will automatically fall back  to . -More than one matching field has been found. &Zero matching fields have been found. +Exactly one matching field has been found. Dirty trick to construct  less specific overlapping instances by B making a class argument a simple type variable, but constraining > that variable to be a particular type. E.g., neither of the B following two instances is more specific than the other, because  NO is not more general than YES:  @ class MyClass a b c | a b -> c where myClass :: a -> b -> c () ; instance MyClass a a YES where myClass _ _ = YES () : instance MyClass a b NO where myClass _ _ = NO () <Hence, attempting to use the first instance will generate a C compilation error rather than inferring the type of c as YES. On C the other hand, of the following two instances, the first is more  specific than the second:   instance MyClass a a YES where  myClass _ _ = YES () 2 instance (TypeGCast NO c) => MyClass a b c where % myClass _ _ = typeGCast $ NO () That' s because c is more general than YES. The key to this , working is that an instance context--i.e., (TypeGCast NO c)--is @ never consulted during instance selection, only to validate an * already-selected most-specific instance.  Note that YES and NO in these examples have kind * -> *.  Hence the G in  TypeGCast(. The same trick is equally applicable  to types of kind * , we just don't happen to need that in this  module.  A variant of # in which the type of the field is = supplied as a non-strict argument. This may be easier than B typecasting the extractor argument. For example, to extract the   from a structure with a single  field:   getFieldPos'  myStruct ( :: ) 1! None!<A data structure representing a dedicated join table in the B database. A join table differs from a model in that rows do not ; have primary keys. Hence, model operations do not apply. C Nonetheless a join table conveys information about a relationship  between models. Note that all names in a  JoinTable should be unquoted. 7Name of the join table in the database. (Not quoted.) Name of the column in table  that contains a |  to model a$. (Not quoted or table-qualified.) Like  for model b.  DBRefInfo. is a type alias for the common case that the  reference in a  is a | (as opposed to a  y3). The functions in this library do not care what 8 type of reference is used. The type is generalized to  0 just to make it easier to assign a selector to  when  the selector returns a y. Note, however, that   returns a  regardless of the flavor $ of reference actually encountered. :A common type of association is when one model contains a |  or y/ pointing to another model. In this case, the  model containing the | is known as the child , and the " referenced model is known as the parent. BTwo pieces of information are required to describe a parent-child D relationship: First, the field selector that extracts the Haskell  | from the haskell type child, and second the name of the " database column that stores this | field. %For example, consider the following:   data Author = Author {  authorId :: DBKey  } deriving (Show, Generic)  instance Model Author   data Post = Post {  postId :: DBKey " , postAuthorId :: DBRef Author  } deriving (Show, Generic)  instance Model Post  . post_author_refinfo :: DBRefInfo Post Author # post_author_refinfo = DBRefInfo { " dbrefSelector = postAuthorId 0 , dbrefQColumn = "\"post\".\"postAuthorId\""  } 7Note that the parent-child relationship described by a  GDBRefInfo + is asymmetric, but bidirectional. When a  child  parent% exists, the schema should generally not permit the  existence of a valid  parent child structure.  However, the  function generates s in  both directions from a single . Constructing such parent-child s requires knowing how " to extract primary keys from the parent type as well as the name ' of the column storing primary keys in parent. Fortunately, this + information is already available from the T class, and thus  does not need to be in the  GDBRefInfo. (Most functions on   GDBRefInfo s require parent and child to be instances of  T.)  When your Ts are instances of Generic (which will usually  be the case), a ) structure can be computed automatically  by ,. This is the recommended way to produce a   GDBRefInfo. (Alternatively, see  and  to make  use of an entirely implicit  DBRefInfo.) &Field selector returning a reference. ;Literal SQL for the database column storing the reference. ? This should be double-quoted and table-qualified, in case the A column name is a reserved keyword, contains capital letters, or > conflicts with the name of a column in the joined table. An  example would be: 1 dbrefQColumn = "\"table_name\".\"column_name\"" =A data structure representing a relationship between a model a  and a model b. At a high level, an Association a b tells you  how to find rows of type b given rows of type a. More @ concretely, this boils down to being able to make two types of  query.  You want to look up a bunch of (a  b)s, filtering using  predicates on both a and b# (e.g., get a list of recent posts 5 and their authors). For this purpose, you can use ,  which allows you to " predicates mentioning columns in  both a and b. & You already have an instance of type a, and want to find all  the b/s associated with it. For that you use either   or ! (which internally access fields ,  , and ). This type of query is E strictly less general than the first one, but can be formulated in E a more efficient way by extracting values directly from a concrete  instance of a without needing to touch table a in the  database.  Note that an  Association) is asymmetric. It tells you how to get  bs from a7s, but not vice versa. In practice, there will almost B always be an association in the other direction, too. Functions  such as  and  therefore create an   Association5 and its inverse simultaneously, returning them as a  pair. *General select returning all instances of a and b that % match according to the association. The right-hand side of the  query. This query  makes no mention of type a$ (but can be combined with the next = two fields to form an optimized query). You probably never : want to use this directly, and should instead use either   or $. Also note this is not useful for  selecting all the b+s in the relation; for that you should use  . A WHERE clause to find all the bs associated with a  particular a0. This can often be done more efficiently than  through . The clause contains '?' characters  which should be filled in by . /The query parameters for the query returned by  . A projection of  , extracting only the fields of  model b&. Note that this query touches table a even if it does  not return results from a. Hence, you can use  to add  predicates on both a and b. (Note the contrast to  , which does not touch table a at all, and  hence in the case of an  INNER JOIN might return rows of b that ) should not be part of the association.  is + intended for use only in conjunction with .)  Returns a  for all bs associated with a particular  a. +Follow an association to return all of the b s associated  with a particular a. The behavior is similar to:  2 findAssoc' ab c a = dbSelect c $ assocWhere ab a ABut if the first argument is a static association, this function D may be marginally faster because it pre-renders most of the query. #Combine two associations into one. ?Combine two associations into one, and project away the middle 3 type. (The middle type can still be mentioned in WHERE clauses.)  An example:  data Author = Author {  authorId :: DBKey  } deriving (Show, Generic) F instance Model Author where modelInfo = underscoreModelInfo "author"   data Post = Post {  postId :: DBKey " , postAuthorId :: DBRef Author  } deriving (Show, Generic) B instance Model Post where modelInfo = underscoreModelInfo "post"   data Comment = Comment {  commentId :: DBKey ! , commentPostId :: DBRef Post  } deriving (Show, Generic) H instance Model Comment where modelInfo = underscoreModelInfo "comment"  ) author_posts :: Association Author Post ( post_author :: Association Post Author < (post_author, author_posts) = dbrefAssocs defaultDBRefInfo  0 -- Could equally well use dbrefAssocs as above + post_comments :: Association Post Comment  post_comments = has  * comment_post :: Association Comment Post  comment_post = belongsTo  . comment_author :: Association Comment Author 6 comment_author = chainAssoc comment_post post_author  / author_comments :: Association Author Comment : author_comments = chainAssoc author_posts post_comments  Creates a  from a model child that references  parent. For this to work, the child type must be an instance  of Generic6 and must contain exactly one field of the any of the  following types:    rt parent, which matches both | parent and  y parent.  Maybe ( rt parent) , for cases where the reference  might be NULL3. Note, however, that an exception will be thrown  if you call  on a child whose reference is C. .A special case arises when a Model contains a | to itself. A If you just wish to find parents and children given an existing  structure (i.e., ), it is okay to declare an   MyType MyType%. However, in this case attempts to  use 3 will then fail. To work around this problem, the  parent must use a row alias. Note that currently  aliasing the child will not work , since the  O# data structure will not contain a | field, only the  contents of the O+ data structure. An example of doing this  correctly (using  and , both of which wrap  defaultDBRefInfo):  data Bar = Bar {  barId :: !DBKey  , barName :: !String ' , barParent :: !(Maybe (DBRef Bar))  } deriving (Show, Generic) @ instance Model Bar where modelInfo = underscoreModelInfo "bar"   data ParentBar = ParentBar A instance RowAlias ParentBar where rowAliasName _ = "parent_bar"  0 toParent :: Association Bar (As ParentBar Bar)  toParent = belongsTo  / toChild :: Association (As ParentBar Bar) Bar  toChild = has 0Generate both the child-parent and parent-child s  implied by a .  Short for  $ snd $ dbrefAssocs defaultDBRefInfo Note the inverse  is given by . For  example, given the Author and Post models described in the  documentation for , in which each Post references an  Author, you might say: ( author_post :: Association Author Post  author_post = has  ( post_author :: Association Post Author  post_author = belongsTo The inverse of  . Short for  $ fst $ dbrefAssocs defaultDBRefInfo See an example at . 1The default join table has the following fields:  jtName8 is the name of the two models (in alphabetical order),  separated by an '_' character.   is the name of model a, an '_' character, and - the name of the primary key column in table a.   is the name of model b, an '_' character, and - the name of the primary key column in table b.  Note that ( cannot create a default join table for E joining a model to itself, as following these rules the two columns C would have the same name. If you wish to join a table to itself, A you have two options: First, you can define the join table and A assign the column names manually. This will permit you to call  (, but you still will not be able to use  C for more complex queries, since SQL does not permit joins between E two tables with the same name. The second option is to give one of . the sides of the join table a row alias with O. For example:  data ParentBar = ParentBar A instance RowAlias ParentBar where rowAliasName _ = "parent_bar"  3 selfJoinTable :: JoinTable Bar (As ParentBar Bar) " selfJoinTable = defaultJoinTable  0 selfJoin :: Association Bar (As ParentBar Bar) 5 otherSelfJoin :: Association (As ParentBar Bar) Bar 4 (selfJoin, otherSelfJoin) = jtAssocs selfJoinTable Flip a join table. This doesn't change the name of the table @ (since the same join table is used in both directions, and the ? default join table name glues together the two model names in  alphabetical order anyway). BA SQL statement suitable for adding a pair to a join table. Note = that the statement takes two parameters (i.e., contains two '?' A characters) corresponding to the primary keys of the two models 8 being associated. These parameters can be supplied by . @Add an association between two models to a join table. Returns  .+ if the association was not already there. =A SQL statement for removing a pair from a join table. Like  2, the query is parameterized by two primary keys. 2Remove an association from a join table. Returns . if the # association was previously there. 3Remove an assocation from a join table when you don' t have the C target instances of the two models handy, but do have references. Generate parameters for  and . , The returned list is suitable for use as a ; instance. For  example: ; execute conn (jtAddStatement my_join_table) (jtParam a b) &Generate a one-way association from a . Use   instead. +Generate the two associations implied by a . ?Generate a one-way association based on the default join table  naming scheme described at . Defined as:  & joinTable = jtAssoc defaultJoinTable  For example:  aToB :: Association A B  aToB = joinTable   bToA :: Association B A  bToA = joinTable /$$"NoneV OPQRSTU[stuvwxy|WTU[stuvwx|yOPQRS None >This is a helper class used to extract the row types. You don't A need to use this class. If you are creating custom types, just  declare an instance of .  @Statement for creating the table corresponding to a model. Not  strict in its argument.  )Create a the database table for a model.  -Create the database table corresponding to a . %Create a join table in the database.    A list of (field,type) pairs to overwrite the default  SQL types of fields. #A list of extra table constraints. ,A non-strict argument to specify which model's table you want  to create. (undefined :: YourModel) should be fine.                     !"#$%&'()*+,-./01234567899:;<=>?@ABBCDEFGHIJKLMNOPQRS T T U U V V W X X Y Z [ \ ] ^ _ ` a b c d d e f g g h i j k l l m n o p q r s t u v w x x y z { | } ~ ~                                           !"#$%&'()*+,*+-./012345645789:;<=>45?@ABC=D;E4FG4FH=I JBK L M4NO P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                       4F                               45 *+4                                     postgresql-orm-0.1Database.PostgreSQL.ORM#Database.PostgreSQL.ORM.ValidationsDatabase.PostgreSQL.EscapeDatabase.PostgreSQL.MigrationsDatabase.PostgreSQL.MigrateDatabase.PostgreSQL.DescribeDatabase.PostgreSQL.DevelData.RequireSelectorDatabase.PostgreSQL.ORM.Model Database.PostgreSQL.ORM.DBSelectDatabase.PostgreSQL.ORM.SqlType Data.GetField#Database.PostgreSQL.ORM.Association#Database.PostgreSQL.ORM.CreateTablepostgresql-simple-0.3.5.0 Database.PostgreSQL.Simple.Types:.ValidationFuncValidationError InvalidError invalidColumn invalidErrorvalidatevalidateNotEmptyId buildIdent quoteIdent buildLiteral buildByteA buildActionbuildSqlFromActionsbuildSqlfmtSql Migration connectEnvmigrate runSqlFilecolumn create_tablecreate_table_stmt drop_tabledrop_table_stmt add_columnadd_column_stmt drop_columndrop_column_stmt rename_columnrename_column_stmt change_columnchange_column_stmt create_indexcreate_unique_indexcreate_index_stmt drop_indexdrop_index_stmt defaultMainMigrationDetails migrationPathmigrationVersion migrationNamedefaultMigrationsDirdumpDb initializeDbrunMigrationsForDirrunRollbackForDir ColumnInfocolNumcolNamecolType colNotNull colPrimary colUnique colReferences describeTable configLocalDB createLocalDB startLocalDB initLocalDB stopLocalDB setLocalDB withTempDBresetConnectionRequireSelector UpdateRow InsertRow LookupRow lookupRowAsunAsRowAlias rowAliasNameModel modelInfomodelIdentifiers modelRead modelWrite modelQueriesmodelCreateInfo modelValidModelCreateInfomodelCreateColumnTypeExceptionsmodelCreateExtraConstraints ModelQueriesmodelLookupQuerymodelUpdateQuerymodelInsertQuerymodelDeleteQueryModelIdentifiers modelQTable modelQColumnsmodelQPrimaryColumnmodelQWriteColumnsmodelQualifiermodelOrigTableGToRowGFromRow GPrimaryKey0GColumns GDatatypeName ModelInfo modelTable modelColumnsmodelPrimaryColumnmodelGetPrimaryKey DBRefUnique UniqueRefDBRef NormalRefGDBRefDBKeyNullKey DBKeyType isNullKeymkDBRefdefaultModelTabledefaultModelColumnsdefaultModelGetPrimaryKeydefaultFromRow defaultToRowdefaultModelWritedefaultModelInfounderscoreModelInfodefaultModelIdentifiersdefaultModelLookupQuerydefaultModelUpdateQuerydefaultModelInsertQuerydefaultModelDeleteQuerydefaultModelQueriesemptyModelCreateInfofromAstoAs modelName primaryKeymodelSelectFragmentfindAllfindRowsavetrySavedestroy destroyByRefprintqDBSelectselWithselSelectKeyword selFieldsselFromselWhereKeywordselWhere selGroupBy selHaving selOrderByselLimit selOffset FromClauseFromJoinfcLeftfcJoinOpfcRight fcOnClause FromModel fcVerbatim fcCanonical emptyDBSelectexpressionDBSelect buildDBSelectrenderDBSelect addWhere_addWhere setOrderBysetLimit setOffset addExpression modelDBSelectdbSelectParamsdbSelectdbJoin dbJoinModels dbProject dbProject'dbNestdbChainSqlType sqlBaseTypesqlType getTypeOid ExtractMaybe ExtractIdGetField getFieldVal getFieldPos GGetField gGetFieldVal gGetFieldPos Extractorextract extractCountTHasMany fromTHasManyTHasNoneTHasOne fromTHasOne getFieldPos' JoinTablejtTable jtColumnA jtColumnB DBRefInfo GDBRefInfo dbrefSelector dbrefQColumn Association assocSelectassocSelectOnlyBassocWhereQueryassocWhereParam assocProject assocWhere findAssoc nestAssoc chainAssocdefaultDBRefInfo dbrefAssocshas belongsTodefaultJoinTablejtFlipjtAddStatementjtAddjtRemoveStatementjtRemove jtRemoveByRefjtParamjtAssocjtAssocs joinTable GDefTypes gDefTypesmodelCreateStatement modelCreatejtCreateStatementjtCreate$fExceptionValidationError uBuildIdentblaze-builder-0.3.1.1#Blaze.ByteString.Builder.ByteStringfromByteStringDatabase.PostgreSQL.Simplequery formatQueryuncheckedWriteNibbles#bytestring-0.10.0.2Data.ByteString.Internal ByteStringc2bc2b# fastFindIndex fastBreakquoter hexNibblesPtrhexCharEscBuildercopyByteToNibbles $fToFieldId $fIsStringId#Database.PostgreSQL.Simple.Internal ConnectionQueryCmdArgscmd cmdVersion cmdCommit executeQuery_ parseCmdArgs runMigration runRollbackgetDirectoryMigrationssplitFileVersionName isVersionghc-prim GHC.TypesTrueFalse defColInfo ConnectInfo isNonEmptyDir addDirectives pgDirectivessystemNoStdoutbase GHC.Generics NoSelectorSelectorIntentionallyCauseError$fRequireSelectora$fRequireSelectorNoSelector Database.PostgreSQL.Simple.ToRowToRow"Database.PostgreSQL.Simple.FromRowFromRowGeneric$Database.PostgreSQL.Simple.FromField FromField"Database.PostgreSQL.Simple.ToFieldToFieldfieldtoRow Data.MaybeJustNothingfromRowdeleteAtAction toUnderscore degen_err Data.EitherEither $fModelAs $fModel:. GUnitType gUnitTypeNamegToRowgFromRow gPrimaryKey0gColumns gDatatypeNamejoinModelIdentifiersaliasModelInfoaliasModelIdentifiers$fToRowUpdateRow$fToRowInsertRow$fFromRowLookupRow$fShowAs $fGUnitTypeM1 $fGUnitTypeV1$fGUnitTypeM10 $fModel(,,,,) $fModel(,,,) $fModel(,,) $fModel(,) $fModel[] $fModelOnly $fGToRowM1 $fGToRow:*: $fGToRowK1 $fGToRowU1 $fGFromRowM1 $fGFromRow:*: $fGFromRowK1 $fGFromRowU1$fGPrimaryKey0M1$fGPrimaryKey0M10$fGPrimaryKey0:*:$fGPrimaryKey0M11 $fGColumnsM1 $fGColumnsM10 $fGColumns:*: $fGColumnsM11 $fGColumnsU1$fGDatatypeNameM1$fShowModelInfo$fToFieldGDBRef$fFromFieldGDBRef $fReadGDBRef $fShowGDBRef$fToFieldDBKey$fFromFieldDBKey $fShowDBKey $fOrdDBKey $fEqDBKeyquery_'Blaze.ByteString.Builder.Internal.TypesBuilderOnlyGDBS gdbsDefault gdbsQuerynullFromspaceqNullqBuildertoQuerybuildFromClause catQueriesmergeFromClauses$fGDBSM1 $fGDBS:*:$fGDBSK1 $fGDBSK10$fShowDBSelectMaybepostgresql-libpq-0.8.2.3Database.PostgreSQL.LibPQOidExtractTypeOid$fSqlTypeGDBRef$fSqlTypeGDBRef0$fSqlTypeVector$fSqlTypeMaybe$fSqlTypeDBKey$fSqlTypeBinary$fSqlTypeBinary0 $fSqlType[]$fSqlTypeUnbounded$fSqlTypeUnbounded0$fSqlTypeUnbounded1$fSqlTypeUnbounded2 $fSqlTypeDay$fSqlTypeUTCTime$fSqlTypeTimeOfDay$fSqlTypeZonedTime$fSqlTypeLocalTime $fSqlTypeOid $fSqlTypeText$fSqlTypeText0$fSqlTypeByteString$fSqlTypeByteString0$fSqlTypeInt64$fSqlTypeInt32$fSqlTypeInt16$fSqlTypeFloat$fSqlTypeDouble $fSqlTypeBool$fFromFieldExtractTypeOidRep TypeGCastIntGHC.Err undefinedGCountgCountGCombinegCombine typeGCast($fExtractorExtractMaybeMaybeMaybeTHasOne$$fExtractorExtractMaybeaMaybeTHasOne$fExtractorExtractIdaaTHasOne $fGetFieldfar$fGGetFieldfM1rg$fGGetFieldf:*:rg$fGGetFieldfK1rg$fExtractorfarg$fGCountTHasNone$fGCountTHasMany$fGCountTHasOne!$fGCombineTHasManyTHasOneTHasMany!$fGCombineTHasOneTHasManyTHasMany"$fGCombineTHasManyTHasNoneTHasMany"$fGCombineTHasNoneTHasManyTHasMany"$fGCombineTHasManyTHasManyTHasMany $fGCombineTHasOneTHasOneTHasMany"$fGCombineTHasNoneTHasNoneTHasNone $fGCombineTHasNoneTHasOneTHasOne $fGCombineTHasOneTHasNoneTHasOne $fTypeGCastff ExtractRefjtQTable jtQColumnA jtQColumnB'$fExtractorExtractRefMaybeGDBRefTHasOne($fExtractorExtractRefMaybeGDBRefTHasOne0($fExtractorExtractRefGDBRefGDBRefTHasOne)$fExtractorExtractRefGDBRefGDBRefTHasOne0$fShowGDBRefInfo$fShowAssociationcustomModelCreateStatement $fGDefTypesM1$fGDefTypes:*: $fGDefTypesK1