Closed mjasnaashari closed 2 months ago
@MohammadJavad-AsnaAshari
Please check this code https://laravel.com/docs/11.x/upgrade#get-column-types
$type = Schema::getColumnType(DB::getTablePrefix().'users','id');
Thanks for brining that up. I've implemented this on the 1.8 branch.
It is still not fully compatible with Laravel 11 though as the TCG\Voyager\Database\Types; still uses the deprecated Doctrine DBAL.
Laravel version
11
PHP version
8.2
Voyager version
1.8.x-dev
Database
MySQL 8.0
Description
I'm experiencing an issue with the Voyager package when trying to run migrations in Laravel 11. The error message I'm receiving is:
This is because the
getDoctrineColumn
method no longer exists in Laravel 11, as it was removed in favor of using thegetSchemaBuilder
method to retrieve column information.I've tried updating the
doctrine/dbal
package to the latest version compatible with Laravel 11, but the issue persists. I've also tried modifying the relevant code in the migration file to use thegetSchemaBuilder
method instead ofgetDoctrineColumn
, but the issue still occurs.I've searched the Voyager package's GitHub issues and found a similar issue (https://github.com/reliese/laravel/issues/273) that was resolved by updating the schema to support the default schema on Postgres and Laravel 11 support on MySQL. However, the changes mentioned in that issue have not been applied to the Voyager package yet.
Steps to reproduce
Expected behavior
The migrations should run successfully without any errors.
Screenshots
No response
Additional context
I believe the issue can be resolved by updating the schema in the Voyager package to use the
getSchemaBuilder
method instead ofgetDoctrineColumn
. This change should be applied to the relevant migration files in the package.Here's how the relevant code in the migration file can be modified to use the
getSchemaBuilder
method:getDoctrineColumn
(line 17 for me!)This should resolve the issue without the need to modify the vendor files.