brackt/drizzle/meta/0035_snapshot.json
Chris Parsons c6ba59b0e6
User/chris/ev f1 framework (#93)
* feat: EV simulation framework with F1 Monte Carlo simulator

- Add EV snapshot tables (participant_ev_snapshots, team_ev_snapshots) and simulation_status column on sports seasons
- Add ev-snapshot model with upsert and history query functions
- Add simulator framework: types, bracket/F1/golf simulators, registry
- F1 simulator: vig-removed ICM weighted draw (pre-season) + race-by-race Monte Carlo from current standings (in-season); per-position column normalization to prevent floating-point EV drift
- Add admin simulate route and Run Simulation button on sports season page
- Rework futures-odds admin page to save odds then run simulation in one action
- Remove recalculate-probabilities route (superseded by simulate route)
- Remove EV trend chart panel and associated DB queries

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: map simulators to sports via simulatorType field

Adds a `simulator_type` enum column to the `sports` table so each sport
can be assigned a specific simulation algorithm rather than deriving it
from the sports season's scoring pattern.

- Add `simulatorTypeEnum` (f1_standings, indycar_standings,
  golf_qualifying_points, playoff_bracket) + `simulatorType` nullable
  column on `sports` table; migration 0037
- Rewrite simulator registry to key off `SimulatorType` instead of
  `ScoringPattern`; indycar_standings shares F1Simulator for now
- `findSportsSeasonById` now returns `SportsSeasonWithSport` so callers
  have typed access to `sport.simulatorType`
- Simulate and futures-odds actions read `sport.simulatorType`; guard
  fires before setting `simulationStatus: running`
- Admin sport edit page gains a Simulator Type dropdown

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 15:34:31 -07:00

3279 lines
No EOL
86 KiB
JSON

{
"id": "5a5b7ce7-0459-461f-8ff0-09f6ce367bd8",
"prevId": "5c8a10ba-c477-491d-9f2f-20bd95f5496b",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.autodraft_settings": {
"name": "autodraft_settings",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"team_id": {
"name": "team_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"is_enabled": {
"name": "is_enabled",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"mode": {
"name": "mode",
"type": "autodraft_mode",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'next_pick'"
},
"queue_only": {
"name": "queue_only",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"autodraft_settings_season_id_seasons_id_fk": {
"name": "autodraft_settings_season_id_seasons_id_fk",
"tableFrom": "autodraft_settings",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"autodraft_settings_team_id_teams_id_fk": {
"name": "autodraft_settings_team_id_teams_id_fk",
"tableFrom": "autodraft_settings",
"tableTo": "teams",
"columnsFrom": [
"team_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.commissioners": {
"name": "commissioners",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"league_id": {
"name": "league_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"commissioners_league_id_leagues_id_fk": {
"name": "commissioners_league_id_leagues_id_fk",
"tableFrom": "commissioners",
"tableTo": "leagues",
"columnsFrom": [
"league_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.draft_picks": {
"name": "draft_picks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"team_id": {
"name": "team_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"pick_number": {
"name": "pick_number",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"round": {
"name": "round",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"pick_in_round": {
"name": "pick_in_round",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"picked_by_user_id": {
"name": "picked_by_user_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"picked_by_type": {
"name": "picked_by_type",
"type": "picked_by_type",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"time_used": {
"name": "time_used",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"draft_picks_season_pick_unique": {
"name": "draft_picks_season_pick_unique",
"columns": [
{
"expression": "season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "pick_number",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"draft_picks_season_id_seasons_id_fk": {
"name": "draft_picks_season_id_seasons_id_fk",
"tableFrom": "draft_picks",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"draft_picks_team_id_teams_id_fk": {
"name": "draft_picks_team_id_teams_id_fk",
"tableFrom": "draft_picks",
"tableTo": "teams",
"columnsFrom": [
"team_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"draft_picks_participant_id_participants_id_fk": {
"name": "draft_picks_participant_id_participants_id_fk",
"tableFrom": "draft_picks",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.draft_queue": {
"name": "draft_queue",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"team_id": {
"name": "team_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"queue_position": {
"name": "queue_position",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"draft_queue_season_id_seasons_id_fk": {
"name": "draft_queue_season_id_seasons_id_fk",
"tableFrom": "draft_queue",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"draft_queue_team_id_teams_id_fk": {
"name": "draft_queue_team_id_teams_id_fk",
"tableFrom": "draft_queue",
"tableTo": "teams",
"columnsFrom": [
"team_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"draft_queue_participant_id_participants_id_fk": {
"name": "draft_queue_participant_id_participants_id_fk",
"tableFrom": "draft_queue",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.draft_slots": {
"name": "draft_slots",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"team_id": {
"name": "team_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"draft_order": {
"name": "draft_order",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"draft_slots_season_id_seasons_id_fk": {
"name": "draft_slots_season_id_seasons_id_fk",
"tableFrom": "draft_slots",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"draft_slots_team_id_teams_id_fk": {
"name": "draft_slots_team_id_teams_id_fk",
"tableFrom": "draft_slots",
"tableTo": "teams",
"columnsFrom": [
"team_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.draft_timers": {
"name": "draft_timers",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"team_id": {
"name": "team_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"time_remaining": {
"name": "time_remaining",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"draft_timers_season_id_seasons_id_fk": {
"name": "draft_timers_season_id_seasons_id_fk",
"tableFrom": "draft_timers",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"draft_timers_team_id_teams_id_fk": {
"name": "draft_timers_team_id_teams_id_fk",
"tableFrom": "draft_timers",
"tableTo": "teams",
"columnsFrom": [
"team_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.event_results": {
"name": "event_results",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"scoring_event_id": {
"name": "scoring_event_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"placement": {
"name": "placement",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"qualifying_points_awarded": {
"name": "qualifying_points_awarded",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"eliminated": {
"name": "eliminated",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"raw_score": {
"name": "raw_score",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"event_results_scoring_event_id_scoring_events_id_fk": {
"name": "event_results_scoring_event_id_scoring_events_id_fk",
"tableFrom": "event_results",
"tableTo": "scoring_events",
"columnsFrom": [
"scoring_event_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"event_results_participant_id_participants_id_fk": {
"name": "event_results_participant_id_participants_id_fk",
"tableFrom": "event_results",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.leagues": {
"name": "leagues",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"created_by": {
"name": "created_by",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"current_season_id": {
"name": "current_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"is_public_draft_board": {
"name": "is_public_draft_board",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.participant_ev_snapshots": {
"name": "participant_ev_snapshots",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"snapshot_date": {
"name": "snapshot_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"prob_first": {
"name": "prob_first",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_second": {
"name": "prob_second",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_third": {
"name": "prob_third",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_fourth": {
"name": "prob_fourth",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_fifth": {
"name": "prob_fifth",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_sixth": {
"name": "prob_sixth",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_seventh": {
"name": "prob_seventh",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_eighth": {
"name": "prob_eighth",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"calculated_ev": {
"name": "calculated_ev",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"source": {
"name": "source",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"participant_ev_snapshots_unique": {
"name": "participant_ev_snapshots_unique",
"columns": [
{
"expression": "participant_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "sports_season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "snapshot_date",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"participant_ev_snapshots_participant_id_participants_id_fk": {
"name": "participant_ev_snapshots_participant_id_participants_id_fk",
"tableFrom": "participant_ev_snapshots",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"participant_ev_snapshots_sports_season_id_sports_seasons_id_fk": {
"name": "participant_ev_snapshots_sports_season_id_sports_seasons_id_fk",
"tableFrom": "participant_ev_snapshots",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.participant_expected_values": {
"name": "participant_expected_values",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"prob_first": {
"name": "prob_first",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_second": {
"name": "prob_second",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_third": {
"name": "prob_third",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_fourth": {
"name": "prob_fourth",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_fifth": {
"name": "prob_fifth",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_sixth": {
"name": "prob_sixth",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_seventh": {
"name": "prob_seventh",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_eighth": {
"name": "prob_eighth",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"expected_value": {
"name": "expected_value",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"source": {
"name": "source",
"type": "probability_source",
"typeSchema": "public",
"primaryKey": false,
"notNull": false,
"default": "'manual'"
},
"source_odds": {
"name": "source_odds",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"calculated_at": {
"name": "calculated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"participant_expected_values_participant_id_participants_id_fk": {
"name": "participant_expected_values_participant_id_participants_id_fk",
"tableFrom": "participant_expected_values",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"participant_expected_values_sports_season_id_sports_seasons_id_fk": {
"name": "participant_expected_values_sports_season_id_sports_seasons_id_fk",
"tableFrom": "participant_expected_values",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.participant_qualifying_totals": {
"name": "participant_qualifying_totals",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"total_qualifying_points": {
"name": "total_qualifying_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"events_scored": {
"name": "events_scored",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"final_ranking": {
"name": "final_ranking",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"participant_qualifying_totals_participant_id_participants_id_fk": {
"name": "participant_qualifying_totals_participant_id_participants_id_fk",
"tableFrom": "participant_qualifying_totals",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"participant_qualifying_totals_sports_season_id_sports_seasons_id_fk": {
"name": "participant_qualifying_totals_sports_season_id_sports_seasons_id_fk",
"tableFrom": "participant_qualifying_totals",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.participant_results": {
"name": "participant_results",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"final_position": {
"name": "final_position",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"qualifying_points": {
"name": "qualifying_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"participant_results_participant_id_participants_id_fk": {
"name": "participant_results_participant_id_participants_id_fk",
"tableFrom": "participant_results",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"participant_results_sports_season_id_sports_seasons_id_fk": {
"name": "participant_results_sports_season_id_sports_seasons_id_fk",
"tableFrom": "participant_results",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.participant_season_results": {
"name": "participant_season_results",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"current_points": {
"name": "current_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"current_position": {
"name": "current_position",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"participant_season_results_participant_id_participants_id_fk": {
"name": "participant_season_results_participant_id_participants_id_fk",
"tableFrom": "participant_season_results",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"participant_season_results_sports_season_id_sports_seasons_id_fk": {
"name": "participant_season_results_sports_season_id_sports_seasons_id_fk",
"tableFrom": "participant_season_results",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.participants": {
"name": "participants",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"short_name": {
"name": "short_name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"external_id": {
"name": "external_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"expected_value": {
"name": "expected_value",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"participants_sports_season_id_sports_seasons_id_fk": {
"name": "participants_sports_season_id_sports_seasons_id_fk",
"tableFrom": "participants",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.playoff_matches": {
"name": "playoff_matches",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"scoring_event_id": {
"name": "scoring_event_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"round": {
"name": "round",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"match_number": {
"name": "match_number",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"participant1_id": {
"name": "participant1_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"participant2_id": {
"name": "participant2_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"winner_id": {
"name": "winner_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"loser_id": {
"name": "loser_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"is_complete": {
"name": "is_complete",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"participant1_score": {
"name": "participant1_score",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"participant2_score": {
"name": "participant2_score",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"is_scoring": {
"name": "is_scoring",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"template_round": {
"name": "template_round",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"seed_info": {
"name": "seed_info",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"playoff_matches_scoring_event_id_scoring_events_id_fk": {
"name": "playoff_matches_scoring_event_id_scoring_events_id_fk",
"tableFrom": "playoff_matches",
"tableTo": "scoring_events",
"columnsFrom": [
"scoring_event_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"playoff_matches_participant1_id_participants_id_fk": {
"name": "playoff_matches_participant1_id_participants_id_fk",
"tableFrom": "playoff_matches",
"tableTo": "participants",
"columnsFrom": [
"participant1_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"playoff_matches_participant2_id_participants_id_fk": {
"name": "playoff_matches_participant2_id_participants_id_fk",
"tableFrom": "playoff_matches",
"tableTo": "participants",
"columnsFrom": [
"participant2_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"playoff_matches_winner_id_participants_id_fk": {
"name": "playoff_matches_winner_id_participants_id_fk",
"tableFrom": "playoff_matches",
"tableTo": "participants",
"columnsFrom": [
"winner_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"playoff_matches_loser_id_participants_id_fk": {
"name": "playoff_matches_loser_id_participants_id_fk",
"tableFrom": "playoff_matches",
"tableTo": "participants",
"columnsFrom": [
"loser_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.qualifying_point_config": {
"name": "qualifying_point_config",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"placement": {
"name": "placement",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"points": {
"name": "points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"qualifying_point_config_sports_season_id_sports_seasons_id_fk": {
"name": "qualifying_point_config_sports_season_id_sports_seasons_id_fk",
"tableFrom": "qualifying_point_config",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.scoring_events": {
"name": "scoring_events",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"event_date": {
"name": "event_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"event_type": {
"name": "event_type",
"type": "event_type",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"playoff_round": {
"name": "playoff_round",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"is_qualifying_event": {
"name": "is_qualifying_event",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"bracket_template_id": {
"name": "bracket_template_id",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"scoring_starts_at_round": {
"name": "scoring_starts_at_round",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"is_complete": {
"name": "is_complete",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"completed_at": {
"name": "completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"scoring_events_sports_season_id_sports_seasons_id_fk": {
"name": "scoring_events_sports_season_id_sports_seasons_id_fk",
"tableFrom": "scoring_events",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.season_sports": {
"name": "season_sports",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"season_sports_season_id_seasons_id_fk": {
"name": "season_sports_season_id_seasons_id_fk",
"tableFrom": "season_sports",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"season_sports_sports_season_id_sports_seasons_id_fk": {
"name": "season_sports_sports_season_id_sports_seasons_id_fk",
"tableFrom": "season_sports",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.season_template_sports": {
"name": "season_template_sports",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"template_id": {
"name": "template_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"season_template_sports_template_id_season_templates_id_fk": {
"name": "season_template_sports_template_id_season_templates_id_fk",
"tableFrom": "season_template_sports",
"tableTo": "season_templates",
"columnsFrom": [
"template_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"season_template_sports_sports_season_id_sports_seasons_id_fk": {
"name": "season_template_sports_sports_season_id_sports_seasons_id_fk",
"tableFrom": "season_template_sports",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.season_templates": {
"name": "season_templates",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"year": {
"name": "year",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.seasons": {
"name": "seasons",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"league_id": {
"name": "league_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"year": {
"name": "year",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "season_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'pre_draft'"
},
"template_id": {
"name": "template_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"draft_rounds": {
"name": "draft_rounds",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 20
},
"flex_spots": {
"name": "flex_spots",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"draft_date_time": {
"name": "draft_date_time",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"draft_initial_time": {
"name": "draft_initial_time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 120
},
"draft_increment_time": {
"name": "draft_increment_time",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 30
},
"current_pick_number": {
"name": "current_pick_number",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1
},
"draft_started_at": {
"name": "draft_started_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"draft_paused": {
"name": "draft_paused",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"invite_code": {
"name": "invite_code",
"type": "varchar(20)",
"primaryKey": false,
"notNull": true
},
"points_for_1st": {
"name": "points_for_1st",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 100
},
"points_for_2nd": {
"name": "points_for_2nd",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 70
},
"points_for_3rd": {
"name": "points_for_3rd",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 50
},
"points_for_4th": {
"name": "points_for_4th",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 40
},
"points_for_5th": {
"name": "points_for_5th",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 25
},
"points_for_6th": {
"name": "points_for_6th",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 25
},
"points_for_7th": {
"name": "points_for_7th",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 15
},
"points_for_8th": {
"name": "points_for_8th",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 15
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"seasons_league_id_leagues_id_fk": {
"name": "seasons_league_id_leagues_id_fk",
"tableFrom": "seasons",
"tableTo": "leagues",
"columnsFrom": [
"league_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"seasons_template_id_season_templates_id_fk": {
"name": "seasons_template_id_season_templates_id_fk",
"tableFrom": "seasons",
"tableTo": "season_templates",
"columnsFrom": [
"template_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"seasons_invite_code_unique": {
"name": "seasons_invite_code_unique",
"nullsNotDistinct": false,
"columns": [
"invite_code"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.sports": {
"name": "sports",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "sport_type",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"slug": {
"name": "slug",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"icon_url": {
"name": "icon_url",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"sports_slug_unique": {
"name": "sports_slug_unique",
"nullsNotDistinct": false,
"columns": [
"slug"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.sports_seasons": {
"name": "sports_seasons",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"sport_id": {
"name": "sport_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"year": {
"name": "year",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"start_date": {
"name": "start_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"end_date": {
"name": "end_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "sports_season_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'upcoming'"
},
"scoring_type": {
"name": "scoring_type",
"type": "scoring_type",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"scoring_pattern": {
"name": "scoring_pattern",
"type": "scoring_pattern",
"typeSchema": "public",
"primaryKey": false,
"notNull": false
},
"total_majors": {
"name": "total_majors",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"majors_completed": {
"name": "majors_completed",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"qualifying_points_finalized": {
"name": "qualifying_points_finalized",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"elo_calibration_exponent": {
"name": "elo_calibration_exponent",
"type": "numeric(3, 2)",
"primaryKey": false,
"notNull": false
},
"elo_min_rating": {
"name": "elo_min_rating",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1250
},
"elo_max_rating": {
"name": "elo_max_rating",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 1750
},
"simulation_status": {
"name": "simulation_status",
"type": "simulation_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'idle'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"sports_seasons_sport_id_sports_id_fk": {
"name": "sports_seasons_sport_id_sports_id_fk",
"tableFrom": "sports_seasons",
"tableTo": "sports",
"columnsFrom": [
"sport_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.team_ev_snapshots": {
"name": "team_ev_snapshots",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"team_id": {
"name": "team_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"snapshot_date": {
"name": "snapshot_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"projected_points": {
"name": "projected_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"actual_points": {
"name": "actual_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"team_ev_snapshots_unique": {
"name": "team_ev_snapshots_unique",
"columns": [
{
"expression": "team_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "snapshot_date",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"team_ev_snapshots_team_id_teams_id_fk": {
"name": "team_ev_snapshots_team_id_teams_id_fk",
"tableFrom": "team_ev_snapshots",
"tableTo": "teams",
"columnsFrom": [
"team_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"team_ev_snapshots_season_id_seasons_id_fk": {
"name": "team_ev_snapshots_season_id_seasons_id_fk",
"tableFrom": "team_ev_snapshots",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.team_sport_scores": {
"name": "team_sport_scores",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"team_id": {
"name": "team_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"total_points": {
"name": "total_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"participants_completed": {
"name": "participants_completed",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"participants_total": {
"name": "participants_total",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"calculated_at": {
"name": "calculated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"team_sport_scores_team_id_teams_id_fk": {
"name": "team_sport_scores_team_id_teams_id_fk",
"tableFrom": "team_sport_scores",
"tableTo": "teams",
"columnsFrom": [
"team_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"team_sport_scores_sports_season_id_sports_seasons_id_fk": {
"name": "team_sport_scores_sports_season_id_sports_seasons_id_fk",
"tableFrom": "team_sport_scores",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.team_standings": {
"name": "team_standings",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"team_id": {
"name": "team_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"total_points": {
"name": "total_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"current_rank": {
"name": "current_rank",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"previous_rank": {
"name": "previous_rank",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"first_place_count": {
"name": "first_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"second_place_count": {
"name": "second_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"third_place_count": {
"name": "third_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"fourth_place_count": {
"name": "fourth_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"fifth_place_count": {
"name": "fifth_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"sixth_place_count": {
"name": "sixth_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"seventh_place_count": {
"name": "seventh_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"eighth_place_count": {
"name": "eighth_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"participants_remaining": {
"name": "participants_remaining",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"actual_points": {
"name": "actual_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"projected_points": {
"name": "projected_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"participants_finished": {
"name": "participants_finished",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"calculated_at": {
"name": "calculated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"team_standings_team_id_teams_id_fk": {
"name": "team_standings_team_id_teams_id_fk",
"tableFrom": "team_standings",
"tableTo": "teams",
"columnsFrom": [
"team_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"team_standings_season_id_seasons_id_fk": {
"name": "team_standings_season_id_seasons_id_fk",
"tableFrom": "team_standings",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.team_standings_snapshots": {
"name": "team_standings_snapshots",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"team_id": {
"name": "team_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"snapshot_date": {
"name": "snapshot_date",
"type": "date",
"primaryKey": false,
"notNull": true
},
"total_points": {
"name": "total_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"rank": {
"name": "rank",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"first_place_count": {
"name": "first_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"second_place_count": {
"name": "second_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"third_place_count": {
"name": "third_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"fourth_place_count": {
"name": "fourth_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"fifth_place_count": {
"name": "fifth_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"sixth_place_count": {
"name": "sixth_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"seventh_place_count": {
"name": "seventh_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"eighth_place_count": {
"name": "eighth_place_count",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"participants_remaining": {
"name": "participants_remaining",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"actual_points": {
"name": "actual_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"projected_points": {
"name": "projected_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"participants_finished": {
"name": "participants_finished",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"team_standings_snapshots_team_id_teams_id_fk": {
"name": "team_standings_snapshots_team_id_teams_id_fk",
"tableFrom": "team_standings_snapshots",
"tableTo": "teams",
"columnsFrom": [
"team_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"team_standings_snapshots_season_id_seasons_id_fk": {
"name": "team_standings_snapshots_season_id_seasons_id_fk",
"tableFrom": "team_standings_snapshots",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.teams": {
"name": "teams",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"logo_url": {
"name": "logo_url",
"type": "varchar(512)",
"primaryKey": false,
"notNull": false
},
"owner_id": {
"name": "owner_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"teams_season_id_seasons_id_fk": {
"name": "teams_season_id_seasons_id_fk",
"tableFrom": "teams",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.tournament_group_members": {
"name": "tournament_group_members",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tournament_group_id": {
"name": "tournament_group_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"eliminated": {
"name": "eliminated",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"tournament_group_members_tournament_group_id_tournament_groups_id_fk": {
"name": "tournament_group_members_tournament_group_id_tournament_groups_id_fk",
"tableFrom": "tournament_group_members",
"tableTo": "tournament_groups",
"columnsFrom": [
"tournament_group_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"tournament_group_members_participant_id_participants_id_fk": {
"name": "tournament_group_members_participant_id_participants_id_fk",
"tableFrom": "tournament_group_members",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.tournament_groups": {
"name": "tournament_groups",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"scoring_event_id": {
"name": "scoring_event_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"group_name": {
"name": "group_name",
"type": "varchar(10)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"tournament_groups_scoring_event_id_scoring_events_id_fk": {
"name": "tournament_groups_scoring_event_id_scoring_events_id_fk",
"tableFrom": "tournament_groups",
"tableTo": "scoring_events",
"columnsFrom": [
"scoring_event_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"clerk_id": {
"name": "clerk_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"username": {
"name": "username",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"display_name": {
"name": "display_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"first_name": {
"name": "first_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"last_name": {
"name": "last_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"image_url": {
"name": "image_url",
"type": "varchar(512)",
"primaryKey": false,
"notNull": false
},
"is_admin": {
"name": "is_admin",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"users_clerk_id_unique": {
"name": "users_clerk_id_unique",
"nullsNotDistinct": false,
"columns": [
"clerk_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {
"public.autodraft_mode": {
"name": "autodraft_mode",
"schema": "public",
"values": [
"next_pick",
"while_on"
]
},
"public.event_type": {
"name": "event_type",
"schema": "public",
"values": [
"playoff_game",
"major_tournament",
"final_standings",
"schedule_event"
]
},
"public.picked_by_type": {
"name": "picked_by_type",
"schema": "public",
"values": [
"owner",
"commissioner",
"auto"
]
},
"public.probability_source": {
"name": "probability_source",
"schema": "public",
"values": [
"manual",
"futures_odds",
"elo_simulation",
"performance_model"
]
},
"public.scoring_pattern": {
"name": "scoring_pattern",
"schema": "public",
"values": [
"playoff_bracket",
"season_standings",
"qualifying_points"
]
},
"public.scoring_type": {
"name": "scoring_type",
"schema": "public",
"values": [
"playoffs",
"regular_season",
"majors"
]
},
"public.season_status": {
"name": "season_status",
"schema": "public",
"values": [
"pre_draft",
"draft",
"active",
"completed"
]
},
"public.simulation_status": {
"name": "simulation_status",
"schema": "public",
"values": [
"idle",
"running",
"failed"
]
},
"public.sport_type": {
"name": "sport_type",
"schema": "public",
"values": [
"team",
"individual"
]
},
"public.sports_season_status": {
"name": "sports_season_status",
"schema": "public",
"values": [
"upcoming",
"active",
"completed"
]
}
},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}