DBIx/Class/Migration/RunScript/Trait/SchemaLoader.pm

filter: Statementstmt 100% 15 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 21 / 21 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« DBIx/Class/Migration/SqliteSandbox.pm ↑ Summary
1 package DBIx::Class::Migration::RunScript::Trait::SchemaLoader;
2  
3 4 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use DBIx::Class::Schema::Loader;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use DBIx::Class::Migration::SchemaLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 requires 'dbh';
8  
9 13 ▶sub schema {
Subroutine schema: called CC=1 SCAR=0.0
Pod documented
10 13 my $dbh = (my $self = shift)->dbh;
11 13 my $name = DBIx::Class::Migration::SchemaLoader::_as_unique_ns(
12 'DBIx::Class::Migration::LoadedSchema');
13 return DBIx::Class::Schema::Loader::make_schema_at(
14 13 ▶ $name, {DBIx::Class::Migration::SchemaLoader::opts}, [ sub {$dbh} ]);
Subroutine __ANON__: called CC=1 SCAR=0.0
15 }
16  
17 4 1;
18  
19 =head1 NAME
20  
21 DBIx::Class::Migration::RunScript::Trait::SchemaLoader - Give your Run Script a Schema
22  
23 =head1 SYNOPSIS
24  
25 use DBIx::Class::Migration::RunScript;
26  
27 builder {
28 'SchemaLoader',
29 sub {
30 shift->schema->resultset('Country')
31 ->populate([
32 ['code'],
33 ['bel'],
34 ['deu'],
35 ['fra'],
36 ]);
37 };
38 };
39  
40 =head1 DESCRIPTION
41  
42 This is a L<Moo::Role> that adds a C<schema> attribute to your
43 L<DBIx::Class::Migration::RunScript>. This C<schema> is generated via
44 L<DBIx::Class::Schema::Loader> so it is consistent to your actual deployed
45 database structure (it is not dependent on your actual code).
46  
47 =head1 ATTRIBUTES
48  
49 This class defines the follow attributes
50  
51 =head2 schema
52  
53 Using L<DBIx::Class::Schema::Loader> create a L<DBIx::Class::Schema> that
54 represents the connected database.
55  
56 =head1 SEE ALSO
57  
58 L<DBIx::Class::Migration>, L<DBIx::Class::Migration::RunScript>
59  
60 =head1 AUTHOR
61  
62 See L<DBIx::Class::Migration> for author information
63  
64 =head1 COPYRIGHT & LICENSE
65  
66 See L<DBIx::Class::Migration> for copyright and license information
67  
68 =cut
69  
70  
« DBIx/Class/Migration/SqliteSandbox.pm ↑ Summary