refactor(storage): drop per-upload storage_driver, use storage_config as single source

Remove w_uploads.storage_driver and route all read/write/delete paths through
storage.Active() backed by storage_config.driver. Block direct driver switches
when uploads exist; require migration task instead. Simplify migration to
cursor-based file_path iteration without per-row driver updates.
This commit is contained in:
ryan
2026-06-18 13:56:31 +08:00
parent 1f391e9ec2
commit 410ff14795
25 changed files with 512 additions and 604 deletions
@@ -85,6 +85,15 @@ export function FileList() {
queryFn: () => services.adminUpload.listUploads(page, pageSize, debouncedKeyword || undefined),
})
const storageDriverQuery = useQuery({
queryKey: ["admin", "storage-config", "driver"],
queryFn: async () => {
const record = await services.adminSystemConfig.getSystemConfig("storage_config")
const cfg = JSON.parse(record.value) as {driver?: string}
return cfg.driver ?? "local"
},
})
const files = listQuery.data?.items ?? []
const total = listQuery.data?.total ?? 0
const totalPages = Math.ceil(total / pageSize)
@@ -470,7 +479,7 @@ export function FileList() {
<div className="grid grid-cols-3 gap-2 border-b border-dashed pb-2">
<span className="text-muted-foreground font-medium">存储驱动</span>
<span className="col-span-2 font-mono text-foreground/90">{detailTarget.storage_driver || "local"}</span>
<span className="col-span-2 font-mono text-foreground/90">{storageDriverQuery.data ?? "local"}</span>
</div>
<div className="grid grid-cols-3 gap-2 border-b border-dashed pb-2">
-1
View File
@@ -24,7 +24,6 @@ export interface Upload {
mime_type: string
extension: string
hash: string
storage_driver: string
type: string
status: string
access_mode: number