“Laravel Migration Ajouter une colonne au tableau existant” Réponses codées

Laravel Migration Ajouter une colonne au tableau existant

php artisan make:migration add_paid_to_users_table --table=users
  
public function up()
{
    Schema::table('users', function($table) {
        $table->integer('paid');
    });
}

public function down()
{
    Schema::table('users', function($table) {
        $table->dropColumn('paid');
    });
}

php artisan migrate
Indian Gooner

Ajoutez une nouvelle colonne à la table existante dans une migration

// for Laravel 5+
php artisan make:migration add_email_to_users_table --table=users

public function up()
{
    Schema::table('users', function($table) {
        $table->integer('email');
    });
}

public function down()
{
    Schema::table('users', function($table) {
        $table->dropColumn('email');
    });
}

php artisan migrate
Yogesh

Ajouter une colonne dans Laravel Migration CMND

php artisan make:migration add_paid_to_users_table --table=users
9jadev

Ajouter un autre champ dans la migration existante Laravel

php artisan make:migration add_paid_to_users_table --table=users
Blushing Bear

Laravel Migration Ajouter une colonne après

Schema::table('users', function ($table) {
    $table->string('email')->after('id')->nullable();
});
Courageous Cod

Comment ajouter une nouvelle colonne à Larevel avec la migration

php artisan make:migration add_paid_to_users_table --table=users


public function up()
{
    Schema::table('users', function($table) {
        $table->integer('paid');
    });
}
and don't forget to add the rollback option:

public function down()
{
    Schema::table('users', function($table) {
        $table->dropColumn('paid');
    });
}
shafeeque

Réponses similaires à “Laravel Migration Ajouter une colonne au tableau existant”

Questions similaires à “Laravel Migration Ajouter une colonne au tableau existant”

Plus de réponses similaires à “Laravel Migration Ajouter une colonne au tableau existant” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code