@hackage beam-sqlite0.7.0.0
Beam driver for SQLite
Categories
License
MIT
Maintainer
travis@athougies.net
Links
Versions
Installation
Dependencies (19)
- aeson >=0.11 && <2.4
- attoparsec >=0.13 && <0.15
- base >=4.11 && <5
- beam-core >=0.11 && <0.12
- beam-migrate >=0.6 && <0.7
- bytestring >=0.10 && <0.13 Show all…
Dependents (6)
@hackage/wikimusic-api, @hackage/acme-everything, @hackage/Shpadoinkle-examples, @hackage/beam-large-records, @hackage/imm, @cardano/freer-extras
Package Flags
werror
(off by default)
Enable -Werror during development
beam-sqlite: Beam backend for the SQLite embedded database
beam-sqlite is a beam backend for
the SQLite embedded database.
SQLite is mostly standards compliant, but there are a few cases that beam-sqlite cannot handle. These cases may result in run-time errors. For more information, see the documentation. Due to SQLite's embedded nature, there are currently no plans to get rid of these. However, proposals and PRs to fix these corner cases are welcome, where appropriate.
Migration support
beam-sqlite supports schema introspection and verification via
Database.Beam.Sqlite.Migrate, including:
- Tables, columns, and their types,
NOT NULLconstraints,- Primary keys,
- User-created secondary indices (via
PRAGMA index_list/PRAGMA index_info), - Foreign key constraints (via
PRAGMA foreign_key_list), includingON DELETE/ON UPDATEactions.
Declaring foreign keys
Use addTableForeignKey from beam-migrate to declare a foreign key on a
checked table entity:
let db = defaultMigratableDbSettings `withDbModification`
(dbModification @_ @Sqlite)
{ _orders =
addTableForeignKey (_customers db)
(\t -> selectorColumnName _order_customer_id t NE.:| [])
primaryKeyColumns
ForeignKeyNoAction -- ON UPDATE NO ACTION (default)
ForeignKeyActionCascade -- ON DELETE CASCADE
}
Note: SQLite disables foreign key enforcement by default. Issue
PRAGMA foreign_keys = ONon each connection (or set it in your open hook) to enable it at runtime.