-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Remove doctrine #1512
Remove doctrine #1512
Conversation
Added fix to #1510,
The completed code is in my repository. There are still some points that I would like to carefully check, so it will be a while before I can say "ready for merge", but would you like to submit a draft pull request? Change set: KentarouTakeda/barryvdh-laravel-ide-helper@laravel-11...laravel-11-remove-doctrine-dbal From what I've tried, the |
0823a62
to
a56ed20
Compare
Sorry didn't see your commit until I fixed some changes. Will compare and check, thanks! |
I dont think the minimum stability was working before.. |
So what do you think @mfn |
Awesome change thanks! I have tested this on a relatively complex Postgres database and it fixes a major issue we had with Doctrine that affected both Laravel and ide-helper previously. We have a table in two schemas with the same name, but differing types on the I'll be using this dev version until it is fully released. Edit: I just noticed there isn't handling for the "bpchar" columns type. This is similar to char and should be mapped to PHP string (it is currently mapping to 'mixed'). See postgres docs. |
Yes added that now |
You may also change
You may also check for PS: We may also check for any type name prefixed by |
Co-authored-by: Hafez Divandari <[email protected]>
Co-authored-by: Hafez Divandari <[email protected]>
Co-authored-by: Hafez Divandari <[email protected]>
So except for the binary -> string change, this doesn't seem to break anything in our current test setup. So LGTM |
I'll also try to test this with a big private project ASAP. |
@barryvdh you missed #1512 (comment)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
First things first: ran this on a private project -> no issues 🎉
-
@barryvdh you missed #1512 (comment)?
This is really a good catch, the keys definitely change (e.g.
postgresql
->pgsql
, etc. ).I didn't actually notice, because I have this:
'custom_db_types' => [ 'postgresql' => [ 'jsonb' => 'string', ], ],
but this change implicitly already supports it, so I wasn't aware of it.
We should definitely write this down as a kind of a (mini-)migration guide.
-
We might also want to point out that people should double check if they can remove
doctrine/dbal
from their top level dependency in composer. I'm an ide-helper user sinc (OH GOSH!) 8 years and back then adding doctrine/dbal explicitly was required (or necessary for whatever reason) :-}
Do we need to group the types by driver still? How does custom mapping work anyways, php handles it the same anyways right? If you want a different type, you should cast it. If it's different for a driver, we should just fix it on our side? |
It seems right. The only edge case comes to my mind is PostgreSQL array types, we can simply fix that, but it's also DB::statement('create table "test" ("arr" int[])');
DB::statement('insert into "test" ("arr") values (array[1,2,3])');
var_dump(DB::table('test')->value('arr')); // string(7) "{1,2,3}" So I think we can remove |
Maybe a valid point, though it depends I guess. Example with With a cast, which performs implicit decoding, it usually becomes Or maybe the root issue is to default to the But I wouldn't have enough knowledge/data to make that decision. |
I agree. We can assume DB always returns |
I have tested this on a private project with 70 tables and 680 columns, including PostgreSQL proprietary types. It produced exactly the same results as the previous version. LGTM. I agree with treating unknown types as sqlsrv(odbc): |
Yes removed them. |
Re-checked my private project (pgsq, 100+ tables, 1000k+ columns) => s'all good :-} Suggestion for the CHANGELOG: ### Changed
- Use of doctrine/dbal [#1512 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1512)
With this functionality gone, a few changes have been made:
- support for custom datatypes has been dropped (config `custom_db_types`)
unknown data types default to `string` now and to fix the type, add a proper cast in Eloquent
- You _might_ have top-level dependency on doctrine/dbal. This may have been in the past due to ide-helper, we suggest to check if you still need it and remove it otherwise Also 👍🏼 for cutting a 3.0 of it. Do we want to push out 3.0 directly or make a preview release? |
Yeah bit conflicted about the 3.0 vs 2.x. It technically isn't a BC break, only if people are relying on Doctrine because of us. But probably better to force the upgrade in 3.x, as it will coincide with Laravel dropping it anways. https://laravel.com/docs/master/upgrade#doctrine-dbal-removal |
Okay changed the branch alias to 3.0-dev |
Thanks @barryvdh , really great work so we can move forward here, thank you (et al) 🙏🏼 |
See #1510