Schema/Result/State.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 20 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Schema/Result/ShipmentRate.pm ↑ Summary Schema/Result/UriRedirect.pm »
1 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package Interchange6::Schema::Result::State;
4  
5 =head1 NAME
6  
7 Interchange6::Schema::Result::State
8  
9 =cut
10  
11 2 ▶use Interchange6::Schema::Candy;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 =head1 DESCRIPTION
14  
15 ISO 3166-2 codes for sub_country identification "states"
16  
17 =head1 ACCESSORS
18  
19 =head2 states_id
20  
21 Primary key.
22  
23 =cut
24  
25 2 primary_column states_id =>
26 { data_type => "integer", is_auto_increment => 1 };
27  
28 =head2 scope
29  
30 Scope. Defaults to empty string.
31  
32 =cut
33  
34 2 column scope =>
35 { data_type => "varchar", default_value => "", size => 32 };
36  
37 =head2 country_iso_code
38  
39 FK on L<Interchange6::Schema::Result::Country/country_iso_code>.
40  
41 =cut
42  
43 2 column country_iso_code =>
44 { data_type => "char", size => 2 };
45  
46 =head2 state_iso_code
47  
48 State ISO code, e.g.: NY.
49  
50 =cut
51  
52 2 column state_iso_code =>
53 { data_type => "varchar", default_value => "", size => 6 };
54  
55 =head2 name
56  
57 Full name of state/province, e.g.: New York.
58  
59 Defaults to empty string.
60  
61 =cut
62  
63 2 column name => {
64 data_type => "varchar",
65 default_value => "",
66 size => 255
67 };
68  
69 =head2 priority
70  
71 Display sort order. Defaults to 0.
72  
73 =cut
74  
75 2 column priority =>
76 { data_type => "integer", default_value => 0 };
77  
78 =head2 active
79  
80 Whether state is an active shipping destination. Defaults to 1 (true).
81  
82 =cut
83  
84 2 column active =>
85 { data_type => "boolean", default_value => 1 };
86  
87 =head1 UNIQUE CONSTRAINT
88  
89 =head2 states_state_country
90  
91 =over 4
92  
93 =item * L</country_iso_code>
94  
95 =item * L</state_iso_code>
96  
97 =back
98  
99 =cut
100  
101 2 unique_constraint states_state_country => [qw/country_iso_code state_iso_code/];
102  
103 =head1 RELATIONS
104  
105 =head2 country
106  
107 Type: belongs_to
108  
109 Related object: L<Interchange6::Schema::Result::Country>
110  
111 =cut
112  
113 2 belongs_to
114 country => "Interchange6::Schema::Result::Country",
115 "country_iso_code",
116 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" };
117  
118 =head2 zone_states
119  
120 Type: has_many
121  
122 Related object L<Interchange6::Schema::Result::ZoneState>
123  
124 =cut
125  
126 2 has_many
127 zone_states => "Interchange6::Schema::Result::ZoneState",
128 "states_id",
129 { cascade_copy => 0, cascade_delete => 0 };
130  
131 =head2 zones
132  
133 Type: many_to_many
134  
135 Composing rels: L</zone_states> -> zone
136  
137 =cut
138  
139 2 many_to_many zones => "zone_states", "zone";
140  
141 2 1;
« Schema/Result/ShipmentRate.pm ↑ Summary Schema/Result/UriRedirect.pm »