your problem because your doctirne/dbal: v3 , try to downgrade to v2 , like this :- doctrine/dbal": "^2.12" this issue related with your problem :- https://github.com/doctrine/dbal/issues/4439
ошибка исчезла. все работает теперь.
]]>use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ChangeFieldMessagesTables extends Migration { ... }
]]>Причем в интернете такая ошибка при переименовывании много у кого возникает, но я не смог ее победить с помощью гугла.
]]>После выполнения
composer require doctrine/dbal
в файле composer.json добавилась строка
"doctrine/dbal": "^3.1",
Пытаюсь сделать миграцию и опять та же ошибка
In MySqlConnection.php line 65:
Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found
Вот содержания файла миграции:
<?php
class ChangeFieldMessagesTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('messages', function (Blueprint $table) {
$table->renameColumn('username', 'name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('messages', function (Blueprint $table) {
//$table->renameColumn('name', 'login');
});
}
}
Вот полностью мой файл с одной добавленной строчкой:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"doctrine/dbal": "^3.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
Прохожу обучающий курс по Laravel и застрял на переименовывании столбцов таблицы.
При выполнении миграции:
php artisan migrate --path=database/migrations/messages
Выдает:
Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found
Прочитал, что требуется doctrine/dbal
Я зашел в файл composer.json и дописал в нем строку
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"doctrine/dbal": "^3.0"
},
Далее запустил в терминале команду composer update
Но данные манипуляции все равно не устранили ошибку.
Подскажите, где я что упускаю?
]]>