INNER CODE UNIT · Python
plugin_dir
fastapi-practices/fba-slim · backend/cli.py:448
plugin_dir = PLUGIN_DIR / plugin
if not plugin_dir.exists():
raise cappa.Exit(f'插件 {plugin} 不存在', code=1)
if not no_sql:
destroy_sql_file = await get_plugin_destroy_sql(plugin, settings.DATABASE_TYPE, settings.DATABASE_PK_MODE)
if destroy_sql_file:
console.note(f'正在执行插件 {plugin} 销毁 SQL 脚本:{destroy_sql_file}')
async with async_db_session.begin() as db:
await execute_destroy_sql_scripts(db, destroy_sql_file)
else:
console.warning(f'插件 {plugin} 未提供销毁 SQL 脚本,跳过数据库清理')
console.note(f'正在卸载插件 {plugin} 依赖...')
await uninstall_requirements_async(plugin)
console.note(f'正在备份插件 {plugin}...')
backup_file = PLUGIN_DIR / f'{plugin}.{timezone.now().strftime("%Y%m%d%H%M%S")}.backup.zip'