Eloquent "boolean" type should be represented as ENUM('N','Y') in the database if database supports enums.
When looking at database structure, ENUM('N','Y') would be much easier to understand as bool type, compared to TINYINT - that is being used now.
If you're a programmer and can't read 0/1 then... I don't know what to think.
This would also make it way harder to do true/false checks as you'd have to manually return $value === 'Y - but only for databases with enums.
No please.
How does one even come up with such a bad idea?
I'm sure that when you see a field of signed TINYINT in MySQL DB with the value of 1 you can't know immediately that's interpeted as boolean - since all possible values there could be anything from -128 to 127.
The age of working with raw DB values is way passed ... I don't see problem if lower layers of software interpreting and converting Y/N to correct boolean type. Why is there DBAL, ORM ?
My argument was to avoid ambiguity where/if possible. You don't have to be insulting. You use a framework to simplify things and if you like 0/1 as Boolean then why do you use languages that have Boolean type.
and BTW it's proposal ...
I'm sure that everyone ever can tell when something is a boolean from 0 and 1 when looking at the column name.
mfw can't read a database
..as long as the column is named well. I'm neutral on the issue, though I would choose 0 and 1 so that it's language independent. I've seen "si" and "no" often enough! If someone comes from a SQL Server background, they'll see this as a deficiency, since SQL Server has the non ANSI standard "bit".
And Laravel does currently use 'bit' for SQL Server boolean columns, and 'boolean' for Postgres. It's only MySQL and SQLite that don't have boolean types and therefore resort to tinyint.
Yes let us all change the core code to be stupid to cater for those who name columns badly or read from the database and can't figure out a boolean column.
Don't misunderstand me, I don't think it belongs in core! I am only familiar with the MySQL drivers, thanks for the clarification about the SQL Server and Postgres drivers.
I was just saying that often I have to read code from non English-speaking programmers and it's not always obvious what is boolean, although that's a cultural problem that will persist as Laravel grows.
So add Y and N which are to represent 2 english words instead of 1 and 0 which are truthy and falsey in like any language?
No, as Andreas said, Laravel makes full use of all that it can, it's fine how it is.
I know it is fine how it is. Everyone does. Except one.
Seems to me me that only @chrispecoraro is the one who can communicate normally in this ticket.
@robclancy 1 and 0 are truth and falsey in some languages and only because of legacy ... languages started implementing Boolean type. Java doesn't treat 0/1 as you say.
Type juggling is not something you cherish. IMHO frameworks should not drag around legacy stuff to higher levels of software.
And one more thing. MySQL use enums with Y and N for it's mysql settings database. And when you use $table->enum('choices', array('foo', 'bar')); on SQLite ... what kind of magic does Eloquent then do? It's fine to do it then? SQLite doesn't have ENUM type.
Btw In the end it doesn't make much change - whatever you do. It was just proposed for the sake to avoid ambiguity as much as possible - for all people.
Not sure if just stupid or master troll.
I'm closing this ... no point in this anymore. @robclancy you need to grow a bit ... especially as a person.
@robclancy OK I apologize partly. I understood it as like you were referring to programming language and not spoken language - my bad. However - since you called me stupid or a troll I'll just let you know ... there are cultures that don't know number 0.
My culture only one that matters #yolo #dragon
I'd just like to mention that none of us in the comments are really affiliated with Laravel at all. Especially not @robclancy
Technically enum is just an integer representation and isn't supported in all DBMS'. With that in mind I find the (now) tinyint perfect and even skipping an underlying layer of complexity.
Most helpful comment
So add Y and N which are to represent 2 english words instead of 1 and 0 which are truthy and falsey in like any language?