Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Diff two schemas, regardless of version numbers
Perl
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib/DBIx/Class/Schema
t
.gitignore
Changes
Makefile.PL
README

README

NAME
    DBIx::Class::Schema::Diff - Diff two schemas, regardless of version
    numbers

VERSION
    0.00

DESCRIPTION
        Is there a project which can check out two tags/commits from
        git and make a diff between the two schemas? So instead of
        having the version information in the database, I would like
        to A) make a diff between database and the current checked out
        version from the repo B) make a diff between two git-versions.

SYNOPSIS
    From a module:

        use DBIx::Class::Schema::Diff;

        my $diff = DBIx::Class::Schema::Diff->new(
                        from => $dsn,
                        to => 'MyApp::Schema',
                        databases => ['SQLite'],
                    );

        # write "diff", "to" and "from" to disk
        $diff->diff_ddl($directory) or die $diff->errstr;
        $diff->to_ddl($directory) or die $diff->errstr;
        $diff->from_ddl($directory) or die $diff->errstr;

    Using the script:

        $ schema-diff.pl \
            --from 'DBI:SQLite:t/db/one.sqlite' \
            --to 'dbi:Pg:dbname=somedatabase&user&pass' \
            --write-from \
            --write-to \
            --output - \
            ;

ATTRIBUTES
  from
    Any source (module name, dbh or dsn) which has the old version of the
    schema. This attribute can coerce. See DBIx::Class::Schema::Diff::Types
    for details.

  to
    Any source (module name, dbh or dsn) which has the new version of the
    schema. This attribute can coerce. See DBIx::Class::Schema::Diff::Types
    for details.

  databases
    Which SQL language the output files should be in.

  errstr
    Holds the last error if any as a string.

METHODS
  diff_ddl
        $bool = $self->diff_ddl($directory, \%args);
        $bool = $self->diff_ddl(\$text, \%args);

    Will write the diff (one file per each type in "databases") between
    "from" and "to" to a selected $directory. %args is passed on to
    SQL::Translator::Diff::new(), but "output_db", "source_schema" and
    "target_schema" is set by this method.

    Will write DDL to $text if given as a scalar reference. (This might not
    make much sense, if you have more than one type defined in "databases").

  from_ddl
  to_ddl
        $bool = $self->from_ddl($directory);
        $bool = $self->from_ddl(\$text);
        $bool = $self->to_ddl($directory);
        $bool = $self->to_ddl(\$text);

    Will write "from" or "to" schemas as DDL to the given directory, with
    all the languages defined in "databases".

    Will write DDL to $text if it is given as a scalar reference. (This
    might not make much sense, if you have more than one type defined in
    "databases".

COPYRIGHT & LICENSE
    This library is free software. You can redistribute it and/or modify it
    under the same terms as Perl itself.

AUTHOR
    Jan Henning Thorsen "jhthorsen at cpan.org"

Something went wrong with that request. Please try again.