orville-postgresql-1.0.0.0: A Haskell library for PostgreSQL
CopyrightFlipstone Technology Partners 2023
LicenseMIT
StabilityStable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Orville.PostgreSQL.Expr.TableConstraint

Description

Since: 1.0.0.0

Synopsis

Documentation

data TableConstraint Source #

Type to represent a table constraint that would be part of a CREATE TABLE or ALTER TABLE statement. For instance, the UNIQUE constraint in

CREATE TABLE FOO
 ( id integer
 , UNIQUE id
 )

TableConstraint provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

uniqueConstraint :: NonEmpty ColumnName -> TableConstraint Source #

Constructs a TableConstraint will create a UNIQUE constraint on the given columns.

Since: 1.0.0.0

foreignKeyConstraint Source #

Arguments

:: NonEmpty ColumnName

The names of the columns in the source table that form the foreign key.

-> Qualified TableName

The name of the table that the foreign key references.

-> NonEmpty ColumnName

The names of the columns in the foreign table that the foreign key references.

-> Maybe ForeignKeyUpdateActionExpr

An optional ON UPDATE foreign key action to perform.

-> Maybe ForeignKeyDeleteActionExpr

An optional ON DELETE foreign key action to perform.

-> TableConstraint 

Constructs a TableConstraint that represent a FOREIGN KEY constraint

Since: 1.0.0.0

data ForeignKeyActionExpr Source #

Type to represent a foreign key action on a FOREIGN KEY constraint. E.G. the CASCADE in

FOREIGN KEY (foo_id) REFERENCES foo (id) ON DELETE CASCADE

ForeignKeyActionExpr provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

restrictExpr :: ForeignKeyActionExpr Source #

The foreign key action RESTRICT.

Since: 1.0.0.0

cascadeExpr :: ForeignKeyActionExpr Source #

The foreign key action CASCADE.

Since: 1.0.0.0

setNullExpr :: ForeignKeyActionExpr Source #

The foreign key action SET NULL.

Since: 1.0.0.0

setDefaultExpr :: ForeignKeyActionExpr Source #

The foreign key action SET DEFAULT.

Since: 1.0.0.0

data ForeignKeyDeleteActionExpr Source #

Type to represent a foreign key update action on a FOREIGN KEY constraint. E.G. the ON DELETE RESTRICT in

FOREIGN KEY (foo_id) REFERENCES foo (id) ON DELETE RESTRICT

ForeignKeyDeleteActionExpr provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

foreignKeyDeleteActionExpr :: ForeignKeyActionExpr -> ForeignKeyDeleteActionExpr Source #

Constructs a ForeignKeyActionExpr that uses the given ForeignKeyActionExpr in an ON UPDATE clause for a foreign key.

Since: 1.0.0.0

data ForeignKeyUpdateActionExpr Source #

Type to represent a foreign key update action on a FOREIGN KEY constraint. E.G. the ON UPDATE RESTRICT in

FOREIGN KEY (foo_id) REFERENCES foo (id) ON UPDATE RESTRICT

ForeignKeyUpdateActionExpr provides a SqlExpression instance. See unsafeSqlExpression for how to construct a value with your own custom SQL.

Since: 1.0.0.0

foreignKeyUpdateActionExpr :: ForeignKeyActionExpr -> ForeignKeyUpdateActionExpr Source #

Constructs a ForeignKeyActionExpr that uses the given ForeignKeyActionExpr in an ON UPDATE clause for a foreign key.

Since: 1.0.0.0