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); """