data to a json file for later use:
$D->old_schema->dump_json_file('/tmp/my_schema1_data.json');
# Or
DBIx::Class::Schema::Diff::SchemaData->new(
schema => 'My::Schema1'
)->dump_json_file('/tm
ema1_data.json');
# Create new diff object using previously saved
# schema data + current schema class:
$D = DBIx::Class::Schema::Diff->new(
old_schema => '/tmp/my_schema1_data.json',
new_
an object, HashRef, or a path to a file containing serialized JSON data (as
produced by L<DBIx::Class::Schema::Diff::SchemaData#dump_json_file>)
See the SYNOPSIS and L<DBIx::Class::Schema::Diff::Sch
andard qw(:all);
use Scalar::Util qw(blessed);
use List::MoreUtils qw(uniq);
use Array::Diff;
use JSON;
use Path::Class qw(file);
sub _types_list { qw(
columns
relationships
constraints
table_nam
s a json file and try to decode it:
local $/;
open( my $fh, '<', $file ) or die "Could not open $file: $!";
my $json_text = <$fh>;
close $fh;
my $data = JSON::d
ecode_json($json_text);
return DBIx::Class::Schema::Diff::SchemaData->new({ data => $data });
}
}
return DBIx::Class::Schema::Diff::SchemaData->new({ schema => $v });
}
}
1;
andard qw(:all);
use Module::Runtime;
use Scalar::Util qw(blessed);
use Path::Class qw(file);
use JSON;
use Clone 'clone';
use Digest::SHA1;
use Data::Dumper;
use Data::Dumper::Concise;
has 'schema'
;
return $self->data->{sources}{$name};
}
sub dump_json {
my $self = shift;
JSON::to_json( $self->data => { pretty => 1 });
}
sub dump_json_file {
my ($self, $path) = @_;
die "Filename req
my $out_fh;
open $out_fh, '>', $file or die "Could not open $file: $!";
print $out_fh JSON::to_json( $self->data, { pretty => 1 });
close $out_fh;
return -f $file ? 1 : 0;
}
sub _gen_dat