20250922141050_project_history_sizes_indexes.mjs 682 B

12345678910111213141516171819202122232425262728293031323334
  1. /* eslint-disable no-unused-vars */
  2. import Helpers from './lib/helpers.mjs'
  3. const tags = ['saas']
  4. const indexes = [
  5. {
  6. key: { lastUpdatedAt: 1 },
  7. expireAfterSeconds: 60 * 60 * 24 * 30 /* 30 days */,
  8. name: 'projectHistorySizes_lastUpdatedAt_ttl_1',
  9. },
  10. {
  11. key: { estimatedSize: 1 },
  12. name: 'projectHistorySizes_estimatedSize_1',
  13. },
  14. ]
  15. const migrate = async client => {
  16. const { db } = client
  17. await Helpers.addIndexesToCollection(db.projectHistorySizes, indexes)
  18. }
  19. const rollback = async client => {
  20. const { db } = client
  21. await Helpers.dropIndexesFromCollection(db.projectHistorySizes, indexes)
  22. }
  23. export default {
  24. tags,
  25. migrate,
  26. rollback,
  27. }