Conditions | 1 |
Paths | 1 |
Total Lines | 43 |
Code Lines | 35 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | $this->schema->create((new Reaction())->getTable(), function (Blueprint $table) { |
||
29 | $table->bigIncrements('id'); |
||
30 | $table->unsignedBigInteger('reactant_id'); |
||
31 | $table->unsignedBigInteger('reacter_id'); |
||
32 | $table->unsignedBigInteger('reaction_type_id'); |
||
33 | $table->decimal('rate', 4, 2); |
||
34 | $table->timestamps(); |
||
35 | |||
36 | $table->index([ |
||
37 | 'reactant_id', |
||
38 | 'reaction_type_id', |
||
39 | ]); |
||
40 | $table->index([ |
||
41 | 'reactant_id', |
||
42 | 'reacter_id', |
||
43 | 'reaction_type_id', |
||
44 | ]); |
||
45 | $table->index([ |
||
46 | 'reactant_id', |
||
47 | 'reacter_id', |
||
48 | ]); |
||
49 | $table->index([ |
||
50 | 'reacter_id', |
||
51 | 'reaction_type_id', |
||
52 | ]); |
||
53 | |||
54 | $table |
||
55 | ->foreign('reactant_id') |
||
56 | ->references('id') |
||
57 | ->on((new Reactant())->getTable()) |
||
58 | ->onDelete('cascade'); |
||
59 | $table |
||
60 | ->foreign('reacter_id') |
||
61 | ->references('id') |
||
62 | ->on((new Reacter())->getTable()) |
||
63 | ->onDelete('cascade'); |
||
64 | $table |
||
65 | ->foreign('reaction_type_id') |
||
66 | ->references('id') |
||
67 | ->on((new ReactionType())->getTable()) |
||
68 | ->onDelete('cascade'); |
||
69 | }); |
||
70 | } |
||
71 | |||
80 |