craigk5n / webcalendar

WebCalendar is a PHP application used to maintain a calendar for a single user or an intranet group of users. It can also be configured as an event calendar.
http://www.k5n.us/webcalendar.php
GNU General Public License v2.0
148 stars 70 forks source link

MySQL Error on install "All parts of a PRIMARY KEY must be NOT NULL" #446

Closed max951 closed 7 months ago

max951 commented 7 months ago

In Install-Procedure Step "Create/Update Tables" i got the error

Error
Error executing query.

After executing the SQL in phpMyAdmin i got a detailed error message

CREATE TABLE webcal_categories (
  cat_id INT NOT NULL,
  cat_owner VARCHAR(25) NULL,
  cat_name VARCHAR(80) NOT NULL,
  cat_color VARCHAR(8) NULL,
  cat_status CHAR DEFAULT 'A',
  cat_icon_mime VARCHAR(32) DEFAULT NULL,
  cat_icon_blob LONGBLOB DEFAULT NULL,
  PRIMARY KEY ( cat_id, cat_owner )
);
MySQL said:
#1171 - All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead

After changed the SQL in install/sql/tables-mysql.sql to

CREATE TABLE webcal_categories (
  cat_id INT NOT NULL,
  cat_owner VARCHAR(25) NOT NULL,
  cat_name VARCHAR(80) NOT NULL,
  cat_color VARCHAR(8) NULL,
  cat_status CHAR DEFAULT 'A',
  cat_icon_mime VARCHAR(32) DEFAULT NULL,
  cat_icon_blob LONGBLOB DEFAULT NULL,
  PRIMARY KEY ( cat_id, cat_owner )
);

the database tables are created without failure.

My Environment: System Status Settings storage: includes/settings.php Database connection: Can connect Number of admin users: 1 WebCalendar version (installer): v1.9.12 WebCalendar version (database): v1.9.12 PHP version: Supported (8.2.13) MySQL: 8.0

craigk5n commented 7 months ago

It's great when a bug report comes with a fix! Code in git has been updated.