From a3c92f45565aba47b8aa10c7be86a395b106ab5d Mon Sep 17 00:00:00 2001 From: Guillaume Heurtier <guillaume.heurtier@maarch.org> Date: Thu, 19 Dec 2019 17:30:30 +0100 Subject: [PATCH] FEAT #12091 TIME 4:00 fixed migration errors --- migration/19.12/1912-postScript.sql | 2 ++ migration/19.12/1912.sql | 6 ++++++ migration/19.12/migrate.sh | 3 ++- migration/19.12/migrateCategories.php | 3 +++ migration/19.12/migrateVersionAttachments.php | 4 ++-- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/migration/19.12/1912-postScript.sql b/migration/19.12/1912-postScript.sql index a9344037d5f..e9c2ea23d22 100644 --- a/migration/19.12/1912-postScript.sql +++ b/migration/19.12/1912-postScript.sql @@ -12,6 +12,8 @@ DROP VIEW IF EXISTS view_contacts; DROP TABLE IF EXISTS cases; DROP TABLE IF EXISTS cases_res; +DELETE FROM contacts_groups_lists WHERE contact_id IS NULL; + DROP TABLE IF EXISTS contacts_res; DROP TABLE IF EXISTS contact_addresses; DROP TABLE IF EXISTS contact_communication; diff --git a/migration/19.12/1912.sql b/migration/19.12/1912.sql index 0093b31e03f..26fd4307705 100644 --- a/migration/19.12/1912.sql +++ b/migration/19.12/1912.sql @@ -363,6 +363,12 @@ DO $$ BEGIN UPDATE security SET where_clause = REGEXP_REPLACE(where_clause, 'typist(\s*)=(\s*)@user', 'typist = @user_id', 'gmi'); END IF; END$$; +ALTER TABLE res_letterbox ADD COLUMN IF NOT EXISTS scan_date timestamp without time zone; +ALTER TABLE res_letterbox ADD COLUMN IF NOT EXISTS scan_user CHARACTER VARYING (50) DEFAULT NULL::character varying; +ALTER TABLE res_letterbox ADD COLUMN IF NOT EXISTS scan_location CHARACTER VARYING (255) DEFAULT NULL::character varying; +ALTER TABLE res_letterbox ADD COLUMN IF NOT EXISTS scan_wkstation CHARACTER VARYING (255) DEFAULT NULL::character varying; +ALTER TABLE res_letterbox ADD COLUMN IF NOT EXISTS scan_batch CHARACTER VARYING (50) DEFAULT NULL::character varying; +ALTER TABLE res_letterbox ADD COLUMN IF NOT EXISTS scan_postmark CHARACTER VARYING (50) DEFAULT NULL::character varying; /* USERGROUP_CONTENT */ diff --git a/migration/19.12/migrate.sh b/migration/19.12/migrate.sh index 93365d4038e..3d720e93199 100755 --- a/migration/19.12/migrate.sh +++ b/migration/19.12/migrate.sh @@ -20,4 +20,5 @@ php ./migrateM2MConfiguration.php php ./removeNatureFromPrint.php php ./migrateCustomValues.php php ./migrateVersionAttachments.php -php ./migrateContacts.php \ No newline at end of file +php ./migrateContacts.php +php ./migrateTemplates.php diff --git a/migration/19.12/migrateCategories.php b/migration/19.12/migrateCategories.php index 21ef67d382e..ea4bd42df4a 100644 --- a/migration/19.12/migrateCategories.php +++ b/migration/19.12/migrateCategories.php @@ -13,6 +13,9 @@ foreach ($customs as $custom) { continue; } + \SrcCore\models\DatabasePDO::reset(); + new \SrcCore\models\DatabasePDO(['customId' => $custom]); + $path = "custom/{$custom}/apps/maarch_entreprise/xml/config.xml"; if (file_exists($path)) { if (!is_readable($path) || !is_writable($path)) { diff --git a/migration/19.12/migrateVersionAttachments.php b/migration/19.12/migrateVersionAttachments.php index 66cb65a71b9..26c9185f12b 100644 --- a/migration/19.12/migrateVersionAttachments.php +++ b/migration/19.12/migrateVersionAttachments.php @@ -71,7 +71,7 @@ foreach ($customs as $custom) { $fingerprint = \Resource\controllers\StoreController::getFingerPrint(['filePath' => $pathToDocument, 'mode' => $docserverType[0]['fingerprint_mode']]); $attachmentInfo['fingerprint'] = $fingerprint; } else { - $attachmentInfo['fingerprint'] = 1; + $attachmentInfo['fingerprint'] = '1'; } } @@ -80,7 +80,7 @@ foreach ($customs as $custom) { if ($attachmentInfo['fingerprint'] == 1) { echo "Le document avec res_version_attachments.res_id = " . $oldResId . " (nouveau res_id : res_attachment.res_id = " . $newResId . ") n'a pas été trouvé sur le docserver (path = '" . $pathToDocument . "')" - . ", le fingerprint du document est assigné à 1"; + . ", le fingerprint du document est assigné à 1\n"; } migrateOrigin(['oldResId' => $oldResId, 'newResId' => $newResId]); -- GitLab