lonnieezell / myth-auth

One-stop Auth package for CodeIgniter 4
MIT License
637 stars 208 forks source link

PostgreSQL support - proposal n.2: change tinyint to bools in database schema #495

Closed xlii-chl closed 2 years ago

xlii-chl commented 2 years ago

This pull-request is a little more ambitious than #494 as it changes the database schema. The code change is bigger and more likely to introduce breaking scenario, but since MySQL & MariaDB implictly convert booleans fields to tinyint and since SQLite isn't strongly typed, the impact on existing deployments may still be acceptable.

Those patch set up a new casting class, taking care of the strange behaviour of PDO/PostgreSQL fetching TRUE/FALSE values as (string)'t'/(string)'f' by default. For now, this patch is still a work in progress as I would prefer and still hope to use PDO::PARAM_*.

Like #494 :

MGatner commented 2 years ago

I will let @lonnieezell handle this one, but at the very least I think the database change should be an additional migration file rather than modifying the current one.

xlii-chl commented 2 years ago

Noted.

Actually, the more I think about it, the less I'm convinced this is the way to go. It would be nice to have boolean fields being actual boolean types, but the difference between the DB storing as 0/1 and PostgreSQL storing as t/f may bring too much hassle for what it's worth.

Ping me if you'd like to see more, but I'll probably close it soon and focus on #494 otherwise.

lonnieezell commented 2 years ago

I think focusing on #493 is probably the better route here. Thanks.