jeudi 12 mai 2016

Laravel Migration: Add a column with a default value of an existing column

i need to add a last_activity column on a table of a live site where i have to make it's default value to equal of updated_at column value. I'm using laravel 5.1 and mysql database driver.

Schema::table('users', function(Blueprint $table)
{
    $table->dateTime('last_activity')->default("COLUMN VALUE OF UPDATED_AT");
});

Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire