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 <noreply@anthropic.com>
This commit is contained in:
13
database.py
13
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);
|
||||
"""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user