2.0 KiB
2.0 KiB
Database Setup Guide
Quick Setup
- Go to your Supabase project dashboard
- Navigate to the SQL Editor
- Copy and paste the contents of
database/schema.sqland run it - Copy and paste the contents of
database/missing_tables.sqland run it - Both scripts will create all necessary tables with proper indexes and RLS policies
Table Structure
Core Tables (from schema.sql)
options_flow
Stores real-time options flow data with:
- Symbol, type (CALL/PUT), strike, expiration
- Premium, volume, sentiment scores
- Rocket score and badges
- Timestamps
daily_analysis
Stores daily post-mortem analysis with:
- Symbol performance metrics
- Final scores and price changes
- Flow statistics aggregated by day
Additional Tables (from missing_tables.sql)
Price Data Tables
minute_bars_et- Minute-level price bars with ET timezonedaily_bars- Daily OHLCV price dataprices_intraday_1m- 1-minute intraday price dataprices_daily- Daily price data (alternative schema)price_daily- Daily price data with Ticker columnprice_1m- 1-minute price data with Ticker column
Options & Alerts Tables
OptionsFlow_monthly- Monthly options flow data (CamelCase)AlertStream_monthly- Monthly alert stream data (CamelCase)alertstream_monthly- Monthly alert stream data (lowercase)
Configuration Tables
bucket_members- Symbol bucket/group memberships (e.g., 'SEMIS', 'BANKS')
Row Level Security (RLS)
The schema includes RLS policies that allow all operations by default. For production, you should create more restrictive policies based on your authentication requirements.
Testing with Sample Data
Uncomment the sample INSERT statements at the bottom of schema.sql to add test data.
Next Steps
After running the schema:
- Verify tables exist in Supabase Table Editor
- Test inserting a row via Supabase Dashboard
- Update your
.envfile with correct Supabase credentials - Test the backend API endpoints