Changeset View
Changeset View
Standalone View
Standalone View
src/database/migrations/2020_02_24_095604_create_changelogs_table.php
- This file was copied from src/database/migrations/2019_12_10_100355_create_package_skus_table.php.
<?php | <?php | ||||
use Illuminate\Support\Facades\Schema; | use Illuminate\Support\Facades\Schema; | ||||
use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||
use Illuminate\Database\Migrations\Migration; | use Illuminate\Database\Migrations\Migration; | ||||
class CreatePackageSkusTable extends Migration | // phpcs:ignore | ||||
class CreateChangelogsTable extends Migration | |||||
{ | { | ||||
/** | /** | ||||
* Run the migrations. | * Run the migrations. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function up() | public function up() | ||||
{ | { | ||||
Schema::create( | Schema::create( | ||||
'package_skus', | 'changelogs', | ||||
function (Blueprint $table) { | function (Blueprint $table) { | ||||
$table->bigIncrements('id'); | $table->bigIncrements('id'); | ||||
$table->string('package_id', 36); | $table->string('wallet_id', 36); | ||||
$table->string('sku_id', 36); | $table->string('sku_id', 36); | ||||
$table->integer('qty')->default(1); | $table->string('action', 12); | ||||
$table->integer('cost')->default(0)->nullable(); | |||||
$table->timestamps(); | |||||
$table->foreign('package_id')->references('id')->on('packages') | //$table->foreign('wallet_id')->references('id')->on('wallets')->onDelete('cascade'); | ||||
->onDelete('cascade')->onUpdate('cascade'); | //$table->foreign('sku_id')->references('id')->on('skus')->onDelete('cascade'); | ||||
$table->foreign('sku_id')->references('id')->on('skus') | |||||
->onDelete('cascade')->onUpdate('cascade'); | |||||
} | } | ||||
); | ); | ||||
} | } | ||||
/** | /** | ||||
* Reverse the migrations. | * Reverse the migrations. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function down() | public function down() | ||||
{ | { | ||||
Schema::dropIfExists('package_skus'); | Schema::dropIfExists('changelogs'); | ||||
} | } | ||||
} | } |