Reputation: 302
I have only one new migration file which is 2017_02_05_121119_create_posts_table.php but when I run "php artisan migrate" it says "[Symfony\Component\Debug\Exception\FatalErrorException] Cannot redeclare class CreateUsersTable".
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePostsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->string('description');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('posts');
}
}
Upvotes: 1
Views: 678
Reputation: 2429
In the Providers folder edit the AppServiceProvider.php file.
You just need to add these two lines to it:
use Illuminate\Support\Facades\Schema;
and in the boot function:
Schema::defaultStringLength(191);
Upvotes: 0
Reputation: 302
edit AppServiceProvider.php and include "use Illuminate\Support\Facades\Schema;" and then in boot method add this line "Schema::defaultStringLength(191);"
Upvotes: 1
Reputation: 1007
Have you made a copy/paste for this migration? looks like you left the classname of a previus one, because the seed is create posts but the class create users.
Upvotes: 1