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

DBIx::Class::Schema::Diff::SchemaDiff - Data representation of schema for diffing

SYNOPSIS

 use DBIx::Class::Schema::Diff::SchemaData;
 
 my $SD = DBIx::Class::Schema::Diff::SchemaData->new( 
  schema => 'My::Schema'
 );
 
 $SD = DBIx::Class::Schema::Diff::SchemaData->new( 
  schema => $schema
 );
 
 # Get hashref representation of schema:
 my $hashref = $SD->data;
 
 my $SD2 = DBIx::Class::Schema::Diff::SchemaData->new( 
  data => $hashref
 );
 
 # Dump as JSON to file:
 $SD2->dump_json_file('/path/to/schema_data.json');
 

DESCRIPTION

Object class representing a DBIx::Class::Schema. The old_schema and new_schema build params in DBIx::Class::Schema::Diff are dynamically coerced into objects of this class.

This class can also be instantiated directly to dump/save the current schema data for later use by DBIx::Class::Schema::Diff (See its SYNOPSIS).

METHODS

new

Create a new DBIx::Class::Schema::Diff::SchemaData instance. The following build options are supported:

schema

DBIx::Class schema supplied as a class name or connected object instance. If this param is supplied it will be used to build data.

data

Can be supplied instead of schema to use previously generated data.

dump_json

Returns data as a serialized JSON string.

dump_json_file

Writes output of dump_json() to the supplied filename as long as it doesn't already exists. If the file already exists, an exception is thrown.

prune

Accepts a list of one or more prune keywords and returns a new SchemaData object with the specified information pruned/stripped from the data. Currently supported prune keywords:

isa
constraints
relationships
columns
private_col_attrs

fingerprint

Returns a sha1-based fingerprint string of the current data. Note that prune will result in different fingerprints. An example fingerprint is schemsum-448d754e40e09e0. The 'schemsum' prefix is just for fun (and also provides an easy way to eyeball these values down the road).

SEE ALSO

AUTHOR

Henry Van Styn <vanstyn@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by IntelliTree Solutions llc.

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