You see, I have a Targeta table in my project with the following code:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTargetasTable extends Migration{
public function up(){
Schema::create('targetas', function (Blueprint $table) {
$table->increments('id');
$table->integer('codigo');
$table->integer('saldo');
$table->timestamps();
});
}
public function down(){
Schema::dropIfExists('targetas');
}
}
And it is related to the User table:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration{
public function up(){
Schema::create('users', function (Blueprint $table){
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->unsignedInteger('cuenta');
$table->foreign('cuenta')->references('id')->on('targetas');
$table->rememberToken();
$table->timestamps();
});
}
public function down(){
Schema::dropIfExists('users');
}
}
But I find this when doing the migration:
What will I be doing wrong?
Edit: I have added a photo with my creation files of the tables.