-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable TINYINT(1) interpretation as BOOLEAN? #1490
Comments
No, there's no way as you see in the code. You should just change the schema.xml by hand when you generate it. |
@marcj I'm not deeply familiar with the CLI tool, but I know that it's possible to somewhat extend/override the code, using Currently we maintain a schema.sql file and auto-generate schema.xml based on it, and then generate the ORM classes. It seems we'll need to revise this workflow. Thanks. |
Well, of course you could extend the MysqlSchemaParser and use this custom class. But the would lead to code duplication. |
I was actually thinking more in the direction of adding a "don't convert tinyint(1) to boolean" flag that could be switched on as a command line parameter, but changing our workflow will be a lot quicker. |
FWIW, I'd like to update that going the other way around (i.e. generating the .sql file from schema.xml) turned out to be equally problematic because TIMESTAMP is converted to 'datetime', TINYINT(11) is converted to 'integer', etc.
Eventually, I decided to go with @marcj's suggestion and extend One note though:
|
In MySQL, BOOL/BOOLEAN are defined as synonyms of TINYINT(1).
The opposite is not true, because TINYINT(1) ranges from -128 to +127 (signed) or 0 to 255 (unsigned).
There might be room for Propel to convert TINYINT(1) to a BOOLEAN - as a convenience method, in case a special configuration flag is explicitly switch on.
But performing this by default is just buggy.
For example,
day_of_week tinyint(1)
ranging from 0 to 6, should not be auto-converted to a boolean.My question is:
Is there any way to bypass the code in MysqlSchemaParser which converts TINYINT(1) to a BOOLEAN?
The text was updated successfully, but these errors were encountered: