added price_offset_percent
This commit is contained in:
@@ -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');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user