@@ -47,10 +47,11 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function getRan() |
49 | 49 | { |
50 | - $qb = AQB::for('m', 'migrations') |
|
51 | - ->sort(['m.batch', 'm.migrations']) |
|
50 | + $qb = AQB::for('m', 'migrations') { |
|
51 | + ->sort(['m.batch', 'm.migrations']) |
|
52 | 52 | ->return('m.migration') |
53 | 53 | ->get(); |
54 | + } |
|
54 | 55 | |
55 | 56 | return $this->getConnection()->select($qb->query); |
56 | 57 | |
@@ -70,12 +71,13 @@ discard block |
||
70 | 71 | { |
71 | 72 | $bindings['steps'] = $steps; |
72 | 73 | |
73 | - $qb = AQB::for('m', 'migrations') |
|
74 | - ->filter('m.batch', '>=', 1) |
|
74 | + $qb = AQB::for('m', 'migrations') { |
|
75 | + ->filter('m.batch', '>=', 1) |
|
75 | 76 | ->sort([['m.batch', 'DESC'], ['m.migration', 'DESC']]) |
76 | 77 | ->limit($steps) |
77 | 78 | ->return(['migration' => 'm.migration', 'batch' => 'm.batch']) |
78 | 79 | ->get(); |
80 | + } |
|
79 | 81 | |
80 | 82 | return $this->getConnection()->select($qb->query); |
81 | 83 | } |
@@ -84,11 +86,12 @@ discard block |
||
84 | 86 | { |
85 | 87 | $batch = $this->getLastBatchNumber(); |
86 | 88 | |
87 | - $qb = AQB::for('m', 'migrations') |
|
88 | - ->filter('m.batch', $batch) |
|
89 | + $qb = AQB::for('m', 'migrations') { |
|
90 | + ->filter('m.batch', $batch) |
|
89 | 91 | ->sort('m.migration', 'desc') |
90 | 92 | ->return('m') |
91 | 93 | ->get(); |
94 | + } |
|
92 | 95 | |
93 | 96 | return $this->getConnection()->select($qb->query); |
94 | 97 | |
@@ -104,10 +107,11 @@ discard block |
||
104 | 107 | */ |
105 | 108 | public function getMigrationBatches() |
106 | 109 | { |
107 | - $qb = AQB::for('m', 'migrations') |
|
108 | - ->sort([['m.batch'], ['m.migration']]) |
|
110 | + $qb = AQB::for('m', 'migrations') { |
|
111 | + ->sort([['m.batch'], ['m.migration']]) |
|
109 | 112 | ->return(['batch' => 'm.batch', 'migration' => 'm.migration']) |
110 | 113 | ->get(); |
114 | + } |
|
111 | 115 | |
112 | 116 | return $this->getConnection()->select($qb->query); |
113 | 117 | |
@@ -142,10 +146,11 @@ discard block |
||
142 | 146 | */ |
143 | 147 | public function delete($migration) |
144 | 148 | { |
145 | - $qb = AQB::for('m', 'migrations') |
|
146 | - ->filter('m.migration', $migration->migration) |
|
149 | + $qb = AQB::for('m', 'migrations') { |
|
150 | + ->filter('m.migration', $migration->migration) |
|
147 | 151 | ->remove('m', 'migrations') |
148 | 152 | ->get(); |
153 | + } |
|
149 | 154 | |
150 | 155 | $this->getConnection()->delete($qb->query, $qb->binds); |
151 | 156 |
@@ -35,11 +35,12 @@ discard block |
||
35 | 35 | $filter[] = ['doc.' . $attribute, '!=', 'null']; |
36 | 36 | } |
37 | 37 | |
38 | - $aqb = AQB::for('doc', $collection) |
|
39 | - ->filter($filter) |
|
38 | + $aqb = AQB::for('doc', $collection) { |
|
39 | + ->filter($filter) |
|
40 | 40 | ->limit(1) |
41 | 41 | ->return('true') |
42 | 42 | ->get(); |
43 | + } |
|
43 | 44 | |
44 | 45 | $command->aqb = $aqb; |
45 | 46 | |
@@ -65,8 +66,8 @@ discard block |
||
65 | 66 | ['doc.' . $command->to], |
66 | 67 | ]; |
67 | 68 | |
68 | - $aqb = AQB::for('doc', $collection) |
|
69 | - ->filter($filter) |
|
69 | + $aqb = AQB::for('doc', $collection) { |
|
70 | + ->filter($filter) |
|
70 | 71 | ->update( |
71 | 72 | 'doc', |
72 | 73 | [ |
@@ -77,6 +78,7 @@ discard block |
||
77 | 78 | ) |
78 | 79 | ->options(['keepNull' => true]) |
79 | 80 | ->get(); |
81 | + } |
|
80 | 82 | |
81 | 83 | $command->aqb = $aqb; |
82 | 84 | |
@@ -102,11 +104,12 @@ discard block |
||
102 | 104 | $filter[] = ['doc.' . $attribute, '!=', 'null', 'OR']; |
103 | 105 | $data[$attribute] = 'null'; |
104 | 106 | } |
105 | - $aqb = AQB::for('doc', $collection) |
|
106 | - ->filter($filter) |
|
107 | + $aqb = AQB::for('doc', $collection) { |
|
108 | + ->filter($filter) |
|
107 | 109 | ->update('doc', $data, $collection) |
108 | 110 | ->options(['keepNull' => false]) |
109 | 111 | ->get(); |
112 | + } |
|
110 | 113 | |
111 | 114 | $command->aqb = $aqb; |
112 | 115 |