added kashkool
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('categories')) {
|
||||
Schema::create('categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->boolean('active')->default(true);
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('cart')) {
|
||||
Schema::create('cart', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('customer_id')->nullable();
|
||||
$table->unsignedTinyInteger('sts')->default(1);
|
||||
$table->string('session_id')->nullable()->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('cart_items')) {
|
||||
Schema::create('cart_items', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('cart_id');
|
||||
$table->unsignedBigInteger('product_id')->nullable();
|
||||
$table->unsignedInteger('quantity')->default(1);
|
||||
$table->decimal('price', 15, 2)->nullable();
|
||||
$table->string('title')->nullable();
|
||||
$table->string('group_type')->nullable();
|
||||
$table->decimal('gold_price', 15, 4)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('pargar_reqasts')) {
|
||||
Schema::create('pargar_reqasts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('m')->nullable();
|
||||
$table->string('route')->nullable();
|
||||
$table->string('ip')->nullable();
|
||||
$table->json('data')->nullable();
|
||||
$table->json('finance_head')->nullable();
|
||||
$table->json('finance_data')->nullable();
|
||||
$table->json('response')->nullable();
|
||||
$table->string('function_name')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasTable('giftcards') && ! Schema::hasColumn('giftcards', 'use_once')) {
|
||||
Schema::table('giftcards', function (Blueprint $table) {
|
||||
$table->unsignedTinyInteger('use_once')->default(0)->after('customer_id');
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasTable('giftcard_codes') && ! Schema::hasColumn('giftcard_codes', 'use_once')) {
|
||||
Schema::table('giftcard_codes', function (Blueprint $table) {
|
||||
$table->unsignedTinyInteger('use_once')->default(0)->after('giftcard_id');
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasTable('giftcard_codes') && Schema::hasColumn('giftcard_codes', 'assigned_to')) {
|
||||
\Illuminate\Support\Facades\DB::statement(
|
||||
'ALTER TABLE `giftcard_codes` MODIFY `assigned_to` TEXT NULL'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cart_items');
|
||||
Schema::dropIfExists('cart');
|
||||
Schema::dropIfExists('categories');
|
||||
Schema::dropIfExists('pargar_reqasts');
|
||||
|
||||
if (Schema::hasTable('giftcards') && Schema::hasColumn('giftcards', 'use_once')) {
|
||||
Schema::table('giftcards', function (Blueprint $table) {
|
||||
$table->dropColumn('use_once');
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasTable('giftcard_codes') && Schema::hasColumn('giftcard_codes', 'use_once')) {
|
||||
Schema::table('giftcard_codes', function (Blueprint $table) {
|
||||
$table->dropColumn('use_once');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user