소스 검색

Merge pull request #20731 from overleaf/revert-20480-ls-convert-migration-scripts-to-esm

Revert "Convert migration scripts to ESM"

GitOrigin-RevId: ca9ddda6ddee8964f72797d3b653ef9cee6a7a49
Liangjun Song 1 년 전
부모
커밋
b69ff9417a
100개의 변경된 파일448개의 추가작업 그리고 983개의 파일을 삭제
  1. 2 3
      services/web/.eastrc
  2. 4 10
      services/web/migrations/20190720165251_create_migrations.js
  3. 4 10
      services/web/migrations/20190730093801_script_example.js
  4. 4 10
      services/web/migrations/20190912145001_create_contacts_indexes.js
  5. 4 10
      services/web/migrations/20190912145002_create_deletedProjects_indexes.js
  6. 4 10
      services/web/migrations/20190912145003_create_deletedSubscriptions_indexes.js
  7. 4 10
      services/web/migrations/20190912145004_create_docHistoryIndex_indexes.js
  8. 4 10
      services/web/migrations/20190912145005_create_docHistory_indexes.js
  9. 4 10
      services/web/migrations/20190912145006_create_docOps_indexes.js
  10. 4 10
      services/web/migrations/20190912145007_create_docSnapshots_indexes.js
  11. 4 10
      services/web/migrations/20190912145008_create_docs_indexes.js
  12. 4 10
      services/web/migrations/20190912145009_create_githubSyncEntityVersions_indexes.js
  13. 4 10
      services/web/migrations/20190912145010_create_githubSyncProjectStates_indexes.js
  14. 4 10
      services/web/migrations/20190912145011_create_githubSyncUserCredentials_indexes.js
  15. 4 10
      services/web/migrations/20190912145012_create_institutions_indexes.js
  16. 4 10
      services/web/migrations/20190912145013_create_messages_indexes.js
  17. 4 10
      services/web/migrations/20190912145014_create_notifications_indexes.js
  18. 4 10
      services/web/migrations/20190912145015_create_oauthAccessTokens_indexes.js
  19. 4 10
      services/web/migrations/20190912145016_create_oauthApplications_indexes.js
  20. 4 10
      services/web/migrations/20190912145017_create_oauthAuthorizationCodes_indexes.js
  21. 4 10
      services/web/migrations/20190912145018_create_projectHistoryFailures_indexes.js
  22. 4 10
      services/web/migrations/20190912145019_create_projectHistoryLabels_indexes.js
  23. 4 10
      services/web/migrations/20190912145020_create_projectHistoryMetaData_indexes.js
  24. 4 10
      services/web/migrations/20190912145021_create_projectHistorySyncState_indexes.js
  25. 5 12
      services/web/migrations/20190912145022_create_projectImportFailures_indexes.js
  26. 4 10
      services/web/migrations/20190912145023_create_projectInvites_indexes.js
  27. 4 10
      services/web/migrations/20190912145024_create_projects_indexes.js
  28. 4 10
      services/web/migrations/20190912145025_create_publishers_indexes.js
  29. 4 10
      services/web/migrations/20190912145026_create_rooms_indexes.js
  30. 4 10
      services/web/migrations/20190912145027_create_spellingPreferences_indexes.js
  31. 4 10
      services/web/migrations/20190912145028_create_subscriptions_indexes.js
  32. 4 10
      services/web/migrations/20190912145029_create_tags_indexes.js
  33. 4 10
      services/web/migrations/20190912145030_create_templates_indexes.js
  34. 4 10
      services/web/migrations/20190912145031_create_tokens_indexes.js
  35. 4 10
      services/web/migrations/20190912145032_create_users_indexes.js
  36. 4 10
      services/web/migrations/20190912145033_create_userstubs_indexes.js
  37. 6 14
      services/web/migrations/20191106102104_saml-log-indexes.js
  38. 6 14
      services/web/migrations/20191107191318_saml-indentifiers-index.js
  39. 4 10
      services/web/migrations/20200110183327_brandVarationIdIndex.js
  40. 4 10
      services/web/migrations/20200120163346_atlas_recommended_indexes.js
  41. 3 9
      services/web/migrations/20200210084301_remove-duplicate-deleted-things.js
  42. 4 10
      services/web/migrations/20200210121103_uniqueify-deletedthings-indexes.js
  43. 4 10
      services/web/migrations/20200302143624_users_affiliationUnchecked_index.js
  44. 11 0
      services/web/migrations/20200522145727_dropProjectImportFailures.js
  45. 0 17
      services/web/migrations/20200522145727_dropProjectImportFailures.mjs
  46. 11 0
      services/web/migrations/20200522145741_dropProjectImportBatchRecords.js
  47. 0 17
      services/web/migrations/20200522145741_dropProjectImportBatchRecords.mjs
  48. 4 10
      services/web/migrations/20200608213302_saml-cache-indexes.js
  49. 4 10
      services/web/migrations/20200729120824_update_subscriptions_manager_ids_index.js
  50. 4 10
      services/web/migrations/20201106094956_active-projects-index-with-id.js
  51. 4 10
      services/web/migrations/20210310111225_create_deletedFiles_projectId_index.js
  52. 4 10
      services/web/migrations/20210407085118_token-expiry-with-ttl-index.js
  53. 4 10
      services/web/migrations/20210408123210_create_docs_project_id_deleted_deletedAt_index.js
  54. 4 10
      services/web/migrations/20210721081758_create_history_display_index.js
  55. 11 0
      services/web/migrations/20210726083523_convert_confirmedAt_strings_to_dates.js
  56. 0 17
      services/web/migrations/20210726083523_convert_confirmedAt_strings_to_dates.mjs
  57. 11 0
      services/web/migrations/20210726083523_convert_split_tests_assigned_at_strings_to_dates.js
  58. 0 17
      services/web/migrations/20210726083523_convert_split_tests_assigned_at_strings_to_dates.mjs
  59. 14 0
      services/web/migrations/20210727123346_ce_sp_backfill_deleted_files.js
  60. 0 20
      services/web/migrations/20210727123346_ce_sp_backfill_deleted_files.mjs
  61. 13 0
      services/web/migrations/20210727150530_ce_sp_backfill_deleted_docs.js
  62. 0 19
      services/web/migrations/20210727150530_ce_sp_backfill_deleted_docs.mjs
  63. 4 10
      services/web/migrations/20210728115327_ce_sp_backfill_dummy_doc_meta.js
  64. 5 12
      services/web/migrations/20210924140139_splittests-name-index.js
  65. 4 10
      services/web/migrations/20220105123000_cleanup_unused_collections.js
  66. 19 0
      services/web/migrations/20220105130000_fix_saml_indexes.js
  67. 0 28
      services/web/migrations/20220105130000_fix_saml_indexes.mjs
  68. 3 9
      services/web/migrations/20220222095146_split_tests_analytics_enabled.js
  69. 4 10
      services/web/migrations/20220811111800_create_dropboxEntities_index.js
  70. 4 10
      services/web/migrations/20220815105500_create_dropboxProjects_index.js
  71. 4 10
      services/web/migrations/20220817120900_create_dropboxProjects_index.js
  72. 4 10
      services/web/migrations/20220825160708_recreate_dropboxEntities.js
  73. 11 0
      services/web/migrations/20220826104236_disable_alpha_beta_program.js
  74. 0 17
      services/web/migrations/20220826104236_disable_alpha_beta_program.mjs
  75. 4 10
      services/web/migrations/20220830140459_create_index_user_labsProgram_labsProgramGalileo.js
  76. 4 10
      services/web/migrations/20220913105500_create_auditLog_indexes.js
  77. 14 0
      services/web/migrations/20220913125500_migrate_auditLog_to_collections.js
  78. 0 20
      services/web/migrations/20220913125500_migrate_auditLog_to_collections.mjs
  79. 4 10
      services/web/migrations/20220929193200_add_auditLog_indexes.js
  80. 9 0
      services/web/migrations/20221111111111_ce_sp_convert_archived_state.js
  81. 0 15
      services/web/migrations/20221111111111_ce_sp_convert_archived_state.mjs
  82. 4 10
      services/web/migrations/20221122191857_project_history_chunks_indexes.js
  83. 4 10
      services/web/migrations/20230110140452_rename_recurly_cached_status.js
  84. 4 11
      services/web/migrations/20230124092607_clear_old_2fa_setup.js
  85. 4 10
      services/web/migrations/20230207134844_group_invite_emails_to_lowercase.js
  86. 4 10
      services/web/migrations/20230217205311_fix_deleted_history_chunks_index.js
  87. 9 0
      services/web/migrations/20230315170739_back_fill_doc_rev.js
  88. 0 15
      services/web/migrations/20230315170739_back_fill_doc_rev.mjs
  89. 4 10
      services/web/migrations/20230405190240_oauth_refresh_tokens_index.js
  90. 4 10
      services/web/migrations/20230406125632_oauth_tokens_ttl.js
  91. 4 10
      services/web/migrations/20230426095212_personal_oauth_tokens_user_index.js
  92. 4 10
      services/web/migrations/20230428154643_history_chunks_garbage_collection_index.js
  93. 4 10
      services/web/migrations/20230502180757_server_pro_oauth_indexes.js
  94. 4 11
      services/web/migrations/20230512100122_ensure_history_migration.js
  95. 4 10
      services/web/migrations/20230616153016_user_features_updated_at_index.js
  96. 11 0
      services/web/migrations/20230817081910_back_fill_gitBridge_feature_server_pro.js
  97. 0 18
      services/web/migrations/20230817081910_back_fill_gitBridge_feature_server_pro.mjs
  98. 3 9
      services/web/migrations/20230928092537_backfill_subscriptions_managed_users_feature_flag.js
  99. 4 10
      services/web/migrations/20231016101457_drop_history_display_index.js
  100. 3 9
      services/web/migrations/20231025094810_sso_config_certificates_array.js

+ 2 - 3
services/web/.eastrc

@@ -1,5 +1,4 @@
 {
-  "adapter": "./migrations/lib/adapter.mjs",
-  "migrationNumberFormat": "dateTime",
-  "migrationExtension": "mjs"
+    "adapter": "./migrations/lib/adapter",
+    "migrationNumberFormat": "dateTime"
 }

+ 4 - 10
services/web/migrations/20190720165251_create_migrations.mjs → services/web/migrations/20190720165251_create_migrations.js

@@ -1,10 +1,10 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.migrations, [
     {
@@ -14,7 +14,7 @@ const migrate = async client => {
   ])
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -23,9 +23,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190730093801_script_example.mjs → services/web/migrations/20190730093801_script_example.js

@@ -8,21 +8,15 @@
  * or "hello <name>", when User.findOne() finds something.
  */
 
-import runScript from '../scripts/example/script_for_migration.js'
+const runScript = require('../scripts/example/script_for_migration.js')
 
-const tags = []
+exports.tags = []
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await runScript()
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145001_create_contacts_indexes.mjs → services/web/migrations/20190912145001_create_contacts_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -14,13 +14,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.contacts, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -29,9 +29,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145002_create_deletedProjects_indexes.mjs → services/web/migrations/20190912145002_create_deletedProjects_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -19,13 +19,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.deletedProjects, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -34,9 +34,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145003_create_deletedSubscriptions_indexes.mjs → services/web/migrations/20190912145003_create_deletedSubscriptions_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -20,13 +20,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.deletedSubscriptions, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -35,9 +35,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145004_create_docHistoryIndex_indexes.mjs → services/web/migrations/20190912145004_create_docHistoryIndex_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -13,13 +13,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.docHistoryIndex, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -28,9 +28,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145005_create_docHistory_indexes.mjs → services/web/migrations/20190912145005_create_docHistory_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -41,13 +41,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.docHistory, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -56,9 +56,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145006_create_docOps_indexes.mjs → services/web/migrations/20190912145006_create_docOps_indexes.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -12,18 +12,12 @@ const indexes = [
   },
 ]
 
-const migrate = async ({ nativeDb }) => {
+exports.migrate = async ({ nativeDb }) => {
   const docOps = nativeDb.collection('docOps')
   await Helpers.addIndexesToCollection(docOps, indexes)
 }
 
-const rollback = async ({ nativeDb }) => {
+exports.rollback = async ({ nativeDb }) => {
   const docOps = nativeDb.collection('docOps')
   await Helpers.dropIndexesFromCollection(docOps, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145007_create_docSnapshots_indexes.mjs → services/web/migrations/20190912145007_create_docSnapshots_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -20,13 +20,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.docSnapshots, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -35,9 +35,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145008_create_docs_indexes.mjs → services/web/migrations/20190912145008_create_docs_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -13,13 +13,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.docs, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -28,9 +28,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145009_create_githubSyncEntityVersions_indexes.mjs → services/web/migrations/20190912145009_create_githubSyncEntityVersions_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -21,13 +21,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.githubSyncEntityVersions, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -39,9 +39,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145010_create_githubSyncProjectStates_indexes.mjs → services/web/migrations/20190912145010_create_githubSyncProjectStates_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -19,13 +19,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.githubSyncProjectStates, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -34,9 +34,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145011_create_githubSyncUserCredentials_indexes.mjs → services/web/migrations/20190912145011_create_githubSyncUserCredentials_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -13,13 +13,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.githubSyncUserCredentials, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -31,9 +31,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145012_create_institutions_indexes.mjs → services/web/migrations/20190912145012_create_institutions_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -14,13 +14,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.institutions, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -29,9 +29,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145013_create_messages_indexes.mjs → services/web/migrations/20190912145013_create_messages_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -14,13 +14,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.messages, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -29,9 +29,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145014_create_notifications_indexes.mjs → services/web/migrations/20190912145014_create_notifications_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -26,13 +26,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.notifications, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -41,9 +41,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145015_create_oauthAccessTokens_indexes.mjs → services/web/migrations/20190912145015_create_oauthAccessTokens_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -21,13 +21,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.oauthAccessTokens, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -36,9 +36,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145016_create_oauthApplications_indexes.mjs → services/web/migrations/20190912145016_create_oauthApplications_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -14,13 +14,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.oauthApplications, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -29,9 +29,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145017_create_oauthAuthorizationCodes_indexes.mjs → services/web/migrations/20190912145017_create_oauthAuthorizationCodes_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -14,13 +14,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.oauthAuthorizationCodes, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -29,9 +29,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145018_create_projectHistoryFailures_indexes.mjs → services/web/migrations/20190912145018_create_projectHistoryFailures_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -13,13 +13,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.projectHistoryFailures, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -28,9 +28,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145019_create_projectHistoryLabels_indexes.mjs → services/web/migrations/20190912145019_create_projectHistoryLabels_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -19,13 +19,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.projectHistoryLabels, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -34,9 +34,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145020_create_projectHistoryMetaData_indexes.mjs → services/web/migrations/20190912145020_create_projectHistoryMetaData_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -13,13 +13,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.projectHistoryMetaData, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -28,9 +28,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145021_create_projectHistorySyncState_indexes.mjs → services/web/migrations/20190912145021_create_projectHistorySyncState_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -20,13 +20,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.projectHistorySyncState, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -35,9 +35,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 5 - 12
services/web/migrations/20190912145022_create_projectImportFailures_indexes.mjs → services/web/migrations/20190912145022_create_projectImportFailures_indexes.js

@@ -1,10 +1,9 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
-import mongodb from '../app/src/infrastructure/mongodb.js'
-const { getCollectionInternal } = mongodb
+const Helpers = require('./lib/helpers')
+const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -20,12 +19,12 @@ async function getCollection() {
   return await getCollectionInternal('projectImportFailures')
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const collection = await getCollection()
   await Helpers.addIndexesToCollection(collection, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const collection = await getCollection()
   try {
     await Helpers.dropIndexesFromCollection(collection, indexes)
@@ -33,9 +32,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145023_create_projectInvites_indexes.mjs → services/web/migrations/20190912145023_create_projectInvites_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -20,13 +20,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.projectInvites, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -35,9 +35,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145024_create_projects_indexes.mjs → services/web/migrations/20190912145024_create_projects_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -123,13 +123,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.projects, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -138,9 +138,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145025_create_publishers_indexes.mjs → services/web/migrations/20190912145025_create_publishers_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -14,13 +14,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.publishers, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -29,9 +29,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145026_create_rooms_indexes.mjs → services/web/migrations/20190912145026_create_rooms_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -13,13 +13,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.rooms, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -28,9 +28,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145027_create_spellingPreferences_indexes.mjs → services/web/migrations/20190912145027_create_spellingPreferences_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -13,13 +13,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.spellingPreferences, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -28,9 +28,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145028_create_subscriptions_indexes.mjs → services/web/migrations/20190912145028_create_subscriptions_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -68,13 +68,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.subscriptions, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -83,9 +83,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145029_create_tags_indexes.mjs → services/web/migrations/20190912145029_create_tags_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -21,13 +21,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.tags, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -36,9 +36,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145030_create_templates_indexes.mjs → services/web/migrations/20190912145030_create_templates_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-pro', 'saas']
+exports.tags = ['server-pro', 'saas']
 
 const indexes = [
   {
@@ -26,13 +26,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.templates, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -41,9 +41,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145031_create_tokens_indexes.mjs → services/web/migrations/20190912145031_create_tokens_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -15,13 +15,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.tokens, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -30,9 +30,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145032_create_users_indexes.mjs → services/web/migrations/20190912145032_create_users_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -147,13 +147,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.users, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -162,9 +162,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20190912145033_create_userstubs_indexes.mjs → services/web/migrations/20190912145033_create_userstubs_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -13,13 +13,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.userstubs, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -28,9 +28,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 6 - 14
services/web/migrations/20191106102104_saml-log-indexes.mjs → services/web/migrations/20191106102104_saml-log-indexes.js

@@ -1,10 +1,9 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
-import mongodb from '../app/src/infrastructure/mongodb.js'
-const { getCollectionInternal } = mongodb
+const Helpers = require('./lib/helpers')
+const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -30,7 +29,7 @@ const indexes = [
 ]
 
 // Export indexes for use in the fix-up migration 20220105130000_fix_saml_indexes.js.
-const samlLogsIndexes = indexes
+exports.samlLogsIndexes = indexes
 
 async function getCollection() {
   // This collection was incorrectly named - it should have been `samlLogs`
@@ -39,12 +38,12 @@ async function getCollection() {
   return await getCollectionInternal('samllog')
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const collection = await getCollection()
   await Helpers.addIndexesToCollection(collection, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const collection = await getCollection()
   try {
     await Helpers.dropIndexesFromCollection(collection, indexes)
@@ -52,10 +51,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-  samlLogsIndexes,
-}

+ 6 - 14
services/web/migrations/20191107191318_saml-indentifiers-index.mjs → services/web/migrations/20191107191318_saml-indentifiers-index.js

@@ -1,10 +1,9 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
-import mongodb from '../app/src/infrastructure/mongodb.js'
-const { getCollectionInternal } = mongodb
+const Helpers = require('./lib/helpers')
+const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -18,7 +17,7 @@ const indexes = [
 ]
 
 // Export indexes for use in the fix-up migration 20220105130000_fix_saml_indexes.js.
-const usersIndexes = indexes
+exports.usersIndexes = indexes
 
 async function getCollection() {
   // This collection was incorrectly named - it should have been `users` instead
@@ -27,12 +26,12 @@ async function getCollection() {
   return await getCollectionInternal('user')
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const collection = await getCollection()
   await Helpers.addIndexesToCollection(collection, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const collection = await getCollection()
   try {
     await Helpers.dropIndexesFromCollection(collection, indexes)
@@ -40,10 +39,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-  usersIndexes,
-}

+ 4 - 10
services/web/migrations/20200110183327_brandVarationIdIndex.mjs → services/web/migrations/20200110183327_brandVarationIdIndex.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -11,20 +11,14 @@ const indexes = [
   },
 ]
 
-const migrate = async ({ db }) => {
+exports.migrate = async ({ db }) => {
   await Helpers.addIndexesToCollection(db.projects, indexes)
 }
 
-const rollback = async ({ db }) => {
+exports.rollback = async ({ db }) => {
   try {
     await Helpers.dropIndexesFromCollection(db.projects, indexes)
   } catch (err) {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20200120163346_atlas_recommended_indexes.mjs → services/web/migrations/20200120163346_atlas_recommended_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = {
   docSnapshots: [{ key: { project_id: 1, ts: 1 }, name: 'project_id_1_ts_1' }],
@@ -15,7 +15,7 @@ const indexes = {
   docs: [{ key: { project_id: 1, inS3: 1 }, name: 'project_id_1_inS3_1' }],
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Promise.all(
@@ -25,7 +25,7 @@ const migrate = async client => {
   )
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   await Promise.all(
@@ -34,9 +34,3 @@ const rollback = async client => {
     )
   )
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 3 - 9
services/web/migrations/20200210084301_remove-duplicate-deleted-things.mjs → services/web/migrations/20200210084301_remove-duplicate-deleted-things.js

@@ -1,6 +1,6 @@
 /* eslint-disable no-unused-vars */
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 async function removeDuplicates(collection, field) {
   const duplicates = await collection.aggregate(
@@ -31,18 +31,12 @@ async function removeDuplicates(collection, field) {
   }
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await removeDuplicates(db.deletedProjects, 'deletedProjectId')
   await removeDuplicates(db.deletedUsers, 'deletedUserId')
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   // can't really do anything here
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20200210121103_uniqueify-deletedthings-indexes.mjs → services/web/migrations/20200210121103_uniqueify-deletedthings-indexes.js

@@ -1,10 +1,10 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   // deletedUsers did not have an index before
   await Helpers.dropIndexesFromCollection(db.deletedProjects, [
@@ -37,7 +37,7 @@ const migrate = async client => {
   ])
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.deletedProjects, [
     {
@@ -68,9 +68,3 @@ const rollback = async client => {
   ])
   // deletedUsers did not have an index before
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20200302143624_users_affiliationUnchecked_index.mjs → services/web/migrations/20200302143624_users_affiliationUnchecked_index.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+exports.tags = ['saas']
 
-const tags = ['saas']
+const Helpers = require('./lib/helpers')
 
 const indexes = [
   {
@@ -14,18 +14,12 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.users, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.users, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 11 - 0
services/web/migrations/20200522145727_dropProjectImportFailures.js

@@ -0,0 +1,11 @@
+const Helpers = require('./lib/helpers')
+
+exports.tags = ['saas']
+
+exports.migrate = async client => {
+  await Helpers.dropCollection('projectImportFailures')
+}
+
+exports.rollback = async client => {
+  // can't really do anything here
+}

+ 0 - 17
services/web/migrations/20200522145727_dropProjectImportFailures.mjs

@@ -1,17 +0,0 @@
-import Helpers from './lib/helpers.mjs'
-
-const tags = ['saas']
-
-const migrate = async client => {
-  await Helpers.dropCollection('projectImportFailures')
-}
-
-const rollback = async client => {
-  // can't really do anything here
-}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 11 - 0
services/web/migrations/20200522145741_dropProjectImportBatchRecords.js

@@ -0,0 +1,11 @@
+const Helpers = require('./lib/helpers')
+
+exports.tags = ['saas']
+
+exports.migrate = async client => {
+  await Helpers.dropCollection('projectImportBatchRecords')
+}
+
+exports.rollback = async client => {
+  // can't really do anything here
+}

+ 0 - 17
services/web/migrations/20200522145741_dropProjectImportBatchRecords.mjs

@@ -1,17 +0,0 @@
-import Helpers from './lib/helpers.mjs'
-
-const tags = ['saas']
-
-const migrate = async client => {
-  await Helpers.dropCollection('projectImportBatchRecords')
-}
-
-const rollback = async client => {
-  // can't really do anything here
-}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20200608213302_saml-cache-indexes.mjs → services/web/migrations/20200608213302_saml-cache-indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -21,13 +21,13 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.addIndexesToCollection(db.samlCache, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -36,9 +36,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20200729120824_update_subscriptions_manager_ids_index.mjs → services/web/migrations/20200729120824_update_subscriptions_manager_ids_index.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const oldIndex = {
   unique: true,
@@ -25,14 +25,14 @@ const newIndex = {
   sparse: true,
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Helpers.dropIndexesFromCollection(db.subscriptions, [oldIndex])
   await Helpers.addIndexesToCollection(db.subscriptions, [newIndex])
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   try {
@@ -42,9 +42,3 @@ const rollback = async client => {
     console.error('Something went wrong rolling back the migrations', err)
   }
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20201106094956_active-projects-index-with-id.mjs → services/web/migrations/20201106094956_active-projects-index-with-id.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const index = {
   key: { _id: 1, lastOpened: 1, active: 1 },
@@ -10,18 +10,12 @@ const index = {
   },
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.projects, [index])
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.projects, [index])
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20210310111225_create_deletedFiles_projectId_index.mjs → services/web/migrations/20210310111225_create_deletedFiles_projectId_index.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -11,18 +11,12 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.deletedFiles, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.deletedFiles, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20210407085118_token-expiry-with-ttl-index.mjs → services/web/migrations/20210407085118_token-expiry-with-ttl-index.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = {
   tokens: [
@@ -15,7 +15,7 @@ const indexes = {
   ],
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
 
   await Promise.all(
@@ -25,7 +25,7 @@ const migrate = async client => {
   )
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
 
   await Promise.all(
@@ -34,9 +34,3 @@ const rollback = async client => {
     )
   )
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20210408123210_create_docs_project_id_deleted_deletedAt_index.mjs → services/web/migrations/20210408123210_create_docs_project_id_deleted_deletedAt_index.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -13,18 +13,12 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.docs, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.docs, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20210721081758_create_history_display_index.mjs → services/web/migrations/20210721081758_create_history_display_index.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -11,18 +11,12 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.projects, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.projects, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 11 - 0
services/web/migrations/20210726083523_convert_confirmedAt_strings_to_dates.js

@@ -0,0 +1,11 @@
+const updateStringDates = require('../scripts/confirmed_at_to_dates.js')
+
+exports.tags = ['saas']
+
+exports.migrate = async client => {
+  await updateStringDates()
+}
+
+exports.rollback = async client => {
+  /* nothing to do */
+}

+ 0 - 17
services/web/migrations/20210726083523_convert_confirmedAt_strings_to_dates.mjs

@@ -1,17 +0,0 @@
-import updateStringDates from '../scripts/confirmed_at_to_dates.js'
-
-const tags = ['saas']
-
-const migrate = async client => {
-  await updateStringDates()
-}
-
-const rollback = async client => {
-  /* nothing to do */
-}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 11 - 0
services/web/migrations/20210726083523_convert_split_tests_assigned_at_strings_to_dates.js

@@ -0,0 +1,11 @@
+const updateStringDates = require('../scripts/split_tests_assigned_at_to_dates')
+
+exports.tags = ['saas']
+
+exports.migrate = async client => {
+  await updateStringDates()
+}
+
+exports.rollback = async client => {
+  /* nothing to do */
+}

+ 0 - 17
services/web/migrations/20210726083523_convert_split_tests_assigned_at_strings_to_dates.mjs

@@ -1,17 +0,0 @@
-import updateStringDates from '../scripts/confirmed_at_to_dates.js'
-
-const tags = ['saas']
-
-const migrate = async client => {
-  await updateStringDates()
-}
-
-const rollback = async client => {
-  /* nothing to do */
-}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 14 - 0
services/web/migrations/20210727123346_ce_sp_backfill_deleted_files.js

@@ -0,0 +1,14 @@
+const runScript = require('../scripts/back_fill_deleted_files.js')
+
+exports.tags = ['server-ce', 'server-pro', 'saas']
+
+exports.migrate = async client => {
+  const options = {
+    performCleanup: true,
+    letUserDoubleCheckInputsFor: 10,
+    fixPartialInserts: true,
+  }
+  await runScript(options)
+}
+
+exports.rollback = async client => {}

+ 0 - 20
services/web/migrations/20210727123346_ce_sp_backfill_deleted_files.mjs

@@ -1,20 +0,0 @@
-import runScript from '../scripts/back_fill_deleted_files.js'
-
-const tags = ['server-ce', 'server-pro', 'saas']
-
-const migrate = async client => {
-  const options = {
-    performCleanup: true,
-    letUserDoubleCheckInputsFor: 10,
-    fixPartialInserts: true,
-  }
-  await runScript(options)
-}
-
-const rollback = async client => {}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 13 - 0
services/web/migrations/20210727150530_ce_sp_backfill_deleted_docs.js

@@ -0,0 +1,13 @@
+const runScript = require('../scripts/back_fill_doc_name_for_deleted_docs.js')
+
+exports.tags = ['server-ce', 'server-pro', 'saas']
+
+exports.migrate = async client => {
+  const options = {
+    performCleanup: true,
+    letUserDoubleCheckInputsFor: 10,
+  }
+  await runScript(options)
+}
+
+exports.rollback = async client => {}

+ 0 - 19
services/web/migrations/20210727150530_ce_sp_backfill_deleted_docs.mjs

@@ -1,19 +0,0 @@
-import runScript from '../scripts/back_fill_doc_name_for_deleted_docs.js'
-
-const tags = ['server-ce', 'server-pro', 'saas']
-
-const migrate = async client => {
-  const options = {
-    performCleanup: true,
-    letUserDoubleCheckInputsFor: 10,
-  }
-  await runScript(options)
-}
-
-const rollback = async client => {}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20210728115327_ce_sp_backfill_dummy_doc_meta.mjs → services/web/migrations/20210728115327_ce_sp_backfill_dummy_doc_meta.js

@@ -1,8 +1,8 @@
-import runScript from '../scripts/back_fill_dummy_doc_meta.js'
+const runScript = require('../scripts/back_fill_dummy_doc_meta.js')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   const [firstProject] = await db.projects
     .find()
@@ -20,10 +20,4 @@ const migrate = async client => {
   await runScript(options)
 }
 
-const rollback = async client => {}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}
+exports.rollback = async client => {}

+ 5 - 12
services/web/migrations/20210924140139_splittests-name-index.mjs → services/web/migrations/20210924140139_splittests-name-index.js

@@ -1,8 +1,7 @@
-import Helpers from './lib/helpers.mjs'
-import mongodb from '../app/src/infrastructure/mongodb.js'
-const { getCollectionInternal } = mongodb
+const Helpers = require('./lib/helpers')
+const { getCollectionInternal } = require('../app/src/infrastructure/mongodb')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -19,18 +18,12 @@ async function getCollection() {
   return await getCollectionInternal('splittests')
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const collection = await getCollection()
   await Helpers.addIndexesToCollection(collection, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const collection = await getCollection()
   await Helpers.dropIndexesFromCollection(collection, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20220105123000_cleanup_unused_collections.mjs → services/web/migrations/20220105123000_cleanup_unused_collections.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const unusedCollections = [
   'collaberatorcount',
@@ -18,18 +18,12 @@ const unusedCollections = [
   'usersEmailDomains',
 ]
 
-const migrate = async () => {
+exports.migrate = async () => {
   for (const name of unusedCollections) {
     await Helpers.dropCollection(name)
   }
 }
 
-const rollback = async () => {
+exports.rollback = async () => {
   // We lost the indexes. There is no way back.
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 19 - 0
services/web/migrations/20220105130000_fix_saml_indexes.js

@@ -0,0 +1,19 @@
+const Helpers = require('./lib/helpers')
+const { samlLogsIndexes } = require('./20191106102104_saml-log-indexes')
+const { usersIndexes } = require('./20191107191318_saml-indentifiers-index')
+
+exports.tags = ['saas']
+
+exports.migrate = async ({ db }) => {
+  // Fix-up the previous SAML migrations that were operating on collections with
+  //  typos in their names.
+  await Helpers.addIndexesToCollection(
+    db.users,
+    usersIndexes.map(index => {
+      return Object.assign({}, index, { unique: true })
+    })
+  )
+  await Helpers.addIndexesToCollection(db.samlLogs, samlLogsIndexes)
+}
+
+exports.rollback = async () => {}

+ 0 - 28
services/web/migrations/20220105130000_fix_saml_indexes.mjs

@@ -1,28 +0,0 @@
-import Helpers from './lib/helpers.mjs'
-import SamlLogsIndexesMigration from './20191106102104_saml-log-indexes.mjs'
-import SamlIndentifiersIndexMigration from './20191107191318_saml-indentifiers-index.mjs'
-
-const { samlLogsIndexes } = SamlLogsIndexesMigration
-const { usersIndexes } = SamlIndentifiersIndexMigration
-
-const tags = ['saas']
-
-const migrate = async ({ db }) => {
-  // Fix-up the previous SAML migrations that were operating on collections with
-  //  typos in their names.
-  await Helpers.addIndexesToCollection(
-    db.users,
-    usersIndexes.map(index => {
-      return Object.assign({}, index, { unique: true })
-    })
-  )
-  await Helpers.addIndexesToCollection(db.samlLogs, samlLogsIndexes)
-}
-
-const rollback = async () => {}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 3 - 9
services/web/migrations/20220222095146_split_tests_analytics_enabled.mjs → services/web/migrations/20220222095146_split_tests_analytics_enabled.js

@@ -1,6 +1,6 @@
-const tags = ['saas']
+exports.tags = ['saas']
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await db.splittests.updateMany(
     {},
@@ -28,7 +28,7 @@ const migrate = async client => {
   )
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await db.splittests.updateMany(
     {},
@@ -49,9 +49,3 @@ const rollback = async client => {
     }
   )
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20220811111800_create_dropboxEntities_index.mjs → services/web/migrations/20220811111800_create_dropboxEntities_index.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -11,18 +11,12 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.dropboxEntities, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.dropboxEntities, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20220815105500_create_dropboxProjects_index.mjs → services/web/migrations/20220815105500_create_dropboxProjects_index.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -13,18 +13,12 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.dropboxProjects, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.dropboxProjects, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20220817120900_create_dropboxProjects_index.mjs → services/web/migrations/20220817120900_create_dropboxProjects_index.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -13,18 +13,12 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.dropboxProjects, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.dropboxProjects, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20220825160708_recreate_dropboxEntities.mjs → services/web/migrations/20220825160708_recreate_dropboxEntities.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -18,7 +18,7 @@ const indexes = [
   { key: { 'overleaf.userId': 1, 'dropbox.pathLower': 'hashed' } },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   // Forcibly drop the dropboxEntities collection. The new structure is
   // different and we don't want to keep the data with the old structure around.
@@ -26,13 +26,7 @@ const migrate = async client => {
   await Helpers.addIndexesToCollection(db.dropboxEntities, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.dropboxEntities, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 11 - 0
services/web/migrations/20220826104236_disable_alpha_beta_program.js

@@ -0,0 +1,11 @@
+exports.tags = ['server-ce', 'server-pro']
+
+exports.migrate = async client => {
+  const { db } = client
+  await db.users.updateMany(
+    {},
+    { $set: { alphaProgram: false, betaProgram: false } }
+  )
+}
+
+exports.rollback = async () => {}

+ 0 - 17
services/web/migrations/20220826104236_disable_alpha_beta_program.mjs

@@ -1,17 +0,0 @@
-const tags = ['server-ce', 'server-pro']
-
-const migrate = async client => {
-  const { db } = client
-  await db.users.updateMany(
-    {},
-    { $set: { alphaProgram: false, betaProgram: false } }
-  )
-}
-
-const rollback = async () => {}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20220830140459_create_index_user_labsProgram_labsProgramGalileo.mjs → services/web/migrations/20220830140459_create_index_user_labsProgram_labsProgramGalileo.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -15,18 +15,12 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.users, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.users, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20220913105500_create_auditLog_indexes.mjs → services/web/migrations/20220913105500_create_auditLog_indexes.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -13,22 +13,16 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.projectAuditLogEntries, indexes)
   await Helpers.addIndexesToCollection(db.userAuditLogEntries, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Promise.all([
     Helpers.dropIndexesFromCollection(db.userAuditLogEntries, indexes),
     Helpers.dropIndexesFromCollection(db.projectAuditLogEntries, indexes),
   ])
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 14 - 0
services/web/migrations/20220913125500_migrate_auditLog_to_collections.js

@@ -0,0 +1,14 @@
+const runScript = require('../scripts/migrate_audit_logs.js')
+
+exports.tags = ['server-ce', 'server-pro', 'saas']
+
+exports.migrate = async () => {
+  const options = {
+    letUserDoubleCheckInputsFor: 10,
+    writeConcurrency: 5,
+    dryRun: false,
+  }
+  await runScript(options)
+}
+
+exports.rollback = async () => {}

+ 0 - 20
services/web/migrations/20220913125500_migrate_auditLog_to_collections.mjs

@@ -1,20 +0,0 @@
-import runScript from '../scripts/migrate_audit_logs.js'
-
-const tags = ['server-ce', 'server-pro', 'saas']
-
-const migrate = async () => {
-  const options = {
-    letUserDoubleCheckInputsFor: 10,
-    writeConcurrency: 5,
-    dryRun: false,
-  }
-  await runScript(options)
-}
-
-const rollback = async () => {}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20220929193200_add_auditLog_indexes.mjs → services/web/migrations/20220929193200_add_auditLog_indexes.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const projectIndexes = [
   {
@@ -20,7 +20,7 @@ const userIndexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(
     db.projectAuditLogEntries,
@@ -29,7 +29,7 @@ const migrate = async client => {
   await Helpers.addIndexesToCollection(db.userAuditLogEntries, userIndexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Promise.all([
     Helpers.dropIndexesFromCollection(
@@ -39,9 +39,3 @@ const rollback = async client => {
     Helpers.dropIndexesFromCollection(db.userAuditLogEntries, userIndexes),
   ])
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 9 - 0
services/web/migrations/20221111111111_ce_sp_convert_archived_state.js

@@ -0,0 +1,9 @@
+const runScript = require('../scripts/convert_archived_state')
+
+exports.tags = ['server-ce', 'server-pro']
+
+exports.migrate = async () => {
+  await runScript('FIRST,SECOND')
+}
+
+exports.rollback = async () => {}

+ 0 - 15
services/web/migrations/20221111111111_ce_sp_convert_archived_state.mjs

@@ -1,15 +0,0 @@
-import runScript from '../scripts/convert_archived_state.js'
-
-const tags = ['server-ce', 'server-pro']
-
-const migrate = async () => {
-  await runScript('FIRST,SECOND')
-}
-
-const rollback = async () => {}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20221122191857_project_history_chunks_indexes.mjs → services/web/migrations/20221122191857_project_history_chunks_indexes.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -18,16 +18,10 @@ const indexes = [
   },
 ]
 
-const migrate = async ({ db }) => {
+exports.migrate = async ({ db }) => {
   await Helpers.addIndexesToCollection(db.projectHistoryChunks, indexes)
 }
 
-const rollback = async ({ db }) => {
+exports.rollback = async ({ db }) => {
   await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20230110140452_rename_recurly_cached_status.mjs → services/web/migrations/20230110140452_rename_recurly_cached_status.js

@@ -1,10 +1,10 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   // 'recurly' -> 'recurlyStatus'
   await db.subscriptions.updateMany(
@@ -28,7 +28,7 @@ const migrate = async client => {
   )
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   // 'recurlyStatus' -> 'recurly'
   await db.subscriptions.updateMany(
@@ -51,9 +51,3 @@ const rollback = async client => {
     { $unset: { recurlyStatus: 1 } }
   )
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 11
services/web/migrations/20230124092607_clear_old_2fa_setup.mjs → services/web/migrations/20230124092607_clear_old_2fa_setup.js

@@ -1,14 +1,13 @@
-import BatchedUpdateScript from '../scripts/helpers/batchedUpdate.js'
-const { batchedUpdate } = BatchedUpdateScript
+const { batchedUpdate } = require('../scripts/helpers/batchedUpdate')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const batchedUpdateOptions = {
   VERBOSE_LOGGING: 'true',
   BATCH_SIZE: '1',
 }
 
-const migrate = async () => {
+exports.migrate = async () => {
   await batchedUpdate(
     'users',
     { 'twoFactorAuthentication.secret': { $exists: true } },
@@ -19,7 +18,7 @@ const migrate = async () => {
   )
 }
 
-const rollback = async () => {
+exports.rollback = async () => {
   await batchedUpdate(
     'users',
     { 'twoFactorAuthentication.secretEncrypted': { $exists: true } },
@@ -29,9 +28,3 @@ const rollback = async () => {
     batchedUpdateOptions
   )
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20230207134844_group_invite_emails_to_lowercase.mjs → services/web/migrations/20230207134844_group_invite_emails_to_lowercase.js

@@ -1,10 +1,10 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   db.subscriptions.updateMany(
     {
@@ -36,12 +36,6 @@ const migrate = async client => {
   )
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   // There is no way back.
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20230217205311_fix_deleted_history_chunks_index.mjs → services/web/migrations/20230217205311_fix_deleted_history_chunks_index.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -15,16 +15,10 @@ const indexes = [
   },
 ]
 
-const migrate = async ({ db }) => {
+exports.migrate = async ({ db }) => {
   await Helpers.addIndexesToCollection(db.projectHistoryChunks, indexes)
 }
 
-const rollback = async ({ db }) => {
+exports.rollback = async ({ db }) => {
   await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 9 - 0
services/web/migrations/20230315170739_back_fill_doc_rev.js

@@ -0,0 +1,9 @@
+const runScript = require('../scripts/back_fill_doc_rev')
+
+exports.tags = ['server-ce', 'server-pro']
+
+exports.migrate = async () => {
+  await runScript(false)
+}
+
+exports.rollback = async () => {}

+ 0 - 15
services/web/migrations/20230315170739_back_fill_doc_rev.mjs

@@ -1,15 +0,0 @@
-import runScript from '../scripts/back_fill_doc_rev.js'
-
-const tags = ['server-ce', 'server-pro']
-
-const migrate = async () => {
-  await runScript(false)
-}
-
-const rollback = async () => {}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20230405190240_oauth_refresh_tokens_index.mjs → services/web/migrations/20230405190240_oauth_refresh_tokens_index.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const OLD_INDEX = {
   key: { refreshToken: 1 },
@@ -18,7 +18,7 @@ const TMP_INDEX = {
   name: 'refreshToken_tmp',
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   // Create a temporary index so that the refresh tokens are not left unindexed
   // while we drop the index and recreate it.
@@ -32,7 +32,7 @@ const migrate = async client => {
   await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [TMP_INDEX])
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   // Create a temporary index so that the refresh tokens are not left unindexed
   // while we drop the index and recreate it.
@@ -45,9 +45,3 @@ const rollback = async client => {
   // Drop the temporary index
   await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [TMP_INDEX])
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20230406125632_oauth_tokens_ttl.mjs → services/web/migrations/20230406125632_oauth_tokens_ttl.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const ACCESS_TOKENS_INDEX = {
   name: 'expiresAt_1',
@@ -16,7 +16,7 @@ const AUTHORIZATION_CODES_INDEX = {
   expireAfterSeconds: 0,
 }
 
-const migrate = async ({ db }) => {
+exports.migrate = async ({ db }) => {
   await Helpers.addIndexesToCollection(db.oauthAccessTokens, [
     ACCESS_TOKENS_INDEX,
   ])
@@ -25,7 +25,7 @@ const migrate = async ({ db }) => {
   ])
 }
 
-const rollback = async ({ db }) => {
+exports.rollback = async ({ db }) => {
   await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, [
     ACCESS_TOKENS_INDEX,
   ])
@@ -33,9 +33,3 @@ const rollback = async ({ db }) => {
     AUTHORIZATION_CODES_INDEX,
   ])
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20230426095212_personal_oauth_tokens_user_index.mjs → services/web/migrations/20230426095212_personal_oauth_tokens_user_index.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const indexes = [
   {
@@ -10,18 +10,12 @@ const indexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.oauthAccessTokens, indexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.oauthAccessTokens, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20230428154643_history_chunks_garbage_collection_index.mjs → services/web/migrations/20230428154643_history_chunks_garbage_collection_index.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-ce', 'server-pro', 'saas']
+exports.tags = ['server-ce', 'server-pro', 'saas']
 
 const oldIndexes = [
   {
@@ -45,20 +45,14 @@ const newIndexes = [
   },
 ]
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.projectHistoryChunks, newIndexes)
   await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, oldIndexes)
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.projectHistoryChunks, oldIndexes)
   await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, newIndexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20230502180757_server_pro_oauth_indexes.mjs → services/web/migrations/20230502180757_server_pro_oauth_indexes.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['server-pro']
+exports.tags = ['server-pro']
 
 const OAUTH_APPLICATIONS_INDEX = {
   key: { id: 1 },
@@ -20,7 +20,7 @@ const OAUTH_AUTHORIZATION_CODES_INDEX = {
   name: 'authorizationCode_1',
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.oauthApplications, [
     OAUTH_APPLICATIONS_INDEX,
@@ -33,7 +33,7 @@ const migrate = async client => {
   ])
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.oauthApplications, [
     OAUTH_APPLICATIONS_INDEX,
@@ -45,9 +45,3 @@ const rollback = async client => {
     OAUTH_AUTHORIZATION_CODES_INDEX,
   ])
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 11
services/web/migrations/20230512100122_ensure_history_migration.mjs → services/web/migrations/20230512100122_ensure_history_migration.js

@@ -1,10 +1,9 @@
-import util from 'util'
-const { promisify } = util
+const { promisify } = require('util')
 const sleep = promisify(setTimeout)
 
-const tags = ['server-ce', 'server-pro']
+exports.tags = ['server-ce', 'server-pro']
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   const count = await db.projects.countDocuments({
     'overleaf.history.display': { $ne: true },
@@ -49,12 +48,6 @@ const migrate = async client => {
   }
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   // Not applicable
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20230616153016_user_features_updated_at_index.mjs → services/web/migrations/20230616153016_user_features_updated_at_index.js

@@ -1,8 +1,8 @@
 /* eslint-disable no-unused-vars */
 
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const index = {
   key: {
@@ -11,18 +11,12 @@ const index = {
   name: 'featuresUpdatedAt_1',
 }
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await Helpers.addIndexesToCollection(db.users, [index])
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await Helpers.dropIndexesFromCollection(db.users, [index])
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 11 - 0
services/web/migrations/20230817081910_back_fill_gitBridge_feature_server_pro.js

@@ -0,0 +1,11 @@
+exports.tags = ['server-ce', 'server-pro']
+
+exports.migrate = async () => {
+  // Run-time import as SaaS does not ship with the server-ce-scripts module
+  const runScript = require('../modules/server-ce-scripts/scripts/upgrade-user-features')
+  await runScript(false, {
+    gitBridge: 1,
+  })
+}
+
+exports.rollback = async () => {}

+ 0 - 18
services/web/migrations/20230817081910_back_fill_gitBridge_feature_server_pro.mjs

@@ -1,18 +0,0 @@
-import runScript from '../modules/server-ce-scripts/scripts/upgrade-user-features.js'
-
-const tags = ['server-ce', 'server-pro']
-
-const migrate = async () => {
-  // Run-time import as SaaS does not ship with the server-ce-scripts module
-  await runScript(false, {
-    gitBridge: 1,
-  })
-}
-
-const rollback = async () => {}
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 3 - 9
services/web/migrations/20230928092537_backfill_subscriptions_managed_users_feature_flag.mjs → services/web/migrations/20230928092537_backfill_subscriptions_managed_users_feature_flag.js

@@ -1,6 +1,6 @@
-const tags = ['saas']
+exports.tags = ['saas']
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await db.subscriptions.updateMany(
     { 'features.managedUsers': { $ne: true } },
@@ -8,16 +8,10 @@ const migrate = async client => {
   )
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await db.subscriptions.updateMany(
     { 'features.managedUsers': { $eq: null } },
     { $set: { 'features.managedUsers': false } }
   )
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 4 - 10
services/web/migrations/20231016101457_drop_history_display_index.mjs → services/web/migrations/20231016101457_drop_history_display_index.js

@@ -1,6 +1,6 @@
-import Helpers from './lib/helpers.mjs'
+const Helpers = require('./lib/helpers')
 
-const tags = ['saas']
+exports.tags = ['saas']
 
 const indexes = [
   {
@@ -9,16 +9,10 @@ const indexes = [
   },
 ]
 
-const migrate = async ({ db }) => {
+exports.migrate = async ({ db }) => {
   await Helpers.dropIndexesFromCollection(db.projects, indexes)
 }
 
-const rollback = async ({ db }) => {
+exports.rollback = async ({ db }) => {
   await Helpers.addIndexesToCollection(db.projects, indexes)
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

+ 3 - 9
services/web/migrations/20231025094810_sso_config_certificates_array.mjs → services/web/migrations/20231025094810_sso_config_certificates_array.js

@@ -1,6 +1,6 @@
-const tags = ['saas']
+exports.tags = ['saas']
 
-const migrate = async client => {
+exports.migrate = async client => {
   const { db } = client
   await db.ssoConfigs.updateMany(
     { certificate: { $exists: true }, certificates: { $exists: false } },
@@ -21,7 +21,7 @@ const migrate = async client => {
   )
 }
 
-const rollback = async client => {
+exports.rollback = async client => {
   const { db } = client
   await db.ssoConfigs.updateMany(
     { certificate: { $exists: false }, certificates: { $exists: true } },
@@ -33,9 +33,3 @@ const rollback = async client => {
     ]
   )
 }
-
-export default {
-  tags,
-  migrate,
-  rollback,
-}

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.