Mike Bissett > DBIx-Changeset-1.11 > DBIx::Changeset

Download:
DBIx-Changeset-1.11.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.11   Source  

NAME ^

DBIx::Changeset - Discrete management for database changes.

SYNOPSIS ^

You probably want to use dbix_changeset.pl from the command line.

        dbix_changeset.pl --help

DESCRIPTION ^

DBIx::Changeset provides an application to aid with the distrubution and application of database schemas and schema data as incremental updates. A Changeset is a discrete chunk of sql stored in a file with a unique id. DBIx::Changeset will compare a list of changesets against a table of applied changesets and apply the differences using the target databases native sql insertion tool in order. This greatly aids the distrubted development of a database application.

Example

        User A creates a schema change in his development environment and applies it. Alls good so he checks
        in the changeset file. User B does a checkout on his development environment and runs the changeset 
        update which notices User A's changeset and applies it. User B's development database is now the same
        as User A's. The database schema/schema data is in sync with the code logic.

DBIx::Changeset does not include an undo feature as it is dealing with schema changes this could cause data loss so is actually an update.

DBIx::Changeset uses a table to store the history of which changesets have been applied, while this is normally in the target database in can be set to another location.

DBIx::Changeset Currently supports MySQL,Postgres and SQLlite, but should be easy to port to other databases.

USAGE ^

Setting up a Database for Changeset

DBIx::Changeset requires a table to store the history of applied changesets. Changeset will add this table for you with the bootstrap command. It requires several options:

        --history_db_dsn           DBI DSN for the history db
        --history_db_user          db user for history db
        --history_db_password      db password for the history db user

Creating a Changeset

To create a new empty changeset file from the given template use the create command. It has several required options:

        --location      Path to changeset files
        --template      Path to changeset template

The location is the path were the changeset files are stored and the template is a the path to a file that is used as the template. There are a couple of optional parameters:

        --edit          Call editor
        --editor        Path to Editor

This loads the created delta up in the choses editor.

        --vcs           Add to version control
        --vcsadd        Command to add to version control

These add the created delta file to your vcs using the command given by the vcsadd option.

Comparing a database

To compare a database to a set of changeset files, you use the compare command. It has a few required options:

                --location                 Path to changeset files
                --history_db_dsn           DBI DSN for the history db
                --history_db_user          db user for history ddb
                --history_db_password      db password for the history db user

        There are also a couple of other useful options:

                --type                         Which factory to use (default disk)
                --like                     only types matching regex

Updating a database To update a database based on changeset files use the update command. The update command has several required options:

        --location                 Path to changeset files
        --type                     Which factory to use (default disk)
        --loader                   Which loader factory to use (default mysql)
        --like                     only types matching regex
        --history_db_dsn           DBI DSN for the history db
        --history_db_user          db user for history db
        --history_db_password      db password for the history db user
        --db_name                  db name for update db
        --db_host                  db host for update db
        --db_user                  db user for update db
        --db_password              db password for the update db user

ACCESSORS ^

db_user the db_user

db_password the db_password

db_uri the db_uri

changeset_location the location of the changeset files, in a format the DBIx::Changeset::File factory object will be expecting

SUPPORT ^

Please report any bugs or feature requests via the CPAN bug tracker

http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Queue=DBIx-Changeset

AUTHORS ^

Mike Bissett, Stephen Steneker, Paul Puse <paran01d@gmail.com>

ACKNOWLEDGEMENTS ^

Thank you to Grox (http://grox.com.au/) for permitting the open sourcing and release of this distribution.

COPYRIGHT & LICENSE ^

Copyright 2004-2008 Grox Pty Ltd.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

syntax highlighting: