add element persistence

This commit is contained in:
Yisroel Baum 2026-08-08 22:21:25 +03:00
parent aaab0e5379
commit fcc6ade8f3
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
7 changed files with 289 additions and 0 deletions

View file

@ -0,0 +1,35 @@
<?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
{
Schema::create('elements', function (Blueprint $table): void {
$table->id();
$table->foreignId('set_id')
->constrained('sets')
->restrictOnDelete();
$table->string('name');
$table->string('kind');
$table->foreignId('parent_element_id')
->nullable()
->constrained('elements')
->restrictOnDelete();
$table->unsignedInteger('position');
$table->index([
'set_id',
'parent_element_id',
'position',
]);
});
}
public function down(): void
{
Schema::dropIfExists('elements');
}
};