Announcing DBIx::Class::Schema::Diff

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Announcing DBIx::Class::Schema::Diff

Henry Van Styn
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
<[hidden email]>


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...