beam-postgres-0.5.4.1: Connection layer between beam and postgres
Safe HaskellNone
LanguageHaskell2010

Database.Beam.Postgres.Migrate

Description

Migrations support for beam-postgres. See Database.Beam.Migrate for more information on beam migrations.

Synopsis

Documentation

data PgCommandSyntax Source #

Representation of an arbitrary Postgres command. This is the combination of the command syntax (repesented by PgSyntax), as well as the type of command (represented by PgCommandType). The command type is necessary for us to know how to retrieve results from the database.

Instances

Instances details
IsSql92Syntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

Associated Types

type Sql92SelectSyntax PgCommandSyntax 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92SelectSyntax PgCommandSyntax = PgSelectSyntax
type Sql92InsertSyntax PgCommandSyntax 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92InsertSyntax PgCommandSyntax = PgInsertSyntax
type Sql92UpdateSyntax PgCommandSyntax 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92UpdateSyntax PgCommandSyntax = PgUpdateSyntax
type Sql92DeleteSyntax PgCommandSyntax 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DeleteSyntax PgCommandSyntax = PgDeleteSyntax

Methods

selectCmd :: Sql92SelectSyntax PgCommandSyntax -> PgCommandSyntax

insertCmd :: Sql92InsertSyntax PgCommandSyntax -> PgCommandSyntax

updateCmd :: Sql92UpdateSyntax PgCommandSyntax -> PgCommandSyntax

deleteCmd :: Sql92DeleteSyntax PgCommandSyntax -> PgCommandSyntax

IsSql92DdlCommandSyntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

Associated Types

type Sql92DdlCommandCreateTableSyntax PgCommandSyntax 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DdlCommandCreateTableSyntax PgCommandSyntax = PgCreateTableSyntax
type Sql92DdlCommandAlterTableSyntax PgCommandSyntax 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DdlCommandAlterTableSyntax PgCommandSyntax = PgAlterTableSyntax
type Sql92DdlCommandDropTableSyntax PgCommandSyntax 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DdlCommandDropTableSyntax PgCommandSyntax

Methods

createTableCmd :: Sql92DdlCommandCreateTableSyntax PgCommandSyntax -> PgCommandSyntax

dropTableCmd :: Sql92DdlCommandDropTableSyntax PgCommandSyntax -> PgCommandSyntax

alterTableCmd :: Sql92DdlCommandAlterTableSyntax PgCommandSyntax -> PgCommandSyntax

IsSql92DdlSchemaCommandSyntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

Associated Types

type Sql92DdlCommandCreateSchemaSyntax PgCommandSyntax 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DdlCommandCreateSchemaSyntax PgCommandSyntax
type Sql92DdlCommandDropSchemaSyntax PgCommandSyntax 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DdlCommandDropSchemaSyntax PgCommandSyntax

Methods

createSchemaCmd :: Sql92DdlCommandCreateSchemaSyntax PgCommandSyntax -> PgCommandSyntax

dropSchemaCmd :: Sql92DdlCommandDropSchemaSyntax PgCommandSyntax -> PgCommandSyntax

type Sql92DeleteSyntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DeleteSyntax PgCommandSyntax = PgDeleteSyntax
type Sql92InsertSyntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92InsertSyntax PgCommandSyntax = PgInsertSyntax
type Sql92SelectSyntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92SelectSyntax PgCommandSyntax = PgSelectSyntax
type Sql92UpdateSyntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92UpdateSyntax PgCommandSyntax = PgUpdateSyntax
type Sql92DdlCommandAlterTableSyntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DdlCommandAlterTableSyntax PgCommandSyntax = PgAlterTableSyntax
type Sql92DdlCommandCreateSchemaSyntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DdlCommandCreateSchemaSyntax PgCommandSyntax
type Sql92DdlCommandCreateTableSyntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DdlCommandCreateTableSyntax PgCommandSyntax = PgCreateTableSyntax
type Sql92DdlCommandDropSchemaSyntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DdlCommandDropSchemaSyntax PgCommandSyntax
type Sql92DdlCommandDropTableSyntax PgCommandSyntax Source # 
Instance details

Defined in Database.Beam.Postgres.Syntax

type Sql92DdlCommandDropTableSyntax PgCommandSyntax

migrationBackend :: BeamMigrationBackend Postgres 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.

getDbConstraints :: Connection -> IO [SomeDatabasePredicate] Source #

getDbConstraintsForSchemas :: Maybe [String] -> Connection -> IO [SomeDatabasePredicate] Source #

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 Postgres () 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 Postgres () a -> IO () Source #

Write the migration given by the MigrationSteps to a file.

Postgres data types

tsquery :: DataType Postgres TsQuery Source #

DataType for tsquery. See TsQuery for more information

tsvector :: DataType Postgres TsVector Source #

DataType for tsvector. See TsVector for more information

text :: DataType Postgres Text Source #

DataType for Postgres TEXT. characterLargeObject is also mapped to this data type

bytea :: DataType Postgres ByteString Source #

DataType for Postgres BYTEA. binaryLargeObject is also mapped to this data type

unboundedArray :: Typeable a => DataType Postgres a -> DataType Postgres (Vector a) Source #

DataType for a Postgres array without any bounds.

Note that array support in beam-migrate is still incomplete.

uuid :: DataType Postgres UUID Source #

DataType for UUID columns. The pgCryptoGenRandomUUID function in the PgCrypto extension can be used to generate UUIDs at random.

money :: DataType Postgres PgMoney Source #

DataType for MONEY columns.

json :: (ToJSON a, FromJSON a) => DataType Postgres (PgJSON a) Source #

DataType for JSON. See PgJSON for more information

jsonb :: (ToJSON a, FromJSON a) => DataType Postgres (PgJSONB a) Source #

DataType for JSONB. See PgJSON for more information

smallserial :: Integral a => DataType Postgres (SqlSerial a) Source #

Postgres SERIAL data types. Automatically generates an appropriate DEFAULT clause and sequence

serial :: Integral a => DataType Postgres (SqlSerial a) Source #

Postgres SERIAL data types. Automatically generates an appropriate DEFAULT clause and sequence

bigserial :: Integral a => DataType Postgres (SqlSerial a) Source #

Postgres SERIAL data types. Automatically generates an appropriate DEFAULT clause and sequence

box :: DataType Postgres PgBox Source #

Orphan instances

BeamSqlBackendHasSerial Postgres Source # 
Instance details

Methods

genericSerial :: FieldReturnType 'True 'False Postgres (SqlSerial Int) a => Text -> a