File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 11<?php
22
3+ use Cake\Datasource\ConnectionManager;
34use Phinx\Migration\AbstractMigration;
45
56class MigrationAddIndex extends AbstractMigration {
@@ -9,11 +10,21 @@ class MigrationAddIndex extends AbstractMigration {
910 */
1011 public function change() {
1112 // Shim: make sure this is void when a migrating with `202311128071500` instead of `20231112807150` has been run already.
12- $result = $this->query('SELECT * FROM queue_phinxlog WHERE version = \'202311128071500\' LIMIT 1')->fetch();
13- if ($result) {
14- $this->execute('DELETE FROM queue_phinxlog WHERE version = \'202311128071500\' LIMIT 1');
13+ $version = '202311128071500';
14+ if (ConnectionManager::getConfig('default')['driver'] === 'Cake\Database\Driver\Sqlserver') {
15+ $result = $this->query('SELECT TOP(1) * FROM queue_phinxlog WHERE version = \'' . $version . '\'')->fetch();
16+ if ($result) {
17+ $this->execute('DELETE TOP(1) FROM queue_phinxlog WHERE version = \'' . $version . '\'');
1518
16- return;
19+ return;
20+ }
21+ } else {
22+ $result = $this->query('SELECT * FROM queue_phinxlog WHERE version = \'' . $version . '\' LIMIT 1')->fetch();
23+ if ($result) {
24+ $this->execute('DELETE FROM queue_phinxlog WHERE version = \'' . $version . '\' LIMIT 1');
25+
26+ return;
27+ }
1728 }
1829
1930 $table = $this->table('queued_jobs');
You can’t perform that action at this time.
0 commit comments