Repository navigation
Conversation
added 2 commits
September 27, 2026 15:37
On SQL Server the per-key value column (declared as 'mediumtext') was auto-mapped to nvarchar(4000), capping a single session key's value at 4000 characters — far smaller than MySQL's mediumtext (~16 MB). Declare svalue as nvarchar with size -1 for MSSQL so the schema/migration render it as NVARCHAR(MAX) (~2 GB). MySQL keeps mediumtext and SQLite keeps an unbounded text column. The per-key version/optimistic-concurrency model is unchanged (no chunking needed).
…tches PK Covers the MSSQL nvarchar(max) fix for session_kv_data.svalue, that MySQL keeps mediumtext, and that the session-ID foreign key type/size matches the sessions primary key across mysql/mssql/sqlite.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #421 +/- ##
============================================
+ Coverage 81.73% 81.75% +0.01%
- Complexity 3287 3288 +1
============================================
Files 106 106
Lines 9714 9721 +7
============================================
+ Hits 7940 7947 +7
Misses 1774 1774
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Store the per-key session value column (
session_kv_data.svalue) asNVARCHAR(MAX)on SQL Server so a single session key is not capped at 4000 characters.Motivation
The per-key value column is declared as
mediumtext. On MySQL that is ~16 MB, but on SQL Server the database layer auto-maps an unsized text type tonvarchar(4000), silently limiting each session key's value to 4000 characters. Any larger value (e.g. a serialized user object, a big cart, cached payload) would be truncated or rejected on MSSQL only. This also aligns with the recent MSSQL per-key session regressions.Changes
SessionSchema::createSessionKvDataTable()now declaressvalueper engine:nvarcharwith size-1→ renders asNVARCHAR(MAX)(~2 GB).mediumtext(unchanged, ~16 MB).text(unchanged).version/optimistic-concurrency model is untouched.UI Changes
Not applicable.
How to Test / Verify
Unit tests in
tests/WebFiori/Framework/Tests/Session/SessionSchemaTest.php:testKvDataSvalueIsNvarcharMaxOnMSSQL— asserts MSSQLsvalueisnvarcharwith size-1.testKvDataSvalueIsMediumTextOnMySQL— asserts MySQL keepsmediumtext.testKvDataSessionIdMatchesSessionsPk— asserts thes_idFK type/size matches thesessionsPK on mysql/mssql/sqlite.Also verified manually that the migration's generated
CREATE TABLEfor MSSQL contains[svalue] [nvarchar](max) not null. Schema test group: 8 tests / 31 assertions passing.Breaking Changes and Migration Steps
None for fresh installs — new
session_kv_datatables get the correct column type. NOTE: existing MSSQL deployments that already ran the 3.1.0 migration will still havenvarchar(4000); widening an existing column (ALTER COLUMN svalue NVARCHAR(MAX)) is intentionally out of scope for this PR.Checklist
composer fix-cs)Related issues
Not Applicable