|
Description
Nick Clemens (kidclamp)
2020-08-31 16:46:25 UTC
Created attachment 109373 [details] [review] Bug 26326: Add Koha Objects for Record Import Matches To test: 1 - Apply patches 2 - Update database 3 - Generate schema files (dbic) 4 - prove -v t/db_dependent/Koha/Import/Record/Matches.t Created attachment 114817 [details] [review] Bug 26326: Add Koha Objects for Import Records and Import Record Matches To test: 1 - Apply patches 2 - Update database 3 - Generate schema files (dbic) 4 - prove -v t/db_dependent/Koha/Import/Records.t 5 - prove -v t/db_dependent/Koha/Import/Record/Matches.t https://bugs.koha-community.org/show_bug.cgi?id=22785 Created attachment 118974 [details] [review] Bug 26326: Add Koha Objects for Import Records and Import Record Matches To test: 1 - Apply patches 2 - Update database 3 - Generate schema files (dbic) 4 - prove -v t/db_dependent/Koha/Import/Records.t 5 - prove -v t/db_dependent/Koha/Import/Record/Matches.t https://bugs.koha-community.org/show_bug.cgi?id=22785 I get an error when running updatedatabase:
DEV atomic update: bug_26326.perl
Atomic update generated errors: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Can't DROP 'PRIMARY'; check that column/key exists [for Statement "ALTER TABLE import_record_matches DROP PRIMARY KEY"] at /usr/share/perl5/DBIx/Class/Schema.pm line 1118.
DBIx::Class::Schema::throw_exception(Koha::Schema=HASH(0x55bbeee34d60), "DBI Exception: DBD::mysql::db do failed: Can't DROP 'PRIMARY'"...) called at /usr/share/perl5/DBIx/Class/Storage.pm line 113
DBIx::Class::Storage::throw_exception(DBIx::Class::Storage::DBI::mysql=HASH(0x55bbee117670), "DBI Exception: DBD::mysql::db do failed: Can't DROP 'PRIMARY'"...) called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1501
DBIx::Class::Storage::DBI::__ANON__("DBD::mysql::db do failed: Can't DROP 'PRIMARY'; check that co"..., DBI::db=HASH(0x55bbef809d70), undef) called at (eval 1457) line 7
eval '$DBversion = \'XXX\';
if( CheckVersion( $DBversion ) ) {
unless(
primary_key_exists(\'import_record_matches\',\'import_record_id\') &&
primary_key_exists(\'import_record_matches\',\'candidate_match_id\')
){
$dbh->do( "ALTER TABLE import_record_matches DROP PRIMARY KEY" );
$dbh->do( "ALTER TABLE import_record_matches ADD PRIMARY KEY (import_record_id,candidate_match_id)" );
}
NewVersion( $DBversion, 26326, "Add primary key to import_record_matches");
}
' called at /kohadevbox/koha/installer/data/mysql/updatedatabase.pl line 23755
Created attachment 119017 [details] [review] Bug 26326: (follow-up) Add ability to check for existence of any primary key Before dropping a primary key we need to see if one exists - this updates the installer method to allow searching for existence of key Created attachment 120992 [details] [review] Bug 26326: Add Koha Objects for Import Records and Import Record Matches To test: 1 - Apply patches 2 - Update database 3 - Generate schema files (dbic) 4 - prove -v t/db_dependent/Koha/Import/Records.t 5 - prove -v t/db_dependent/Koha/Import/Record/Matches.t https://bugs.koha-community.org/show_bug.cgi?id=22785 Created attachment 120993 [details] [review] Bug 26326: (follow-up) Add ability to check for existence of any primary key Before dropping a primary key we need to see if one exists - this updates the installer method to allow searching for existence of key I'm getting a failure on that second test:
root@kohadevbox:koha(master)$ prove -v t/db_dependent/Koha/Import/Record/Matches.t
t/db_dependent/Koha/Import/Record/Matches.t ..
1..7
No method count found for Koha::Import::Record::Matches DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'chosen' in 'where clause' [for Statement "SELECT COUNT( * ) FROM `import_record_matches` `me` WHERE ( `chosen` = ? )" with ParamValues: 0=1] at /kohadevbox/koha/Koha/Objects.pm line 601
at t/db_dependent/Koha/Import/Record/Matches.t line 34.
ok 1 - The 2 matches should have been added
No method count found for Koha::Import::Record::Matches DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'chosen' in 'where clause' [for Statement "SELECT COUNT( * ) FROM `import_record_matches` `me` WHERE ( `chosen` = ? )" with ParamValues: 0=1] at /kohadevbox/koha/Koha/Objects.pm line 601
at t/db_dependent/Koha/Import/Record/Matches.t line 41.
Use of uninitialized value $nb_of_chosen_matches in addition (+) at t/db_dependent/Koha/Import/Record/Matches.t line 41.
not ok 2 - The 2 chosen matches should have been added
# Failed test 'The 2 chosen matches should have been added'
# at t/db_dependent/Koha/Import/Record/Matches.t line 41.
# got: undef
# expected: '2'
ok 3 - Find a match by import record id and candidate should return the correct match
The method Koha::Import::Record::Match->chosen is not covered by tests!
Trace begun at /kohadevbox/koha/Koha/Object.pm line 826
Koha::Object::AUTOLOAD('Koha::Import::Record::Match=HASH(0x560a165b3078)', 0) called at /kohadevbox/koha/Koha/Import/Record/Matches.pm line 49
Koha::Import::Record::Matches::unset_chosen('Koha::Import::Record::Matches=HASH(0x560a165f24b8)') called at t/db_dependent/Koha/Import/Record/Matches.t line 47
# Looks like your test exited with 255 just after 3.
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 5/7 subtests
Test Summary Report
-------------------
t/db_dependent/Koha/Import/Record/Matches.t (Wstat: 65280 Tests: 3 Failed: 1)
Failed test: 2
Non-zero exit status: 255
Parse errors: Bad plan. You planned 7 tests but ran 3.
Files=1, Tests=3, 2 wallclock secs ( 0.01 usr 0.00 sys + 1.17 cusr 0.21 csys = 1.39 CPU)
Result: FAIL
Created attachment 121164 [details] [review] Bug 26326: Add Koha Objects for Import Records and Import Record Matches To test: 1 - Apply patches 2 - Update database 3 - Generate schema files (dbic) 4 - prove -v t/db_dependent/Koha/Import/Records.t 5 - prove -v t/db_dependent/Koha/Import/Record/Matches.t Created attachment 121165 [details] [review] Bug 26326: (follow-up) Add ability to check for existence of any primary key Before dropping a primary key we need to see if one exists - this updates the installer method to allow searching for existence of key Created attachment 121166 [details] [review] Bug 26326: DO NOT PUSH Schema changes Created attachment 121199 [details] [review] Bug 26326: Add Koha Objects for Import Records and Import Record Matches To test: 1 - Apply patches 2 - Update database 3 - Generate schema files (dbic) 4 - prove -v t/db_dependent/Koha/Import/Records.t 5 - prove -v t/db_dependent/Koha/Import/Record/Matches.t Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Created attachment 121200 [details] [review] Bug 26326: (follow-up) Add ability to check for existence of any primary key Before dropping a primary key we need to see if one exists - this updates the installer method to allow searching for existence of key Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Created attachment 121201 [details] [review] Bug 26326: DO NOT PUSH Schema changes Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Looking here Couldnt finish this one. Resetting status Created attachment 124171 [details] [review] Bug 26326: Add Koha Objects for Import Records and Import Record Matches To test: 1 - Apply patches 2 - Update database 3 - Generate schema files (dbic) 4 - prove -v t/db_dependent/Koha/Import/Records.t 5 - prove -v t/db_dependent/Koha/Import/Record/Matches.t Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Created attachment 124172 [details] [review] Bug 26326: (follow-up) Add ability to check for existence of any primary key Before dropping a primary key we need to see if one exists - this updates the installer method to allow searching for existence of key Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Created attachment 124173 [details] [review] Bug 26326: DO NOT PUSH Schema changes Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Please fix the QA script POD and merge marker errors. Created attachment 126979 [details] [review] Bug 26326: (follow-up) Address qa script failures (In reply to Katrin Fischer from comment #20) > Please fix the QA script POD and merge marker errors. Remaining errors are spurious and can be ignored Created attachment 127165 [details] [review] Bug 26326: Add Koha Objects for Import Records and Import Record Matches To test: 1 - Apply patches 2 - Update database 3 - Generate schema files (dbic) 4 - prove -v t/db_dependent/Koha/Import/Records.t 5 - prove -v t/db_dependent/Koha/Import/Record/Matches.t Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Created attachment 127166 [details] [review] Bug 26326: (follow-up) Add ability to check for existence of any primary key Before dropping a primary key we need to see if one exists - this updates the installer method to allow searching for existence of key Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Created attachment 127167 [details] [review] Bug 26326: DO NOT PUSH Schema changes Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Created attachment 127168 [details] [review] Bug 26326: (follow-up) Address qa script failures Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> +sub unset_chosen {
+ my ( $self ) = @_;
+ while ( my $match = $self->next ){
+ $match->chosen(0)->store;
+ }
+}
This is not used, not covered by tests, and actually could be replaced by a single $set->update call.
Created attachment 127257 [details] [review] Bug 26326: Add Koha Objects for Import Records and Import Record Matches To test: 1 - Apply patches 2 - Update database 3 - Generate schema files (dbic) 4 - prove -v t/db_dependent/Koha/Import/Records.t 5 - prove -v t/db_dependent/Koha/Import/Record/Matches.t Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> JD Amended patch: remove unused unset_chosen method Created attachment 127258 [details] [review] Bug 26326: (follow-up) Add ability to check for existence of any primary key Before dropping a primary key we need to see if one exists - this updates the installer method to allow searching for existence of key Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Bug 26326: (follow-up) Address qa script failures Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Created attachment 127259 [details] [review] Bug 26326: DO NOT PUSH Schema changes Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Pushed to master for 21.11, thanks to everybody involved! |