FEAT #11691 TIME 0:20 migrate origin in res_attachments

parent caaeb69d
......@@ -36,6 +36,7 @@ foreach ($customs as $custom) {
$newResId = \Attachment\models\AttachmentModel::create($attachmentInfo);
migrateOrigin(['oldResId' => $oldResId, 'newResId' => $newResId]);
migrateAdrVersionAttachments(['oldResId' => $oldResId, 'newResId' => $newResId]);
migrateHistoryVersion(['oldResId' => $oldResId, 'newResId' => $newResId]);
migrateEmailsVersion(['oldResId' => $oldResId, 'newResId' => $newResId]);
......@@ -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");
}
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 = [])
{
$adrInfos = \SrcCore\models\DatabaseModel::select(['select' => ['*'], 'table' => ['adr_attachments_version'], 'where' => ['res_id = ?'], 'data' => [$args['oldResId']]]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment