Skip to content
Snippets Groups Projects
Verified Commit 49ac450d authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #11691 TIME 0:20 migrate origin in res_attachments

parent caaeb69d
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,7 @@ foreach ($customs as $custom) { ...@@ -36,6 +36,7 @@ foreach ($customs as $custom) {
$newResId = \Attachment\models\AttachmentModel::create($attachmentInfo); $newResId = \Attachment\models\AttachmentModel::create($attachmentInfo);
migrateOrigin(['oldResId' => $oldResId, 'newResId' => $newResId]);
migrateAdrVersionAttachments(['oldResId' => $oldResId, 'newResId' => $newResId]); migrateAdrVersionAttachments(['oldResId' => $oldResId, 'newResId' => $newResId]);
migrateHistoryVersion(['oldResId' => $oldResId, 'newResId' => $newResId]); migrateHistoryVersion(['oldResId' => $oldResId, 'newResId' => $newResId]);
migrateEmailsVersion(['oldResId' => $oldResId, 'newResId' => $newResId]); migrateEmailsVersion(['oldResId' => $oldResId, 'newResId' => $newResId]);
...@@ -48,6 +49,16 @@ foreach ($customs as $custom) { ...@@ -48,6 +49,16 @@ foreach ($customs as $custom) {
printf("Migration version attachement (CUSTOM {$custom}) : " . $migrated . " Version(s) trouvée(s) et migrée(s).\n"); printf("Migration version attachement (CUSTOM {$custom}) : " . $migrated . " Version(s) trouvée(s) et migrée(s).\n");
} }
function migrateOrigin($args = [])
{
\SrcCore\models\DatabaseModel::update([
'set' => ['origin' => $args['newResId'] . ',res_attachments'],
'table' => 'res_attachments',
'where' => ['origin = ?'],
'data' => [$args['oldResId'] . ',res_version_attachments']
]);
}
function migrateAdrVersionAttachments($args = []) function migrateAdrVersionAttachments($args = [])
{ {
$adrInfos = \SrcCore\models\DatabaseModel::select(['select' => ['*'], 'table' => ['adr_attachments_version'], 'where' => ['res_id = ?'], 'data' => [$args['oldResId']]]); $adrInfos = \SrcCore\models\DatabaseModel::select(['select' => ['*'], 'table' => ['adr_attachments_version'], 'where' => ['res_id = ?'], 'data' => [$args['oldResId']]]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment