“ausländische Key Laravel -Migration” Code-Antworten

Machen Sie einen Vorzeichenschlüssel in Migrationen mit Laravel 8

$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
Imran Developer

Laravel Fremdschlüssel

Schema::table('posts', function (Blueprint $table) {
    $table->unsignedBigInteger('user_id');

    $table->foreign('user_id')->references('id')->on('users');
});
OR
Schema::table('posts', function (Blueprint $table) {
    $table->foreignId('user_id')->constrained();
});
Courageous Cod

Fügen Sie Fremdschlüsselsäule Laravel 5.8 hinzu

update your `integer('user_id')` to `bigInteger('user_id')`
public function up() { 
        Schema::create('evaluation', function (Blueprint $table) { 
            $table->increments('id'); 
            $table->bigInteger('user_id')->unsigned()->index(); 
            $table->timestamps();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
        });
    }
Splendid Stoat

Erstellen Sie fremde Key Laravel -Migration

Schema::table('posts', function (Blueprint $table) {
    $table->unsignedBigInteger('user_id');

    $table->foreign('user_id')->references('id')->on('users');
});
Super Starling

Laravel 8 Fremdschlüsselwanderung

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

Schema::table('posts', function (Blueprint $table) {
    $table->unsignedBigInteger('user_id');

    $table->foreign('user_id')->references('id')->on('users');
});
Combative Coyote

ausländische Key Laravel -Migration

$table->foreign('column_name')->references('id')->on('table_name')->onDelete('cascade');
Super Starling

Ähnliche Antworten wie “ausländische Key Laravel -Migration”

Fragen ähnlich wie “ausländische Key Laravel -Migration”

Weitere verwandte Antworten zu “ausländische Key Laravel -Migration” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen