I'm trying to migrate my laravel project.
But When I enter migrate command I'm getting this error.I didn't understand why its giving me this error when I'm trying to migrate my project.
[ErrorException]
Undefined index: index_type
Exception trace:
() at /var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php:75
Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at /var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php:75
Doctrine\DBAL\Schema\MySqlSchemaManager->_getPortableTableIndexesList() at /var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:193
Doctrine\DBAL\Schema\AbstractSchemaManager->listTableIndexes() at /var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:286
Doctrine\DBAL\Schema\AbstractSchemaManager->listTableDetails() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php:320
Illuminate\Database\Schema\Grammars\Grammar->getChangedDiff() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php:302
Illuminate\Database\Schema\Grammars\Grammar->compileChange() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php:107
Illuminate\Database\Schema\Blueprint->toSql() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php:82
Illuminate\Database\Schema\Blueprint->build() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:229
Illuminate\Database\Schema\Builder->build() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:130
Illuminate\Database\Schema\Builder->table() at /var/www/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:237
Illuminate\Support\Facades\Facade::__callStatic() at /var/www/database/migrations/2016_10_25_222438_update_relationships_for_employee.php:20
Illuminate\Support\Facades\Schema::table() at /var/www/database/migrations/2016_10_25_222438_update_relationships_for_employee.php:20
UpdateRelationshipsForEmployee->up() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:373
Illuminate\Database\Migrations\Migrator->Illuminate\Database\Migrations\{closure}() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:380
Illuminate\Database\Migrations\Migrator->runMigration() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:162
Illuminate\Database\Migrations\Migrator->runUp() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:130
Illuminate\Database\Migrations\Migrator->runMigrationList() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:97
Illuminate\Database\Migrations\Migrator->run() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:66
Illuminate\Database\Console\Migrations\MigrateCommand->fire() at n/a:n/a
call_user_func_array() at /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:508
Illuminate\Container\Container->call() at /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
Illuminate\Console\Command->execute() at /var/www/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
Illuminate\Console\Command->run() at /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php:185
Illuminate\Console\Command->call() at /var/www/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/RefreshCommand.php:66
Illuminate\Database\Console\Migrations\RefreshCommand->fire() at n/a:n/a
call_user_func_array() at /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:508
Illuminate\Container\Container->call() at /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
Illuminate\Console\Command->execute() at /var/www/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
Illuminate\Console\Command->run() at /var/www/vendor/symfony/console/Application.php:820
Symfony\Component\Console\Application->doRunCommand() at /var/www/vendor/symfony/console/Application.php:187
Symfony\Component\Console\Application->doRun() at /var/www/vendor/symfony/console/Application.php:118
Symfony\Component\Console\Application->run() at /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:121
Illuminate\Foundation\Console\Kernel->handle() at /var/www/artisan:36
my migration file is below.
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateRelationshipsForEmployee extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::table('employee',function ($table){
$table->integer('retail_id')->unsigned()->index()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('employee', function ($table){
$table->integer('retail_id')->change();
});
//
}
}
Just drop the total database and run the command php artisan migrate:refresh --seed
Also you can maintain your database. Just copy your model and migration information. Then Delete. After deleting recreate model and table.
Now. go to your database migrations table. Delete the employee row. Now. delete your employee table.
Now just terminal command php artisan migrate
Check your os locale or php locale,
cannot convert capital case correctly in dependent library used by laravel because your locale is different from en_us.UTF8
try
setlocale(LC_CTYPE, 'en_US.UTF8');
Use en_us.UTF8 for case transformations regardless of the active locale.