I created a Laravel project and I added some tables using Migrate. It worked fine. The tables already had data. Now I need another table, and I tried to add it with this command:
php artisan make:migration create_books_table
It works and adds files to \ database \ migrations .... Then I added the schema to the up () function. But when I run the command,
php artisan migrate
It does not work, giving an error. A base table or view already exists.
Please, help. I am very new to laravel. Thanks
Migration code ..
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBooksTable extends Migration {
public function up()
{
Schema::create('books', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->text('description');
$table->timestamps();
});
}
public function down()
{
Schema::drop('books');
}
}
source
share