.
This commit is contained in:
@@ -14,8 +14,8 @@ return new class extends Migration
|
||||
$table->integer('customer_id')->nullable();
|
||||
$table->unsignedTinyInteger('use_once')->default(0);
|
||||
$table->integer('count')->nullable();
|
||||
$table->float('amount')->nullable();
|
||||
$table->bigInteger('total')->nullable();
|
||||
$table->decimal('amount', 20, 4)->nullable();
|
||||
$table->decimal('total', 20, 4)->nullable();
|
||||
$table->integer('unit')->nullable();
|
||||
$table->string('unique_code')->nullable();
|
||||
$table->timestamp('created_at')->nullable();
|
||||
@@ -37,7 +37,7 @@ return new class extends Migration
|
||||
$table->string('code')->nullable();
|
||||
$table->unsignedTinyInteger('sts')->nullable();
|
||||
$table->unsignedTinyInteger('unit')->nullable();
|
||||
$table->float('amount')->nullable();
|
||||
$table->decimal('amount', 20, 4)->nullable();
|
||||
$table->text('assigned_to')->nullable();
|
||||
$table->timestamp('used_at')->nullable();
|
||||
$table->timestamp('expiry_date')->nullable();
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* سقف قبلی amount (مثلاً FLOAT/DECIMAL با precision کم) جلوی مبالغ ~۱۰۰ میلیون ریال را میگرفت (خطای ۱۲۶۴).
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (Schema::hasTable('giftcards') && Schema::hasColumn('giftcards', 'amount')) {
|
||||
DB::statement('ALTER TABLE `giftcards` MODIFY `amount` DECIMAL(20,4) NULL');
|
||||
}
|
||||
|
||||
if (Schema::hasTable('giftcards') && Schema::hasColumn('giftcards', 'total')) {
|
||||
DB::statement('ALTER TABLE `giftcards` MODIFY `total` DECIMAL(20,4) NULL');
|
||||
}
|
||||
|
||||
if (Schema::hasTable('giftcard_codes') && Schema::hasColumn('giftcard_codes', 'amount')) {
|
||||
DB::statement('ALTER TABLE `giftcard_codes` MODIFY `amount` DECIMAL(20,4) NULL');
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (Schema::hasTable('giftcards') && Schema::hasColumn('giftcards', 'amount')) {
|
||||
DB::statement('ALTER TABLE `giftcards` MODIFY `amount` FLOAT NULL');
|
||||
}
|
||||
|
||||
if (Schema::hasTable('giftcards') && Schema::hasColumn('giftcards', 'total')) {
|
||||
DB::statement('ALTER TABLE `giftcards` MODIFY `total` BIGINT NULL');
|
||||
}
|
||||
|
||||
if (Schema::hasTable('giftcard_codes') && Schema::hasColumn('giftcard_codes', 'amount')) {
|
||||
DB::statement('ALTER TABLE `giftcard_codes` MODIFY `amount` FLOAT NULL');
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user