Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function up(): void |
||
17 | { |
||
18 | Schema::create(config('rinvex.attributes.tables.attribute_entity'), function (Blueprint $table) { |
||
19 | // Columns |
||
20 | $table->integer('attribute_id')->unsigned(); |
||
21 | $table->string('entity_type'); |
||
22 | $table->integer('entity_id')->unsigned()->nullable(); // TODO: Making this nullable for now as it breaks the basic features |
||
23 | $table->timestamps(); |
||
24 | |||
25 | // Indexes |
||
26 | $table->unique(['attribute_id', 'entity_type'], 'attributable_attribute_id_entity_type'); |
||
27 | $table->foreign('attribute_id')->references('id')->on(config('rinvex.attributes.tables.attributes')) |
||
28 | ->onDelete('cascade')->onUpdate('cascade'); |
||
29 | }); |
||
30 | } |
||
31 | |||
42 |