Catalyst/TraitFor/Model/DBIC/Schema/FromMigration/_MigrationHelper.pm

filter: Statementstmt 58.6% 17 / 29 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 1 totaltotal 48.7% 20 / 41 CC 3 SCAR 16.1
CC
3
Cov
52%
do_install_if_needed
12.0
__ANON__
2.0
_build_callback_from_default_fixtures
2.0
CRAP 5.0
« DBIx/Class/Migration/PostgresqlSandbox.pm ↑ Summary Test/DBIx/Class/FixtureCommand/Population.pm »
1 package Catalyst::TraitFor::Model::DBIC::Schema::FromMigration::_MigrationHelper;
2  
3 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use DBIx::Class::Migration::Types -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 has 'migration_class',
7 is => 'ro',
8 isa => LoadableClass,
9 default => 'DBIx::Class::Migration',
10 required => 1,
11 ;
12  
13 2 has 'schema_class',
14 is => 'ro';
15  
16 has 'migration_init_args',
17 is => 'ro',
18 isa => HashRef,
19 0 ▶ default => sub { +{} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
20 2 ;
21  
22 2 has 'default_fixtures',
23 is => 'ro',
24 isa => ArrayRef,
25 predicate => 'has_default_fixtures';
26  
27 2 has 'install_if_needed',
28 is => 'ro',
29 isa => HashRef|Bool,
30 predicate => 'has_install_if_needed';
31  
32 2 has 'migration',
33 is => 'lazy';
34  
35 1 ▶sub _build_migration {
Subroutine _build_migration: called CC=1 SCAR=0.0
36 1 my $self = shift;
37 1 my %init = %{ $self->migration_init_args };
38 1 return $self->migration_class->new(%init);
39 }
40  
41 0 ▶sub _build_callback_from_default_fixtures {
Subroutine _build_callback_from_default_fixtures: not called CC=1 SCAR=6.9
42 0 my @fixtures = @{ shift->default_fixtures };
43 0 ▶ return sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
44 0 my ($schema, $migration) = @_;
45 0 $migration->populate(@fixtures)};
46 }
47  
48 0 ▶sub do_install_if_needed {
Subroutine do_install_if_needed: not called CC=3 SCAR=24.8
Pod undocumented
49 0 my $self = shift;
50 0 ▶ if($self->has_install_if_needed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_install_if_needed) 0 0 0
51 0 ▶ if(ref $self->install_if_needed) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->install_if_needed) { } 0 0 0
52 0 $self->migration->install_if_needed(%{$self->install_if_needed})
53 } else {
54 0 $self->migration->install_if_needed;
55 }
56 }
57 }
58  
59 2 1;
60  
61 =head1 NAME
62  
63 Catalyst::TraitFor::Model::DBIC::Schema::FromMigration::_MigrationHelper - Trait Helper
64  
65 =head1 SYNOPSIS
66  
67 use Catalyst::TraitFor::Model::DBIC::Schema::FromMigration::_MigrationHelper;
68
69 =head1 DESCRIPTION
70  
71 This is a helper for L<Catalyst::TraitFor::Model::DBIC::Schema::FromMigration>.
72 There are no 'user servicable' parts here, this is a private class that exposes
73 a bit of L<DBIx::Class::Migration> to make hooking up an existing migration
74 database sandbox to L<Catalyst> easier and error free.
75  
76 =head1 SEE ALSO
77  
78 L<Catalyst::Model::DBIC::Schema>, L<Catalyst>, L<DBIx::Class::Migration>
79 L<Catalyst::TraitFor::Model::DBIC::Schema::FromMigration>
80  
81 =head1 AUTHOR
82  
83 See L<DBIx::Class::Migration> for author information
84  
85 =head1 COPYRIGHT & LICENSE
86  
87 =cut
« DBIx/Class/Migration/PostgresqlSandbox.pm ↑ Summary Test/DBIx/Class/FixtureCommand/Population.pm »