From 5cb8d4ec1732506ca085178de0bcf0b7b3c05e9a Mon Sep 17 00:00:00 2001 From: gilesb Date: Fri, 9 Jan 2026 23:22:28 +0000 Subject: [PATCH] Add storage_backends table for user storage config Prepares L1 for distributed storage integration with user-provided storage backends (Pinata, web3.storage, local). The storage config is synced from L2 or can be configured locally per actor. Co-Authored-By: Claude Opus 4.5 --- database.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/database.py b/database.py index 04e6c70..ece2fb3 100644 --- a/database.py +++ b/database.py @@ -84,6 +84,18 @@ CREATE TABLE IF NOT EXISTS run_cache ( created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() ); +-- User storage backends (synced from L2 or configured locally) +CREATE TABLE IF NOT EXISTS storage_backends ( + id SERIAL PRIMARY KEY, + actor_id VARCHAR(255) NOT NULL, + provider_type VARCHAR(50) NOT NULL, + config JSONB NOT NULL DEFAULT '{}', + capacity_gb INTEGER NOT NULL, + used_bytes BIGINT DEFAULT 0, + is_active BOOLEAN DEFAULT true, + synced_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + -- Indexes CREATE INDEX IF NOT EXISTS idx_item_types_content_hash ON item_types(content_hash); CREATE INDEX IF NOT EXISTS idx_item_types_actor_id ON item_types(actor_id); @@ -93,6 +105,7 @@ CREATE INDEX IF NOT EXISTS idx_pin_reasons_item_type ON pin_reasons(item_type_id CREATE INDEX IF NOT EXISTS idx_l2_shares_content_hash ON l2_shares(content_hash); CREATE INDEX IF NOT EXISTS idx_l2_shares_actor_id ON l2_shares(actor_id); CREATE INDEX IF NOT EXISTS idx_run_cache_output ON run_cache(output_hash); +CREATE INDEX IF NOT EXISTS idx_storage_backends_actor ON storage_backends(actor_id); """