| 1 | 2 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | package Interchange6::Schema::Result::Orderline; | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Interchange6::Schema::Result::Orderline | ||
| 8 | |||
| 9 | =cut | ||
| 10 | |||
| 11 | 2 | ▶ | use Interchange6::Schema::Candy; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | =head1 ACCESSORS | ||
| 14 | |||
| 15 | =head2 orderlines_id | ||
| 16 | |||
| 17 | Primary key. | ||
| 18 | |||
| 19 | =cut | ||
| 20 | |||
| 21 | 2 | primary_column orderlines_id => { | |
| 22 | data_type => "integer", | ||
| 23 | is_auto_increment => 1, | ||
| 24 | sequence => "orderlines_orderlines_id_seq", | ||
| 25 | }; | ||
| 26 | |||
| 27 | =head2 orders_id | ||
| 28 | |||
| 29 | FK on L<Interchange6::Schema::Result::Order/orders_id>. | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | 2 | column orders_id => | |
| 34 | { data_type => "integer", is_foreign_key => 1 }; | ||
| 35 | |||
| 36 | =head2 order_position | ||
| 37 | |||
| 38 | Signed integer order position. Defaults to 0. | ||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | 2 | column order_position => | |
| 43 | { data_type => "integer", default_value => 0 }; | ||
| 44 | |||
| 45 | =head2 sku | ||
| 46 | |||
| 47 | FK on L<Interchange6::Schema::Result::Product/sku>. | ||
| 48 | |||
| 49 | =cut | ||
| 50 | |||
| 51 | 2 | column sku => | |
| 52 | { data_type => "varchar", is_foreign_key => 1, size => 64 }; | ||
| 53 | |||
| 54 | =head2 name | ||
| 55 | |||
| 56 | Product name. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | 2 | column name => { | |
| 61 | data_type => "varchar", | ||
| 62 | size => 255 | ||
| 63 | }; | ||
| 64 | |||
| 65 | =head2 short_description | ||
| 66 | |||
| 67 | Product short description. | ||
| 68 | |||
| 69 | Defaults to empty string. | ||
| 70 | |||
| 71 | =cut | ||
| 72 | |||
| 73 | 2 | column short_description => { | |
| 74 | data_type => "varchar", | ||
| 75 | default_value => "", | ||
| 76 | size => 500 | ||
| 77 | }; | ||
| 78 | |||
| 79 | =head2 description | ||
| 80 | |||
| 81 | Product descrtption. | ||
| 82 | |||
| 83 | =cut | ||
| 84 | |||
| 85 | 2 | column description => { data_type => "text" }; | |
| 86 | |||
| 87 | =head2 weight | ||
| 88 | |||
| 89 | Weight of product. Defaults to 0. | ||
| 90 | |||
| 91 | =cut | ||
| 92 | |||
| 93 | 2 | column weight => { | |
| 94 | data_type => "numeric", | ||
| 95 | default_value => "0.0", | ||
| 96 | size => [ 10, 3 ] | ||
| 97 | }; | ||
| 98 | |||
| 99 | =head2 quantity | ||
| 100 | |||
| 101 | Product quantity. | ||
| 102 | |||
| 103 | =cut | ||
| 104 | |||
| 105 | 2 | column quantity => { data_type => "integer" }; | |
| 106 | |||
| 107 | =head2 price | ||
| 108 | |||
| 109 | Product price. | ||
| 110 | |||
| 111 | =cut | ||
| 112 | |||
| 113 | 2 | column price => { | |
| 114 | data_type => "numeric", | ||
| 115 | size => [ 10, 2 ], | ||
| 116 | }; | ||
| 117 | |||
| 118 | =head2 subtotal | ||
| 119 | |||
| 120 | Line subtotal. | ||
| 121 | |||
| 122 | =cut | ||
| 123 | |||
| 124 | 2 | column subtotal => { | |
| 125 | data_type => "numeric", | ||
| 126 | size => [ 11, 2 ], | ||
| 127 | }; | ||
| 128 | |||
| 129 | =head2 shipping | ||
| 130 | |||
| 131 | Shipping cost. | ||
| 132 | |||
| 133 | Defaults to 0. | ||
| 134 | |||
| 135 | =cut | ||
| 136 | |||
| 137 | 2 | column shipping => { | |
| 138 | data_type => "numeric", | ||
| 139 | default_value => "0.0", | ||
| 140 | size => [ 11, 2 ], | ||
| 141 | }; | ||
| 142 | |||
| 143 | =head2 handling | ||
| 144 | |||
| 145 | Handling cost. | ||
| 146 | |||
| 147 | Defaults to 0. | ||
| 148 | |||
| 149 | =cut | ||
| 150 | |||
| 151 | 2 | column handling => { | |
| 152 | data_type => "numeric", | ||
| 153 | default_value => "0.0", | ||
| 154 | size => [ 11, 2 ], | ||
| 155 | }; | ||
| 156 | |||
| 157 | =head2 salestax | ||
| 158 | |||
| 159 | Sales tax. | ||
| 160 | |||
| 161 | Defaults to 0. | ||
| 162 | |||
| 163 | =cut | ||
| 164 | |||
| 165 | 2 | column salestax => { | |
| 166 | data_type => "numeric", | ||
| 167 | default_value => "0.0", | ||
| 168 | size => [ 11, 2 ], | ||
| 169 | }; | ||
| 170 | |||
| 171 | =head2 status | ||
| 172 | |||
| 173 | Status, e.g.: picking, shipped, cancelled. | ||
| 174 | |||
| 175 | Defaults to empty string. | ||
| 176 | |||
| 177 | =cut | ||
| 178 | |||
| 179 | 2 | column status => | |
| 180 | { data_type => "varchar", default_value => "", size => 24 }; | ||
| 181 | |||
| 182 | =head1 RELATIONS | ||
| 183 | |||
| 184 | =head2 order | ||
| 185 | |||
| 186 | Type: belongs_to | ||
| 187 | |||
| 188 | Related object: L<Interchange6::Schema::Result::Order> | ||
| 189 | |||
| 190 | =cut | ||
| 191 | |||
| 192 | 2 | belongs_to | |
| 193 | order => "Interchange6::Schema::Result::Order", | ||
| 194 | "orders_id", | ||
| 195 | { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }; | ||
| 196 | |||
| 197 | =head2 orderlines_shipping | ||
| 198 | |||
| 199 | Type: has_many | ||
| 200 | |||
| 201 | Related object: L<Interchange6::Schema::Result::OrderlinesShipping> | ||
| 202 | |||
| 203 | =cut | ||
| 204 | |||
| 205 | 2 | has_many | |
| 206 | orderlines_shipping => "Interchange6::Schema::Result::OrderlinesShipping", | ||
| 207 | "orderlines_id", | ||
| 208 | { cascade_copy => 0, cascade_delete => 0 }; | ||
| 209 | |||
| 210 | =head2 product | ||
| 211 | |||
| 212 | Type: belongs_to | ||
| 213 | |||
| 214 | Related object: L<Interchange6::Schema::Result::Product> | ||
| 215 | |||
| 216 | =cut | ||
| 217 | |||
| 218 | 2 | belongs_to | |
| 219 | product => "Interchange6::Schema::Result::Product", | ||
| 220 | "sku", | ||
| 221 | { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }; | ||
| 222 | |||
| 223 | =head2 addresses | ||
| 224 | |||
| 225 | Type: many_to_many | ||
| 226 | |||
| 227 | Composing rels: L</orderlines_shipping> -> address | ||
| 228 | |||
| 229 | =cut | ||
| 230 | |||
| 231 | 2 | many_to_many addresses => "orderlines_shipping", "address"; | |
| 232 | |||
| 233 | 2 | 1; | |