fix wallet

This commit is contained in:
2026-06-10 13:11:51 +03:30
parent fe4d85325e
commit 539e38d034
14 changed files with 957 additions and 293 deletions
@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (!Schema::hasTable('products')) {
return;
}
if (!Schema::hasColumn('products', 'show_in_assets')) {
Schema::table('products', function (Blueprint $table) {
if (Schema::hasColumn('products', 'show')) {
$table->boolean('show_in_assets')->default(false)->after('show');
} else {
$table->boolean('show_in_assets')->default(false);
}
});
} else {
DB::statement(
'ALTER TABLE `products` MODIFY COLUMN `show_in_assets` TINYINT(1) NOT NULL DEFAULT 0'
);
DB::table('products')->update(['show_in_assets' => 0]);
}
}
public function down(): void
{
if (!Schema::hasTable('products') || !Schema::hasColumn('products', 'show_in_assets')) {
return;
}
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('show_in_assets');
});
}
};
@@ -0,0 +1,36 @@
<?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('products')) {
return;
}
if (!Schema::hasColumn('products', 'use_last_price_if_zero')) {
Schema::table('products', function (Blueprint $table) {
if (Schema::hasColumn('products', 'show_in_assets')) {
$table->boolean('use_last_price_if_zero')->default(false)->after('show_in_assets');
} else {
$table->boolean('use_last_price_if_zero')->default(false);
}
});
}
}
public function down(): void
{
if (!Schema::hasTable('products') || !Schema::hasColumn('products', 'use_last_price_if_zero')) {
return;
}
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('use_last_price_if_zero');
});
}
};