|
|
|
@ -570,13 +570,25 @@ export default class Model implements TableType {
|
|
|
|
|
// get existing cache
|
|
|
|
|
const key = `${CacheScope.MODEL}:${tableId}`; |
|
|
|
|
const o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT); |
|
|
|
|
let oldModel = { ...o }; |
|
|
|
|
// update alias
|
|
|
|
|
if (o) { |
|
|
|
|
o.title = title; |
|
|
|
|
o.table_name = table_name; |
|
|
|
|
// set cache
|
|
|
|
|
await NocoCache.set(key, o); |
|
|
|
|
} else { |
|
|
|
|
oldModel = await this.get(tableId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// delete alias cache
|
|
|
|
|
await NocoCache.del( |
|
|
|
|
`${CacheScope.MODEL}:${oldModel.project_id}:${oldModel.base_id}:${oldModel.title}`, |
|
|
|
|
); |
|
|
|
|
await NocoCache.del( |
|
|
|
|
`${CacheScope.MODEL}:${oldModel.project_id}:${oldModel.title}`, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// set meta
|
|
|
|
|
return await ncMeta.metaUpdate( |
|
|
|
|
null, |
|
|
|
|