Bug 18836 - MySQL 5.7 - Table 'koha_library.club_enrollments' doesn't exist
Summary: MySQL 5.7 - Table 'koha_library.club_enrollments' doesn't exist
Status: RESOLVED DUPLICATE of bug 20144
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: Macintosh Linux
: P5 - low major (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 12461
Blocks: 17258
  Show dependency treegraph
 
Reported: 2017-06-21 14:21 UTC by C.J.S. Hayward
Modified: 2018-02-06 20:53 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description C.J.S. Hayward 2017-06-21 14:21:02 UTC
(Checked the Wiki, tried chat, and searched bugs before reporting.)

I tried to log in as a user and got:

Software error:

Template process failed: undef error - DBIx::Class::Storage::DBI::_dbh_execute(): Table 'koha_library.club_enrollments' doesn't exist at /usr/share/koha/lib/Koha/Objects.pm line 260
For help, please send mail to the webmaster ([no address given]), giving this error message and the time and date of the error.

The VirtualHost below is the only one listening on its special port:

Listen 7026

# OPAC
<VirtualHost *:7026>
  <IfVersion >= 2.4>
   Define instance "library"
  </IfVersion>
   Include /etc/koha/apache-shared.conf
#  Include /etc/koha/apache-shared-disable.conf
#  Include /etc/koha/apache-shared-opac-plack.conf
   Include /etc/koha/apache-shared-opac.conf

   ServerName library.myDNSname.org
   SetEnv KOHA_CONF "/etc/koha/sites/library/koha-conf.xml"
   AssignUserID library-koha library-koha

   ErrorLog    /var/log/koha/library/opac-error.log
#  TransferLog /var/log/koha/library/opac-access.log
#  RewriteLog  /var/log/koha/library/opac-rewrite.log
</VirtualHost>

What can I do to either create missing tables like koha_libary.club_enrollments, or mark them as not needed for the patron screen to do its work?


Thanks,
C.J.S. Hayward
https://CJSHayward.com
Comment 1 Katrin Fischer 2017-06-21 19:14:19 UTC
Did you have any errors running the web installer?
Comment 2 C.J.S. Hayward 2017-06-21 19:31:40 UTC
I don't remember seeing errors. Would it make sense to wipe the installation and re-run the installer, and if so, how can I do that?

Thx,
Comment 3 Katrin Fischer 2017-06-21 20:08:24 UTC
You could create and try with another instance - this might be the easiest and you might be able to compare the 2 databases.
Comment 4 C.J.S. Hayward 2017-06-21 20:45:40 UTC
Thank you; I tried and ran into an error. Ducked into chat, and they said a bugfix that might address my current difficulty is slated for announcement in the next few days.


Thanks,
Comment 5 Katrin Fischer 2017-06-21 21:02:14 UTC
I know ;)

I was thinking of bug 18741 - it might be a fix, but I am not sure. Maybe someone else could run a test?
Comment 6 Katrin Fischer 2017-06-23 07:28:50 UTC
We just got a report of a successful Koha installation in Ubuntu with 17.05. Made me wonder - which DBMS are you using? MySQL?
Comment 7 C.J.S. Hayward 2017-06-23 12:13:43 UTC
I'm using MySQL on a Mint 18.1 VM running under VirtualBox on a Mac.

Would it make sense to erase all traces of Koha installations and reinstall from scratch?

If so, what do I need to do so Koha sees a clean slate?


TIA,
C.J.S. Hayward
https://CJSHayward.com
Comment 8 C.J.S. Hayward 2017-06-23 12:16:52 UTC
linux-tools monasterylibrary # mysql --version
mysql  Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using  EditLine wrapper
Comment 9 Katrin Fischer 2017-06-23 12:54:14 UTC
Ok, first thing: Don't use Mysql 5.7 - it won't work well with Koha, there are known problems with it. It's recommended to use MariaDB instead.
Comment 10 Mark Tompsett 2017-06-23 18:14:44 UTC
(In reply to C.J.S. Hayward from comment #7)
> I'm using MySQL on a Mint 18.1 VM running under VirtualBox on a Mac.
> Would it make sense to erase all traces of Koha installations and
> reinstall from scratch?

No, it makes more sense to restart the VirtualBox image from scratch. Clean is important.

I successfully installed Koha 17.05 on Linux Mint 18 (I used https://linuxmint.com/edition.php?id=217).

I generally followed:
https://wiki.koha-community.org/wiki/Koha_on_ubuntu_-_packages

I have updated the instructions to highlight the community's preference for MariaDB.

Your use of specialized port suggests that you should read https://wiki.koha-community.org/wiki/Koha_on_ubuntu_-_packages#Appendix_A:_Named-based_vs._IP-based_installations
My test was a Name Based installation, as does following the dotted blue boxes (at least they are on my screen).

DISCLAIMER: I make no claims about overall functionality, nor do I recommend the use of Linux Mint. Debian has the ability to add a Desktop. It makes no sense to me using Linux Mint, when you could choose GNOME, XFCE, or a couple others as part of the Debian installation.

Any problems you are encountering are likely related to https://wiki.koha-community.org/wiki/Koha_on_ubuntu_-_packages#Ubuntu_16.04_and_MySQL_5.7
Particularly, the second option without the MySQL configuration tweak.
Comment 11 Magnus Enger 2017-06-27 11:30:56 UTC
(In reply to C.J.S. Hayward from comment #0)
> Template process failed: undef error -
> DBIx::Class::Storage::DBI::_dbh_execute(): Table
> 'koha_library.club_enrollments' doesn't exist at
> /usr/share/koha/lib/Koha/Objects.pm line 260

The problem is that the table 'koha_library.club_enrollments' does not exist. This is because MySQL 5.7 does not like the default value given to the "date_created" column: 

mysql> CREATE TABLE IF NOT EXISTS club_enrollments (
    ->   id int(11) NOT NULL AUTO_INCREMENT,
    ->   club_id int(11) NOT NULL,
    ->   borrowernumber int(11) NOT NULL,
    ->   date_enrolled timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    ->   date_canceled timestamp NULL DEFAULT NULL,
    ->   date_created timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
    ->   date_updated timestamp NULL DEFAULT NULL,
    ->   branchcode varchar(10) NULL DEFAULT NULL,
    ->   PRIMARY KEY (id),
    ->   KEY club_id (club_id),
    ->   KEY borrowernumber (borrowernumber),
    ->   KEY branchcode (branchcode),
    ->   CONSTRAINT club_enrollments_ibfk_1 FOREIGN KEY (club_id) REFERENCES clubs (id) ON DELETE CASCADE ON UPDATE CASCADE,
    ->   CONSTRAINT club_enrollments_ibfk_2 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
    ->   CONSTRAINT club_enrollments_ibfk_3 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE SET NULL ON UPDATE CASCADE
    -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ERROR 1067 (42000): Invalid default value for 'date_created'

MySQL 5.5 does not have any problems with the default value.
Comment 12 C.J.S. Hayward 2017-06-27 20:11:34 UTC
Thank you. How do things stand after migrating the VM to use MariaDB?

Thanks,
Comment 13 Freddy Enrique 2017-08-26 05:00:26 UTC
I ran into the same problem after updating Koha. what could be the possible solution?
Comment 14 Katrin Fischer 2017-08-27 12:05:24 UTC
Hi Freddy, same question to you: Are you running MySQL 5.7 by chance? 
See here:
https://wiki.koha-community.org/wiki/Koha_on_Debian#Debian_Packages_on_Koha
Comment 15 Paul Chau 2018-01-24 11:23:16 UTC
I am using ubuntu 16.04

The problem seems to be related to setting of sql-mode in /etc/mysql/mariadb.conf.d/50-server.cnf

If anyone can confirm after changing sql-mode to other value like '' will allow clubenrollments to be created.

Also somewhere from the net mentioned "SET SESSION sql_mode = '';" will help.
Comment 16 Jonathan Druart 2018-02-06 20:53:06 UTC
Will be fixed by bug 20144

*** This bug has been marked as a duplicate of bug 20144 ***