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
Data type "boolean" is not supported in "mysql" database. #642
Comments
@jounii The MySql does not have internal BOOLEAN data type. Types like BOOLEAN and BOOL are TINYINT(1) internally. In Changelog the TypeOrm team wrote this:
I think they made the right decision because the types are mapped explicitly. I imagine this will reduce errors in maintaining this awesome library. |
@jounii if you define column type explicitly then you must use But if you variable is |
Mysql does have alias for BOOLEAN and BOOL to mapped to TINYINT. If you logic is right, shouldn't the sqlite implementation driver also rule tinyint and others out too? Sqlite uses internally only "integer" type and aliases rest. Have to try if the boolean entity member is properly mapped if I don't specify the types manually. |
Works ok without defining the type. Problem solved for now, thanks. Related to this is if the tinyint (and others specific data size types) go out of fashion, the Column options would need some sort of data length/type hinting options so the driver could choose best suiting internal type. Maybe possibility to define data type converter class/function so you could customise these yourself. I suppose I could override the DriverFactory to provide own wrapper driver, but it'll be exercise for later. |
maybe i'm missing something, but in
and also
both result in the following exception: did something change? i can't get the column working unless i specify |
Looks like it cannot figure out parameter type. Parameter type is automatically determined only if you setup reflect-metadata properly and setup tsconfig properly. Read more about them on a homepage |
ah, you're right. i did not have thanks for the help! |
reflect-metadata should be loaded before any your entity is loaded. Probably you have loaded entities before your imported reflect-metadata in your app.ts |
i don't think so, but i am still new to TypeScript and TypeORM. here's an abbreviated version of my
thanks again for your help. although my particular issue is solved, i wanna help with future documentation if this is in fact a scenario that's unaccounted for. |
its not an unaccounted scenario, Im sure its something on your side. You can create a demo git repo with problem reproduction and I'll take why its happening on you |
typeorm
0.1.0-alpha.28
is giving now errorData type "boolean" is not supported in "mysql" database.
if using boolean datatype. Running with sqlite this works fine.This used to work with 0.0.11. I suppose I could fallback to tinyint as solution for now.
The text was updated successfully, but these errors were encountered: