add element persistence
This commit is contained in:
parent
aaab0e5379
commit
fcc6ade8f3
7 changed files with 289 additions and 0 deletions
|
|
@ -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');
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue