123
This commit is contained in:
@@ -13,14 +13,16 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('components', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name'); // Например: "Intel Core i5-12400F"
|
||||
$table->foreignId('component_type_id')->constrained()->onDelete('cascade');
|
||||
$table->decimal('price', 10, 2);
|
||||
$table->json('specifications')->nullable(); // Для хранения характеристик
|
||||
$table->boolean('is_official')->default(true); // true = админ, false = пользователь
|
||||
$table->foreignId('created_by_user_id')->nullable()->constrained('users')->onDelete('set null');
|
||||
$table->timestamps();
|
||||
$table->text('name');
|
||||
$table->text('type');
|
||||
$table->text('brand');
|
||||
$table->text('model');
|
||||
$table->integer('price');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
Schema::create('component_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name'); // Например: "Процессор", "Видеокарта"
|
||||
$table->string('code')->unique(); // Уникальный код: cpu, gpu, ram и т.д.
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// Заполняем таблицу начальными данными (seed)
|
||||
DB::table('component_types')->insert([
|
||||
['name' => 'Процессор', 'code' => 'cpu'],
|
||||
['name' => 'Видеокарта', 'code' => 'gpu'],
|
||||
['name' => 'Материнская плата', 'code' => 'motherboard'],
|
||||
['name' => 'ОЗУ', 'code' => 'ram'],
|
||||
['name' => 'Блок питания', 'code' => 'psu'],
|
||||
['name' => 'SSD', 'code' => 'ssd'],
|
||||
['name' => 'Корпус', 'code' => 'case'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('component_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePcBuildsTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pc_builds', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$table->string('name'); // Например: "Игровой ПК 2025"
|
||||
$table->text('description')->nullable(); // Описание
|
||||
$table->boolean('is_ai_generated')->default(false); // true = сгенерировано ИИ
|
||||
$table->text('ai_prompt')->nullable(); // Исходный запрос к ИИ
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('pc_builds');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user