Bug 7736 and t/db_dependent/TestBuilder.t
Hi to all, working on bug 7736, after insert code and update db, I find problem with this test: prove t/db_dependent/TestBuilder This is the error that I receviee: t/db_dependent/TestBuilder.t .. 3/41 DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`edifact_messages`, CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`)) [for Statement "DELETE FROM `aqbasket` WHERE ( `basketno` = ? )" with ParamValues: 0='37'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1593. DBIx::Class::ResultSet::delete_all(): Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`edifact_messages`, CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`)) at /production/develops/t/lib/TestBuilder.pm line 94 DBIx::Class::Carp::__ANON__(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at /usr/share/perl5/DBIx/Class/Storage/TxnScopeGuard.pm line 132 # Looks like you planned 41 tests but ran 35. # Looks like your test exited with 255 just after 35. t/db_dependent/TestBuilder.t .. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 6/41 subtests Test Summary Report ------------------- t/db_dependent/TestBuilder.t (Wstat: 65280 Tests: 35 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 41 tests but ran 35. Files=1, Tests=35, 9 wallclock secs ( 0.04 usr 0.01 sys + 7.54 cusr 0.24 csys = 7.83 CPU) Result: FAIL The bug 7736 add 3 table to Koha: edifact_ean table vendor_edi_accounts table edifact_messages vendor_edi_accounts with does constraints CREATE TABLE IF NOT EXISTS vendor_edi_accounts ( ... CONSTRAINT vfk_vendor_id FOREIGN KEY ( vendor_id ) REFERENCES aqbooksellers ( id ), CONSTRAINT vfk_shipment_budget FOREIGN KEY ( shipment_budget ) REFERENCES aqbudgets ( budget_id ) ... ) CREATE TABLE IF NOT EXISTS edifact_messages ( ... CONSTRAINT emfk_vendor FOREIGN KEY ( vendor_id ) REFERENCES aqbooksellers ( id ), CONSTRAINT emfk_edi_acct FOREIGN KEY ( edi_acct ) REFERENCES vendor_edi_accounts ( id ), CONSTRAINT emfk_basketno FOREIGN KEY ( basketno ) REFERENCES aqbasket ( basketno ) ... ) ALTER TABLE aqinvoices ADD COLUMN message_id INT(11) REFERENCES edifact_messages( id ); ALTER TABLE aqinvoices ADD CONSTRAINT edifact_msg_fk FOREIGN KEY ( message_id ) REFERENCES edifact_messages ( id ) ON DELETE SET NULL; CREATE TABLE IF NOT EXISTS edifact_ean ( ... CONSTRAINT efk_branchcode FOREIGN KEY ( branchcode ) REFERENCES branches ( branchcode ) ... ) The full update done by bug 7736 is here: https://github.com/colinsc/koha/blob/edifact_snapshot_150911/installer/data/... As I see there is a problem on about this costraint of table edifact_messages: CONSTRAINT emfk_basketno FOREIGN KEY ( basketno ) REFERENCES aqbasket ( basketno ) Reading the code of t/db_dependent/TestBuilder.t I don't understand if there is problem on how the constraint is done or I need to change TestBuilder.t. Do you have any idea ? Where can i find more info about TestBuilder.t ? Bye Zeno Tajoli -- Zeno Tajoli /Dipartimento Sviluppi Innovativi/ - Automazione Biblioteche Email: z.tajoli@cineca.it Fax: 051/6132198 *CINECA* Consorzio Interuniversitario - Sede operativa di Segrate (MI)
I can have a look but the patch does not apply anymore and I have got an error on updating the DB: DBD::mysql::db do failed: Can't create table `koha`.`edifact_ean` (errno: 150 "Foreign key constraint is incorrectly formed") [for Statement "CREATE TABLE IF NOT EXISTS edifact_ean ( branchcode VARCHAR(10) NOT NULL REFERENCES branches (branchcode), ean varchar(15) NOT NULL, id_code_qualifier VARCHAR(3) NOT NULL DEFAULT '14', CONSTRAINT efk_branchcode FOREIGN KEY ( branchcode ) REFERENCES branches ( branchcode ) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 "] at installer/data/mysql/updatedatabase.pl line 11247. Upgrade to 3.21.00.XXX done (Bug 7736 DB Changes for Edifact Processing ( Quote, Order and Invoice)) 2015-10-27 12:09 GMT+00:00 Tajoli Zeno <z.tajoli@cineca.it>:
Hi to all,
working on bug 7736, after insert code and update db, I find problem with this test: prove t/db_dependent/TestBuilder
This is the error that I receviee:
t/db_dependent/TestBuilder.t .. 3/41 DBD::mysql::st execute failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`edifact_messages`, CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`)) [for Statement "DELETE FROM `aqbasket` WHERE ( `basketno` = ? )" with ParamValues: 0='37'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1593.
DBIx::Class::ResultSet::delete_all(): Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`edifact_messages`, CONSTRAINT `emfk_basketno` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`)) at /production/develops/t/lib/TestBuilder.pm line 94 DBIx::Class::Carp::__ANON__(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at /usr/share/perl5/DBIx/Class/Storage/TxnScopeGuard.pm line 132
# Looks like you planned 41 tests but ran 35. # Looks like your test exited with 255 just after 35.
t/db_dependent/TestBuilder.t .. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 6/41 subtests
Test Summary Report ------------------- t/db_dependent/TestBuilder.t (Wstat: 65280 Tests: 35 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 41 tests but ran 35. Files=1, Tests=35, 9 wallclock secs ( 0.04 usr 0.01 sys + 7.54 cusr 0.24 csys = 7.83 CPU) Result: FAIL
The bug 7736 add 3 table to Koha:
edifact_ean table vendor_edi_accounts table edifact_messages vendor_edi_accounts
with does constraints
CREATE TABLE IF NOT EXISTS vendor_edi_accounts ( ... CONSTRAINT vfk_vendor_id FOREIGN KEY ( vendor_id ) REFERENCES aqbooksellers ( id ), CONSTRAINT vfk_shipment_budget FOREIGN KEY ( shipment_budget ) REFERENCES aqbudgets ( budget_id ) ... )
CREATE TABLE IF NOT EXISTS edifact_messages ( ... CONSTRAINT emfk_vendor FOREIGN KEY ( vendor_id ) REFERENCES aqbooksellers ( id ), CONSTRAINT emfk_edi_acct FOREIGN KEY ( edi_acct ) REFERENCES vendor_edi_accounts ( id ), CONSTRAINT emfk_basketno FOREIGN KEY ( basketno ) REFERENCES aqbasket ( basketno ) ... )
ALTER TABLE aqinvoices ADD COLUMN message_id INT(11) REFERENCES edifact_messages( id );
ALTER TABLE aqinvoices ADD CONSTRAINT edifact_msg_fk FOREIGN KEY ( message_id ) REFERENCES edifact_messages ( id ) ON DELETE SET NULL;
CREATE TABLE IF NOT EXISTS edifact_ean ( ... CONSTRAINT efk_branchcode FOREIGN KEY ( branchcode ) REFERENCES branches ( branchcode ) ... )
The full update done by bug 7736 is here: https://github.com/colinsc/koha/blob/edifact_snapshot_150911/installer/data/...
As I see there is a problem on about this costraint of table edifact_messages: CONSTRAINT emfk_basketno FOREIGN KEY ( basketno ) REFERENCES aqbasket ( basketno )
Reading the code of t/db_dependent/TestBuilder.t I don't understand if there is problem on how the constraint is done or I need to change TestBuilder.t.
Do you have any idea ? Where can i find more info about TestBuilder.t ?
Bye Zeno Tajoli
-- Zeno Tajoli /Dipartimento Sviluppi Innovativi/ - Automazione Biblioteche Email: z.tajoli@cineca.it Fax: 051/6132198 *CINECA* Consorzio Interuniversitario - Sede operativa di Segrate (MI) _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
Hi, Il 27/10/2015 13:26, Jonathan Druart ha scritto:
I can have a look but the patch does not apply anymore and I have got an error on updating the DB: DBD::mysql::db do failed: Can't create table `koha`.`edifact_ean`
in fact the definition of edifact_ean in atomicupdate is wrong. I'm rebasing the patch Bye -- Zeno Tajoli /Dipartimento Sviluppi Innovativi/ - Automazione Biblioteche Email: z.tajoli@cineca.it Fax: 051/6132198 *CINECA* Consorzio Interuniversitario - Sede operativa di Segrate (MI)
participants (2)
-
Jonathan Druart -
Tajoli Zeno