| Conditions | 2 |
| Paths | 2 |
| Total Lines | 25 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function change(): void |
||
| 24 | { |
||
| 25 | $table = $this->table('media-records'); |
||
| 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('file_name', 'string'); |
||
| 35 | $table->addColumn('path', 'string'); |
||
| 36 | $table->addColumn('disk', 'string'); |
||
| 37 | |||
| 38 | $table->addIndex(['model']); |
||
| 39 | $table->addIndex(['model_id']); |
||
| 40 | $table->addIndex(['collection_name']); |
||
| 41 | |||
| 42 | $table->addIndex(['model', 'model_id', 'collection_name', 'path'], ['unique' => true]); |
||
| 43 | |||
| 44 | $table->save(); |
||
| 45 | |||
| 46 | $table->changeColumn('id', 'biginteger', ['identity' => true]); |
||
| 47 | $table->save(); |
||
| 48 | } |
||
| 50 |