MT#9177 Move vendor credentials to db

changes/75/675/1
Irina Peshinskaya 11 years ago
parent 7959d2b56f
commit 5befb25cad

@ -34,7 +34,7 @@ __PACKAGE__->add_columns(
{ {
data_type => "enum", data_type => "enum",
default_value => "http", default_value => "http",
extra => { list => ["http","ztp_panasonic","ztp_linksys"] }, extra => { list => ["http","redirect_panasonic","redirect_linksys"] },
is_nullable => 0, is_nullable => 0,
}, },
); );

@ -20,7 +20,7 @@ __PACKAGE__->add_columns(
{ {
data_type => "enum", data_type => "enum",
default_value => "http", default_value => "http",
extra => { list => ["http","ztp_panasonic","ztp_linksys"] }, extra => { list => ["http","redirect_panasonic","redirect_linksys"] },
is_nullable => 0, is_nullable => 0,
}, },
"parameter_name", "parameter_name",

@ -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>

@ -197,6 +197,13 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 }, { cascade_copy => 0, cascade_delete => 0 },
); );
__PACKAGE__->has_many(
"vendor_credentials",
"NGCP::Schema::Result::contract_vendor_credentials",
{ "foreign.contract_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many( __PACKAGE__->has_many(
"voip_sound_sets", "voip_sound_sets",
"NGCP::Schema::Result::voip_sound_sets", "NGCP::Schema::Result::voip_sound_sets",

Loading…
Cancel
Save