Safe Haskell | None |
---|---|
Language | Haskell2010 |
Migrations support for SQLite databases
- migrationBackend :: BeamMigrationBackend SqliteCommandSyntax Sqlite Connection SqliteM
- migrateScript :: MigrationSteps SqliteCommandSyntax () a -> [ByteString]
- writeMigrationScript :: FilePath -> MigrationSteps SqliteCommandSyntax () a -> IO ()
- sqlitePredConverter :: HaskellPredicateConverter
- sqliteTypeToHs :: SqliteDataTypeSyntax -> Maybe HsDataType
- getDbConstraints :: SqliteM [SomeDatabasePredicate]
- sqliteText :: DataType SqliteDataTypeSyntax Text
- sqliteBlob :: DataType SqliteDataTypeSyntax ByteString
- sqliteBigInt :: DataType SqliteDataTypeSyntax Int64
beam-migrate
CLI support
migrationBackend :: BeamMigrationBackend SqliteCommandSyntax Sqlite Connection SqliteM Source #
Top-level BeamMigrationBackend
loaded dynamically by the
beam-migrate
CLI tool.
beam-migrate
utility functions
migrateScript :: MigrationSteps SqliteCommandSyntax () 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 SqliteCommandSyntax () 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.