Bug 34587: DBIC files

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Matt Blenkinsop 2023-04-27 10:49:20 +00:00 committed by Tomas Cohen Arazi
parent 80b9878de3
commit 8f372e1e43
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
7 changed files with 1141 additions and 0 deletions

View File

@ -1312,6 +1312,21 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 erm_counter_logs
Type: has_many
Related object: L<Koha::Schema::Result::ErmCounterLog>
=cut
__PACKAGE__->has_many(
"erm_counter_logs",
"Koha::Schema::Result::ErmCounterLog",
{ "foreign.borrowernumber" => "self.borrowernumber" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 erm_user_roles
Type: has_many

View File

@ -0,0 +1,157 @@
use utf8;
package Koha::Schema::Result::ErmCounterFile;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::ErmCounterFile
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<erm_counter_files>
=cut
__PACKAGE__->table("erm_counter_files");
=head1 ACCESSORS
=head2 erm_counter_files_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
primary key
=head2 usage_data_provider_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 1
foreign key to erm_usage_data_providers
=head2 type
data_type: 'varchar'
is_nullable: 1
size: 80
type of counter file
=head2 filename
data_type: 'varchar'
is_nullable: 1
size: 80
name of the counter file
=head2 file_content
data_type: 'longblob'
is_nullable: 1
content of the counter file
=head2 date_uploaded
data_type: 'timestamp'
datetime_undef_if_invalid: 1
default_value: current_timestamp
is_nullable: 0
counter file upload date
=cut
__PACKAGE__->add_columns(
"erm_counter_files_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"usage_data_provider_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"type",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"filename",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"file_content",
{ data_type => "longblob", is_nullable => 1 },
"date_uploaded",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
default_value => \"current_timestamp",
is_nullable => 0,
},
);
=head1 PRIMARY KEY
=over 4
=item * L</erm_counter_files_id>
=back
=cut
__PACKAGE__->set_primary_key("erm_counter_files_id");
=head1 RELATIONS
=head2 erm_counter_logs
Type: has_many
Related object: L<Koha::Schema::Result::ErmCounterLog>
=cut
__PACKAGE__->has_many(
"erm_counter_logs",
"Koha::Schema::Result::ErmCounterLog",
{ "foreign.counter_files_id" => "self.erm_counter_files_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 usage_data_provider
Type: belongs_to
Related object: L<Koha::Schema::Result::ErmUsageDataProvider>
=cut
__PACKAGE__->belongs_to(
"usage_data_provider",
"Koha::Schema::Result::ErmUsageDataProvider",
{ erm_usage_data_provider_id => "usage_data_provider_id" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "CASCADE",
on_update => "CASCADE",
},
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-15 09:43:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+cy3yVUyED7b16dNoC6dSQ
sub koha_object_class {
'Koha::ERM::CounterFile';
}
sub koha_objects_class {
'Koha::ERM::CounterFiles';
}
1;

View File

@ -0,0 +1,161 @@
use utf8;
package Koha::Schema::Result::ErmCounterLog;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::ErmCounterLog
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<erm_counter_logs>
=cut
__PACKAGE__->table("erm_counter_logs");
=head1 ACCESSORS
=head2 erm_counter_log_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
primary key
=head2 borrowernumber
data_type: 'integer'
is_foreign_key: 1
is_nullable: 1
foreign key to borrowers
=head2 counter_files_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 1
foreign key to erm_counter_files
=head2 importdate
data_type: 'timestamp'
datetime_undef_if_invalid: 1
default_value: current_timestamp
is_nullable: 0
counter file import date
=head2 filename
data_type: 'varchar'
is_nullable: 1
size: 80
name of the counter file
=head2 logdetails
data_type: 'longtext'
is_nullable: 1
details from the counter log
=cut
__PACKAGE__->add_columns(
"erm_counter_log_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"borrowernumber",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"counter_files_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"importdate",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
default_value => \"current_timestamp",
is_nullable => 0,
},
"filename",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"logdetails",
{ data_type => "longtext", is_nullable => 1 },
);
=head1 PRIMARY KEY
=over 4
=item * L</erm_counter_log_id>
=back
=cut
__PACKAGE__->set_primary_key("erm_counter_log_id");
=head1 RELATIONS
=head2 borrowernumber
Type: belongs_to
Related object: L<Koha::Schema::Result::Borrower>
=cut
__PACKAGE__->belongs_to(
"borrowernumber",
"Koha::Schema::Result::Borrower",
{ borrowernumber => "borrowernumber" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "CASCADE",
on_update => "CASCADE",
},
);
=head2 counter_file
Type: belongs_to
Related object: L<Koha::Schema::Result::ErmCounterFile>
=cut
__PACKAGE__->belongs_to(
"counter_file",
"Koha::Schema::Result::ErmCounterFile",
{ erm_counter_files_id => "counter_files_id" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "CASCADE",
on_update => "CASCADE",
},
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-16 17:38:56
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:v22verlpwR3+7qLwsxJjtw
sub koha_object_class {
'Koha::ERM::CounterLog';
}
sub koha_objects_class {
'Koha::ERM::CounterLogs';
}
1;

View File

@ -0,0 +1,297 @@
use utf8;
package Koha::Schema::Result::ErmUsageDataProvider;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::ErmUsageDataProvider
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<erm_usage_data_providers>
=cut
__PACKAGE__->table("erm_usage_data_providers");
=head1 ACCESSORS
=head2 erm_usage_data_provider_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
primary key
=head2 name
data_type: 'varchar'
is_nullable: 0
size: 80
name of the data provider
=head2 description
data_type: 'longtext'
is_nullable: 1
description of the data provider
=head2 active
data_type: 'tinyint'
default_value: 1
is_nullable: 0
current status of the harvester - active/inactive
=head2 method
data_type: 'varchar'
is_nullable: 1
size: 80
method of the harvester
=head2 aggregator
data_type: 'varchar'
is_nullable: 1
size: 80
aggregator of the harvester
=head2 service_type
data_type: 'varchar'
is_nullable: 1
size: 80
service_type of the harvester
=head2 service_url
data_type: 'varchar'
is_nullable: 1
size: 80
service_url of the harvester
=head2 report_release
data_type: 'varchar'
is_nullable: 1
size: 80
report_release of the harvester
=head2 begin_date
data_type: 'date'
datetime_undef_if_invalid: 1
is_nullable: 1
start date of the harvester
=head2 end_date
data_type: 'date'
datetime_undef_if_invalid: 1
is_nullable: 1
end date of the harvester
=head2 customer_id
data_type: 'varchar'
is_nullable: 1
size: 50
sushi customer id
=head2 requestor_id
data_type: 'varchar'
is_nullable: 1
size: 50
sushi requestor id
=head2 api_key
data_type: 'varchar'
is_nullable: 1
size: 80
sushi api key
=head2 requestor_name
data_type: 'varchar'
is_nullable: 1
size: 80
requestor name
=head2 requestor_email
data_type: 'varchar'
is_nullable: 1
size: 80
requestor email
=head2 report_types
data_type: 'varchar'
is_nullable: 1
size: 255
report types provided by the harvester
=cut
__PACKAGE__->add_columns(
"erm_usage_data_provider_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"name",
{ data_type => "varchar", is_nullable => 0, size => 80 },
"description",
{ data_type => "longtext", is_nullable => 1 },
"active",
{ data_type => "tinyint", default_value => 1, is_nullable => 0 },
"method",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"aggregator",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"service_type",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"service_url",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"report_release",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"begin_date",
{ data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
"end_date",
{ data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
"customer_id",
{ data_type => "varchar", is_nullable => 1, size => 50 },
"requestor_id",
{ data_type => "varchar", is_nullable => 1, size => 50 },
"api_key",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"requestor_name",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"requestor_email",
{ data_type => "varchar", is_nullable => 1, size => 80 },
"report_types",
{ data_type => "varchar", is_nullable => 1, size => 255 },
);
=head1 PRIMARY KEY
=over 4
=item * L</erm_usage_data_provider_id>
=back
=cut
__PACKAGE__->set_primary_key("erm_usage_data_provider_id");
=head1 RELATIONS
=head2 erm_counter_files
Type: has_many
Related object: L<Koha::Schema::Result::ErmCounterFile>
=cut
__PACKAGE__->has_many(
"erm_counter_files",
"Koha::Schema::Result::ErmCounterFile",
{
"foreign.usage_data_provider_id" => "self.erm_usage_data_provider_id",
},
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 erm_usage_muses
Type: has_many
Related object: L<Koha::Schema::Result::ErmUsageMus>
=cut
__PACKAGE__->has_many(
"erm_usage_muses",
"Koha::Schema::Result::ErmUsageMus",
{
"foreign.usage_data_provider_id" => "self.erm_usage_data_provider_id",
},
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 erm_usage_titles
Type: has_many
Related object: L<Koha::Schema::Result::ErmUsageTitle>
=cut
__PACKAGE__->has_many(
"erm_usage_titles",
"Koha::Schema::Result::ErmUsageTitle",
{
"foreign.usage_data_provider_id" => "self.erm_usage_data_provider_id",
},
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 erm_usage_yuses
Type: has_many
Related object: L<Koha::Schema::Result::ErmUsageYus>
=cut
__PACKAGE__->has_many(
"erm_usage_yuses",
"Koha::Schema::Result::ErmUsageYus",
{
"foreign.usage_data_provider_id" => "self.erm_usage_data_provider_id",
},
{ cascade_copy => 0, cascade_delete => 0 },
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-16 17:38:56
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XdI3SAA+QWQsWyQdoS0EEQ
# __PACKAGE__->add_columns(
# '+active' => { is_boolean => 1 }
# );
sub koha_object_class {
'Koha::ERM::UsageDataProvider';
}
sub koha_objects_class {
'Koha::ERM::UsageDataProviders';
}
1;

View File

@ -0,0 +1,174 @@
use utf8;
package Koha::Schema::Result::ErmUsageMus;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::ErmUsageMus
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<erm_usage_mus>
=cut
__PACKAGE__->table("erm_usage_mus");
=head1 ACCESSORS
=head2 monthly_usage_summary_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
primary key
=head2 title_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 1
item title id number
=head2 usage_data_provider_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 1
item title id number
=head2 year
data_type: 'integer'
is_nullable: 1
year of usage statistics
=head2 month
data_type: 'integer'
is_nullable: 1
month of usage statistics
=head2 usage_count
data_type: 'integer'
is_nullable: 1
usage count for the title
=head2 metric_type
data_type: 'varchar'
is_nullable: 1
size: 50
metric type for the usage statistic
=head2 report_type
data_type: 'varchar'
is_nullable: 1
size: 50
report type for the usage statistic
=cut
__PACKAGE__->add_columns(
"monthly_usage_summary_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"title_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"usage_data_provider_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"year",
{ data_type => "integer", is_nullable => 1 },
"month",
{ data_type => "integer", is_nullable => 1 },
"usage_count",
{ data_type => "integer", is_nullable => 1 },
"metric_type",
{ data_type => "varchar", is_nullable => 1, size => 50 },
"report_type",
{ data_type => "varchar", is_nullable => 1, size => 50 },
);
=head1 PRIMARY KEY
=over 4
=item * L</monthly_usage_summary_id>
=back
=cut
__PACKAGE__->set_primary_key("monthly_usage_summary_id");
=head1 RELATIONS
=head2 title
Type: belongs_to
Related object: L<Koha::Schema::Result::ErmUsageTitle>
=cut
__PACKAGE__->belongs_to(
"title",
"Koha::Schema::Result::ErmUsageTitle",
{ title_id => "title_id" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "CASCADE",
on_update => "CASCADE",
},
);
=head2 usage_data_provider
Type: belongs_to
Related object: L<Koha::Schema::Result::ErmUsageDataProvider>
=cut
__PACKAGE__->belongs_to(
"usage_data_provider",
"Koha::Schema::Result::ErmUsageDataProvider",
{ erm_usage_data_provider_id => "usage_data_provider_id" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "CASCADE",
on_update => "CASCADE",
},
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-25 13:49:06
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QarVvHaFDYvZtUt2brKM2w
sub koha_object_class {
'Koha::ERM::MonthlyUsage';
}
sub koha_objects_class {
'Koha::ERM::MonthlyUsages';
}
1;

View File

@ -0,0 +1,172 @@
use utf8;
package Koha::Schema::Result::ErmUsageTitle;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::ErmUsageTitle
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<erm_usage_titles>
=cut
__PACKAGE__->table("erm_usage_titles");
=head1 ACCESSORS
=head2 title_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
primary key
=head2 title
data_type: 'varchar'
is_nullable: 1
size: 255
item title
=head2 usage_data_provider_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
platform the title is harvested by
=head2 title_doi
data_type: 'varchar'
is_nullable: 1
size: 24
DOI number for the title
=head2 print_issn
data_type: 'varchar'
is_nullable: 1
size: 24
Print ISSN number for the title
=head2 online_issn
data_type: 'varchar'
is_nullable: 1
size: 24
Online ISSN number for the title
=head2 title_uri
data_type: 'varchar'
is_nullable: 1
size: 24
URI number for the title
=cut
__PACKAGE__->add_columns(
"title_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"title",
{ data_type => "varchar", is_nullable => 1, size => 255 },
"usage_data_provider_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"title_doi",
{ data_type => "varchar", is_nullable => 1, size => 24 },
"print_issn",
{ data_type => "varchar", is_nullable => 1, size => 24 },
"online_issn",
{ data_type => "varchar", is_nullable => 1, size => 24 },
"title_uri",
{ data_type => "varchar", is_nullable => 1, size => 24 },
);
=head1 PRIMARY KEY
=over 4
=item * L</title_id>
=back
=cut
__PACKAGE__->set_primary_key("title_id");
=head1 RELATIONS
=head2 erm_usage_muses
Type: has_many
Related object: L<Koha::Schema::Result::ErmUsageMus>
=cut
__PACKAGE__->has_many(
"erm_usage_muses",
"Koha::Schema::Result::ErmUsageMus",
{ "foreign.title_id" => "self.title_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 erm_usage_yuses
Type: has_many
Related object: L<Koha::Schema::Result::ErmUsageYus>
=cut
__PACKAGE__->has_many(
"erm_usage_yuses",
"Koha::Schema::Result::ErmUsageYus",
{ "foreign.title_id" => "self.title_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 usage_data_provider
Type: belongs_to
Related object: L<Koha::Schema::Result::ErmUsageDataProvider>
=cut
__PACKAGE__->belongs_to(
"usage_data_provider",
"Koha::Schema::Result::ErmUsageDataProvider",
{ erm_usage_data_provider_id => "usage_data_provider_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-15 09:43:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IfPJJVTctPmRyVYt0DUbYA
sub koha_object_class {
'Koha::ERM::UsageTitle';
}
sub koha_objects_class {
'Koha::ERM::UsageTitles';
}
1;

View File

@ -0,0 +1,165 @@
use utf8;
package Koha::Schema::Result::ErmUsageYus;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::ErmUsageYus
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<erm_usage_yus>
=cut
__PACKAGE__->table("erm_usage_yus");
=head1 ACCESSORS
=head2 yearly_usage_summary_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
primary key
=head2 title_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 1
item title id number
=head2 usage_data_provider_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 1
item title id number
=head2 year
data_type: 'integer'
is_nullable: 1
year of usage statistics
=head2 totalcount
data_type: 'integer'
is_nullable: 1
usage count for the title
=head2 metric_type
data_type: 'varchar'
is_nullable: 1
size: 50
metric type for the usage statistic
=head2 report_type
data_type: 'varchar'
is_nullable: 1
size: 50
report type for the usage statistic
=cut
__PACKAGE__->add_columns(
"yearly_usage_summary_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"title_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"usage_data_provider_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"year",
{ data_type => "integer", is_nullable => 1 },
"totalcount",
{ data_type => "integer", is_nullable => 1 },
"metric_type",
{ data_type => "varchar", is_nullable => 1, size => 50 },
"report_type",
{ data_type => "varchar", is_nullable => 1, size => 50 },
);
=head1 PRIMARY KEY
=over 4
=item * L</yearly_usage_summary_id>
=back
=cut
__PACKAGE__->set_primary_key("yearly_usage_summary_id");
=head1 RELATIONS
=head2 title
Type: belongs_to
Related object: L<Koha::Schema::Result::ErmUsageTitle>
=cut
__PACKAGE__->belongs_to(
"title",
"Koha::Schema::Result::ErmUsageTitle",
{ title_id => "title_id" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "CASCADE",
on_update => "CASCADE",
},
);
=head2 usage_data_provider
Type: belongs_to
Related object: L<Koha::Schema::Result::ErmUsageDataProvider>
=cut
__PACKAGE__->belongs_to(
"usage_data_provider",
"Koha::Schema::Result::ErmUsageDataProvider",
{ erm_usage_data_provider_id => "usage_data_provider_id" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "CASCADE",
on_update => "CASCADE",
},
);
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-25 13:49:06
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zXTpOQQ2kTmGzzOSohg0YA
sub koha_object_class {
'Koha::ERM::YearlyUsage';
}
sub koha_objects_class {
'Koha::ERM::YearlyUsages';
}
1;