Skip to content

Commit 24b2871

Browse files
committed
fix db structure for document type
1 parent 075c801 commit 24b2871

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

database/migrations/create_inspire-cms-core_table.php.stub

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,16 @@ return new class extends BaseMigration
139139

140140
$table->index('field_group_id');
141141
});
142-
Schema::create($tableNames['document_type_inheritance'], function (Blueprint $table) {
143-
$table->integer('document_type_id');
144-
$table->integer('inherited_document_type_id');
145142

146-
$table->index('document_type_id');
147-
$table->index('inherited_document_type_id');
143+
$documentTypeTable = $tableNames['document_type'];
144+
Schema::create($tableNames['document_type_inheritance'], function (Blueprint $table) use ($documentTypeTable) {
145+
$table->foreignId('document_type_id')->constrained($documentTypeTable, 'id')->onDelete('cascade');
146+
$table->foreignId('inherited_document_type_id')->constrained($documentTypeTable, 'id')->onDelete('cascade');
148147
});
149148

150-
Schema::create($tableNames['allowed_document_type'], function (Blueprint $table) {
151-
$table->foreignId('id')->constrained('cms_document_types', 'id')->onDelete('cascade');
152-
$table->foreignId('allowed_id')->constrained('cms_document_types', 'id')->onDelete('cascade');
149+
Schema::create($tableNames['allowed_document_type'], function (Blueprint $table) use ($documentTypeTable) {
150+
$table->foreignId('id')->constrained($documentTypeTable, 'id')->onDelete('cascade');
151+
$table->foreignId('allowed_id')->constrained($documentTypeTable, 'id')->onDelete('cascade');
153152
});
154153

155154
Schema::create($tableNames['user'], function (Blueprint $table) {

0 commit comments

Comments
 (0)