This commit is contained in:
2026-06-13 12:42:42 +03:30
parent f8c96a420f
commit e70fcef962
8 changed files with 264 additions and 7 deletions
@@ -0,0 +1,45 @@
<?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('price_sync_logs')) {
Schema::create('price_sync_logs', function (Blueprint $table) {
$table->id();
$table->string('source', 32);
$table->string('source_url', 512)->nullable();
$table->unsignedBigInteger('liquid_gold_price')->default(0);
$table->unsignedSmallInteger('products_updated')->default(0);
$table->timestamp('created_at')->nullable();
});
}
if (! Schema::hasTable('price_sync_log_items')) {
Schema::create('price_sync_log_items', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('log_id');
$table->unsignedBigInteger('product_id')->nullable();
$table->string('product_title', 255)->nullable();
$table->string('reading_method', 128)->nullable();
$table->string('source_name', 255)->nullable();
$table->unsignedBigInteger('base_price')->default(0);
$table->unsignedBigInteger('base_profit')->default(0);
$table->decimal('offset_percent', 8, 2)->default(0);
$table->unsignedBigInteger('stored_price')->default(0);
$table->unsignedBigInteger('previous_price')->default(0);
$table->index('log_id');
});
}
}
public function down(): void
{
Schema::dropIfExists('price_sync_log_items');
Schema::dropIfExists('price_sync_logs');
}
};