-- Regime snapshots table CREATE TABLE IF NOT EXISTS regime_snapshots ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), created_at timestamptz NOT NULL DEFAULT now(), growth_score float, inflation_score float, quadrant_probabilities jsonb, transition_risk text, correlation_matrix jsonb, indicator_values jsonb ); -- Enable Row Level Security (optional but recommended) ALTER TABLE regime_snapshots ENABLE ROW LEVEL SECURITY; -- Allow all operations for authenticated and anon users CREATE POLICY "Allow all" ON regime_snapshots FOR ALL USING (true) WITH CHECK (true); -- Price cache table CREATE TABLE IF NOT EXISTS price_cache ( ticker text NOT NULL, date text NOT NULL, close float NOT NULL, PRIMARY KEY (ticker, date) ); ALTER TABLE price_cache ENABLE ROW LEVEL SECURITY; CREATE POLICY "Allow all" ON price_cache FOR ALL USING (true) WITH CHECK (true); -- Index for efficient ticker lookups CREATE INDEX IF NOT EXISTS idx_price_cache_ticker ON price_cache(ticker, date DESC);