beam-sqlite-0.5.2.0: Beam driver for SQLite
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.Beam.Sqlite.Migrate

Description

Migrations support for SQLite databases

Synopsis

beam-migrate CLI support

migrationBackend :: BeamMigrationBackend Sqlite SqliteM Source #

Top-level BeamMigrationBackend loaded dynamically by the beam-migrate CLI tool.

data SqliteCommandSyntax Source #

A SQLite command. INSERT is special cased to handle AUTO INCREMENT columns. The fromSqliteCommand function will take an SqliteCommandSyntax and convert it into the correct SqliteSyntax.

Instances

Instances details
IsSql92Syntax SqliteCommandSyntax Source # 
Instance details

Defined in Database.Beam.Sqlite.Syntax

IsSql92DdlCommandSyntax SqliteCommandSyntax Source # 
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92DeleteSyntax SqliteCommandSyntax Source # 
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92InsertSyntax SqliteCommandSyntax Source # 
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92SelectSyntax SqliteCommandSyntax Source # 
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92UpdateSyntax SqliteCommandSyntax Source # 
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92DdlCommandAlterTableSyntax SqliteCommandSyntax Source # 
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92DdlCommandCreateTableSyntax SqliteCommandSyntax Source # 
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92DdlCommandDropTableSyntax SqliteCommandSyntax Source # 
Instance details

Defined in Database.Beam.Sqlite.Syntax

beam-migrate utility functions

migrateScript :: MigrationSteps Sqlite () a -> [ByteString] Source #

Render a series of MigrationSteps in the SqliteCommandSyntax into a line-by-line list of lazy BL'ByteStrings. The output is suitable for inclusion in a migration script. Comments are generated giving a description of each migration step.

writeMigrationScript :: FilePath -> MigrationSteps Sqlite () a -> IO () Source #

Write the output of migrateScript to a file

sqlitePredConverter :: HaskellPredicateConverter Source #

HaskellPredicateConverter that can convert all constraints generated by getDbConstaints into their equivalent in the beam-migrate haskell syntax. Suitable for auto-generation of a haskell migration.

sqliteTypeToHs :: SqliteDataTypeSyntax -> Maybe HsDataType Source #

Convert a SQLite data type to the corresponding Haskell one

getDbConstraints :: SqliteM [SomeDatabasePredicate] Source #

Get a list of database predicates for the current database. This is beam's best guess at providing a schema for the current database. Note that SQLite type names are not standardized, and the so-called column "affinities" are too broad to be of use. This function attemps to guess a good enough type based on the exact type supplied in the CREATE TABLE commands. It will correctly parse any type generated by beam and most SQL compliant types, but it may falter on databases created or managed by tools that do not follow these standards.

SQLite-specific data types