| 1 | 2 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | package Interchange6::Schema::Result::MerchandisingProduct; | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Interchange6::Schema::Result::MerchandisingProduct | ||
| 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 merchandising_products_id | ||
| 16 | |||
| 17 | Primary key. | ||
| 18 | |||
| 19 | =cut | ||
| 20 | |||
| 21 | 2 | primary_column merchandising_products_id => { | |
| 22 | data_type => "integer", | ||
| 23 | is_auto_increment => 1, | ||
| 24 | sequence => "merchandising_products_merchandising_products_id_seq", | ||
| 25 | }; | ||
| 26 | |||
| 27 | =head2 sku | ||
| 28 | |||
| 29 | FK on L<Interchange6::Schema::Result::Product/sku> | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | 2 | column sku => | |
| 34 | { data_type => "varchar", is_foreign_key => 1, size => 64 }; | ||
| 35 | |||
| 36 | =head2 sku_related | ||
| 37 | |||
| 38 | FK on L<Interchange6::Schema::Result::Product/sku> | ||
| 39 | |||
| 40 | Is nullable. | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | 2 | column sku_related => | |
| 45 | { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 64 }; | ||
| 46 | |||
| 47 | =head2 type | ||
| 48 | |||
| 49 | Type, e.g.: related, also_viewed, also_bought. | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | 2 | column type => | |
| 54 | { data_type => "varchar", default_value => "", size => 32 }; | ||
| 55 | |||
| 56 | =head1 UNIQUE CONSTRAINT | ||
| 57 | |||
| 58 | =head2 merchandising_products_sku_sku_related_type | ||
| 59 | |||
| 60 | =over 4 | ||
| 61 | |||
| 62 | =item * L</sku> | ||
| 63 | |||
| 64 | =item * L</sku_related> | ||
| 65 | |||
| 66 | =item * L</type> | ||
| 67 | |||
| 68 | =back | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | 2 | unique_constraint merchandising_products_sku_sku_related_type => | |
| 73 | [qw/sku sku_related type/]; | ||
| 74 | |||
| 75 | =head1 RELATIONS | ||
| 76 | |||
| 77 | =head2 merchandising_attributes | ||
| 78 | |||
| 79 | Type: has_many | ||
| 80 | |||
| 81 | Related object: L<Interchange6::Schema::Result::MerchandisingAttribute> | ||
| 82 | |||
| 83 | =cut | ||
| 84 | |||
| 85 | 2 | has_many | |
| 86 | merchandising_attributes => | ||
| 87 | "Interchange6::Schema::Result::MerchandisingAttribute", | ||
| 88 | "merchandising_products_id", | ||
| 89 | { cascade_copy => 0, cascade_delete => 0 }; | ||
| 90 | |||
| 91 | =head2 product | ||
| 92 | |||
| 93 | Type: belongs_to | ||
| 94 | |||
| 95 | Related object: L<Interchange6::Schema::Result::Product> | ||
| 96 | |||
| 97 | =cut | ||
| 98 | |||
| 99 | 2 | belongs_to | |
| 100 | product => "Interchange6::Schema::Result::Product", | ||
| 101 | "sku", | ||
| 102 | { | ||
| 103 | is_deferrable => 1, | ||
| 104 | join_type => "LEFT", | ||
| 105 | on_delete => "CASCADE", | ||
| 106 | on_update => "CASCADE", | ||
| 107 | }; | ||
| 108 | |||
| 109 | =head2 product_related | ||
| 110 | |||
| 111 | Type: belongs_to | ||
| 112 | |||
| 113 | Related object: L<Interchange6::Schema::Result::Product> | ||
| 114 | |||
| 115 | =cut | ||
| 116 | |||
| 117 | 2 | belongs_to | |
| 118 | product_related => "Interchange6::Schema::Result::Product", | ||
| 119 | { sku => "sku_related" }, | ||
| 120 | { | ||
| 121 | is_deferrable => 1, | ||
| 122 | join_type => "LEFT", | ||
| 123 | on_delete => "CASCADE", | ||
| 124 | on_update => "CASCADE", | ||
| 125 | }; | ||
| 126 | |||
| 127 | 2 | 1; | |