“Cómo crear migración en Laravel” Código de respuesta

PHP Artisan Migrate Crear mesa

php artisan make:migration create_users_table

php artisan migrate
Shadow

llave extranjera de Laravel

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

PHP Artisan hace migración

php artisan make:migration create_users_table
Mobile Star

Laravel crea migración

// use the make:migration Artisan command to generate a database migration
php artisan make:migration create_flights_table

// use --create to indicate whether the migration will be creating a new table
php artisan make:migration create_flights_table --create=flights

// use --table to indicate the table name
php artisan make:migration add_destination_to_flights_table --table=flights
Yingfufu

Cómo crear migración en Laravel

$table->increments('id');
Jittery Jay

Artisan hace migración con modelo

php artisan make:Model Status -m
Adorable Aardvark

Respuestas similares a “Cómo crear migración en Laravel”

Preguntas similares a “Cómo crear migración en Laravel”

Más respuestas relacionadas con “Cómo crear migración en Laravel” en PHP

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código