samedi 3 mars 2018

Laravel keeps referencing old migration

Post_Like::create([
      'like' => 1,
      'post_id' => 1,
      'user_id' => 2,
]);

When I hit this route and perform the code above. The error below occurs.

Table 'database.post__likes' doesn't exist

Here is my migration file. Before I misspelled the table name. I typed post__likes when it was suppose to be post_likes. So I deleted that migration file and made a new one. Now I typed post_likes. But now it keeps saying the post__likes table does not exist.

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePostLikesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('post_likes', function (Blueprint $table) {
            $table->increments('id');
            $table->boolean('like');
            $table->integer('post_id');
            $table->integer('user_id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('post_likes');
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire