Changeset View
Changeset View
Standalone View
Standalone View
src/database/migrations/2022_09_08_100000_plans_free_months.php
<?php | <?php | ||||
use Illuminate\Database\Migrations\Migration; | use Illuminate\Database\Migrations\Migration; | ||||
use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
use Illuminate\Support\Facades\DB; | |||||
use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
return new class extends Migration | return new class extends Migration | ||||
{ | { | ||||
/** | /** | ||||
* Run the migrations. | * Run the migrations. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function up() | public function up() | ||||
{ | { | ||||
Schema::table( | Schema::table( | ||||
'plans', | 'plans', | ||||
function (Blueprint $table) { | function (Blueprint $table) { | ||||
$table->tinyInteger('free_months')->unsigned()->default(0); | $table->tinyInteger('free_months')->unsigned()->default(0); | ||||
} | } | ||||
); | ); | ||||
DB::table('plans')->update(['free_months' => 1]); | |||||
} | } | ||||
/** | /** | ||||
* Reverse the migrations. | * Reverse the migrations. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function down() | public function down() | ||||
Show All 9 Lines |