Пытаюсь связать 2 таблицы, при миграции вылазит ошибка SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "roles" does not exist (SQL: alter table "users" add constraint "users_role_id_foreign" foreign key ("role_id") references "roles" ("id_role"))
. Не пойму в чем дело
class CreateUsersTable extends Migration
{
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('role_id')->unsigned();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
$table->foreign('role_id')->references('id_role')->on('roles');
});
}
public function down()
{
Schema::dropIfExists('users');
}
}
class CreateRolesTable extends Migration
{
public function up()
{
Schema::create('roles', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('id_role');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('roles');
}
}