File Coverage

blib/lib/Interchange6/Schema.pm
Criterion Covered Total %
statement 27 40 67.5
branch 0 10 0.0
condition n/a
subroutine 9 10 90.0
pod n/a
total 36 60 60.0


line stmt bran cond sub pod time code
1 1     1   946 use utf8;
  1         7  
  1         4  
2              
3             package Interchange6::Schema;
4              
5             =encoding utf8
6              
7             =head1 NAME
8              
9             Interchange6::Schema - Database Schema for Interchange 6
10              
11             =head1 VERSION
12              
13             0.070
14              
15             =cut
16              
17             our $VERSION = '0.070';
18              
19             =head1 DESCRIPTION
20              
21             Database schema classes for Interchange6 Open Source eCommerce
22             software.
23              
24             Components used:
25              
26             =over
27              
28             =item * L
29              
30             =item * L
31              
32             =back
33              
34             =cut
35              
36 1     1   48 use strict;
  1         1  
  1         22  
37 1     1   4 use warnings;
  1         0  
  1         26  
38              
39 1     1   4 use base 'DBIx::Class::Schema';
  1         1  
  1         539  
40              
41             __PACKAGE__->load_components( 'Helper::Schema::DateTime',
42             'Helper::Schema::QuoteNames' );
43              
44             __PACKAGE__->load_namespaces(
45             default_resultset_class => 'ResultSet',
46             );
47              
48             =head1 MANUAL
49              
50             Please see the L for an overview of available documentation.
51              
52             =head1 METHODS
53              
54             =head2 deploy
55              
56             Overload L in order to add some core fixtures
57             via the following classes:
58              
59             =over
60              
61             =item * Interchange6::Schema::Populate::CountryLocale
62              
63             =item * Interchange6::Schema::Populate::MessageType
64              
65             =item * Interchange6::Schema::Populate::Role
66              
67             =item * Interchange6::Schema::Populate::StateLocale
68              
69             =item * Interchange6::Schema::Populate::Zone
70              
71             =back
72              
73             =cut
74              
75             {
76 1     1   50246 use Interchange6::Schema::Populate::CountryLocale;
  1         6  
  1         135  
77 1     1   585 use Interchange6::Schema::Populate::MessageType;
  1         3  
  1         28  
78 1     1   478 use Interchange6::Schema::Populate::Role;
  1         2  
  1         27  
79 1     1   388 use Interchange6::Schema::Populate::StateLocale;
  1         3  
  1         34  
80 1     1   496 use Interchange6::Schema::Populate::Zone;
  1         3  
  1         214  
81              
82             sub deploy {
83 0     0     my $self = shift;
84 0           my $new = $self->next::method(@_);
85              
86 0           my $pop_country =
87             Interchange6::Schema::Populate::CountryLocale->new->records;
88 0 0         $self->resultset('Country')->populate($pop_country)
89             or die "Failed to populate Country";
90              
91 0           my $pop_messagetype =
92             Interchange6::Schema::Populate::MessageType->new->records;
93 0 0         $self->resultset('MessageType')->populate($pop_messagetype)
94             or die "Failed to populate MessageType";
95              
96 0           my $pop_role =
97             Interchange6::Schema::Populate::Role->new->records;
98 0 0         $self->resultset('Role')->populate($pop_role)
99             or die "Failed to populate Role";
100              
101 0           my $pop_state =
102             Interchange6::Schema::Populate::StateLocale->new->records;
103 0 0         my $states = $self->resultset('State')->populate($pop_state)
104             or die "Failed to populate State";
105              
106 0           my $min_states_id = $self->resultset('State')->search(
107             {},
108             {
109             select => [ { min => 'states_id' } ],
110             as => ['min_id'],
111             }
112             )->first->get_column('min_id');
113              
114 0           my $pop_zone =
115             Interchange6::Schema::Populate::Zone->new(
116             states_id_initial_value => $min_states_id )->records;
117 0 0         $self->resultset('Zone')->populate($pop_zone)
118             or die "Failed to populate Zone";
119             }
120             }
121              
122             1;
123              
124             __END__