Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit f721abab erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: uuid migration (quiqqer v1 to v2)

Übergeordneter a09967c6
No related branches found
No related tags found
2 Merge Requests!16Next,!15Dev
......@@ -3,14 +3,14 @@
<global>
<table name="cron">
<field type="INT( 3 ) NOT NULL AUTO_INCREMENT PRIMARY KEY">id</field>
<field type="TINYINT( 1 )">active</field>
<field type="VARCHAR( 1000 ) NOT NULL">title</field>
<field type="VARCHAR( 128 ) NOT NULL">min</field>
<field type="VARCHAR( 128 ) NOT NULL">hour</field>
<field type="VARCHAR( 128 ) NOT NULL">day</field>
<field type="VARCHAR( 128 ) NOT NULL">month</field>
<field type="VARCHAR( 128 ) NOT NULL">dayOfWeek</field>
<field type="INT(3) NOT NULL AUTO_INCREMENT PRIMARY KEY">id</field>
<field type="TINYINT(1)">active</field>
<field type="VARCHAR(1000) NOT NULL">title</field>
<field type="VARCHAR(128) NOT NULL">min</field>
<field type="VARCHAR(128) NOT NULL">hour</field>
<field type="VARCHAR(128) NOT NULL">day</field>
<field type="VARCHAR(128) NOT NULL">month</field>
<field type="VARCHAR(128) NOT NULL">dayOfWeek</field>
<field type="TEXT NOT NULL">exec</field>
<field type="TEXT NOT NULL">params</field>
<field type="DATETIME NULL DEFAULT NULL">lastexec</field>
......@@ -19,8 +19,8 @@
</table>
<table name="cron_history">
<field type="INT( 3 ) NOT NULL">cronid</field>
<field type="INT( 11 ) NOT NULL">uid</field>
<field type="INT(3) NOT NULL">cronid</field>
<field type="VARCHAR(50) NOT NULL">uid</field>
<field type="DATETIME NOT NULL">lastexec</field>
<field type="DATETIME NULL DEFAULT NULl">finish</field>
......@@ -28,8 +28,8 @@
</table>
<table name="cron_cronservice">
<field type="INT( 3 ) NOT NULL">cronid</field>
<field type="INT( 11 ) NOT NULL">uid</field>
<field type="INT(3) NOT NULL">cronid</field>
<field type="VARCHAR(50) NOT NULL">uid</field>
<field type="DATETIME NOT NULL">lastexec</field>
<index>cronid</index>
......
......@@ -6,4 +6,5 @@
<event on="onCreateProject" fire="\QUI\Cron\EventHandler::onCreateProject"/>
<event on="onPackageInstallAfter" fire="\QUI\Cron\EventHandler::onPackageInstall"/>
<event on="onUpdateEnd" fire="\QUI\Cron\EventHandler::updateEnd"/>
<event on="onQuiqqerMigrationV2" fire="\QUI\Cron\EventHandler::onQuiqqerMigrationV2"/>
</events>
\ No newline at end of file
......@@ -9,6 +9,8 @@ namespace QUI\Cron;
use QUI;
use QUI\Exception;
use QUI\System\Console\Tools\MigrationV2;
use function explode;
use function str_replace;
......@@ -343,4 +345,33 @@ class EventHandler
return $createCrons;
}
public static function onQuiqqerMigrationV2(MigrationV2 $Console): void
{
$Console->writeLn('- Migrate cron history');
$count = (new Manager())->getHistoryCount();
if ($count > 100000) {
$Console->writeLn(
'cron history table has more than 100000 entries. skip the migration.
please have a look and empty or decimate the table if necessary.',
'red'
);
$Console->resetColor();
return;
}
QUI\Utils\MigrationV1ToV2::migrateUsers(
QUI::getDBTableName('cron_history'),
['uid'],
'cronid'
);
QUI\Utils\MigrationV1ToV2::migrateUsers(
QUI::getDBTableName('cron_cronservice'),
['uid'],
'cronid'
);
}
}
......@@ -466,7 +466,7 @@ class Manager
'cronid' => $cronId,
'lastexec' => date('Y-m-d H:i:s', $starTime),
'finish' => date('Y-m-d H:i:s'),
'uid' => QUI::getUserBySession()->getId() ?: 0
'uid' => QUI::getUserBySession()->getUUID() ?: 0
]);
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren