NAME
DBIO::DB2::DDL - Generate DB2 DDL from DBIO Result classes
VERSION
version 0.900000
DESCRIPTION
DBIO::DB2::DDL generates a DB2 DDL script from a DBIO::Schema class hierarchy. It is the desired-state side of the test-deploy-and- compare strategy used by DBIO::DB2::Deploy.
my $ddl = DBIO::DB2::DDL->install_ddl($schema_class_or_instance);
The output is plain SQL, suitable for executing one statement at a time against a fresh DB2 database. Emits CREATE TABLE (inline columns, primary key and named FOREIGN KEY constraints) and CREATE INDEX.
Foreign keys are emitted as named inline constraints (CONSTRAINT fk_<table>_<cols> FOREIGN KEY ...) with a deterministic name derived from the relationship. DB2 enforces referential integrity, so the install DDL must carry the FKs; the deterministic name gives the live database and the throwaway compare schema the same stable constraint identity, which is what makes the name-based FK diff in DBIO::DB2::Diff::ForeignKey sound (see ADR 0005). New-table FKs are also rendered inline by DBIO::DB2::Diff::Table on the diff path.
METHODS
install_ddl
my $ddl = DBIO::DB2::DDL->install_ddl($schema);
Returns the full installation DDL as a single string.
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.