Safe Haskell | None |
---|---|
Language | Haskell2010 |
Migrations support for SQLite databases
Synopsis
- migrationBackend :: BeamMigrationBackend Sqlite SqliteM
- data SqliteCommandSyntax
- migrateScript :: MigrationSteps Sqlite () a -> [ ByteString ]
- writeMigrationScript :: FilePath -> MigrationSteps Sqlite () a -> IO ()
- sqlitePredConverter :: HaskellPredicateConverter
- sqliteTypeToHs :: SqliteDataTypeSyntax -> Maybe HsDataType
- getDbConstraints :: SqliteM [ SomeDatabasePredicate ]
- sqliteText :: DataType Sqlite Text
- sqliteBlob :: DataType Sqlite ByteString
- sqliteBigInt :: DataType Sqlite Int64
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
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'ByteString
s. 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.