diff --git a/HISTORY.md b/HISTORY.md index cc92fa0d3..d2eb4f92f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +# 1.0.34 / 2018-02-12 + + * feat: only migration white list data + # 1.0.33 / 2018-02-07 * feat: update checker supported diff --git a/app.js b/app.js index 2f2d13d56..a8d1d14ff 100644 --- a/app.js +++ b/app.js @@ -31,6 +31,12 @@ module.exports = app => { try { const list = JSON.parse(content); + app.whiteList = list.map(item => { + return { + identifer: item.identifer, + }; + }); + for (let i = 0; i < list.length; i++) { const data = list[i]; const { diff --git a/app/controller/api/data.js b/app/controller/api/data.js index 62f61ac6e..4f153d2a4 100644 --- a/app/controller/api/data.js +++ b/app/controller/api/data.js @@ -1,7 +1,9 @@ 'use strict'; +const { + Controller, +} = require('egg'); const _ = require('xutil'); -const Controller = require('egg').Controller; const allowedProxyHeaders = [ 'set-cookie', diff --git a/app/service/data.js b/app/service/data.js index 0d4b54732..39a48a4e3 100644 --- a/app/service/data.js +++ b/app/service/data.js @@ -68,6 +68,9 @@ class DataService extends Service { async asyncMigration() { const res = await this.ctx.model.Data.findAll({ + where: { + [this.app.Sequelize.Op.or]: this.ctx.app.whiteList || [], + }, raw: true, }); diff --git a/package.json b/package.json index 824bc4ed6..f7c339464 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "macaca-datahub", - "version": "1.0.33", + "version": "1.0.34", "description": "Continuous data provider for development, testing, staging and production.", "bin": { "datahub": "./bin/datahub.js"