Saturday, March 4, 2017

Laravel table refuse to be registered on migrations table and rollbacked or migrated

I have a migration table refuse to be registered in migrations tables ..

2014_10_12_000000_create_users_table    1
2014_10_12_100000_create_password_resets_table  1
2016_03_21_010421_create_orders_table   1
2016_03_21_010549_create_types_table    1
2016_03_21_010722_create_materials_table    1
2016_03_21_010814_create_ratings_table  1
2016_03_21_011205_create_costs_table    1
2016_03_21_012114_create_locations_table    1
2016_06_02_181122_create_assignments_table  1
2016_06_25_001455_create_bills_table    1
2016_07_26_195012_create_roles_table    1
2016_08_06_205440_create_permissions_table  1
2016_08_11_013917_create_material_order_table   1

file : 2017_03_04_201351_create_permission_role_table.php

<?php

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

class CreatePermissionRoleTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        /**
         * Run the migrations.
         *
         * @return void
         */
        Schema::create('permission_role', function (Blueprint $table) {
            $table->integer('permission_id')->unsigned()->index();
            $table->integer('role_id')->unsigned()->index();

            $table->foreign('permission_id')
                ->references('id')
                ->on('permissions')
                ->onDelete('cascade');

            $table->foreign('role_id')
                ->references('id')
                ->on('roles')
                ->onDelete('cascade');

            $table->primary(['permission_id', 'role_id']);
        });
    }

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

this is the migration ..

i tried composer dump also it does not appear ..

it refuse to migrate ..

i deleted manually but have the same error upon migrate:refresh

Finally that is the error :

  [Illuminate\Database\QueryException]
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'permission_role' already exists (SQL: create table `permission_role` (`permission_id` in
  t unsigned not null, `role_id` int unsigned not null) default character set utf8 collate utf8_unicode_ci)



  [PDOException]
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'permission_role' already exists

table info : innoDB .



via Hos Mercury

Advertisement