Integrity violation while writing *_state and *_event tables

Created on 18 April 2024, 8 months ago

Problem/Motivation

when I create a new event I had 4 errors:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'n-n-n' for key 'PRIMARY': INSERT INTO "bat_event_[]_minute_event"
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'n-n-n' for key 'PRIMARY': INSERT INTO "bat_event_[]_minute_state"
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'n-n-n' for key 'PRIMARY': INSERT INTO "bat_event_[]_hour_event"
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'n-n-n' for key 'PRIMARY': INSERT INTO "bat_event_[]_hour_state"

I think thers's an error when creating bat_event_[]_hour_state,bat_event_[]_minute_event,bat_event_[]_hour_state,bat_event_[]_minute_event
primary keys.

Steps to reproduce

try to create/edit events

Proposed resolution

I temporary solved altering primary key, i.e:
ALTER TABLE `bat_event_[]_minute_state` DROP PRIMARY KEY, ADD PRIMARY KEY (`unit_id`, `year`, `month`, `day`, `hour`) USING BTREE;
comparing function bat_event_create_event_type_schema($machine_name)
version in '8.x-3.x-dev' whith one in '8.x-10.1' i saw that tables indexes and primary keys creation were correct

🐛 Bug report
Status

Closed: duplicate

Version

10.1

Component

Code

Created by

🇮🇹Italy antonio.bertolini

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024