소스 검색

create migration file

itizawa 5 년 전
부모
커밋
81f8b5b7a0
1개의 변경된 파일23개의 추가작업 그리고 0개의 파일을 삭제
  1. 23 0
      src/migrations/20200828024025-copy-aws-setting.js

+ 23 - 0
src/migrations/20200828024025-copy-aws-setting.js

@@ -0,0 +1,23 @@
+require('module-alias/register');
+const logger = require('@alias/logger')('growi:migrate:remove-layout-setting');
+
+const mongoose = require('mongoose');
+const config = require('@root/config/migrate');
+
+// const { getModelSafely } = require('@commons/util/mongoose-utils');
+
+module.exports = {
+  async up(db, client) {
+    logger.info('Apply migration');
+    mongoose.connect(config.mongoUri, config.mongodb.options);
+
+    logger.info('Migration has successfully applied');
+  },
+
+  async down(db, client) {
+    logger.info('Rollback migration');
+    mongoose.connect(config.mongoUri, config.mongodb.options);
+
+    logger.info('Migration has been successfully rollbacked');
+  },
+};