enforce element level hierarchy
This commit is contained in:
parent
25495b6c4d
commit
99e1ba051c
5 changed files with 80 additions and 44 deletions
|
|
@ -10,18 +10,17 @@ return new class extends Migration
|
|||
{
|
||||
Schema::create('elements', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('set_id')
|
||||
->constrained('sets')
|
||||
$table->foreignId('set_level_id')
|
||||
->constrained('set_levels')
|
||||
->restrictOnDelete();
|
||||
$table->string('name');
|
||||
$table->string('kind');
|
||||
$table->foreignId('parent_element_id')
|
||||
->nullable()
|
||||
->constrained('elements')
|
||||
->restrictOnDelete();
|
||||
$table->unsignedInteger('position');
|
||||
$table->index([
|
||||
'set_id',
|
||||
'set_level_id',
|
||||
'parent_element_id',
|
||||
'position',
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue