NAME

DBIO::ClickHouse::Test::Schema - ClickHouse-native test schema for the DBIO::ClickHouse live suite

VERSION

version 0.900004

SYNOPSIS

my $schema = DBIO::ClickHouse::Test->init_schema;
my $rs     = $schema->resultset('Hit');

DESCRIPTION

The test schema the DBIO::ClickHouse live suite deploys. It exists because the family-wide DBIO::Test::Schema cannot be the test schema for this driver -- see "WHY NOT DBIO::Test::Schema" -- and it is deliberately small: six sources, each of which is the only place one ClickHouse-specific decision gets deployed against a real server.

WHY NOT DBIO::Test::Schema

Every other driver distribution calls DBIO::Test->init_schema and gets DBIO::Test::Schema, the ~50-source fixture the family shares. DBIO::ClickHouse::Test does not, for four reasons in descending order of severity:

1. Its identity model is the one thing this driver documents as impossible. Nearly every source there has an integer is_auto_increment primary key. ClickHouse has no sequences and no identity columns, so DBIO::ClickHouse::DDL emits no default for such a column and "last_insert_id" in DBIO::ClickHouse::Storage throws by design. A schema whose $rs->create({ name => 'x' }) cannot work is not a fixture, it is a trap: the test would be exercising the error path while claiming to exercise the happy one.
2. It carries nothing this driver deploys and everything it drops. Foreign keys, unique constraints and standalone indexes are all silently omitted by the DDL layer (docs/adr/0004-no-foreign-keys.md), so the relationship-heavy half of that schema deploys to nothing at all -- while the part that would actually be interesting here, ENGINE and the MergeTree keys, is a concept it has no way to express.
3. A deploy round trip has to be clean to be worth anything. The whole premise of DBIO::ClickHouse::Deploy is that a freshly deployed schema diffs empty against itself. That is a strong statement about forty tables whose types were designed for SQLite, and a weak one about the handful of constructs ClickHouse actually has. Here it is the opposite: the schema is chosen so that a clean diff means every branch of the type map and every clickhouse_table clause survived the trip through system.*.
4. Live runs are rationed. ClickHouse has no in-memory mode, so every one of these tables is a real CREATE TABLE on a real server that the maintainer started by hand for one serial run. Forty of them per test file, none of which asserts anything ClickHouse-specific, is not a cost this suite gets to spend.

The offline half of the suite is unaffected -- it never deploys anything.

THE SOURCES

SEE ALSO

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.