Issue
The problem is that I have this error:
[PDOException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'songs' already exists
This is my migration file:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSongsTable extends Migration
{
public function up()
{
Schema::create('songs', function (Blueprint $table)
{
$table->increments('id');
$table->integer('user_id');
$table->string('title');
$table->string('slug')->unique();
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
}
}
I think the solution will be just to delete the table then run migration again, so how can I drop a table in Laravel 5 using the command line? I am using MySQL.
Solution
A nice easy way that I found is just using phpmyadmin and just drop the table manually. Of course if the migration is still there when you run the migration again the table will be created again.
Answered By - koooko
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.