Copyright | Flipstone Technology Partners 2023 |
---|---|
License | MIT |
Stability | Stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Since: 1.0.0.0
Synopsis
- data TableConstraint
- uniqueConstraint :: NonEmpty ColumnName -> TableConstraint
- foreignKeyConstraint :: NonEmpty ColumnName -> Qualified TableName -> NonEmpty ColumnName -> Maybe ForeignKeyUpdateActionExpr -> Maybe ForeignKeyDeleteActionExpr -> TableConstraint
- data ForeignKeyActionExpr
- restrictExpr :: ForeignKeyActionExpr
- cascadeExpr :: ForeignKeyActionExpr
- setNullExpr :: ForeignKeyActionExpr
- setDefaultExpr :: ForeignKeyActionExpr
- data ForeignKeyDeleteActionExpr
- foreignKeyDeleteActionExpr :: ForeignKeyActionExpr -> ForeignKeyDeleteActionExpr
- data ForeignKeyUpdateActionExpr
- foreignKeyUpdateActionExpr :: ForeignKeyActionExpr -> ForeignKeyUpdateActionExpr
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
Instances
uniqueConstraint :: NonEmpty ColumnName -> TableConstraint Source #
Constructs a TableConstraint
will create a UNIQUE
constraint on the
given columns.
Since: 1.0.0.0
:: 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 |
-> Maybe ForeignKeyDeleteActionExpr | An optional |
-> 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
Instances
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