[Koha-bugs] [Bug 27534] koha upgrade throws SQL error while applying Bug 25333 - Change message transport type for Talking Tech from "phone" to "itiva"
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Wed Feb 3 15:09:35 CET 2021
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27534
--- Comment #10 from Manos PETRIDIS <egpetridis at yahoo.com> ---
(In reply to Jonathan Druart from comment #9)
> Manos, it means you already have it in the table.
>
> MariaDB [koha_kohadev]> select count(*) from letter where
> message_transport_type="phone";
> +----------+
> | count(*) |
> +----------+
> | 1 |
> +----------+
> 1 row in set (0.000 sec)
>
> MariaDB [koha_kohadev]> UPDATE message_transport_types SET
> message_transport_type = "xxx" WHERE message_transport_type = "phone";
> Query OK, 1 row affected (0.019 sec)
> Rows matched: 1 Changed: 1 Warnings: 0
>
> MariaDB [koha_kohadev]> select count(*) from letter where
> message_transport_type="xxx";
> +----------+
> | count(*) |
> +----------+
> | 1 |
> +----------+
> 1 row in set (0.002 sec)
>
>
> That seems to work for me.
The error originally reported was
DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key
constraint fails (`koha_usmarc`.`letter`, CONSTRAINT
`message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES
`message_transport_types` (`message_transport_type`)) [for Statement "
UPDATE message_transport_types SET message_transport_type = "itiva"
WHERE message_transport_type = "phone"
"] at
/usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl line
23192.
Upgrade to 20.06.00.058 done [00:14:07]: Bug 25333 - Change message transport
type for Talking Tech from "phone" to "itiva"
... and Kyle HALL noted that it may be due to a missing "ON UPDATE CASCADE" on
the `letter` table. I followed the test he suggested and verified that in my
installation the update failed.
If I read correctly the patch you supplied, you drop FOREIGN KEY
message_transport_type_fk in letter table. As far as I know though, one doesn't
need to drop the FOREIGN KEY altogether, just drop the CONSTRAINT and re-create
it, including the missing CASCADE clause.
I was then able to sucessufuly perform the test update
UPDATE message_transport_types SET message_transport_type = "asdf" WHERE
message_transport_type = "email" .
I understand that I have to run
UPDATE message_transport_types SET message_transport_type = "itiva" WHERE
message_transport_type = "phone"
so that the correction in Bug 25333 is performed, but apart from that, what is
that I already have [some] table?
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list