Ver código fonte

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

Revert "Revert "Convert migration scripts to ESM""

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

+ 3 - 2
services/web/.eastrc

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -1,11 +0,0 @@
-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
-}

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

@@ -0,0 +1,17 @@
+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,
+}

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

@@ -1,11 +0,0 @@
-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
-}

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

@@ -0,0 +1,17 @@
+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,
+}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -1,11 +0,0 @@
-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 */
-}

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

@@ -0,0 +1,17 @@
+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,
+}

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

@@ -1,11 +0,0 @@
-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 */
-}

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

@@ -0,0 +1,17 @@
+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,
+}

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

@@ -1,14 +0,0 @@
-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 => {}

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

@@ -0,0 +1,20 @@
+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,
+}

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

@@ -1,13 +0,0 @@
-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 => {}

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

@@ -0,0 +1,19 @@
+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,
+}

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

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

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

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

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

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

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

@@ -1,19 +0,0 @@
-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 () => {}

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

@@ -0,0 +1,28 @@
+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,
+}

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

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

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

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

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

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

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

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

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

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

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

@@ -1,11 +0,0 @@
-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 () => {}

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

@@ -0,0 +1,17 @@
+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,
+}

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

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

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

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

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

@@ -1,14 +0,0 @@
-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 () => {}

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

@@ -0,0 +1,20 @@
+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,
+}

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

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

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

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

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

@@ -0,0 +1,15 @@
+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,
+}

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -0,0 +1,15 @@
+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,
+}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -1,11 +0,0 @@
-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 () => {}

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

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

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

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

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

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

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

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

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff