-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathseed.sql
More file actions
31 lines (26 loc) · 1.04 KB
/
seed.sql
File metadata and controls
31 lines (26 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
CREATE TABLE IF NOT EXISTS draft_ratings (
id INTEGER PRIMARY KEY AUTOINCREMENT,
pick_number INTEGER NOT NULL,
round INTEGER NOT NULL,
overall_pick INTEGER NOT NULL,
player_id INTEGER NOT NULL,
season INTEGER NOT NULL,
verdict TEXT NOT NULL CHECK (verdict IN ('Steal', 'Value', 'Fair', 'Reach', 'Bust', 'No Verdict')),
average_points REAL NOT NULL,
total_points REAL NOT NULL,
player_name TEXT NOT NULL,
team_name TEXT NOT NULL,
team_id INTEGER NOT NULL,
snapshot_timestamp TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Create indexes for common queries
CREATE INDEX IF NOT EXISTS idx_draft_ratings_team
ON draft_ratings(team_id, season);
CREATE INDEX IF NOT EXISTS idx_draft_ratings_player
ON draft_ratings(player_id, season);
CREATE INDEX IF NOT EXISTS idx_draft_ratings_snapshot
ON draft_ratings(snapshot_timestamp DESC);
-- Create index for draft order queries
CREATE INDEX IF NOT EXISTS idx_draft_order
ON draft_ratings(season, round, pick_number);