NAME

DBIO::Schema::ModelCompiler - compile a base-type schema into one engine's native target model

VERSION

version 0.900004

SYNOPSIS

my $compiler = DBIO::Schema::ModelCompiler->new(adapter => $adapter);
my $model    = $compiler->compile($schema);

DESCRIPTION

Walks every source of a DBIO schema, normalises each column to its base type through "canonical_column" in DBIO::Schema::Type, and asks an adapter (see DBIO::Adapter::Base) for the engine-native type. The result is a plain target model for one engine.

METHODS

new

my $compiler = DBIO::Schema::ModelCompiler->new(adapter => $adapter);

Croaks unless adapter is given. All arguments are kept on the object.

adapter

Returns the adapter passed to "new".

compile

my $model = $compiler->compile($schema);

Returns { tables => { $table_name => $table, ... } }, one entry per source whose name is a plain string (virtual views with a scalar-ref name are skipped). Each $table is { table_name, columns => [...], primary_key => [...] }, and each column is { column_name, native_type, not_null, default, is_pk, auto_increment }, with native_type coming from the adapter's to_native.

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.