added price_offset_percent

This commit is contained in:
2026-06-02 16:00:33 +03:30
parent 6cbbde9834
commit c40ac0a3fe
6 changed files with 215 additions and 36 deletions
@@ -0,0 +1,34 @@
<?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;
}
Schema::table('products', function (Blueprint $table) {
if (!Schema::hasColumn('products', 'price_offset_percent')) {
$table->decimal('price_offset_percent', 8, 2)->default(0)->after('price_profit');
}
});
}
public function down(): void
{
if (!Schema::hasTable('products')) {
return;
}
if (Schema::hasColumn('products', 'price_offset_percent')) {
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('price_offset_percent');
});
}
}
};