migrate.js 699 B

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * Configuration file for migrate-mongo
  3. * @see https://github.com/seppevs/migrate-mongo
  4. *
  5. * @author Yuki Takei <yuki@weseek.co.jp>
  6. */
  7. const { URL } = require('url');
  8. const { getMongoUri } = require('~/server/util/mongoose-utils');
  9. const mongoUri = getMongoUri();
  10. // parse url
  11. const url = new URL(mongoUri);
  12. const mongodb = {
  13. url: mongoUri,
  14. databaseName: url.pathname.substring(1), // omit heading slash
  15. options: {
  16. useNewUrlParser: true, // removes a deprecation warning when connecting
  17. useUnifiedTopology: true,
  18. useFindAndModify: false,
  19. },
  20. };
  21. module.exports = {
  22. mongoUri,
  23. mongodb,
  24. migrationsDir: 'src/migrations/',
  25. changelogCollectionName: 'migrations',
  26. };