Conditions | 1 |
Paths | 1 |
Total Lines | 27 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
25 | public function up(): void |
||
26 | { |
||
27 | Schema::create('love_reactant_reaction_counters', function (Blueprint $table) { |
||
28 | $table->bigIncrements('id'); |
||
29 | $table->unsignedBigInteger('reactant_id'); |
||
30 | $table->unsignedBigInteger('reaction_type_id'); |
||
31 | $table->unsignedBigInteger('count')->default(0); |
||
32 | $table->bigInteger('weight')->default(0); |
||
33 | $table->timestamps(); |
||
34 | |||
35 | $table->index('reactant_id'); |
||
36 | $table->index('reaction_type_id'); |
||
37 | $table->index([ |
||
38 | 'reactant_id', |
||
39 | 'reaction_type_id', |
||
40 | ], 'love_reactant_reaction_counters_reactant_reaction_type_index'); |
||
41 | |||
42 | $table |
||
43 | ->foreign('reactant_id') |
||
44 | ->references('id') |
||
45 | ->on('love_reactants') |
||
46 | ->onDelete('cascade'); |
||
47 | $table |
||
48 | ->foreign('reaction_type_id') |
||
49 | ->references('id') |
||
50 | ->on('love_reaction_types') |
||
51 | ->onDelete('cascade'); |
||
52 | }); |
||
65 |