35 lines
861 B
PHP
35 lines
861 B
PHP
<?php namespace Site21\Fields\Updates;
|
|
|
|
use Schema;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use October\Rain\Database\Updates\Migration;
|
|
|
|
|
|
class AddModuleField extends Migration
|
|
{
|
|
const TABLE_NAME = 'site21_shopaholic_fields';
|
|
|
|
public function up()
|
|
{
|
|
if (!Schema::hasTable(self::TABLE_NAME) || Schema::hasColumn(self::TABLE_NAME, 'module')) {
|
|
return;
|
|
}
|
|
|
|
Schema::table(self::TABLE_NAME, function (Blueprint $obTable)
|
|
{
|
|
$obTable->string('module')->default(0);
|
|
});
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
if (!Schema::hasTable(self::TABLE_NAME) || !Schema::hasColumn(self::TABLE_NAME, 'module')) {
|
|
return;
|
|
}
|
|
|
|
Schema::table(self::TABLE_NAME, function (Blueprint $obTable)
|
|
{
|
|
$obTable->dropColumn(['module']);
|
|
});
|
|
}
|
|
} |