Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dominiquevienne/f01ddf524611ce8c9a1d11ca31f038df to your computer and use it in GitHub Desktop.
Save dominiquevienne/f01ddf524611ce8c9a1d11ca31f038df to your computer and use it in GitHub Desktop.
Laravel - Migration file - Sample - Adding a born_at property
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateUsersAddBorn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->date('born_at')->nullable()->after('remember_token');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('born_at');
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment