NAME

DBIO::SQLite - SQLite-specific schema management for DBIO

VERSION

version 0.900000

SYNOPSIS

Schema class

package MyApp::Schema;
use DBIO Schema => -sqlite;

The -sqlite shortcut pins +DBIO::SQLite::Storage as the storage type. It is equivalent to the explicit component form:

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

Result classes

package MyApp::Schema::Result::Artist;
use DBIO;

__PACKAGE__->table('artist');
__PACKAGE__->add_columns(
  id   => { data_type => 'integer', is_auto_increment => 1 },
  name => { data_type => 'varchar', size => 100 },
);
__PACKAGE__->set_primary_key('id');
__PACKAGE__->has_many(cds => 'MyApp::Schema::Result::CD', 'artist_id');

package MyApp::Schema::Result::CD;
use DBIO;

__PACKAGE__->table('cd');
__PACKAGE__->add_columns(
  id        => { data_type => 'integer', is_auto_increment => 1 },
  artist_id => { data_type => 'integer' },
  title     => { data_type => 'varchar', size => 200 },
);
__PACKAGE__->set_primary_key('id');
__PACKAGE__->belongs_to(artist => 'MyApp::Schema::Result::Artist', 'artist_id');

Connecting

my $schema = MyApp::Schema->connect('dbi:SQLite:db/app.db');
$schema->deploy;

my $artist = $schema->resultset('Artist')->create({ name => 'Sonic Youth' });
my @cds    = $artist->cds->all;

The classic use base form is still supported:

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

DESCRIPTION

DBIO::SQLite is the SQLite driver component for DBIO.

When this component is loaded into a schema class, connection() sets "storage_type" in DBIO::Schema to +DBIO::SQLite::Storage, which enables SQLite-specific storage behavior automatically.

METHODS

connection

Overrides "connection" in DBIO to force +DBIO::SQLite::Storage as storage_type.

MIGRATION NOTES

SQLite storage and SQLMaker classes were split out of the historical DBIx::Class monolithic distribution:

  • Old: DBIx::Class::Storage::DBI::SQLite

  • New: DBIO::SQLite::Storage

  • Old: DBIx::Class::SQLMaker::SQLite

  • New: DBIO::SQLite::SQLMaker

If DBIO-SQLite is installed, core DBIO::Storage::DBI can autodetect SQLite DSNs and load the new storage class via the driver registry.

TESTING

SQLite tests in this distribution use in-memory databases and do not require database credentials.

Offline SQLMaker tests can use DBIO::SQLite::Test or DBIO::Test with:

storage_type => 'DBIO::SQLite::Storage'

Shared tests can also exercise the replicated path with:

replicated   => 1,
storage_type => 'DBIO::SQLite::Storage'

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.