Add PBX autoprovisioning tables.

agranig/subs-login
Andreas Granig 12 years ago
parent 23399cec51
commit 73bd5d8656

@ -0,0 +1,139 @@
package NGCP::Schema::Result::autoprov_configs;
use Sipwise::Base;
use MooseX::NonMoose;
use Scalar::Util qw(blessed);
our $VERSION = '2.004';
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime", "Helper::Row::ToJSON");
__PACKAGE__->table("provisioning.autoprov_configs");
__PACKAGE__->add_columns(
"id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_auto_increment => 1,
is_nullable => 0,
},
"device_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 0,
},
"version",
{ data_type => "varchar", is_nullable => 0, size => 255 },
"content_type",
{ data_type => "varchar", is_nullable => 0, size => 255 },
"data",
{ data_type => "mediumtext", is_nullable => 0 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to(
"device",
"NGCP::Schema::Result::autoprov_devices",
{ id => "device_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
__PACKAGE__->has_many(
"autoprov_profiles",
"NGCP::Schema::Result::autoprov_profiles",
{ "foreign.firmware_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
sub TO_JSON {
my ($self) = @_;
return {
map { blessed($_) && $_->isa('DateTime') ? $_->datetime : $_ } %{ $self->next::method }
};
}
=encoding UTF-8
=head1 NAME
NGCP::Schema::provisioning::Result::autoprov_configs
=head1 COMPONENTS LOADED
=over 4
=item * L<DBIx::Class::InflateColumn::DateTime>
=item * L<DBIx::Class::Helper::Row::ToJSON>
=back
=head1 TABLE: C<autoprov_configs>
=head1 ACCESSORS
=head2 id
data_type: 'integer'
extra: {unsigned => 1}
is_auto_increment: 1
is_nullable: 0
=head2 device_id
data_type: 'integer'
extra: {unsigned => 1}
is_foreign_key: 1
is_nullable: 0
=head2 version
data_type: 'varchar'
is_nullable: 0
size: 255
=head2 data
data_type: 'mediumtext'
is_nullable: 0
=head1 PRIMARY KEY
=over 4
=item * L</id>
=back
=head1 RELATIONS
=head2 device
Type: belongs_to
Related object: L<NGCP::Schema::provisioning::Result::autoprov_devices>
=cut
# Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-09-09 18:26:38
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rr7y7bh33fX3UgE8IXLl5w
# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;

@ -0,0 +1,140 @@
package NGCP::Schema::Result::autoprov_devices;
use Sipwise::Base;
use MooseX::NonMoose;
use Scalar::Util qw(blessed);
our $VERSION = '2.004';
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime", "Helper::Row::ToJSON");
__PACKAGE__->table("provisioning.autoprov_devices");
__PACKAGE__->add_columns(
"id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_auto_increment => 1,
is_nullable => 0,
},
"reseller_id",
{ data_type => "integer", extra => { unsigned => 1 }, is_nullable => 0 },
"vendor",
{ data_type => "varchar", is_nullable => 0, size => 255 },
"model",
{ data_type => "varchar", is_nullable => 0, size => 255 },
"front_image",
{ data_type => "mediumblob", is_nullable => 1 },
"front_image_type",
{ data_type => "varchar", is_nullable => 0, size => 32 },
"mac_image",
{ data_type => "mediumblob", is_nullable => 1 },
"mac_image_type",
{ data_type => "varchar", is_nullable => 0, size => 32 },
);
__PACKAGE__->belongs_to(
"reseller",
"NGCP::Schema::Result::resellers",
{ id => "reseller_id" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "CASCADE",
on_update => "CASCADE",
}
);
__PACKAGE__->has_many(
"autoprov_firmwares",
"NGCP::Schema::Result::autoprov_firmwares",
{ "foreign.device_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"autoprov_configs",
"NGCP::Schema::Result::autoprov_configs",
{ "foreign.device_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->set_primary_key("id");
sub TO_JSON {
my ($self) = @_;
return {
map { blessed($_) && $_->isa('DateTime') ? $_->datetime : $_ } %{ $self->next::method }
};
}
=encoding UTF-8
=head1 NAME
NGCP::Schema::provisioning::Result::autoprov_devices
=head1 COMPONENTS LOADED
=over 4
=item * L<DBIx::Class::InflateColumn::DateTime>
=item * L<DBIx::Class::Helper::Row::ToJSON>
=back
=head1 TABLE: C<autoprov_devices>
=head1 ACCESSORS
=head2 id
data_type: 'integer'
extra: {unsigned => 1}
is_auto_increment: 1
is_nullable: 0
=head2 reseller_id
data_type: 'integer'
extra: {unsigned => 1}
is_nullable: 0
=head2 vendor
data_type: 'varchar'
is_nullable: 0
size: 255
=head2 model
data_type: 'varchar'
is_nullable: 0
size: 255
=head1 PRIMARY KEY
=over 4
=item * L</id>
=back
=cut
# Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-09-09 12:29:48
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fFY/6TuWLmvWIb9jDVyYFA
# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;

@ -0,0 +1,150 @@
package NGCP::Schema::Result::autoprov_field_devices;
use Sipwise::Base;
use MooseX::NonMoose;
use Scalar::Util qw(blessed);
our $VERSION = '2.004';
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime", "Helper::Row::ToJSON");
__PACKAGE__->table("provisioning.autoprov_field_devices");
__PACKAGE__->add_columns(
"id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_auto_increment => 1,
is_nullable => 0,
},
"subscriber_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 0,
},
"profile_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 0,
},
"identifier",
{ data_type => "varchar", is_nullable => 0, size => 255 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->add_unique_constraint("uk_identifier_idx", ["identifier"]);
__PACKAGE__->belongs_to(
"profile",
"NGCP::Schema::Result::autoprov_profiles",
{ id => "profile_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
__PACKAGE__->belongs_to(
"provisioning_voip_subscriber",
"NGCP::Schema::Result::provisioning_voip_subscribers",
{ id => "subscriber_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
sub TO_JSON {
my ($self) = @_;
return {
map { blessed($_) && $_->isa('DateTime') ? $_->datetime : $_ } %{ $self->next::method }
};
}
=encoding UTF-8
=head1 NAME
NGCP::Schema::provisioning::Result::autoprov_field_devices
=head1 COMPONENTS LOADED
=over 4
=item * L<DBIx::Class::InflateColumn::DateTime>
=item * L<DBIx::Class::Helper::Row::ToJSON>
=back
=head1 TABLE: C<autoprov_field_devices>
=head1 ACCESSORS
=head2 id
data_type: 'integer'
extra: {unsigned => 1}
is_auto_increment: 1
is_nullable: 0
=head2 subscriber_id
data_type: 'integer'
extra: {unsigned => 1}
is_foreign_key: 1
is_nullable: 0
=head2 profile_id
data_type: 'integer'
extra: {unsigned => 1}
is_foreign_key: 1
is_nullable: 0
=head2 identifier
data_type: 'varchar'
is_nullable: 0
size: 255
=head1 PRIMARY KEY
=over 4
=item * L</id>
=back
=head1 RELATIONS
=head2 profile
Type: belongs_to
Related object: L<NGCP::Schema::provisioning::Result::autoprov_profiles>
=head2 subscriber
Type: belongs_to
Related object: L<NGCP::Schema::provisioning::Result::voip_subscribers>
=cut
# Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-09-13 15:15:24
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nPg7ocQR/hxOrPWVhmsyQA
# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;

@ -0,0 +1,130 @@
package NGCP::Schema::Result::autoprov_firmwares;
use Sipwise::Base;
use MooseX::NonMoose;
use Scalar::Util qw(blessed);
our $VERSION = '2.004';
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime", "Helper::Row::ToJSON");
__PACKAGE__->table("provisioning.autoprov_firmwares");
__PACKAGE__->add_columns(
"id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_auto_increment => 1,
is_nullable => 0,
},
"device_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 0,
},
"filename",
{ data_type => "varchar", is_nullable => 1, size => 255 },
"data",
{ data_type => "longblob", is_nullable => 0 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to(
"device",
"NGCP::Schema::Result::autoprov_devices",
{ id => "device_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
__PACKAGE__->has_many(
"autoprov_profiles",
"NGCP::Schema::Result::autoprov_profiles",
{ "foreign.firmware_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
sub TO_JSON {
my ($self) = @_;
return {
map { blessed($_) && $_->isa('DateTime') ? $_->datetime : $_ } %{ $self->next::method }
};
}
=encoding UTF-8
=head1 NAME
NGCP::Schema::provisioning::Result::autoprov_firmwares
=head1 COMPONENTS LOADED
=over 4
=item * L<DBIx::Class::InflateColumn::DateTime>
=item * L<DBIx::Class::Helper::Row::ToJSON>
=back
=head1 TABLE: C<autoprov_firmwares>
=head1 ACCESSORS
=head2 id
data_type: 'integer'
extra: {unsigned => 1}
is_auto_increment: 1
is_nullable: 0
=head2 device_id
data_type: 'integer'
extra: {unsigned => 1}
is_foreign_key: 1
is_nullable: 0
=head2 data
data_type: 'longblob'
is_nullable: 0
=head1 PRIMARY KEY
=over 4
=item * L</id>
=back
=head1 RELATIONS
=head2 device
Type: belongs_to
Related object: L<NGCP::Schema::provisioning::Result::autoprov_devices>
=cut
# Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-09-09 16:43:11
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HXEGelcjENvGXpVeIfpWOw
# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;

@ -0,0 +1,154 @@
package NGCP::Schema::Result::autoprov_profiles;
use Sipwise::Base;
use MooseX::NonMoose;
use Scalar::Util qw(blessed);
our $VERSION = '2.004';
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
extends 'DBIx::Class::Core';
__PACKAGE__->load_components("InflateColumn::DateTime", "Helper::Row::ToJSON");
__PACKAGE__->table("provisioning.autoprov_profiles");
__PACKAGE__->add_columns(
"id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_auto_increment => 1,
is_nullable => 0,
},
"firmware_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 1,
},
"config_id",
{
data_type => "integer",
extra => { unsigned => 1 },
is_foreign_key => 1,
is_nullable => 0,
},
"name",
{ data_type => "varchar", is_nullable => 0, size => 255 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->belongs_to(
"config",
"NGCP::Schema::Result::autoprov_configs",
{ id => "config_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
__PACKAGE__->belongs_to(
"firmware",
"NGCP::Schema::Result::autoprov_firmwares",
{ id => "firmware_id" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "CASCADE",
on_update => "CASCADE",
},
);
sub TO_JSON {
my ($self) = @_;
return {
map { blessed($_) && $_->isa('DateTime') ? $_->datetime : $_ } %{ $self->next::method }
};
}
=encoding UTF-8
=head1 NAME
NGCP::Schema::provisioning::Result::autoprov_profiles
=head1 COMPONENTS LOADED
=over 4
=item * L<DBIx::Class::InflateColumn::DateTime>
=item * L<DBIx::Class::Helper::Row::ToJSON>
=back
=head1 TABLE: C<autoprov_profiles>
=head1 ACCESSORS
=head2 id
data_type: 'integer'
extra: {unsigned => 1}
is_auto_increment: 1
is_nullable: 0
=head2 firmware_id
data_type: 'integer'
extra: {unsigned => 1}
is_foreign_key: 1
is_nullable: 1
=head2 config_id
data_type: 'integer'
extra: {unsigned => 1}
is_foreign_key: 1
is_nullable: 0
=head2 name
data_type: 'varchar'
is_nullable: 0
size: 255
=head1 PRIMARY KEY
=over 4
=item * L</id>
=back
=head1 RELATIONS
=head2 config
Type: belongs_to
Related object: L<NGCP::Schema::provisioning::Result::autoprov_configs>
=head2 firmware
Type: belongs_to
Related object: L<NGCP::Schema::provisioning::Result::autoprov_firmwares>
=cut
# Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-09-09 22:49:47
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:c7ukjLDxp+bOS99nHMBm6A
# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
1;

@ -190,6 +190,13 @@ __PACKAGE__->belongs_to(
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"autoprov_field_devices",
"NGCP::Schema::Result::autoprov_field_devices",
{ "foreign.subscriber_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
sub TO_JSON {
my ($self) = @_;
return {

@ -155,6 +155,13 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"autoprov_devices",
"NGCP::Schema::Result::autoprov_devices",
{ "foreign.reseller_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
sub TO_JSON {
my ($self) = @_;
return {

Loading…
Cancel
Save