Merge pull request #1306 in YUNIONIO/onecloud from ~QUXUAN/onecloud:hotfix/qx-metadata-sql-fix to release/2.8.0

* commit '4ee31813b4fcb653b95abc195841715b336bf8e6':
  避免mysql _ 是特殊字符问题
This commit is contained in:
李泽玺
2019-03-22 11:37:11 +08:00
+1 -1
View File
@@ -288,7 +288,7 @@ func (manager *SMetadataManager) SetAll(ctx context.Context, obj IModel, store m
}
records := []SMetadata{}
q := manager.Query().Equals("id", idStr).NotLike("key", SYS_TAG_PREFIX+"%")
q := manager.Query().Equals("id", idStr).NotLike("key", `\_\_%`) //避免删除系统内置的metadata, _ 在mysql里面有特殊含义,需要转义
switch delRange {
case TAG_DELETE_RANGE_USER:
q = q.Like("key", USER_TAG_PREFIX+"%")