Refactor Organisation table to easier column names
This commit is contained in:
parent
e2cf58c895
commit
6596fd10aa
6 changed files with 93 additions and 142 deletions
|
@ -1,85 +1,42 @@
|
|||
use utf8;
|
||||
package Pear::LocalLoop::Schema::Result::Organisation;
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader
|
||||
# DO NOT MODIFY THE FIRST PART OF THIS FILE
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Pear::LocalLoop::Schema::Result::Organisation
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use base 'DBIx::Class::Core';
|
||||
|
||||
=head1 COMPONENTS LOADED
|
||||
|
||||
=over 4
|
||||
|
||||
=item * L<DBIx::Class::InflateColumn::DateTime>
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->load_components("InflateColumn::DateTime");
|
||||
|
||||
=head1 TABLE: C<Organisations>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->table("Organisations");
|
||||
|
||||
=head1 ACCESSORS
|
||||
|
||||
=head2 organisationalid
|
||||
|
||||
data_type: 'integer'
|
||||
is_auto_increment: 1
|
||||
is_nullable: 0
|
||||
|
||||
=head2 name
|
||||
|
||||
data_type: 'text'
|
||||
is_nullable: 0
|
||||
|
||||
=head2 fulladdress
|
||||
|
||||
data_type: 'text'
|
||||
is_nullable: 0
|
||||
|
||||
=head2 postcode
|
||||
|
||||
data_type: 'text'
|
||||
is_nullable: 0
|
||||
|
||||
=cut
|
||||
__PACKAGE__->table("organisations");
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
"organisationalid",
|
||||
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
|
||||
"name",
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
"fulladdress",
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
"postcode",
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
id => {
|
||||
data_type => 'integer',
|
||||
is_auto_increment => 1,
|
||||
is_nullable => 0,
|
||||
},
|
||||
name => {
|
||||
data_type => 'varchar',
|
||||
size => 255,
|
||||
is_nullable => 0,
|
||||
},
|
||||
street_address => {
|
||||
data_type => 'text',
|
||||
is_nullable => 1,
|
||||
},
|
||||
town => {
|
||||
data_type => 'varchar',
|
||||
size => 255,
|
||||
is_nullable => 0,
|
||||
},
|
||||
postcode => {
|
||||
data_type => 'varchar',
|
||||
size => 16,
|
||||
is_nullable => 1,
|
||||
},
|
||||
);
|
||||
|
||||
=head1 PRIMARY KEY
|
||||
|
||||
=over 4
|
||||
|
||||
=item * L</organisationalid>
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->set_primary_key("organisationalid");
|
||||
__PACKAGE__->set_primary_key('id');
|
||||
|
||||
=head1 RELATIONS
|
||||
|
||||
|
@ -94,7 +51,7 @@ Related object: L<Pear::LocalLoop::Schema::Result::Transaction>
|
|||
__PACKAGE__->has_many(
|
||||
"transactions",
|
||||
"Pear::LocalLoop::Schema::Result::Transaction",
|
||||
{ "foreign.sellerorganisationid_fk" => "self.organisationalid" },
|
||||
{ "foreign.sellerorganisationid_fk" => 'self.id' },
|
||||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
|
@ -109,14 +66,8 @@ Related object: L<Pear::LocalLoop::Schema::Result::User>
|
|||
__PACKAGE__->might_have(
|
||||
"user",
|
||||
"Pear::LocalLoop::Schema::Result::User",
|
||||
{ "foreign.organisationalid_fk" => "self.organisationalid" },
|
||||
{ "foreign.organisationalid_fk" => 'self.id' },
|
||||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2017-02-24 17:32:21
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:p9FzM/H5YQbo2d0lN/DfCg
|
||||
|
||||
|
||||
# You can replace this text with custom code or comments, and it will be preserved on regeneration
|
||||
1;
|
||||
|
|
|
@ -139,7 +139,7 @@ Related object: L<Pear::LocalLoop::Schema::Result::Organisation>
|
|||
__PACKAGE__->belongs_to(
|
||||
"sellerorganisationid_fk",
|
||||
"Pear::LocalLoop::Schema::Result::Organisation",
|
||||
{ organisationalid => "sellerorganisationid_fk" },
|
||||
{ id => "sellerorganisationid_fk" },
|
||||
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
|
||||
);
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ Related object: L<Pear::LocalLoop::Schema::Result::Organisation>
|
|||
__PACKAGE__->belongs_to(
|
||||
"organisation",
|
||||
"Pear::LocalLoop::Schema::Result::Organisation",
|
||||
{ organisationalid => "organisationalid_fk" },
|
||||
{ id => "organisationalid_fk" },
|
||||
{
|
||||
is_deferrable => 0,
|
||||
join_type => "LEFT",
|
||||
|
|
Reference in a new issue