selda-0.3.2.0: Multi-backend, high-level EDSL for interacting with SQL databases.

Safe HaskellNone
LanguageHaskell2010

Database.Selda.Validation

Description

Utilities for validating and inspecting Selda tables.

Synopsis

Documentation

data TableDiff Source #

A description of the difference between a schema and its corresponding database table.

Instances
Eq TableDiff Source # 
Instance details

Defined in Database.Selda.Validation

Show TableDiff Source # 
Instance details

Defined in Database.Selda.Validation

data TableName Source #

Name of a database table.

data ColName Source #

Name of a database column.

Instances
Eq ColName Source # 
Instance details

Defined in Database.Selda.Types

Methods

(==) :: ColName -> ColName -> Bool #

(/=) :: ColName -> ColName -> Bool #

Ord ColName Source # 
Instance details

Defined in Database.Selda.Types

Show ColName Source # 
Instance details

Defined in Database.Selda.Types

IsString ColName Source # 
Instance details

Defined in Database.Selda.Types

Methods

fromString :: String -> ColName #

data ColumnInfo Source #

Comprehensive information about a column.

columnInfo :: Table a -> [ColumnInfo] Source #

Get the column information for each column in the given table.

showTableDiff :: TableDiff -> Text Source #

Pretty-print a table diff.

showColumnDiff :: ColumnDiff -> Text Source #

Pretty-print a column diff.

describeTable :: MonadSelda m => TableName -> m [ColumnInfo] Source #

Get a description of the table by the given name currently in the database.

diffTable :: MonadSelda m => Table a -> m TableDiff Source #

Check the given table for consistency with the current database, returning a description of all inconsistencies found. The table schema itself is not validated beforehand.

diffTables :: Table a -> Table b -> TableDiff Source #

Compute the difference between the two given tables. The first table is considered to be the schema, and the second the database.

validateTable :: MonadSelda m => Table a -> m () Source #

Validate a table schema, and check it for consistency against the current database. Throws a ValidationError if the schema does not validate, or if inconsistencies were found.

validateSchema :: MonadThrow m => Table a -> m () Source #

Ensure that the schema of the given table is valid. Does not ensure consistency with the current database.