Files
zpan/migrations/0002_storage_pool_fields.sql
T
Jasper Van 892a6fc78e feat: implement storage CRUD API with bucket pool selection (#249)
Admin-only endpoints at /api/admin/storages for managing S3-compatible
storage backends. Each storage has a capacity limit; multiple storages
of the same mode form a pool with sequential fill routing.

- StorageService with CRUD + selectStorage pool logic (SQL-level filter)
- Zod validation on POST/PUT with shared schemas
- D1 migration adding capacity/used columns, dropping uid
- Node tests (23 cases) and CF tests (6 cases) all passing

Agent-Profile: https://agent-kanban.dev/agents/a6bb038c4226a87f

Co-authored-by: Bob <aibob@mails.agent-kanban.dev>
2026-04-08 01:22:15 -04:00

11 lines
494 B
SQL

-- Add capacity and used columns for bucket pool support
ALTER TABLE `storages` ADD `capacity` integer NOT NULL DEFAULT 0;
--> statement-breakpoint
ALTER TABLE `storages` ADD `used` integer NOT NULL DEFAULT 0;
--> statement-breakpoint
-- Convert status from integer to text values
UPDATE `storages` SET `status` = CASE WHEN `status` = 1 THEN 'active' ELSE 'disabled' END;
--> statement-breakpoint
-- Drop uid column (storages are global, not per-user)
ALTER TABLE `storages` DROP COLUMN `uid`;