Safe Haskell | None |
---|---|
Language | Haskell2010 |
Finally-tagless encoding of SQL92 DDL commands.
If you're writing a beam backend driver and you want to support migrations,
making an instance of your command syntax for IsSql92DdlCommandSyntax
and
making it satisfy Sql92SaneDdlCommandSyntax
.
Synopsis
- type Sql92SaneDdlCommandSyntax cmd = (Sql92SaneDdlCommandSyntaxMigrateOnly cmd, Sql92ExpressionCastTargetSyntax (Sql92ExpressionSyntax cmd) ~ Sql92DdlCommandDataTypeSyntax cmd, Sql92ColumnSchemaExpressionSyntax (Sql92DdlCommandColumnSchemaSyntax cmd) ~ Sql92ExpressionSyntax cmd)
- type Sql92SaneDdlCommandSyntaxMigrateOnly cmd = (IsSql92DdlCommandSyntax cmd, Sql92SerializableDataTypeSyntax (Sql92DdlCommandDataTypeSyntax cmd), Sql92SerializableConstraintDefinitionSyntax (Sql92DdlCommandConstraintDefinitionSyntax cmd), Typeable (Sql92DdlCommandColumnSchemaSyntax cmd), Sql92AlterTableColumnSchemaSyntax (Sql92AlterTableAlterTableActionSyntax (Sql92DdlCommandAlterTableSyntax cmd)) ~ Sql92CreateTableColumnSchemaSyntax (Sql92DdlCommandCreateTableSyntax cmd))
- type Sql92DdlCommandDataTypeSyntax syntax = Sql92ColumnSchemaColumnTypeSyntax (Sql92DdlCommandColumnSchemaSyntax syntax)
- type Sql92DdlCommandColumnSchemaSyntax syntax = Sql92CreateTableColumnSchemaSyntax (Sql92DdlCommandCreateTableSyntax syntax)
- type Sql92DdlCommandConstraintDefinitionSyntax syntax = Sql92ColumnSchemaColumnConstraintDefinitionSyntax (Sql92DdlCommandColumnSchemaSyntax syntax)
- type Sql92DdlColumnSchemaConstraintSyntax syntax = Sql92ColumnConstraintDefinitionConstraintSyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax syntax)
- type Sql92DdlCommandColumnConstraintSyntax syntax = Sql92DdlColumnSchemaConstraintSyntax (Sql92DdlCommandColumnSchemaSyntax syntax)
- type Sql92DdlCommandMatchTypeSyntax syntax = Sql92ColumnConstraintMatchTypeSyntax (Sql92DdlCommandColumnConstraintSyntax syntax)
- type Sql92DdlCommandReferentialActionSyntax syntax = Sql92ColumnConstraintReferentialActionSyntax (Sql92DdlCommandColumnConstraintSyntax syntax)
- type Sql92DdlCommandConstraintAttributesSyntax syntax = Sql92ColumnConstraintDefinitionAttributesSyntax (Sql92DdlCommandConstraintDefinitionSyntax syntax)
- type Sql92DdlCommandAlterTableActionSyntax syntax = Sql92AlterTableAlterTableActionSyntax (Sql92DdlCommandAlterTableSyntax syntax)
- class (IsSql92CreateTableSyntax (Sql92DdlCommandCreateTableSyntax syntax), IsSql92DropTableSyntax (Sql92DdlCommandDropTableSyntax syntax), IsSql92AlterTableSyntax (Sql92DdlCommandAlterTableSyntax syntax)) => IsSql92DdlCommandSyntax syntax where
- type Sql92DdlCommandCreateTableSyntax syntax :: *
- type Sql92DdlCommandAlterTableSyntax syntax :: *
- type Sql92DdlCommandDropTableSyntax syntax :: *
- createTableCmd :: Sql92DdlCommandCreateTableSyntax syntax -> syntax
- dropTableCmd :: Sql92DdlCommandDropTableSyntax syntax -> syntax
- alterTableCmd :: Sql92DdlCommandAlterTableSyntax syntax -> syntax
- class (IsSql92TableConstraintSyntax (Sql92CreateTableTableConstraintSyntax syntax), IsSql92ColumnSchemaSyntax (Sql92CreateTableColumnSchemaSyntax syntax), IsSql92TableNameSyntax (Sql92CreateTableTableNameSyntax syntax)) => IsSql92CreateTableSyntax syntax where
- type Sql92CreateTableTableNameSyntax syntax :: *
- type Sql92CreateTableColumnSchemaSyntax syntax :: *
- type Sql92CreateTableTableConstraintSyntax syntax :: *
- type Sql92CreateTableOptionsSyntax syntax :: *
- createTableSyntax :: Maybe (Sql92CreateTableOptionsSyntax syntax) -> Sql92CreateTableTableNameSyntax syntax -> [(Text, Sql92CreateTableColumnSchemaSyntax syntax)] -> [Sql92CreateTableTableConstraintSyntax syntax] -> syntax
- class IsSql92TableNameSyntax (Sql92DropTableTableNameSyntax syntax) => IsSql92DropTableSyntax syntax where
- type Sql92DropTableTableNameSyntax syntax :: *
- dropTableSyntax :: Sql92DropTableTableNameSyntax syntax -> syntax
- class (IsSql92TableNameSyntax (Sql92AlterTableTableNameSyntax syntax), IsSql92AlterTableActionSyntax (Sql92AlterTableAlterTableActionSyntax syntax)) => IsSql92AlterTableSyntax syntax where
- type Sql92AlterTableTableNameSyntax syntax :: *
- type Sql92AlterTableAlterTableActionSyntax syntax :: *
- alterTableSyntax :: Sql92AlterTableTableNameSyntax syntax -> Sql92AlterTableAlterTableActionSyntax syntax -> syntax
- class (IsSql92ColumnSchemaSyntax (Sql92AlterTableColumnSchemaSyntax syntax), IsSql92AlterColumnActionSyntax (Sql92AlterTableAlterColumnActionSyntax syntax)) => IsSql92AlterTableActionSyntax syntax where
- type Sql92AlterTableAlterColumnActionSyntax syntax :: *
- type Sql92AlterTableColumnSchemaSyntax syntax :: *
- alterColumnSyntax :: Text -> Sql92AlterTableAlterColumnActionSyntax syntax -> syntax
- addColumnSyntax :: Text -> Sql92AlterTableColumnSchemaSyntax syntax -> syntax
- dropColumnSyntax :: Text -> syntax
- renameTableToSyntax :: Text -> syntax
- renameColumnToSyntax :: Text -> Text -> syntax
- class IsSql92AlterColumnActionSyntax syntax where
- setNotNullSyntax, setNullSyntax :: syntax
- class (IsSql92ColumnConstraintDefinitionSyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), IsSql92DataTypeSyntax (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Typeable (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Sql92DisplaySyntax (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Hashable (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Eq (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Sql92DisplaySyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), Eq (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), Hashable (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), IsSql92ExpressionSyntax (Sql92ColumnSchemaExpressionSyntax columnSchema), Typeable columnSchema, Sql92DisplaySyntax columnSchema, Eq columnSchema, Hashable columnSchema) => IsSql92ColumnSchemaSyntax columnSchema where
- type Sql92ColumnSchemaColumnTypeSyntax columnSchema :: *
- type Sql92ColumnSchemaExpressionSyntax columnSchema :: *
- type Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema :: *
- columnSchemaSyntax :: Sql92ColumnSchemaColumnTypeSyntax columnSchema -> Maybe (Sql92ColumnSchemaExpressionSyntax columnSchema) -> [Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema] -> Maybe Text -> columnSchema
- class Typeable constraint => IsSql92TableConstraintSyntax constraint where
- primaryKeyConstraintSyntax :: [Text] -> constraint
- class Typeable match => IsSql92MatchTypeSyntax match where
- fullMatchSyntax :: match
- partialMatchSyntax :: match
- class Typeable refAction => IsSql92ReferentialActionSyntax refAction where
- referentialActionCascadeSyntax :: refAction
- referentialActionSetNullSyntax :: refAction
- referentialActionSetDefaultSyntax :: refAction
- referentialActionNoActionSyntax :: refAction
- class (IsSql92ColumnConstraintSyntax (Sql92ColumnConstraintDefinitionConstraintSyntax constraint), IsSql92ConstraintAttributesSyntax (Sql92ColumnConstraintDefinitionAttributesSyntax constraint), Typeable constraint) => IsSql92ColumnConstraintDefinitionSyntax constraint where
- type Sql92ColumnConstraintDefinitionConstraintSyntax constraint :: *
- type Sql92ColumnConstraintDefinitionAttributesSyntax constraint :: *
- constraintDefinitionSyntax :: Maybe Text -> Sql92ColumnConstraintDefinitionConstraintSyntax constraint -> Maybe (Sql92ColumnConstraintDefinitionAttributesSyntax constraint) -> constraint
- class (Semigroup attrs, Monoid attrs, Typeable attrs) => IsSql92ConstraintAttributesSyntax attrs where
- initiallyDeferredAttributeSyntax :: attrs
- initiallyImmediateAttributeSyntax :: attrs
- notDeferrableAttributeSyntax :: attrs
- deferrableAttributeSyntax :: attrs
- class (IsSql92MatchTypeSyntax (Sql92ColumnConstraintMatchTypeSyntax constraint), IsSql92ReferentialActionSyntax (Sql92ColumnConstraintReferentialActionSyntax constraint), Typeable (Sql92ColumnConstraintExpressionSyntax constraint), Typeable constraint) => IsSql92ColumnConstraintSyntax constraint where
- type Sql92ColumnConstraintMatchTypeSyntax constraint :: *
- type Sql92ColumnConstraintReferentialActionSyntax constraint :: *
- type Sql92ColumnConstraintExpressionSyntax constraint :: *
- notNullConstraintSyntax :: constraint
- uniqueColumnConstraintSyntax :: constraint
- primaryKeyColumnConstraintSyntax :: constraint
- checkColumnConstraintSyntax :: Sql92ColumnConstraintExpressionSyntax constraint -> constraint
- referencesConstraintSyntax :: Text -> [Text] -> Maybe (Sql92ColumnConstraintMatchTypeSyntax constraint) -> Maybe (Sql92ColumnConstraintReferentialActionSyntax constraint) -> Maybe (Sql92ColumnConstraintReferentialActionSyntax constraint) -> constraint
- class Sql92SerializableDataTypeSyntax dataType where
- serializeDataType :: dataType -> Value
- class Sql92SerializableConstraintDefinitionSyntax constraint where
- serializeConstraint :: constraint -> Value
Convenience type synonyms
type Sql92SaneDdlCommandSyntax cmd = (Sql92SaneDdlCommandSyntaxMigrateOnly cmd, Sql92ExpressionCastTargetSyntax (Sql92ExpressionSyntax cmd) ~ Sql92DdlCommandDataTypeSyntax cmd, Sql92ColumnSchemaExpressionSyntax (Sql92DdlCommandColumnSchemaSyntax cmd) ~ Sql92ExpressionSyntax cmd) Source #
Syntax equalities that any reasonable DDL syntax would follow, including equalities between beam-migrate and beam-core types.
type Sql92SaneDdlCommandSyntaxMigrateOnly cmd = (IsSql92DdlCommandSyntax cmd, Sql92SerializableDataTypeSyntax (Sql92DdlCommandDataTypeSyntax cmd), Sql92SerializableConstraintDefinitionSyntax (Sql92DdlCommandConstraintDefinitionSyntax cmd), Typeable (Sql92DdlCommandColumnSchemaSyntax cmd), Sql92AlterTableColumnSchemaSyntax (Sql92AlterTableAlterTableActionSyntax (Sql92DdlCommandAlterTableSyntax cmd)) ~ Sql92CreateTableColumnSchemaSyntax (Sql92DdlCommandCreateTableSyntax cmd)) Source #
Syntax equalities for any reasonable DDL syntax, only including types defined here.
type Sql92DdlCommandDataTypeSyntax syntax = Sql92ColumnSchemaColumnTypeSyntax (Sql92DdlCommandColumnSchemaSyntax syntax) Source #
type Sql92DdlCommandColumnSchemaSyntax syntax = Sql92CreateTableColumnSchemaSyntax (Sql92DdlCommandCreateTableSyntax syntax) Source #
type Sql92DdlCommandConstraintDefinitionSyntax syntax = Sql92ColumnSchemaColumnConstraintDefinitionSyntax (Sql92DdlCommandColumnSchemaSyntax syntax) Source #
type Sql92DdlColumnSchemaConstraintSyntax syntax = Sql92ColumnConstraintDefinitionConstraintSyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax syntax) Source #
type Sql92DdlCommandColumnConstraintSyntax syntax = Sql92DdlColumnSchemaConstraintSyntax (Sql92DdlCommandColumnSchemaSyntax syntax) Source #
type Sql92DdlCommandMatchTypeSyntax syntax = Sql92ColumnConstraintMatchTypeSyntax (Sql92DdlCommandColumnConstraintSyntax syntax) Source #
type Sql92DdlCommandReferentialActionSyntax syntax = Sql92ColumnConstraintReferentialActionSyntax (Sql92DdlCommandColumnConstraintSyntax syntax) Source #
type Sql92DdlCommandConstraintAttributesSyntax syntax = Sql92ColumnConstraintDefinitionAttributesSyntax (Sql92DdlCommandConstraintDefinitionSyntax syntax) Source #
type Sql92DdlCommandAlterTableActionSyntax syntax = Sql92AlterTableAlterTableActionSyntax (Sql92DdlCommandAlterTableSyntax syntax) Source #
class (IsSql92CreateTableSyntax (Sql92DdlCommandCreateTableSyntax syntax), IsSql92DropTableSyntax (Sql92DdlCommandDropTableSyntax syntax), IsSql92AlterTableSyntax (Sql92DdlCommandAlterTableSyntax syntax)) => IsSql92DdlCommandSyntax syntax where Source #
type Sql92DdlCommandCreateTableSyntax syntax :: * Source #
type Sql92DdlCommandAlterTableSyntax syntax :: * Source #
type Sql92DdlCommandDropTableSyntax syntax :: * Source #
createTableCmd :: Sql92DdlCommandCreateTableSyntax syntax -> syntax Source #
dropTableCmd :: Sql92DdlCommandDropTableSyntax syntax -> syntax Source #
alterTableCmd :: Sql92DdlCommandAlterTableSyntax syntax -> syntax Source #
Instances
IsSql92DdlCommandSyntax SqlSyntaxBuilder Source # | |
IsSql92DdlCommandSyntax HsAction Source # | |
Defined in Database.Beam.Haskell.Syntax |
class (IsSql92TableConstraintSyntax (Sql92CreateTableTableConstraintSyntax syntax), IsSql92ColumnSchemaSyntax (Sql92CreateTableColumnSchemaSyntax syntax), IsSql92TableNameSyntax (Sql92CreateTableTableNameSyntax syntax)) => IsSql92CreateTableSyntax syntax where Source #
type Sql92CreateTableTableNameSyntax syntax :: * Source #
type Sql92CreateTableColumnSchemaSyntax syntax :: * Source #
type Sql92CreateTableTableConstraintSyntax syntax :: * Source #
type Sql92CreateTableOptionsSyntax syntax :: * Source #
createTableSyntax :: Maybe (Sql92CreateTableOptionsSyntax syntax) -> Sql92CreateTableTableNameSyntax syntax -> [(Text, Sql92CreateTableColumnSchemaSyntax syntax)] -> [Sql92CreateTableTableConstraintSyntax syntax] -> syntax Source #
Instances
IsSql92CreateTableSyntax SqlSyntaxBuilder Source # | |
Defined in Database.Beam.Migrate.SQL.Builder | |
IsSql92CreateTableSyntax HsAction Source # | |
Defined in Database.Beam.Haskell.Syntax |
class IsSql92TableNameSyntax (Sql92DropTableTableNameSyntax syntax) => IsSql92DropTableSyntax syntax where Source #
type Sql92DropTableTableNameSyntax syntax :: * Source #
dropTableSyntax :: Sql92DropTableTableNameSyntax syntax -> syntax Source #
Instances
IsSql92DropTableSyntax SqlSyntaxBuilder Source # | |
IsSql92DropTableSyntax HsAction Source # | |
Defined in Database.Beam.Haskell.Syntax type Sql92DropTableTableNameSyntax HsAction :: Type Source # |
class (IsSql92TableNameSyntax (Sql92AlterTableTableNameSyntax syntax), IsSql92AlterTableActionSyntax (Sql92AlterTableAlterTableActionSyntax syntax)) => IsSql92AlterTableSyntax syntax where Source #
type Sql92AlterTableTableNameSyntax syntax :: * Source #
type Sql92AlterTableAlterTableActionSyntax syntax :: * Source #
alterTableSyntax :: Sql92AlterTableTableNameSyntax syntax -> Sql92AlterTableAlterTableActionSyntax syntax -> syntax Source #
Instances
IsSql92AlterTableSyntax SqlSyntaxBuilder Source # | |
IsSql92AlterTableSyntax HsAction Source # | |
Defined in Database.Beam.Haskell.Syntax |
class (IsSql92ColumnSchemaSyntax (Sql92AlterTableColumnSchemaSyntax syntax), IsSql92AlterColumnActionSyntax (Sql92AlterTableAlterColumnActionSyntax syntax)) => IsSql92AlterTableActionSyntax syntax where Source #
type Sql92AlterTableAlterColumnActionSyntax syntax :: * Source #
type Sql92AlterTableColumnSchemaSyntax syntax :: * Source #
alterColumnSyntax :: Text -> Sql92AlterTableAlterColumnActionSyntax syntax -> syntax Source #
addColumnSyntax :: Text -> Sql92AlterTableColumnSchemaSyntax syntax -> syntax Source #
dropColumnSyntax :: Text -> syntax Source #
renameTableToSyntax :: Text -> syntax Source #
renameColumnToSyntax :: Text -> Text -> syntax Source #
Instances
class IsSql92AlterColumnActionSyntax syntax where Source #
setNotNullSyntax :: syntax Source #
setNullSyntax :: syntax Source #
class (IsSql92ColumnConstraintDefinitionSyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), IsSql92DataTypeSyntax (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Typeable (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Sql92DisplaySyntax (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Hashable (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Eq (Sql92ColumnSchemaColumnTypeSyntax columnSchema), Sql92DisplaySyntax (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), Eq (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), Hashable (Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema), IsSql92ExpressionSyntax (Sql92ColumnSchemaExpressionSyntax columnSchema), Typeable columnSchema, Sql92DisplaySyntax columnSchema, Eq columnSchema, Hashable columnSchema) => IsSql92ColumnSchemaSyntax columnSchema where Source #
type Sql92ColumnSchemaColumnTypeSyntax columnSchema :: * Source #
type Sql92ColumnSchemaExpressionSyntax columnSchema :: * Source #
type Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema :: * Source #
:: Sql92ColumnSchemaColumnTypeSyntax columnSchema | Column type |
-> Maybe (Sql92ColumnSchemaExpressionSyntax columnSchema) | Default value |
-> [Sql92ColumnSchemaColumnConstraintDefinitionSyntax columnSchema] | Column constraints |
-> Maybe Text | Default collation |
-> columnSchema |
Instances
IsSql92ColumnSchemaSyntax SqlSyntaxBuilder Source # | |
IsSql92ColumnSchemaSyntax HsColumnSchema Source # | |
class Typeable constraint => IsSql92TableConstraintSyntax constraint where Source #
primaryKeyConstraintSyntax :: [Text] -> constraint Source #
Instances
IsSql92TableConstraintSyntax SqlSyntaxBuilder Source # | |
Defined in Database.Beam.Migrate.SQL.Builder | |
IsSql92TableConstraintSyntax HsTableConstraint Source # | |
Defined in Database.Beam.Haskell.Syntax |
class Typeable match => IsSql92MatchTypeSyntax match where Source #
fullMatchSyntax :: match Source #
partialMatchSyntax :: match Source #
class Typeable refAction => IsSql92ReferentialActionSyntax refAction where Source #
referentialActionCascadeSyntax :: refAction Source #
referentialActionSetNullSyntax :: refAction Source #
referentialActionSetDefaultSyntax :: refAction Source #
referentialActionNoActionSyntax :: refAction Source #
Instances
class (IsSql92ColumnConstraintSyntax (Sql92ColumnConstraintDefinitionConstraintSyntax constraint), IsSql92ConstraintAttributesSyntax (Sql92ColumnConstraintDefinitionAttributesSyntax constraint), Typeable constraint) => IsSql92ColumnConstraintDefinitionSyntax constraint where Source #
type Sql92ColumnConstraintDefinitionConstraintSyntax constraint :: * Source #
type Sql92ColumnConstraintDefinitionAttributesSyntax constraint :: * Source #
constraintDefinitionSyntax :: Maybe Text -> Sql92ColumnConstraintDefinitionConstraintSyntax constraint -> Maybe (Sql92ColumnConstraintDefinitionAttributesSyntax constraint) -> constraint Source #
Instances
class (Semigroup attrs, Monoid attrs, Typeable attrs) => IsSql92ConstraintAttributesSyntax attrs where Source #
initiallyDeferredAttributeSyntax :: attrs Source #
initiallyImmediateAttributeSyntax :: attrs Source #
notDeferrableAttributeSyntax :: attrs Source #
deferrableAttributeSyntax :: attrs Source #
Instances
class (IsSql92MatchTypeSyntax (Sql92ColumnConstraintMatchTypeSyntax constraint), IsSql92ReferentialActionSyntax (Sql92ColumnConstraintReferentialActionSyntax constraint), Typeable (Sql92ColumnConstraintExpressionSyntax constraint), Typeable constraint) => IsSql92ColumnConstraintSyntax constraint where Source #
type Sql92ColumnConstraintMatchTypeSyntax constraint :: * Source #
type Sql92ColumnConstraintReferentialActionSyntax constraint :: * Source #
type Sql92ColumnConstraintExpressionSyntax constraint :: * Source #
notNullConstraintSyntax :: constraint Source #
uniqueColumnConstraintSyntax :: constraint Source #
primaryKeyColumnConstraintSyntax :: constraint Source #
checkColumnConstraintSyntax :: Sql92ColumnConstraintExpressionSyntax constraint -> constraint Source #
referencesConstraintSyntax Source #
:: Text | |
-> [Text] | |
-> Maybe (Sql92ColumnConstraintMatchTypeSyntax constraint) | |
-> Maybe (Sql92ColumnConstraintReferentialActionSyntax constraint) | On update |
-> Maybe (Sql92ColumnConstraintReferentialActionSyntax constraint) | On delete |
-> constraint |
Instances
class Sql92SerializableDataTypeSyntax dataType where Source #
IsSql92DataTypeSyntax
es that can be serialized to JSON
serializeDataType :: dataType -> Value Source #
Instances
Sql92SerializableDataTypeSyntax HsDataType Source # | |
Defined in Database.Beam.Haskell.Syntax serializeDataType :: HsDataType -> Value Source # |
class Sql92SerializableConstraintDefinitionSyntax constraint where Source #
IsSql92ColumnConstraintDefinitionSyntax
es that can be serialized to JSON
serializeConstraint :: constraint -> Value Source #