MT#8645 - add billing_profiles status, create_timestamp,

modify_timestamp, terminate_timestamp
          add billing_mappings contract_active "belongs_to" relation
changes/75/675/1
Kirill Solomko 11 years ago
parent 83ed0fee85
commit b712efcdd4

@ -72,6 +72,19 @@ __PACKAGE__->belongs_to(
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
__PACKAGE__->belongs_to(
"contract_active",
"NGCP::Schema::Result::contracts",
sub {
my $args = shift;
return {
"$args->{foreign_alias}.id" => { -ident => "$args->{self_alias}.contract_id" } ,
"$args->{foreign_alias}.status" => { '!=' => 'terminated' },
};
},
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
__PACKAGE__->belongs_to(
"product",
"NGCP::Schema::Result::products",
@ -176,6 +189,12 @@ Type: belongs_to
Related object: L<NGCP::Schema::Result::contracts>
=head2 contract_active
Type: belongs_to
Related object: L<NGCP::Schema::Result::contracts>
=head2 product
Type: belongs_to

@ -63,6 +63,33 @@ __PACKAGE__->add_columns(
{ data_type => "varchar", is_nullable => 1, size => 255 },
"currency",
{ data_type => "varchar", is_nullable => 1, size => 31 },
"status",
{
data_type => "enum",
default_value => "active",
extra => { list => ["active", "terminated"] },
is_nullable => 0,
},
"modify_timestamp",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
default_value => \"current_timestamp",
is_nullable => 0,
},
"create_timestamp",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
default_value => "0000-00-00 00:00:00",
is_nullable => 0,
},
"terminate_timestamp",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
is_nullable => 1,
},
);
__PACKAGE__->set_primary_key("id");
@ -273,6 +300,33 @@ NGCP::Schema::Result::billing_profiles
default_value: 1
is_nullable: 0
head2 status
data_type: 'enum'
default_value: 'active'
extra: {list => ["pending","active","locked","terminated"]}
is_nullable: 0
=head2 modify_timestamp
data_type: 'timestamp'
datetime_undef_if_invalid: 1
default_value: current_timestamp
is_nullable: 0
=head2 create_timestamp
data_type: 'timestamp'
datetime_undef_if_invalid: 1
default_value: '0000-00-00 00:00:00'
is_nullable: 0
=head2 terminate_timestamp
data_type: 'timestamp'
datetime_undef_if_invalid: 1
is_nullable: 1
=head1 PRIMARY KEY
=over 4

Loading…
Cancel
Save