@@ -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