Просмотр исходного кода

Merge pull request #8786 from overleaf/bg-check-age-for-migration

enforce cutoff date for track-changes history migration

GitOrigin-RevId: cd7b76281c66b7e6edc856d70660f2c5b8ae5275
Brian Gough 4 лет назад
Родитель
Сommit
e32d1dbdd6

+ 5 - 1
services/web/scripts/history/upgrade_none_with_conversion_if_sl_history.js

@@ -13,7 +13,9 @@ const FIX_INVALID_CHARACTERS = process.env.FIX_INVALID_CHARACTERS === 'true'
 const FORCE_NEW_HISTORY_ON_FAILURE =
   process.env.FORCE_NEW_HISTORY_ON_FAILURE === 'true'
 const IMPORT_ZIP_FILE_PATH = process.env.IMPORT_ZIP_FILE_PATH
-
+const CUTOFF_DATE = process.env.CUTOFF_DATE
+  ? new Date(process.env.CUTOFF_DATE)
+  : undefined
 // persist fallback in order to keep batchedUpdate in-sync
 process.env.BATCH_SIZE = BATCH_SIZE
 // raise mongo timeout to 1hr if otherwise unspecified
@@ -50,6 +52,7 @@ console.log({
   CONVERT_LARGE_DOCS_TO_FILE,
   USER_ID,
   IMPORT_ZIP_FILE_PATH,
+  CUTOFF_DATE,
 })
 
 const RESULT = {
@@ -143,6 +146,7 @@ async function doUpgradeForNoneWithConversion(project) {
         fixInvalidCharacters: FIX_INVALID_CHARACTERS,
         forceNewHistoryOnFailure: FORCE_NEW_HISTORY_ON_FAILURE,
         importZipFilePath: IMPORT_ZIP_FILE_PATH,
+        cutoffDate: CUTOFF_DATE,
       })
     } catch (err) {
       // if migrateProjectHistory fails, it cleans up by deleting