Started refactoring pending orgs table

This commit is contained in:
Tom Bloor 2017-04-21 12:42:31 +01:00
parent 718d5f002e
commit 99ef319c3b
4 changed files with 61 additions and 126 deletions

View file

@ -1,100 +1,52 @@
use utf8;
package Pear::LocalLoop::Schema::Result::PendingOrganisation;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Pear::LocalLoop::Schema::Result::PendingOrganisation
=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<PendingOrganisations>
=cut
__PACKAGE__->table("PendingOrganisations");
=head1 ACCESSORS
=head2 pendingorganisationid
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
=head2 usersubmitted_fk
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
=head2 timedatesubmitted
data_type: 'integer'
is_nullable: 0
=head2 name
data_type: 'text'
is_nullable: 0
=head2 fulladdress
data_type: 'text'
is_nullable: 1
=head2 postcode
data_type: 'text'
is_nullable: 1
=cut
__PACKAGE__->table("pending_organisations");
__PACKAGE__->add_columns(
"pendingorganisationid",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"usersubmitted_fk",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"timedatesubmitted",
{ data_type => "datetime", is_nullable => 0 },
"name",
{ data_type => "text", is_nullable => 0 },
"fulladdress",
{ data_type => "text", is_nullable => 1 },
"postcode",
{ data_type => "text", is_nullable => 1 },
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,
},
submitted_by_id => {
data_type => "integer",
is_foreign_key => 1,
is_nullable => 0,
},
submitted_at => {
data_type => "datetime",
is_nullable => 0,
},
);
=head1 PRIMARY KEY
=over 4
=item * L</pendingorganisationid>
=back
=cut
__PACKAGE__->set_primary_key("pendingorganisationid");
__PACKAGE__->set_primary_key('id');
=head1 RELATIONS
@ -110,7 +62,7 @@ __PACKAGE__->has_many(
"pending_transactions",
"Pear::LocalLoop::Schema::Result::PendingTransaction",
{
"foreign.pendingsellerorganisationid_fk" => "self.pendingorganisationid",
"foreign.pendingsellerorganisationid_fk" => "self.id",
},
{ cascade_copy => 0, cascade_delete => 0 },
);
@ -124,9 +76,9 @@ Related object: L<Pear::LocalLoop::Schema::Result::User>
=cut
__PACKAGE__->belongs_to(
"usersubmitted_fk",
"submitted_by",
"Pear::LocalLoop::Schema::Result::User",
{ userid => "usersubmitted_fk" },
{ userid => "submitted_by_id" },
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
);

View file

@ -139,7 +139,7 @@ Related object: L<Pear::LocalLoop::Schema::Result::PendingOrganisation>
__PACKAGE__->belongs_to(
"pendingsellerorganisationid_fk",
"Pear::LocalLoop::Schema::Result::PendingOrganisation",
{ pendingorganisationid => "pendingsellerorganisationid_fk" },
{ id => "pendingsellerorganisationid_fk" },
{ is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
);

View file

@ -214,7 +214,7 @@ Related object: L<Pear::LocalLoop::Schema::Result::PendingOrganisation>
__PACKAGE__->has_many(
"pending_organisations",
"Pear::LocalLoop::Schema::Result::PendingOrganisation",
{ "foreign.usersubmitted_fk" => "self.userid" },
{ "foreign.submitted_by_id" => "self.userid" },
{ cascade_copy => 0, cascade_delete => 0 },
);