[Koha-bugs] [Bug 11390] DBIx::Class schema deployment script

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Nov 28 00:00:30 CET 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11390

--- Comment #9 from David Cook <dcook at prosentient.com.au> ---
(In reply to David Cook from comment #8)

> 10) DBIC wasn't able to create tables
> 
> DBD::mysql::db do failed: Can't create table 'kohadev38.items_search_fields'
> (errno: 150) at /usr/lib/perl5/site_perl/5.16.2/DBIx/Class/Storage/DBI.pm
> line 3053.
> DBD::mysql::db do failed: Incorrect table definition; there can be only one
> auto column and it must be defined as a key at
> /usr/lib/perl5/site_perl/5.16.2/DBIx/Class/Storage/DBI.pm line 3053
> 
> AFFECTED:
> `items_search_fields`
> `message_queue`
> 

Muahahaha!

Solved!

1) `items_search_fields`

Foreign keys must reference indexed columns. In kohastructure.sql,
`authorised_values`.`category` has an index. However, that index is missing
when using DBIC, so we get an errno 150, when we try to add
`items_search_fields` because the constraint can't be generated.

The fix? Add an index to `authorised_values`.`category`. DONE!

(http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html)

2) `message_queue`

This error is also because of a missing key. In kohastructure.sql,
`message_queue`.`message_id` has an index. In theory, it should be a primary
key, but it's not. It's just a regular key. Anyway, it's enough not to generate
errors.

However, with DBIC, that index is missing, so we get an error when trying to
add `message_queue`.

---

In summary, add indexes for `authorised_values`.`category` and
`message_queue`.`message_id`, and both tables will be created properly.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list