parent
7959d2b56f
commit
5befb25cad
@ -0,0 +1,106 @@
|
|||||||
|
package NGCP::Schema::Result::contract_vendor_credentials;
|
||||||
|
use Scalar::Util qw(blessed);
|
||||||
|
use parent 'DBIx::Class::Core';
|
||||||
|
|
||||||
|
our $VERSION = '2.007';
|
||||||
|
|
||||||
|
__PACKAGE__->load_components("InflateColumn::DateTime", "Helper::Row::ToJSON");
|
||||||
|
|
||||||
|
__PACKAGE__->table("billing.contract_vendor_credentials");
|
||||||
|
|
||||||
|
__PACKAGE__->add_columns(
|
||||||
|
"id",
|
||||||
|
{
|
||||||
|
data_type => "integer",
|
||||||
|
extra => { unsigned => 1 },
|
||||||
|
is_auto_increment => 1,
|
||||||
|
is_nullable => 0,
|
||||||
|
},
|
||||||
|
"contract_id",
|
||||||
|
{
|
||||||
|
data_type => "integer",
|
||||||
|
extra => { unsigned => 1 },
|
||||||
|
is_nullable => 0,
|
||||||
|
},
|
||||||
|
"vendor",
|
||||||
|
{
|
||||||
|
data_type => "enum",
|
||||||
|
default_value => "http",
|
||||||
|
extra => { list => ["http","redirect_panasonic","redirect_linksys"] },
|
||||||
|
is_nullable => 0,
|
||||||
|
},
|
||||||
|
"user",
|
||||||
|
{ data_type => "varchar", is_nullable => 0, size => 255 },
|
||||||
|
"password",
|
||||||
|
{ data_type => "varchar", is_nullable => 0, size => 255 },
|
||||||
|
);
|
||||||
|
|
||||||
|
__PACKAGE__->set_primary_key("id");
|
||||||
|
|
||||||
|
__PACKAGE__->belongs_to(
|
||||||
|
"contract",
|
||||||
|
"NGCP::Schema::Result::contracts",
|
||||||
|
{ id => "contract_id" },
|
||||||
|
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
|
||||||
|
);
|
||||||
|
|
||||||
|
sub TO_JSON {
|
||||||
|
my ($self) = @_;
|
||||||
|
return {
|
||||||
|
map { blessed($_) && $_->isa('DateTime') ? $_->datetime : $_ } %{ $self->next::method }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=encoding UTF-8
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
NGCP::Schema::provisioning::Result::contract_vendor_credentials
|
||||||
|
|
||||||
|
=head1 COMPONENTS LOADED
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item * L<DBIx::Class::InflateColumn::DateTime>
|
||||||
|
|
||||||
|
=item * L<DBIx::Class::Helper::Row::ToJSON>
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 TABLE: C<contract_vendor_credentials>
|
||||||
|
|
||||||
|
=head1 ACCESSORS
|
||||||
|
|
||||||
|
=head2 id
|
||||||
|
|
||||||
|
data_type: 'integer'
|
||||||
|
extra: {unsigned => 1}
|
||||||
|
is_auto_increment: 1
|
||||||
|
is_nullable: 0
|
||||||
|
|
||||||
|
=head2 contract_id
|
||||||
|
|
||||||
|
data_type: 'integer'
|
||||||
|
extra: {unsigned => 1}
|
||||||
|
is_foreign_key: 1
|
||||||
|
is_nullable: 0
|
||||||
|
|
||||||
|
=head1 PRIMARY KEY
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item * L</id>
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 RELATIONS
|
||||||
|
|
||||||
|
=head2 contract
|
||||||
|
|
||||||
|
Type: belongs_to
|
||||||
|
|
||||||
|
Related object: L<NGCP::Schema::provisioning::Result::contracts>
|
||||||
|
|
Loading…
Reference in new issue