<?phpuseApp\Library\Classes\Database\Migration;useIlluminate\Database\Schema\Blueprint;classAddTemplateUrlColumnToEmailLogsTableextendsMigration{constTABLE_NAME='email_logs';/** * Run the migrations. * * @return void */publicfunctionup(){// Add new `template_url` column if if doesn't existif(!$this->hasColumn('template_url')){$this->table(function(Blueprint$table){$table->string('template_url',256)->after('content')->nullable();});}}/** * Reverse the migrations. * * @return void */publicfunctiondown(){// Remove the new column if it existsif($this->hasColumn('template_url')){$this->table(function(Blueprint$table){$table->dropColumn('template_url');});}}}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.