[DBIx-Class-Devel] Announcing DBIx::Class::Schema::Diff

Henry Van Styn vanstyn at cpan.org
Wed Apr 23 09:56:21 GMT 2014


DBIx::Class::Schema::Diff is a new general-purpose tool for identifying changes
between 2 DBIC schemas. It has just been released on CPAN (v1.00). It is 
designed to be flexible and easy to use with straightforward, DWIM APIs.

It is currently able to detect changes in any of the following 5 types of 
source data (as well as added/deleted/changed events):

 * columns
 * relationships
 * constraints
 * table_name
 * isa

The old and new schemas can be supplied as class names, object instances, or 
pre-saved dumps (i.e. when comparing the same schema class name between an
older and new version):

  my $D = DBIx::Class::Schema::Diff->new(
    old_schema => $schema1,
    new_schema => $schema2
  );

The differences can then be inspected via the 'diff' method which returns a 
HashRef structure, or undef if there are no differences detected:

  my $hash = $D->diff;

Additionally, you can filter the diff using chainable filter/filter_out methods
with a simple syntax:

 # Only columns, excluding Artist
 $hash = $D->filter('columns')
           ->filter_out('Artist')
           ->diff;

The filter arguments can range from very broad to very narrow. This allows you
to craft simple boolean tests to check for specific changes as an alternative
to manually inspecting the diff.

For more info, documentation and examples (including more thorough explanations
of the diff structure and filter argument syntax), see the POD on CPAN.

  CPAN:    https://metacpan.org/pod/DBIx::Class::Schema::Diff 
  GitHub:  https://github.com/vanstyn/DBIx-Class-Schema-Diff

Questions/comments/patches welcome,

vanstyn

--
Henry Van Styn
<vanstyn at cpan.org>




More information about the DBIx-Class-Devel mailing list