Entity Assoiciations added to database
This commit is contained in:
parent
cb9c219b27
commit
d36091528f
2 changed files with 46 additions and 0 deletions
|
@ -44,6 +44,13 @@ __PACKAGE__->has_many(
|
|||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"associations",
|
||||
"Pear::LocalLoop::Schema::Result::EntityAssociation",
|
||||
{ "foreign.entity_id" => "self.id" },
|
||||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"sales",
|
||||
"Pear::LocalLoop::Schema::Result::Transaction",
|
||||
|
|
39
lib/Pear/LocalLoop/Schema/Result/EntityAssociation.pm
Normal file
39
lib/Pear/LocalLoop/Schema/Result/EntityAssociation.pm
Normal file
|
@ -0,0 +1,39 @@
|
|||
package Pear::LocalLoop::Schema::Result::EntityAssociation;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use base 'DBIx::Class::Core';
|
||||
|
||||
__PACKAGE__->load_components(qw/
|
||||
InflateColumn::DateTime
|
||||
TimeStamp
|
||||
/);
|
||||
|
||||
__PACKAGE__->table("entity_association");
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
"id" => {
|
||||
data_type => "integer",
|
||||
is_auto_increment => 1,
|
||||
is_nullable => 0,
|
||||
},
|
||||
"entity_id" => {
|
||||
data_type => 'integer',
|
||||
is_nullable => 0,
|
||||
is_foreign_key => 1,
|
||||
},
|
||||
"lis" => {
|
||||
data_type => 'boolean',
|
||||
default => undef,
|
||||
is_nullable => 1,
|
||||
},
|
||||
);
|
||||
|
||||
__PACKAGE__->set_primary_key("id");
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"entity",
|
||||
"Pear::LocalLoop::Schema::Result::Entity",
|
||||
"entity_id",
|
||||
);
|
Reference in a new issue