Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
trouvaille
/
migrations
:
2023_11_09_081405_create_user_wallet_table.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { /** * Run the migrations. * * @return void */ public function up() { if (!Schema::hasColumn('user', 'credit_balance')) { Schema::table('users', function (Blueprint $table) { $table->decimal('credit_balance',10)->nullable(); }); } Schema::create('credit_transactions', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('user_id'); $table->unsignedBigInteger('payment_id')->nullable(); $table->unsignedBigInteger('ref_id')->nullable(); $table->string('type',30)->nullable(); $table->decimal('amount',10)->nullable(); $table->text('meta')->nullable(); $table->string('status',30)->nullable(); $table->softDeletes(); $table->bigInteger('create_user')->nullable(); $table->bigInteger('update_user')->nullable(); $table->index('user_id'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('user_wallet'); } };