Skip to content

fix(mysql): allow DEFAULT values for TEXT columns#2063

Open
hevengo wants to merge 2 commits intopropelorm:masterfrom
hevengoCorp:bugfix-text-defaults-handling
Open

fix(mysql): allow DEFAULT values for TEXT columns#2063
hevengo wants to merge 2 commits intopropelorm:masterfrom
hevengoCorp:bugfix-text-defaults-handling

Conversation

@hevengo
Copy link
Copy Markdown

@hevengo hevengo commented Feb 10, 2026

allow DEFAULT values for TEXT columns on MySQL 8.0.13+ and MariaDB 10.2.1+

Remove the EngineException that blocked DEFAULT values for TEXT columns while keeping it for BLOB types. Update the reverse schema parser to preserve TEXT default values during introspection, with handling for MariaDB's extra single-quote wrapping on TEXT defaults.

…d MariaDB 10.2.1+

Remove the EngineException that blocked DEFAULT values for TEXT columns
while keeping it for BLOB types. Update the reverse schema parser to
preserve TEXT default values during introspection, with handling for
MariaDB's extra single-quote wrapping on TEXT defaults.
@mringler
Copy link
Copy Markdown
Contributor

Very nice! Spotless too (though unconventional boundary characters in regex always trip me up).

The state of Propel2 test suite hides it well, but the added test in MysqlSchemaParserTest currently fails:

1) Propel\Tests\Generator\Reverse\MysqlSchemaParserTest::testTextDefaultValues
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'hello text'
+'_utf8mb3\'hello text\''

/home/runner/work/Propel2/Propel2/tests/Propel/Tests/Generator/Reverse/MysqlSchemaParserTest.php:143

(see run output)

Once this is figured out, I'd be happy to add this to Perpl if you don't mind?

…er test

Update MysqlSchemaParser regex to strip MySQL 8.0+ charset prefixes
(e.g. _utf8mb3'value') when parsing TEXT column default values,
in addition to MariaDB's extra single-quote wrapping.
@hevengo
Copy link
Copy Markdown
Author

hevengo commented Feb 14, 2026

fixed the said test-case - but tests are still failing in obscure ways

@mringler
Copy link
Copy Markdown
Contributor

Oh, that is a new issue with Github. Apparently they broke the tool that runs docker containers in actions (see for example issue report in old action repo). @oojacoboo fixed it for Perpl.

I checked out the PR and pushed a branch here, but tests are still failing (see run). Tried locally with more slashes (~^(?:_\w+)?\\\\\'(.*)\\\\\'$~), but then MariaDB doesn't work anymore (output is ''hello text'').
Running composer run cs-fix fixes the code style complaints automatically.

Let me know if I can be of assistance.

@mringler
Copy link
Copy Markdown
Contributor

I think I figured it out, the issue is MariaDB encodes the default string once, but MySQL does it twice. Have a look at perplorm#118, does that seem ok?

Sorry for butting in, I need to get rid of that branch again.

Checkout Perpl, it's still maintained and improved Propel2. Would have been fun to figure this out together!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants