perf: 敏感词迁移的双条件检查

This commit is contained in:
RockChinQ 2024-03-23 22:41:21 +08:00
parent 835275b47f
commit 2c3399e237

View File

@ -14,7 +14,7 @@ class SensitiveWordMigration(migration.Migration):
async def need_migrate(self) -> bool:
"""判断当前环境是否需要运行此迁移
"""
return os.path.exists("data/config/sensitive-words.json")
return os.path.exists("data/config/sensitive-words.json") and not os.path.exists("data/metadata/sensitive-words.json")
async def run(self):
"""执行迁移