Safe Haskell | None |
---|---|
Language | Haskell2010 |
Database.Persist.Postgresql.Internal
Synopsis
- newtype P = P {
- unP :: PersistValue
- newtype PgInterval = PgInterval {}
- getGetter :: Oid -> Getter PersistValue
- data AlterDB
- data AlterTable
- data AlterColumn
- data SafeToRemove
- migrateStructured :: [EntityDef] -> (Text -> IO Statement) -> EntityDef -> IO (Either [Text] [AlterDB])
- mockMigrateStructured :: [EntityDef] -> EntityDef -> [AlterDB]
- addTable :: [Column] -> EntityDef -> AlterDB
- findAlters :: [EntityDef] -> EntityDef -> Column -> [Column] -> ([AlterColumn], [Column])
- maySerial :: SqlType -> Maybe Text -> Text
- mayDefault :: Maybe Text -> Text
- showSqlType :: SqlType -> Text
- showColumn :: Column -> Text
- showAlter :: EntityNameDB -> AlterColumn -> Text
- showAlterDb :: AlterDB -> (Bool, Text)
- showAlterTable :: EntityNameDB -> AlterTable -> Text
- getAddReference :: [EntityDef] -> EntityDef -> FieldNameDB -> ColumnReference -> Maybe AlterDB
- udToPair :: UniqueDef -> (ConstraintNameDB, [FieldNameDB])
- safeToRemove :: EntityDef -> FieldNameDB -> Bool
- postgresMkColumns :: [EntityDef] -> EntityDef -> ([Column], [UniqueDef], [ForeignDef])
- getAlters :: [EntityDef] -> EntityDef -> ([Column], [(ConstraintNameDB, [FieldNameDB])]) -> ([Column], [(ConstraintNameDB, [FieldNameDB])]) -> ([AlterColumn], [AlterTable])
- escapeE :: EntityNameDB -> Text
- escapeF :: FieldNameDB -> Text
- escape :: Text -> Text
Documentation
Newtype used to avoid orphan instances for postgresql-simple
classes.
Since: 2.13.2.0
Constructors
P | |
Fields
|
newtype PgInterval Source #
Represent Postgres interval using NominalDiffTime
Since: 2.11.0.0
Constructors
PgInterval | |
Fields |
Instances
Show PgInterval Source # | |
Defined in Database.Persist.Postgresql.Internal Methods showsPrec :: Int -> PgInterval -> ShowS # show :: PgInterval -> String # showList :: [PgInterval] -> ShowS # | |
Eq PgInterval Source # | |
Defined in Database.Persist.Postgresql.Internal | |
PersistField PgInterval Source # | |
Defined in Database.Persist.Postgresql.Internal Methods toPersistValue :: PgInterval -> PersistValue # fromPersistValue :: PersistValue -> Either Text PgInterval # | |
PersistFieldSql PgInterval Source # | |
Defined in Database.Persist.Postgresql.Internal Methods sqlType :: Proxy PgInterval -> SqlType # | |
FromField PgInterval Source # | |
Defined in Database.Persist.Postgresql.Internal Methods | |
ToField PgInterval Source # | |
Defined in Database.Persist.Postgresql.Internal Methods toField :: PgInterval -> Action # |
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 PersistBool
s.
Since: 2.13.2.0
Represents a change to a Postgres DB in a statement.
Since: 2.17.1.0
Constructors
AddTable EntityNameDB EntityIdDef [Column] | |
AlterColumn EntityNameDB AlterColumn | |
AlterTable EntityNameDB AlterTable |
data AlterTable Source #
Represents a change to a Postgres table in a DB statement.
Since: 2.17.1.0
Instances
Show AlterTable Source # | |
Defined in Database.Persist.Postgresql.Internal Methods showsPrec :: Int -> AlterTable -> ShowS # show :: AlterTable -> String # showList :: [AlterTable] -> ShowS # | |
Eq AlterTable Source # | |
Defined in Database.Persist.Postgresql.Internal |
data AlterColumn Source #
Represents a change to a Postgres column in a DB statement.
Since: 2.17.1.0
Constructors
Instances
Show AlterColumn Source # | |
Defined in Database.Persist.Postgresql.Internal Methods showsPrec :: Int -> AlterColumn -> ShowS # show :: AlterColumn -> String # showList :: [AlterColumn] -> ShowS # | |
Eq AlterColumn Source # | |
Defined in Database.Persist.Postgresql.Internal |
data SafeToRemove Source #
Indicates whether a Postgres Column is safe to drop.
Since: 2.17.1.0
Instances
Show SafeToRemove Source # | |
Defined in Database.Persist.Postgresql.Internal Methods showsPrec :: Int -> SafeToRemove -> ShowS # show :: SafeToRemove -> String # showList :: [SafeToRemove] -> ShowS # | |
Eq SafeToRemove Source # | |
Defined in Database.Persist.Postgresql.Internal |
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
showSqlType :: SqlType -> Text Source #
showColumn :: Column -> Text Source #
showAlter :: EntityNameDB -> AlterColumn -> Text Source #
showAlterTable :: EntityNameDB -> AlterTable -> Text Source #
getAddReference :: [EntityDef] -> EntityDef -> FieldNameDB -> ColumnReference -> Maybe AlterDB Source #
Get the references to be added to a table for the given column.
udToPair :: UniqueDef -> (ConstraintNameDB, [FieldNameDB]) Source #
safeToRemove :: EntityDef -> FieldNameDB -> Bool Source #
Check if a column name is listed as the "safe to remove" in the entity list.
postgresMkColumns :: [EntityDef] -> EntityDef -> ([Column], [UniqueDef], [ForeignDef]) Source #
getAlters :: [EntityDef] -> EntityDef -> ([Column], [(ConstraintNameDB, [FieldNameDB])]) -> ([Column], [(ConstraintNameDB, [FieldNameDB])]) -> ([AlterColumn], [AlterTable]) Source #
escapeE :: EntityNameDB -> Text Source #
escapeF :: FieldNameDB -> Text Source #