persistent-postgresql-2.13.7.0: Backend for the persistent library using postgresql.
Safe HaskellNone
LanguageHaskell2010

Database.Persist.Postgresql.Internal

Synopsis

Documentation

newtype P Source #

Newtype used to avoid orphan instances for postgresql-simple classes.

Since: 2.13.2.0

Constructors

P 

Fields

Instances

Instances details
FromField P Source # 
Instance details

Defined in Database.Persist.Postgresql.Internal

ToField P Source # 
Instance details

Defined in Database.Persist.Postgresql.Internal

Methods

toField :: P -> Action Source #

newtype PgInterval Source #

Represent Postgres interval using NominalDiffTime

Since: 2.11.0.0

Constructors

PgInterval 

Fields

getGetter :: Oid -> Getter PersistValue Source #

Get the field parser corresponding to the given Oid.

For example, pass in the Oid of bool, and you will get back a field parser which parses boolean values in the table into PersistBools.

Since: 2.13.2.0

data AlterDB Source #

Represents a change to a Postgres DB in a statement.

Since: 2.17.1.0

Instances

Instances details
Show AlterDB Source # 
Instance details

Defined in Database.Persist.Postgresql.Internal

Methods

showsPrec :: Int -> AlterDB -> ShowS

show :: AlterDB -> String

showList :: [AlterDB] -> ShowS

Eq AlterDB Source # 
Instance details

Defined in Database.Persist.Postgresql.Internal

Methods

(==) :: AlterDB -> AlterDB -> Bool

(/=) :: AlterDB -> AlterDB -> Bool

data AlterTable Source #

Represents a change to a Postgres table in a DB statement.

Since: 2.17.1.0

Instances

Instances details
Show AlterTable Source # 
Instance details

Defined in Database.Persist.Postgresql.Internal

Methods

showsPrec :: Int -> AlterTable -> ShowS

show :: AlterTable -> String

showList :: [AlterTable] -> ShowS

Eq AlterTable Source # 
Instance details

Defined in Database.Persist.Postgresql.Internal

Methods

(==) :: AlterTable -> AlterTable -> Bool

(/=) :: AlterTable -> AlterTable -> Bool

data AlterColumn Source #

Represents a change to a Postgres column in a DB statement.

Since: 2.17.1.0

Instances

Instances details
Show AlterColumn Source # 
Instance details

Defined in Database.Persist.Postgresql.Internal

Methods

showsPrec :: Int -> AlterColumn -> ShowS

show :: AlterColumn -> String

showList :: [AlterColumn] -> ShowS

Eq AlterColumn Source # 
Instance details

Defined in Database.Persist.Postgresql.Internal

Methods

(==) :: AlterColumn -> AlterColumn -> Bool

(/=) :: AlterColumn -> AlterColumn -> Bool

data SafeToRemove Source #

Indicates whether a Postgres Column is safe to drop.

Since: 2.17.1.0

Instances

Instances details
Show SafeToRemove Source # 
Instance details

Defined in Database.Persist.Postgresql.Internal

Methods

showsPrec :: Int -> SafeToRemove -> ShowS

show :: SafeToRemove -> String

showList :: [SafeToRemove] -> ShowS

Eq SafeToRemove Source # 
Instance details

Defined in Database.Persist.Postgresql.Internal

Methods

(==) :: SafeToRemove -> SafeToRemove -> Bool

(/=) :: SafeToRemove -> SafeToRemove -> Bool

migrateStructured :: [EntityDef] -> (Text -> IO Statement) -> EntityDef -> IO (Either [Text] [AlterDB]) Source #

Returns a structured representation of all of the DB changes required to migrate the Entity from its current state in the database to the state described in Haskell.

Since: 2.17.1.0

mockMigrateStructured :: [EntityDef] -> EntityDef -> [AlterDB] Source #

Returns a structured representation of all of the DB changes required to migrate the Entity to the state described in Haskell, assuming it currently does not exist in the database.

Since: 2.17.1.0

addTable :: [Column] -> EntityDef -> AlterDB Source #

Returns a structured representation of all of the DB changes required to migrate the Entity from its current state in the database to the state described in Haskell.

Since: 2.17.1.0

findAlters Source #

Arguments

:: [EntityDef]

The list of all entity definitions that persistent is aware of.

-> EntityDef

The entity definition for the entity that we're working on.

-> Column

The column that we're searching for potential alterations for.

-> [Column] 
-> ([AlterColumn], [Column]) 

maySerial :: SqlType -> Maybe Text -> Text Source #

mayDefault :: Maybe Text -> Text Source #

showAlterDb :: AlterDB -> (Bool, Text) Source #

getAddReference :: [EntityDef] -> EntityDef -> FieldNameDB -> ColumnReference -> Maybe AlterDB Source #

Get the references to be added to a table for the given column.

safeToRemove :: EntityDef -> FieldNameDB -> Bool Source #

Check if a column name is listed as the "safe to remove" in the entity list.

escape :: Text -> Text Source #