简体   繁体   中英

when migrate the table throws exception in laravel eloquent

Help me to resolve

[Symfony\\Component\\Debug\\Exception\\FatalThrowableError]
Class 'Doctrine\\DBAL\\Driver\\PDOMySql\\Driver' not found

Did you require the doctrine/dbal package?

If you haven't, run the following.

composer require doctrine/dbal

Read the section about modifying columns

https://laravel.com/docs/5.6/migrations#modifying-columns

Taken from laravel documentation

Before modifying a column, be sure to add the doctrine/dbal dependency to your composer.json file. The Doctrine DBAL library is used to determine the current state of the column and create the SQL queries needed to make the specified adjustments to the column:

Run composer require doctrine/dbal

Then

Run composer update .

It should fix the issue.

composer require doctrine/dbal:^2.12.1

他们更改了 dbal 3 上的类路径,因此您将需要旧版本。

You need to generate the migration properly and then only it will work when you try to migrate the tables

To create a migration you need to use the make:migration

php artisan make:migration create_users_table

The new migration will be placed in your database/migrations directory. Each migration file name contains a timestamp which allows Laravel to determine the order of the migrations.

The --table and --create options may also be used to indicate the name of the table and whether the migration will be creating a new table. These options pre-fill the generated migration stub file with the specified table:

For example,

php artisan make:migration create_users_table --create=users

php artisan make:migration add_votes_to_users_table --table=users

For more information's to read about migrating tables in laravel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM