Bug 41460 - On Mysql on upgrade from 25.05 to 25.11 I got the error TEXT column 'value' can't have a default value
Summary: On Mysql on upgrade from 25.05 to 25.11 I got the error TEXT column 'value' c...
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Database (show other bugs)
Version: 25.11
Hardware: All All
: P5 - low blocker
Assignee: Michael Hafen
QA Contact: Testopia
URL:
Keywords:
Depends on: 40405
Blocks:
  Show dependency treegraph
 
Reported: 2025-12-16 18:40 UTC by Michael Hafen
Modified: 2026-01-24 19:22 UTC (History)
5 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41460: Remove default value from mediumtext column systempreferences.value (1.00 KB, patch)
2025-12-16 18:43 UTC, Michael Hafen
Details | Diff | Splinter Review
Bug 41460: Remove default value from mediumtext column systempreferences.value (1.94 KB, patch)
2026-01-06 20:27 UTC, Michael Hafen
Details | Diff | Splinter Review
Bug 41460: Remove default value from mediumtext column systempreferences.value (2.89 KB, patch)
2026-01-12 22:59 UTC, Michael Hafen
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Hafen 2025-12-16 18:40:07 UTC
Mysql does not allow blob or text type columns to have a default.  The systempreferences.value column is the only occurrence of this I found in the kohastructure.sql file.  It seems Mysql will ignore the default null as long as the column allows null, so that's not an issue.
Bug 40405 sets systempreferences.value to NOT NULL, but tries to also add a DEFAULT '', which causes Mysql to throw the above error.

Proposed solution is to remove the DEFAULT '' part of the clause from the db_rev file.
Comment 1 Michael Hafen 2025-12-16 18:43:21 UTC
Created attachment 190558 [details] [review]
Bug 41460: Remove default value from mediumtext column systempreferences.value

Bug 41460: Remove default value from mediumtext column systempreferences.value

Mysql doesn't allow text type columns to have a default.

I think this is a trivial patch.
Comment 2 David Nind 2025-12-20 00:10:34 UTC
Any hints on how to test this using KTD?
Comment 3 Fridolin Somers 2025-12-22 13:12:17 UTC
MySQL 8 ?
Comment 4 Jonathan Druart 2026-01-06 12:43:42 UTC
Then you need to adjust this one:

installer/data/mysql/kohastructure.sql
6680   `value` mediumtext NOT NULL DEFAULT '' COMMENT 'system preference values',
Comment 5 Michael Hafen 2026-01-06 20:27:34 UTC
Created attachment 190960 [details] [review]
Bug 41460: Remove default value from mediumtext column  systempreferences.value

Mysql doesn't allow text type columns to have a default.
Comment 6 David Cook 2026-01-12 05:24:02 UTC
I think you need to add an atomic update for main as well, and that will then allow people to test "main' as well.
Comment 7 Michael Hafen 2026-01-12 22:59:49 UTC
Created attachment 191330 [details] [review]
Bug 41460: Remove default value from mediumtext column  systempreferences.value

Mysql doesn't allow text type columns to have a default.
Comment 8 David Nind 2026-01-24 19:22:18 UTC
Happy to test, but don't know enough about how to test this without a test plan.

Have added a related bug that deals with other system preference related issues.