Last active
January 27, 2018 06:46
-
-
Save dertajora/d9741c7ca002623af5efa21a3a16b34b to your computer and use it in GitHub Desktop.
Example of generated migration file when we want to modify a table
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\Support\Facades\Schema; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class AdjustTicketsTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::table('tickets', function (Blueprint $table) { | |
$table->timestamp('processed_at')->nullable()->comment("When ticket processed by scheduler");; | |
$table->timestamp('completed_at')->nullable()->comment("When ticket completed by scheduler");; | |
$table->integer('scheduled_by')->nullable()->comment("Scheduler who schedule the ticket");; | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::table('tickets', function (Blueprint $table) { | |
$table->dropColumn(['processed_at', 'completed_at', 'scheduled_by']); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment