NAME
DBIO::Informix::Deploy - Deploy and upgrade Informix schemas via test-deploy-and-compare
VERSION
version 0.900007
DESCRIPTION
DBIO::Informix::Deploy orchestrates schema deployment and upgrades for Informix using the test-deploy-and-compare strategy, parallel to DBIO::MySQL::Deploy and DBIO::PostgreSQL::Deploy.
The shared orchestration ("install" in DBIO::Deploy::Base, diff, apply, upgrade) is inherited from DBIO::Deploy::Base, the throwaway-database orchestration from DBIO::Deploy::Base::TempDatabase. Informix has no :memory: mode, so the desired schema is deployed into a throwaway database.
For upgrades the strategy is:
- 1. Introspect the live database via the
sys*catalog (source model) - 2. Create a throwaway database
WITH LOG, on a connection of its own that is connected to no database - 3. Deploy the desired DDL into it, on a second connection to that database. The DDL names no database: it is the one DBIO::Informix::DDL writes for the live database, and nothing in it can reach a live object.
- 4. Introspect the throwaway database the same way (target model)
- 5. Compute the diff between the two models via DBIO::Informix::Diff
- 6. Drop the throwaway database, also when the deploy or the introspection died
my $deploy = DBIO::Informix::Deploy->new(
schema => MyApp::DB->connect("dbi:Informix:myapp\@myserver"),
);
$deploy->install; # fresh
my $diff = $deploy->diff; # or step-by-step
$deploy->apply($diff) if $diff->has_changes;
$deploy->upgrade; # convenience
The live DSN has to be the form dbi:Informix:database[@server]; any other form is refused when the throwaway database is addressed. The connecting user needs the right to CREATE DATABASE and to drop what it created. The name is temp_db_prefix plus process id and time, so the database is not one of the user's.
A CREATE VIEW body is the user's SQL. It runs in the throwaway database, so it reads the objects of that database, not of the live one.
METHODS
_temp_dsn
The DSN of the throwaway database: the live DSN with the database replaced, the server kept.
_admin_dbh
CREATE DATABASE is refused on a connection to a database (error -759), so the statements run on a connection of their own to the server of the live DSN with no database, AutoCommit on, closed again when the build is done.
_create_temp_db
Creates the throwaway database WITH LOG and returns its name. The connection is in that database afterwards.
_drop_temp_db
The database that is open cannot be dropped (error -359), so the connection closes it first.
_deploy_and_introspect_temp
As in DBIO::Deploy::Base::TempDatabase, with DELIMIDENT set for the connect to the throwaway database as DBIO::Informix::Storage sets it, so quoted identifiers in the DDL are identifiers.
_check_before_apply
$self->_check_before_apply($diff);
The driver seam of "apply" in DBIO::Deploy::Base and upgrade (core ADR 0080): it runs once the diff is released and before the first statement, for a diff with changes, and puts the diff through "_refuse_unfillable" on the connection of the deployment. apply and upgrade are those of the base class: a diff with a drop or a possibly lossy change of a column runs with allow_destructive => 1.
_refuse_unfillable
$self->_refuse_unfillable($diff, $dbh);
Two changes the server refuses half way through the upgrade (with its own error, after earlier statements ran) are refused by the driver before the first statement, naming table and column:
a
NOT NULLcolumn without a default added to a table that holds rows (-269): there is no value for the rows already there;a column that becomes
NOT NULLover a table that holdsNULLs in it (-530).
The check asks the table; an empty table, or one without such a row, is not refused.
SEE ALSO
DBIO::Informix - schema component
DBIO::Informix::DDL - generates DDL
DBIO::Informix::Introspect - reads live database state
DBIO::Informix::Diff - compares two introspected models
DBIO::Deploy::Base::TempDatabase - shared throwaway-database orchestration
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.