This commit is contained in:
dimon8
2026-01-07 19:29:49 +00:00
parent 31b79d70c5
commit d8a8759504
14 changed files with 363 additions and 78 deletions

View File

@@ -11,16 +11,19 @@ return new class extends Migration
*/
public function up(): void
{
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();
});
Schema::create('components', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->decimal('price', 10, 2);
$table->unsignedBigInteger('component_type_id'); // ссылка на тип компонента
$table->json('specifications')->nullable(); // JSON-поле для характеристик
$table->boolean('is_official')->default(false); // официальный или нет
$table->unsignedBigInteger('created_by_user_id')->nullable(); // кто создал
$table->timestamps();
$table->foreign('component_type_id')->references('id')->on('component_types');
$table->foreign('created_by_user_id')->references('id')->on('users')->onDelete('set null');
});
}