The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Tangram::Deploy - prepare a database for use with a Schema

SYNOPSIS

        use Tangram::Core;
        use Tangram::Deploy;

        $schema = Tangram::Schema->new( $hashref );

        # deploy to opened DBI handle
        $dbh = DBI->connect(...);
        $schema->deploy($dbh, $schema);

        # write SQL to FILE
        $schema->deploy( \*FILE );

        # write SQL to STDOUT
        $schema->deploy();
   

DESCRIPTION

This module adds two functions to Tangram::Schema, deploy() and retreat().

INSTANCE METHODS

deploy( HANDLE )

Writes SQL statements to HANDLE. The SQL code prepares a database for use with this Schema, and consists mostly in a series of CREATE TABLE instructions.

HANDLE may be a DBI connection handle, a file handle or undef (in which case the SQL code is sent to STDOUT).

The SQL code is only guaranteed to work against an empty database.

retreat( HANDLE )

Writes SQL statements to HANDLE. The SQL code removes whatever was set up by deploy().

HANDLE may be a DBI connection handle, a file handle or undef (in which case the SQL code is sent to STDOUT).

The SQL code is only guaranteed to work against a database that was deployed using exactly the same schema.

SEE ALSO

Tangram::Schema, Tangram::Storage