Page 1 of 1

SQL-ERR after update

Posted: Tue Jan 21, 2020 9:46 am
by tigerA
Hi.

After update to Fedora 30/Zoneminder 1.34 I had seen in logs:
SQL-ERR 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'StorageId' cannot be null', statement was 'UPDATE Events SET `Id`=?, `Name`=?, `MonitorId`=?, `StorageId`=?, `SecondaryStorageId`=?, `Cause`=?, `StartTime`=?, `EndTime`=?, `Width`=?, `Height`=?, `Length`=?, `Frames`=?, `AlarmFrames`=?, `DefaultVideo`=?, `SaveJPEGs`=?, `TotScore`=?, `AvgScore`=?, `MaxScore`=?, `Archived`=?, `Videoed`=?, `Uploaded`=?, `Emailed`=?, `Messaged`=?, `Executed`=?, `Notes`=?, `StateId`=?, `Orientation`=?, `DiskSpace`=?, `Scheme`=?, `Locked`=? WHERE Id=?' params:2417291,Event-ip02- 2417291,2,,,Continuous,2020-01-21 11:10:00,2020-01-21 11:20:00,1280,800,600.05,4777,,2417291-video.mp4,0,0,0,0,0,1,0,0,0,0,,1,ROTATE_0,320632263,Medium,0,2417291

Options->Storage->id = 0

Re: SQL-ERR after update

Posted: Wed Apr 08, 2020 2:14 am
by lightenup
I see the same error but it is only when I am in the montage review page. Otherwise, everything works fine.

Re: SQL-ERR after update

Posted: Wed Apr 08, 2020 1:38 pm
by iconnor
Your db's must have come from a time during development. There was a time when that column was NOT NULL. Nowadays we allow it to be null.

Actually looking at the db update scripts, I may have screwed this up.

So the following sql code will change it to allow NULLs but I will have to look into side effects before including in 1.34.10


ALTER TABLE Events MODIFY `StorageId` smallint(5) unsigned default 0;

Re: SQL-ERR after update

Posted: Wed Apr 08, 2020 6:12 pm
by lightenup
I made the db change suggested and it fixed my issue! I will post back if I see any issues crop up.

Thanks again!