Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
23 | public function change(): void |
||
24 | { |
||
25 | $table = $this->table('media-properties'); |
||
26 | if ($table->exists()) { |
||
27 | return; |
||
28 | } |
||
29 | |||
30 | $table->addColumn('model', 'string'); |
||
31 | $table->addColumn('model_id', 'biginteger'); |
||
32 | $table->addColumn('collection_name', 'string'); |
||
33 | |||
34 | $table->addColumn('custom_properties', 'json'); |
||
35 | |||
36 | $table->addIndex(['model']); |
||
37 | $table->addIndex(['model_id']); |
||
38 | $table->addIndex(['collection_name']); |
||
39 | $table->addIndex(['model', 'model_id', 'collection_name'], ['unique' => true]); |
||
40 | |||
41 | $table->save(); |
||
42 | |||
43 | $table->changeColumn('id', 'biginteger', ['identity' => true]); |
||
44 | $table->save(); |
||
45 | } |
||
47 |