Conditions | 2 |
Paths | 2 |
Total Lines | 37 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
22 | public function safeUp() |
||
23 | { |
||
24 | $query = (new Query()) |
||
25 | ->from(['{{%elementlist}}']) |
||
26 | ->select([ |
||
27 | 'fieldId', |
||
28 | 'sourceId', |
||
29 | 'targetId', |
||
30 | 'sortOrder', |
||
31 | 'dateCreated', |
||
32 | 'dateUpdated', |
||
33 | 'uid', |
||
34 | 'siteId as sourceSiteId', |
||
35 | ]); |
||
36 | |||
37 | foreach ($query->batch(1000) as $batch) { |
||
38 | Craft::$app->getDb()->createCommand()->batchInsert( |
||
39 | Association::tableName(), |
||
40 | [ |
||
41 | 'fieldId', |
||
42 | 'sourceId', |
||
43 | 'targetId', |
||
44 | 'sortOrder', |
||
45 | 'dateCreated', |
||
46 | 'dateUpdated', |
||
47 | 'uid', |
||
48 | 'siteId' |
||
49 | ], |
||
50 | $batch, |
||
51 | false |
||
52 | )->execute(); |
||
53 | } |
||
54 | |||
55 | $this->dropTableIfExists('elementlist'); |
||
56 | |||
57 | return true; |
||
58 | } |
||
59 | |||
68 |