NAME
DBIO::DuckDB::Test - DuckDB-specific test utilities for DBIO
VERSION
version 0.900007
SYNOPSIS
use DBIO::DuckDB::Test;
my $schema = DBIO::DuckDB::Test->init_schema;
my $rs = $schema->resultset('Artist');
DESCRIPTION
Extends DBIO::Test with DuckDB-specific test helpers for the DBIO::DuckDB driver distribution. Mirrors DBIO::SQLite::Test: driver tests call DBIO::DuckDB::Test->init_schema and get a connected, deployed schema backed by an in-memory DuckDB.
METHODS
_database
Returns ($dsn, $user, $pass, \%opts) for $schema->connect(). Honours DBIO_TEST_DUCKDB_DSN if set, otherwise uses dbi:DuckDB:dbname=:memory:.
The arguments are those of "init_schema". The ones that steer the helper itself (no_deploy, no_populate, storage_type, ...) are consumed here and left out of the connect attributes; everything else (quote_names, on_connect_do, AutoCommit, DBI attributes) is passed on to the connection.
init_schema
my $schema = DBIO::DuckDB::Test->init_schema(%opts);
Thin wrapper around "init_schema" in DBIO::Test. Fills in dsn and storage_type for DuckDB (honouring DBIO_TEST_DUCKDB_DSN) and then delegates to the core harness.
Core's deploy_schema calls $schema->deploy, which "deploy" in DBIO::Schema routes through dbio_deploy_class when set on the storage class -- so DuckDB deployment goes through DBIO::DuckDB::Deploy (the native test-and-compare path), not SQL::Translator. No extra install step needed here.
_without_unsupported_fk_actions
The shared core fixture declares CASCADE and SET NULL on some of its relationships, and DuckDB refuses those on a foreign key; the driver refuses them too, loudly, when it writes the DDL. So that the fixture can still be deployed here, the helper takes the actions DuckDB cannot do off the relationships of the schema it hands out -- on its own copy of the sources, the fixture classes stay as they are. A test of the refusal declares its own schema.
AUTHOR
DBIO Authors
COPYRIGHT AND LICENSE
Copyright (C) 2026 DBIO Authors
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.