Created
June 15, 2019 08:19
-
-
Save alvaro-canepa/c6fc97acbfbbeb92be3d7c2758c0b961 to your computer and use it in GitHub Desktop.
PHP OctoberCMS Plugin Update for PHPStorm file templates
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 | |
#if (${NAMESPACE}) namespace ${NAMESPACE}; | |
#end | |
use Schema; | |
use October\Rain\Database\Schema\Blueprint; | |
use October\Rain\Database\Updates\Migration; | |
#parse("PHP Class Doc Comment.php") | |
class ${NAME} extends Migration | |
{ | |
protected ${DS}tablename = '${Table}'; | |
public function up() | |
{ | |
if(Schema::hasTable(${DS}this->tablename)){ | |
Schema::table(${DS}this->tablename, function (Blueprint ${DS}table) { | |
}); | |
} | |
} | |
public function down() | |
{ | |
if(!Schema::hasTable(${DS}this->tablename)){ | |
return false; | |
} | |
if (Schema::hasColumns(${DS}this->tablename, ['column'])) { | |
Schema::table(${DS}this->tablename, function (Blueprint ${DS}table) { | |
${DS}table->dropColumn(['column']); | |
} | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment