Added entity postcode lookup
This commit is contained in:
parent
04a8186b2a
commit
697c1494b0
12 changed files with 4793 additions and 1 deletions
|
@ -42,6 +42,11 @@ __PACKAGE__->might_have(
|
|||
"Pear::LocalLoop::Schema::Result::EntityAssociation" => "entity_id",
|
||||
);
|
||||
|
||||
__PACKAGE__->might_have(
|
||||
"postcode",
|
||||
"Pear::LocalLoop::Schema::Result::EntityPostcode" => "entity_id",
|
||||
);
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"purchases",
|
||||
"Pear::LocalLoop::Schema::Result::Transaction",
|
||||
|
|
44
lib/Pear/LocalLoop/Schema/Result/EntityPostcode.pm
Normal file
44
lib/Pear/LocalLoop/Schema/Result/EntityPostcode.pm
Normal file
|
@ -0,0 +1,44 @@
|
|||
package Pear::LocalLoop::Schema::Result::EntityPostcode;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use base 'DBIx::Class::Core';
|
||||
|
||||
__PACKAGE__->table('entities_postcodes');
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
outcode => {
|
||||
data_type => 'char',
|
||||
size => 4,
|
||||
is_nullable => 0,
|
||||
},
|
||||
incode => {
|
||||
data_type => 'char',
|
||||
size => 3,
|
||||
is_nullable => 0,
|
||||
},
|
||||
entity_id => {
|
||||
data_type => 'integer',
|
||||
is_nullable => 0,
|
||||
is_foreign_key => 1,
|
||||
},
|
||||
);
|
||||
|
||||
__PACKAGE__->set_primary_key(qw/ outcode incode entity_id /);
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"entity",
|
||||
"Pear::LocalLoop::Schema::Result::Entity",
|
||||
"entity_id",
|
||||
);
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"gb_postcode",
|
||||
"Pear::LocalLoop::Schema::Result::GbPostcode",
|
||||
{
|
||||
"foreign.outcode" => "self.outcode",
|
||||
"foreign.incode" => "self.incode",
|
||||
},
|
||||
);
|
||||
1;
|
Reference in a new issue