I want to use artisan migration within my controller, like this
echo '<br>init migrate:install...';
Artisan::call('migrate');
echo 'done migrate:install';
It works fine for all my table creations and etc. But there are problems when I try to use $table->renameColumn
Laravel doc said I need to include doctrine/dbal, but how? I have tried use Doctrine\DBAL\Driver\PDOMySql\Driver;
but no luck.
FYI i cannot use CLI, my host doesn't provide any CLI to me.
Here is my error
Symfony \ Component \ Debug \ Exception \ FatalErrorException
Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found
UPDATE
Same error when using terminal to migrate
SECOND UPDATE
An Example of migration code at app/database/migrations
use Illuminate\Database\Migrations\Migration;
class UpdatePostsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user', function($table)
{
$table->renameColumn('fullname', 'full_name');
});
}
}
Add the doctrine/dbal
dependency to your composer.json
file.
For more information, it's on the very bottom of this page in the documentation.
http://laravel.com/docs/releases
Add doctrine/dbal dependency to your composer.json file, like
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"illuminate/html": "5.*",
"doctrine/dbal": "~2.3"
},
Then update composer using sudo composer update command, this will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With