| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Database.Beam.Postgres.Migrate
Description
Migrations support for beam-postgres. See Database.Beam.Migrate for more information on beam migrations.
Synopsis
- migrationBackend :: BeamMigrationBackend PgCommandSyntax Postgres Connection Pg
- postgresDataTypeDeserializers :: BeamDeserializers PgCommandSyntax
- pgPredConverter :: HaskellPredicateConverter
- getDbConstraints :: Connection -> IO [SomeDatabasePredicate]
- pgTypeToHs :: PgDataTypeSyntax -> Maybe HsDataType
- migrateScript :: MigrationSteps PgCommandSyntax () a' -> [ByteString]
- writeMigrationScript :: FilePath -> MigrationSteps PgCommandSyntax () a -> IO ()
- tsquery :: DataType PgDataTypeSyntax TsQuery
- tsvector :: DataType PgDataTypeSyntax TsVector
- text :: DataType PgDataTypeSyntax Text
- bytea :: DataType PgDataTypeSyntax ByteString
- unboundedArray :: forall a. Typeable a => DataType PgDataTypeSyntax a -> DataType PgDataTypeSyntax (Vector a)
- uuid :: DataType PgDataTypeSyntax UUID
- money :: DataType PgDataTypeSyntax PgMoney
- json :: (ToJSON a, FromJSON a) => DataType PgDataTypeSyntax (PgJSON a)
- jsonb :: (ToJSON a, FromJSON a) => DataType PgDataTypeSyntax (PgJSONB a)
- smallserial :: Integral a => DataType PgDataTypeSyntax (SqlSerial a)
- serial :: Integral a => DataType PgDataTypeSyntax (SqlSerial a)
- bigserial :: Integral a => DataType PgDataTypeSyntax (SqlSerial a)
Documentation
migrationBackend :: BeamMigrationBackend PgCommandSyntax Postgres Connection Pg Source #
Top-level migration backend for use by beam-migrate tools
pgPredConverter :: HaskellPredicateConverter Source #
Converts postgres DatabasePredicates to DatabasePredicates in the
Haskell syntax. Allows automatic generation of Haskell schemas from postgres
constraints.
pgTypeToHs :: PgDataTypeSyntax -> Maybe HsDataType Source #
Turn a PgDataTypeSyntax into the corresponding HsDataType. This is a
best effort guess, and may fail on more exotic types. Feel free to send PRs
to make this function more robust!
migrateScript :: MigrationSteps PgCommandSyntax () a' -> [ByteString] Source #
Turn a series of MigrationSteps into a line-by-line array of
ByteStrings suitable for writing to a script.
writeMigrationScript :: FilePath -> MigrationSteps PgCommandSyntax () a -> IO () Source #
Write the migration given by the MigrationSteps to a file.
Postgres data types
text :: DataType PgDataTypeSyntax Text Source #
DataType for Postgres TEXT. characterLargeObject is also mapped to
this data type
bytea :: DataType PgDataTypeSyntax ByteString Source #
DataType for Postgres BYTEA. binaryLargeObject is also mapped to
this data type
unboundedArray :: forall a. Typeable a => DataType PgDataTypeSyntax a -> DataType PgDataTypeSyntax (Vector a) Source #
DataType for a Postgres array without any bounds.
Note that array support in beam-migrate is still incomplete.
uuid :: DataType PgDataTypeSyntax UUID Source #
DataType for UUID columns. The pgCryptoGenRandomUUID function in
the PgCrypto extension can be used to generate UUIDs at random.
smallserial :: Integral a => DataType PgDataTypeSyntax (SqlSerial a) Source #
Postgres SERIAL data types. Automatically generates an appropriate
DEFAULT clause and sequence
serial :: Integral a => DataType PgDataTypeSyntax (SqlSerial a) Source #
Postgres SERIAL data types. Automatically generates an appropriate
DEFAULT clause and sequence
bigserial :: Integral a => DataType PgDataTypeSyntax (SqlSerial a) Source #
Postgres SERIAL data types. Automatically generates an appropriate
DEFAULT clause and sequence
Orphan instances
| IsBeamSerialColumnSchemaSyntax PgColumnSchemaSyntax Source # | |
Methods genericSerial :: FieldReturnType True False PgColumnSchemaSyntax (SqlSerial Int) a => Text -> a # | |