2024-05-16 20:32:30 +08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from .. import migration
|
|
|
|
|
|
|
|
|
|
|
2025-04-29 17:24:07 +08:00
|
|
|
@migration.migration_class('vision-config', 6)
|
2024-05-16 20:32:30 +08:00
|
|
|
class VisionConfigMigration(migration.Migration):
|
|
|
|
|
"""迁移"""
|
|
|
|
|
|
|
|
|
|
async def need_migrate(self) -> bool:
|
|
|
|
|
"""判断当前环境是否需要运行此迁移"""
|
2025-04-29 17:24:07 +08:00
|
|
|
return 'enable-vision' not in self.ap.provider_cfg.data
|
2024-05-16 20:32:30 +08:00
|
|
|
|
|
|
|
|
async def run(self):
|
|
|
|
|
"""执行迁移"""
|
2025-04-29 17:24:07 +08:00
|
|
|
if 'enable-vision' not in self.ap.provider_cfg.data:
|
|
|
|
|
self.ap.provider_cfg.data['enable-vision'] = False
|
2024-05-16 20:32:30 +08:00
|
|
|
|
|
|
|
|
await self.ap.provider_cfg.dump_config()
|