Created
December 16, 2021 07:11
-
-
Save dominiquevienne/f01ddf524611ce8c9a1d11ca31f038df to your computer and use it in GitHub Desktop.
Laravel - Migration file - Sample - Adding a born_at property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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