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