DBIO::SQLite

SQLite driver for DBIO (fork of DBIx::Class::Storage::DBI::SQLite).

Supports

Usage

package MyApp::DB;
use base 'DBIO::Schema';
__PACKAGE__->load_components('SQLite');

my $schema = MyApp::DB->connect('dbi:SQLite:myapp.db');

For in-memory testing:

my $schema = MyApp::DB->connect('dbi:SQLite::memory:');

DBIO core autodetects dbi:SQLite: DSNs and loads this storage automatically.

SQLite Features

Types

SQLite JSON (version 3.38+)

Full-Text Search (FTS5)

Indexes

SQLite-Specific Features

Introspection

Deploy

DBIO::SQLite::Deploy orchestrates test-deploy-and-compare:

  1. Introspect live database via sqlite_master and PRAGMA (DBIO::SQLite::Introspect)
  2. Deploy desired schema to a temporary in-memory database (:memory:)
  3. Introspect the temporary database the same way
  4. Diff source vs target (DBIO::SQLite::Diff)

SQLite's :memory: database makes deploy testing extremely fast - no cleanup needed.

Install (install_ddl) creates fresh schema. Upgrade diffs live vs. desired.

Testing

export DBIO_TEST_SQLITE_DSN="dbi:SQLite::memory:"
prove -l t/

SQLite is ideal for testing because :memory: requires no server process. Offline tests (t/00-load.t) run without any database.

Requirements

See Also

DBIO::Introspect::Base, DBIO::Diff::Base, DBIO::Deploy

Repository

https://codeberg.org/dbio/dbio-sqlite