brackt/drizzle/meta/0089_snapshot.json

5715 lines
151 KiB
JSON
Raw Normal View History

Canonical tournament layer: cutover + cleanup (2/2) (#367) * refactor(schema): rename per-window tables to season_* prefix Renames participants, participant_expected_values, participant_qualifying_totals, participant_results, participant_surface_elos to season_* prefixed names. Renames event_results.participant_id to season_participant_id. Phase 1a of canonical tournament layer migration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor: rename participant.ts model file to season-participant.ts Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(models): update model layer to use renamed schema exports Updated all model files to use the renamed schema exports from Task 1: - participants → seasonParticipants - participantExpectedValues → seasonParticipantExpectedValues - participantQualifyingTotals → seasonParticipantQualifyingTotals - participantResults → seasonParticipantResults - participantSurfaceElos → seasonParticipantSurfaceElos - eventResults.participantId → eventResults.seasonParticipantId - db.query relation accessors updated - Relation field .participant → .seasonParticipant where applicable - Import paths updated: ./participant → ./season-participant Files updated (14 model files + 3 test files): - draft-pick.ts - draft-utils.ts - event-result.ts - group-stage-match.ts - participant-result.ts - qualifying-points.ts - scoring-calculator.ts - scoring-event.ts - sports-season.ts - surface-elo.ts - team-score-events.ts - cs2-major-stage.ts - golf-skills.ts - participant-expected-value.ts - __tests__/sports-season.clone.test.ts - __tests__/auto-pick.test.ts - __tests__/executeAutoPick.timer.test.ts Typecheck errors decreased: 779 → 499 (280 fewer) All model file errors related to renamed schemas resolved. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(routes): update route layer to use renamed schema exports - Update model import from ~/models/participant to ~/models/season-participant - Rename schema.participants to schema.seasonParticipants - Rename schema.participantResults to schema.seasonParticipantResults - Rename db.query.participants to db.query.seasonParticipants - Update 9 route files and 1 test file Affected files: - admin.sports-seasons.$id.events.$eventId.bracket.server.ts - admin.sports-seasons.$id.participants.tsx - api/draft.force-manual-pick.ts - api/draft.make-pick.ts - api/draft.replace-pick.ts - api/seasons.$seasonId.draft.ts - leagues/$leagueId.draft-board.$seasonId.tsx - leagues/$leagueId.sports-seasons.$sportsSeasonId.server.ts - admin/__tests__/sports-seasons-participants.test.ts Error count reduced from 499 to 453 (46 errors fixed). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(routes): update route files for schema rename Update route imports from ~/models/participant to ~/models/season-participant and fix references to .participant/.participantId on event results to use .seasonParticipant/.seasonParticipantId after schema rename. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(services): update simulators and services for renamed schema Update all simulators, services, and server files to use renamed schema tables: - participants → seasonParticipants - participantExpectedValues → seasonParticipantExpectedValues - participantResults → seasonParticipantResults - eventResults.participantId → eventResults.seasonParticipantId Files updated: - 20 sport simulators (NBA, NHL, NFL, MLB, etc.) - probability-updater.ts - standings-sync/index.ts - sports-data-sync.server.ts - server/socket.ts Typecheck errors reduced from 365 to 0. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * migration: rename per-window tables to season_* prefix * fix(tests): update mock query keys after participants table rename Change mock db.query.participants to db.query.seasonParticipants in test files to match the schema rename from commit 66145a9. This fixes "Cannot read properties of undefined (reading 'findFirst'/'findMany')" errors that occurred when production code queries db.query.seasonParticipants but test mocks only defined the old participants key. Files updated: - app/services/simulations/__tests__/world-cup-simulator.test.ts - app/routes/api/__tests__/draft.force-manual-pick.test.ts - app/routes/api/__tests__/draft.force-manual-pick.timer-mode.test.ts - app/routes/api/__tests__/draft.make-pick.timer-mode.test.ts - server/__tests__/timer-autodraft.test.ts - app/models/__tests__/team-score-events.test.ts Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(tests): update remaining mock paths and keys after schema rename * fix(tests): final two mock stragglers after schema rename - draft-pick.test.ts: assertion on db.query.participantQualifyingTotals - process-match-result.test.ts: mock key participants → seasonParticipants Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * chore: add post-phase1a baseline capture (temp, for diff verification) * chore: capture pre-migration baselines * chore: remove post-phase1a capture helper after verification * schema: add canonical tournament & participant tables Adds tournaments, participants (canonical), tournament_results, and participant_surface_elos (canonical). Adds nullable tournament_id to scoring_events and nullable participant_id to season_participants. Phase 1b of canonical tournament layer migration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat(models): add canonical tournament, participant, result, surface-elo models Adds CRUD modules for the canonical tables created in commit 775b905. Each module mirrors existing app/models conventions (database() from ~/database/context, schema from ~/database/schema, mock-based tests). Key implementation notes: - participant.ts exports use "Canonical" prefix (CanonicalParticipant, createCanonicalParticipant, etc.) to avoid collision with existing season-participant.ts exports - All four models include comprehensive unit tests following the audit-log.test.ts pattern - Tests use mocked db responses (no real database access) - Upsert functions use onConflictDoUpdate for appropriate unique constraints Part of Phase 1b of canonical tournament layer migration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * migration: create canonical tables, add nullable FKs * scripts: add extractTournamentIdentity helper for backfill Pure function that derives canonical (name, year) identity from a scoring_events row, stripping trailing 4-digit years from the name or falling back to eventDate. Used by the Phase 2 backfill to group per-window events into canonical tournaments. * scripts: add backfill orchestrator for canonical layer Populates canonical tournaments, participants, tournament_results, and participant_surface_elos from per-window data for qualifying-points sports. Skips already-linked rows, is idempotent, and supports dry-run mode. Critical invariants enforced by the implementation: - qualifying_points_awarded is never copied to tournament_results - season_participant_qualifying_totals is never touched - conflicting surface-Elo values between windows raise a loud error (recorded in report.errors) rather than overwriting * scripts: add backfill CLI with dry-run default Wires backfill-canonical-layer.ts to a CLI entry point exposed as `npm run backfill:canonical`. Defaults to --dry-run; requires --apply to actually write. Supports --sport=<uuid> to limit to a single sport. Exits 2 if the backfill reports errors (e.g., surface-Elo conflicts). * fix(backfill-cli): wrap runBackfill in DatabaseContext.run The orchestrator uses database() from ~/database/context, which requires AsyncLocalStorage to be populated. Wrap the CLI invocation with DatabaseContext.run(db, ...) using server/db's cached connection pool. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(backfill-cli): exit 0 on success so pg pool doesn't block The cached postgres connection pool keeps the Node event loop open after main() returns. Explicit process.exit(0) on success mirrors the pattern in scripts/capture-baseline.ts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * schema: add check constraint requiring tournament_id for qualifying events Team sports (NHL, NBA, etc.) have scoring_events with no canonical tournament, so we can't require tournament_id globally. The constraint only applies when is_qualifying_event=true. Phase 3 Task 1 of canonical tournament layer migration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat(BatchResultEntry): make form intent configurable Canonical tournament admin page will submit with a different intent (batch-upsert-results). Existing per-window callers continue to get "batch-add-results" as the default, so no behavior changes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat(services): syncTournamentResults fan-out service * schema: add unique (scoring_event_id, season_participant_id) on event_results syncTournamentResults uses check-then-write on event_results. The unique index defends against race conditions (unlikely today — admin is single-writer — but safe to enforce). WARNING: if existing prod data has duplicate (scoring_event_id, season_participant_id) pairs, the migration will fail. Verify with: SELECT scoring_event_id, season_participant_id, count(*) FROM event_results GROUP BY 1, 2 HAVING count(*) > 1; Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat(surface-elo): getSurfaceEloMap reads from canonical Switch the tennis simulator's Elo source from the per-window table to the canonical participant_surface_elos via season_participants.participant_id. Map key stays season_participant.id so the simulator's call pattern is unchanged. Other functions in this file still read/write the per-window table (seasonParticipantSurfaceElos). They back the old admin surface-elo page and are removed in Phase 4 after the canonical admin flow replaces them. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat(admin): canonical tournament list + result entry routes New routes /admin/tournaments and /admin/tournaments/:id. The detail page lets admins enter tournament results once via paste-and-parse, then calls syncTournamentResults to fan out to every linked window. Phase 3 Task 4 of canonical tournament layer migration. * feat: per-window batch-add-results routes through canonical when linked If the scoring_event has a tournament_id, translate season_participant ids to canonical participant ids, upsert tournament_results, and fan out via syncTournamentResults. Team sports (no tournament link) keep the legacy direct-write path. Phase 3 Task 8 of canonical tournament layer migration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat(surface-elo): mirror batchUpsert writes to canonical table The simulator now reads surface Elo from the canonical table (participant_surface_elos). The existing per-window admin page still posts to batchUpsertSurfaceElos; without this change, those edits would silently fail to affect simulator output. Mirror every write to both tables until Phase 4 removes the per-window path entirely. Phase 3 Task 5 (partial — canonical write path; dedicated canonical admin UI deferred; existing page continues to work and now edits both tables). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat: auto-provision canonical tournaments and participants on create Creating new qualifying scoring_events or season_participants now auto-upserts the matching canonical rows. Needed so the check constraint doesn't reject qualifying events, and so new season participants flow through syncTournamentResults. - Extract tournament identity shared between backfill and event-creation into app/lib/tournament-identity.ts; scripts/backfill re-exports it. - createScoringEvent + bulkCreateScoringEvents now accept tournamentId. - Event creation routes auto-compute (name, year) and upsert tournament. - createParticipant + createManyParticipants auto-link to canonical participants by (sportId, name). Phase 3 Task 7 of canonical tournament layer migration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(tests): update surface-elo tests for canonical mirror getSurfaceEloMap now joins through season_participants and returns rows keyed by seasonParticipantId (was participantId). batchUpsertSurfaceElos now performs a second db.select to resolve canonical links before mirroring writes; tests mock the lookup explicitly and exercise both the "no canonical link" short-circuit path and the "mirror to canonical" path. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * migration: add check constraint + unique index for canonical * refactor(surface-elo): canonical-only; drop per-window path batchUpsertSurfaceElos now writes only to the canonical participant_surface_elos table (the mirror step is now the only step). getSurfaceElosForSeason joins through season_participants → canonical participants so the admin UI keeps its existing (id, participantId, sportsSeasonId, ...) row shape. season_participants without a canonical link get silently skipped. In practice every qualifying-points roster entry is canonical-linked after Phase 2 backfill + Phase 3 auto-linking on createParticipant. Phase 4 Tasks 2 + 3 of canonical tournament layer migration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor: remove legacy direct-write fallback in batch-add-results Every qualifying scoring_event now has tournament_id (check constraint enforces it), so the non-canonical fallback is dead. Replace with an explicit error surface so any configuration regression becomes visible instead of silently bypassing canonical. Phase 4 Task 4. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * schema: drop season_participant_surface_elos table Table had no remaining readers after Phase 3 and no remaining writers after Phase 4 Task 2. Also removes the now-unrunnable Phase 2 backfill scripts and the backfill:canonical npm script — the backfill ran once and is preserved in git history (commits 85bca8b, 8186dbb, 6f3438b, bc0f530, 327c7b9). Phase 4 Task 5. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * docs(agents): describe canonical/per-window split Update database.md with the canonical/per-window model explanation, the syncTournamentResults fan-out contract, the check constraint, and the tennis-Men/Women quirk. Update domain-models.md to reflect the renamed per-window entities and the new canonical layer. Also update the drizzle-kit gotchas section with lessons from the migration: do not use --custom for renames; FK constraint naming can mismatch Drizzle convention. Phase 4 Task 6. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * migration: drop season_participant_surface_elos * feat(admin): add Tournaments link to admin sidebar Missed in Phase 3 Task 4 — the /admin/tournaments route exists but was not reachable from the admin nav without typing the URL. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(lint): address 4 oxlint errors on canonical-layer-pr2 - Remove unused filterNewResults import (events batch-add-results legacy path was removed in Phase 4 Task 4). - Replace import() type annotation in sync-tournament-results test with a top-level type import (consistent-type-imports rule). - Hoist tableName helper out of makeFakeDb closure so it's not recreated per call (consistent-function-scoping rule). - eqeqeq: replace `!= null` with explicit null/undefined checks in tournament-identity. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Chris Parsons <chrisp@extrahop.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 21:04:48 -07:00
{
"id": "cf875e21-71e0-40bc-aa85-a1901861b8b0",
"prevId": "feb9e343-a91c-4c94-a77c-6a1d876e42b5",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.accounts": {
"name": "accounts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"account_id": {
"name": "account_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"provider_id": {
"name": "provider_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"access_token": {
"name": "access_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"refresh_token": {
"name": "refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"id_token": {
"name": "id_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"access_token_expires_at": {
"name": "access_token_expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"refresh_token_expires_at": {
"name": "refresh_token_expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"scope": {
"name": "scope",
"type": "text",
"primaryKey": false,
"notNull": false
},
"password": {
"name": "password",
"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": {
"accounts_user_id_users_id_fk": {
"name": "accounts_user_id_users_id_fk",
"tableFrom": "accounts",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"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.commissioner_audit_log": {
"name": "commissioner_audit_log",
"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
},
"league_id": {
"name": "league_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"actor_user_id": {
"name": "actor_user_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"actor_display_name": {
"name": "actor_display_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"action": {
"name": "action",
"type": "audit_action",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"affected_team_ids": {
"name": "affected_team_ids",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"details": {
"name": "details",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"audit_log_season_id_idx": {
"name": "audit_log_season_id_idx",
"columns": [
{
"expression": "season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "created_at",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"commissioner_audit_log_season_id_seasons_id_fk": {
"name": "commissioner_audit_log_season_id_seasons_id_fk",
"tableFrom": "commissioner_audit_log",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"commissioner_audit_log_league_id_leagues_id_fk": {
"name": "commissioner_audit_log_league_id_leagues_id_fk",
"tableFrom": "commissioner_audit_log",
"tableTo": "leagues",
"columnsFrom": [
"league_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.cs2_major_stage_results": {
"name": "cs2_major_stage_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
},
"stage_entry": {
"name": "stage_entry",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"stage_eliminated": {
"name": "stage_eliminated",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"stage_eliminated_wins": {
"name": "stage_eliminated_wins",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"final_placement": {
"name": "final_placement",
"type": "integer",
"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": {
"cs2_major_stage_results_unique": {
"name": "cs2_major_stage_results_unique",
"columns": [
{
"expression": "scoring_event_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "participant_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"cs2_major_stage_results_scoring_event_id_scoring_events_id_fk": {
"name": "cs2_major_stage_results_scoring_event_id_scoring_events_id_fk",
"tableFrom": "cs2_major_stage_results",
"tableTo": "scoring_events",
"columnsFrom": [
"scoring_event_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"cs2_major_stage_results_participant_id_season_participants_id_fk": {
"name": "cs2_major_stage_results_participant_id_season_participants_id_fk",
"tableFrom": "cs2_major_stage_results",
"tableTo": "season_participants",
"columnsFrom": [
"participant_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_season_participants_id_fk": {
"name": "draft_picks_participant_id_season_participants_id_fk",
"tableFrom": "draft_picks",
"tableTo": "season_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_season_participants_id_fk": {
"name": "draft_queue_participant_id_season_participants_id_fk",
"tableFrom": "draft_queue",
"tableTo": "season_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
},
"season_participant_id": {
"name": "season_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": {
"event_results_event_participant_unique": {
"name": "event_results_event_participant_unique",
"columns": [
{
"expression": "scoring_event_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "season_participant_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"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_season_participant_id_season_participants_id_fk": {
"name": "event_results_season_participant_id_season_participants_id_fk",
"tableFrom": "event_results",
"tableTo": "season_participants",
"columnsFrom": [
"season_participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.group_stage_matches": {
"name": "group_stage_matches",
"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
},
"participant1_id": {
"name": "participant1_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"participant2_id": {
"name": "participant2_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"participant1_score": {
"name": "participant1_score",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"participant2_score": {
"name": "participant2_score",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"is_complete": {
"name": "is_complete",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"matchday": {
"name": "matchday",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"scheduled_at": {
"name": "scheduled_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": {
"group_stage_matches_group_pair_unique": {
"name": "group_stage_matches_group_pair_unique",
"columns": [
{
"expression": "tournament_group_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "participant1_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "participant2_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"group_stage_matches_tournament_group_id_tournament_groups_id_fk": {
"name": "group_stage_matches_tournament_group_id_tournament_groups_id_fk",
"tableFrom": "group_stage_matches",
"tableTo": "tournament_groups",
"columnsFrom": [
"tournament_group_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"group_stage_matches_participant1_id_season_participants_id_fk": {
"name": "group_stage_matches_participant1_id_season_participants_id_fk",
"tableFrom": "group_stage_matches",
"tableTo": "season_participants",
"columnsFrom": [
"participant1_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"group_stage_matches_participant2_id_season_participants_id_fk": {
"name": "group_stage_matches_participant2_id_season_participants_id_fk",
"tableFrom": "group_stage_matches",
"tableTo": "season_participants",
"columnsFrom": [
"participant2_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"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
},
"discord_webhook_url": {
"name": "discord_webhook_url",
"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": {},
"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, 4)",
"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_season_participants_id_fk": {
"name": "participant_ev_snapshots_participant_id_season_participants_id_fk",
"tableFrom": "participant_ev_snapshots",
"tableTo": "season_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_golf_skills": {
"name": "participant_golf_skills",
"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
},
"sg_total": {
"name": "sg_total",
"type": "numeric(5, 2)",
"primaryKey": false,
"notNull": false
},
"datagolf_rank": {
"name": "datagolf_rank",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"masters_odds": {
"name": "masters_odds",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"us_open_odds": {
"name": "us_open_odds",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"open_championship_odds": {
"name": "open_championship_odds",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"pga_championship_odds": {
"name": "pga_championship_odds",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"participant_golf_skills_unique": {
"name": "participant_golf_skills_unique",
"columns": [
{
"expression": "participant_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "sports_season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"participant_golf_skills_participant_id_season_participants_id_fk": {
"name": "participant_golf_skills_participant_id_season_participants_id_fk",
"tableFrom": "participant_golf_skills",
"tableTo": "season_participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"participant_golf_skills_sports_season_id_sports_seasons_id_fk": {
"name": "participant_golf_skills_sports_season_id_sports_seasons_id_fk",
"tableFrom": "participant_golf_skills",
"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_season_participants_id_fk": {
"name": "participant_season_results_participant_id_season_participants_id_fk",
"tableFrom": "participant_season_results",
"tableTo": "season_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.participant_surface_elos": {
"name": "participant_surface_elos",
"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
},
"world_ranking": {
"name": "world_ranking",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"elo_hard": {
"name": "elo_hard",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"elo_clay": {
"name": "elo_clay",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"elo_grass": {
"name": "elo_grass",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"participant_surface_elos_participant_unique": {
"name": "participant_surface_elos_participant_unique",
"columns": [
{
"expression": "participant_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"participant_surface_elos_participant_id_participants_id_fk": {
"name": "participant_surface_elos_participant_id_participants_id_fk",
"tableFrom": "participant_surface_elos",
"tableTo": "participants",
"columnsFrom": [
"participant_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()"
},
"sport_id": {
"name": "sport_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"external_key": {
"name": "external_key",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"metadata": {
"name": "metadata",
"type": "jsonb",
"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": {
"participants_sport_name_unique": {
"name": "participants_sport_name_unique",
"columns": [
{
"expression": "sport_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "name",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"participants_sport_id_sports_id_fk": {
"name": "participants_sport_id_sports_id_fk",
"tableFrom": "participants",
"tableTo": "sports",
"columnsFrom": [
"sport_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.pending_standings_mappings": {
"name": "pending_standings_mappings",
"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
},
"external_team_id": {
"name": "external_team_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"team_name": {
"name": "team_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"standing_data": {
"name": "standing_data",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"psm_season_external_id_idx": {
"name": "psm_season_external_id_idx",
"columns": [
{
"expression": "sports_season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "external_team_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"pending_standings_mappings_sports_season_id_sports_seasons_id_fk": {
"name": "pending_standings_mappings_sports_season_id_sports_seasons_id_fk",
"tableFrom": "pending_standings_mappings",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.playoff_match_games": {
"name": "playoff_match_games",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"playoff_match_id": {
"name": "playoff_match_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"game_number": {
"name": "game_number",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"scheduled_at": {
"name": "scheduled_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "playoff_match_game_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'scheduled'"
},
"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
},
"winner_id": {
"name": "winner_id",
"type": "uuid",
"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": {
"playoff_match_games_playoff_match_id_playoff_matches_id_fk": {
"name": "playoff_match_games_playoff_match_id_playoff_matches_id_fk",
"tableFrom": "playoff_match_games",
"tableTo": "playoff_matches",
"columnsFrom": [
"playoff_match_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"playoff_match_games_winner_id_season_participants_id_fk": {
"name": "playoff_match_games_winner_id_season_participants_id_fk",
"tableFrom": "playoff_match_games",
"tableTo": "season_participants",
"columnsFrom": [
"winner_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.playoff_match_odds": {
"name": "playoff_match_odds",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"playoff_match_id": {
"name": "playoff_match_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"moneyline_odds": {
"name": "moneyline_odds",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"implied_probability": {
"name": "implied_probability",
"type": "numeric(6, 4)",
"primaryKey": false,
"notNull": false
},
"odds_source": {
"name": "odds_source",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"recorded_at": {
"name": "recorded_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"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_match_odds_playoff_match_id_playoff_matches_id_fk": {
"name": "playoff_match_odds_playoff_match_id_playoff_matches_id_fk",
"tableFrom": "playoff_match_odds",
"tableTo": "playoff_matches",
"columnsFrom": [
"playoff_match_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"playoff_match_odds_participant_id_season_participants_id_fk": {
"name": "playoff_match_odds_participant_id_season_participants_id_fk",
"tableFrom": "playoff_match_odds",
"tableTo": "season_participants",
"columnsFrom": [
"participant_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_season_participants_id_fk": {
"name": "playoff_matches_participant1_id_season_participants_id_fk",
"tableFrom": "playoff_matches",
"tableTo": "season_participants",
"columnsFrom": [
"participant1_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"playoff_matches_participant2_id_season_participants_id_fk": {
"name": "playoff_matches_participant2_id_season_participants_id_fk",
"tableFrom": "playoff_matches",
"tableTo": "season_participants",
"columnsFrom": [
"participant2_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"playoff_matches_winner_id_season_participants_id_fk": {
"name": "playoff_matches_winner_id_season_participants_id_fk",
"tableFrom": "playoff_matches",
"tableTo": "season_participants",
"columnsFrom": [
"winner_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"playoff_matches_loser_id_season_participants_id_fk": {
"name": "playoff_matches_loser_id_season_participants_id_fk",
"tableFrom": "playoff_matches",
"tableTo": "season_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.regular_season_standings": {
"name": "regular_season_standings",
"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
},
"wins": {
"name": "wins",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"losses": {
"name": "losses",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"ot_losses": {
"name": "ot_losses",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"ties": {
"name": "ties",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"win_pct": {
"name": "win_pct",
"type": "numeric(5, 4)",
"primaryKey": false,
"notNull": false
},
"games_played": {
"name": "games_played",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"games_back": {
"name": "games_back",
"type": "numeric(5, 1)",
"primaryKey": false,
"notNull": false
},
"conference": {
"name": "conference",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"division": {
"name": "division",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"conference_rank": {
"name": "conference_rank",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"division_rank": {
"name": "division_rank",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"league_rank": {
"name": "league_rank",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"streak": {
"name": "streak",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"last_ten": {
"name": "last_ten",
"type": "varchar(15)",
"primaryKey": false,
"notNull": false
},
"home_record": {
"name": "home_record",
"type": "varchar(15)",
"primaryKey": false,
"notNull": false
},
"away_record": {
"name": "away_record",
"type": "varchar(15)",
"primaryKey": false,
"notNull": false
},
"external_team_id": {
"name": "external_team_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"srs": {
"name": "srs",
"type": "numeric(6, 2)",
"primaryKey": false,
"notNull": false
},
"synced_at": {
"name": "synced_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": {
"rss_participant_season_idx": {
"name": "rss_participant_season_idx",
"columns": [
{
"expression": "participant_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "sports_season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"regular_season_standings_participant_id_season_participants_id_fk": {
"name": "regular_season_standings_participant_id_season_participants_id_fk",
"tableFrom": "regular_season_standings",
"tableTo": "season_participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"regular_season_standings_sports_season_id_sports_seasons_id_fk": {
"name": "regular_season_standings_sports_season_id_sports_seasons_id_fk",
"tableFrom": "regular_season_standings",
"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
},
"tournament_id": {
"name": "tournament_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"event_date": {
"name": "event_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"event_starts_at": {
"name": "event_starts_at",
"type": "timestamp with time zone",
"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
},
"bracket_region_config": {
"name": "bracket_region_config",
"type": "jsonb",
"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"
},
"scoring_events_tournament_id_tournaments_id_fk": {
"name": "scoring_events_tournament_id_tournaments_id_fk",
"tableFrom": "scoring_events",
"tableTo": "tournaments",
"columnsFrom": [
"tournament_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {
"scoring_events_qualifying_require_tournament": {
"name": "scoring_events_qualifying_require_tournament",
"value": "NOT \"scoring_events\".\"is_qualifying_event\" OR \"scoring_events\".\"tournament_id\" IS NOT NULL"
}
},
"isRLSEnabled": false
},
"public.season_participant_expected_values": {
"name": "season_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(6, 4)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_second": {
"name": "prob_second",
"type": "numeric(6, 4)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_third": {
"name": "prob_third",
"type": "numeric(6, 4)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_fourth": {
"name": "prob_fourth",
"type": "numeric(6, 4)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_fifth": {
"name": "prob_fifth",
"type": "numeric(6, 4)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_sixth": {
"name": "prob_sixth",
"type": "numeric(6, 4)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_seventh": {
"name": "prob_seventh",
"type": "numeric(6, 4)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"prob_eighth": {
"name": "prob_eighth",
"type": "numeric(6, 4)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"expected_value": {
"name": "expected_value",
"type": "numeric(10, 4)",
"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
},
"source_elo": {
"name": "source_elo",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"world_ranking": {
"name": "world_ranking",
"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": {
"participant_ev_participant_season_unique": {
"name": "participant_ev_participant_season_unique",
"columns": [
{
"expression": "participant_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "sports_season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"season_participant_expected_values_participant_id_season_participants_id_fk": {
"name": "season_participant_expected_values_participant_id_season_participants_id_fk",
"tableFrom": "season_participant_expected_values",
"tableTo": "season_participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"season_participant_expected_values_sports_season_id_sports_seasons_id_fk": {
"name": "season_participant_expected_values_sports_season_id_sports_seasons_id_fk",
"tableFrom": "season_participant_expected_values",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.season_participant_qualifying_totals": {
"name": "season_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": {
"season_participant_qualifying_totals_participant_id_season_participants_id_fk": {
"name": "season_participant_qualifying_totals_participant_id_season_participants_id_fk",
"tableFrom": "season_participant_qualifying_totals",
"tableTo": "season_participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"season_participant_qualifying_totals_sports_season_id_sports_seasons_id_fk": {
"name": "season_participant_qualifying_totals_sports_season_id_sports_seasons_id_fk",
"tableFrom": "season_participant_qualifying_totals",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.season_participant_results": {
"name": "season_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
},
"is_partial_score": {
"name": "is_partial_score",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": 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": {
"season_participant_results_participant_id_season_participants_id_fk": {
"name": "season_participant_results_participant_id_season_participants_id_fk",
"tableFrom": "season_participant_results",
"tableTo": "season_participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"season_participant_results_sports_season_id_sports_seasons_id_fk": {
"name": "season_participant_results_sports_season_id_sports_seasons_id_fk",
"tableFrom": "season_participant_results",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.season_participant_surface_elos": {
"name": "season_participant_surface_elos",
"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
},
"world_ranking": {
"name": "world_ranking",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"elo_hard": {
"name": "elo_hard",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"elo_clay": {
"name": "elo_clay",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"elo_grass": {
"name": "elo_grass",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"participant_surface_elos_unique": {
"name": "participant_surface_elos_unique",
"columns": [
{
"expression": "participant_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "sports_season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"season_participant_surface_elos_participant_id_season_participants_id_fk": {
"name": "season_participant_surface_elos_participant_id_season_participants_id_fk",
"tableFrom": "season_participant_surface_elos",
"tableTo": "season_participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"season_participant_surface_elos_sports_season_id_sports_seasons_id_fk": {
"name": "season_participant_surface_elos_sports_season_id_sports_seasons_id_fk",
"tableFrom": "season_participant_surface_elos",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.season_participants": {
"name": "season_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
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"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, 4)",
"primaryKey": false,
"notNull": true,
"default": "'0'"
},
"vorp_value": {
"name": "vorp_value",
"type": "numeric(10, 4)",
"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": {
"participants_sports_season_name_unique": {
"name": "participants_sports_season_name_unique",
"columns": [
{
"expression": "sports_season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "name",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"season_participants_sports_season_id_sports_seasons_id_fk": {
"name": "season_participants_sports_season_id_sports_seasons_id_fk",
"tableFrom": "season_participants",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"season_participants_participant_id_participants_id_fk": {
"name": "season_participants_participant_id_participants_id_fk",
"tableFrom": "season_participants",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "restrict",
"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
},
"draft_timer_mode": {
"name": "draft_timer_mode",
"type": "draft_timer_mode",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'chess_clock'"
},
"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_completed_at": {
"name": "draft_completed_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"draft_paused": {
"name": "draft_paused",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"overnight_pause_mode": {
"name": "overnight_pause_mode",
"type": "overnight_pause_mode",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'none'"
},
"overnight_pause_start": {
"name": "overnight_pause_start",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"overnight_pause_end": {
"name": "overnight_pause_end",
"type": "varchar(5)",
"primaryKey": false,
"notNull": false
},
"overnight_pause_timezone": {
"name": "overnight_pause_timezone",
"type": "varchar(50)",
"primaryKey": false,
"notNull": 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.sessions": {
"name": "sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"token": {
"name": "token",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "uuid",
"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()"
},
"ip_address": {
"name": "ip_address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"user_agent": {
"name": "user_agent",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sessions_user_id_users_id_fk": {
"name": "sessions_user_id_users_id_fk",
"tableFrom": "sessions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"sessions_token_unique": {
"name": "sessions_token_unique",
"nullsNotDistinct": false,
"columns": [
"token"
]
}
},
"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
},
"simulator_type": {
"name": "simulator_type",
"type": "simulator_type",
"typeSchema": "public",
"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'"
},
"draft_on": {
"name": "draft_on",
"type": "date",
"primaryKey": false,
"notNull": true
},
"draft_off": {
"name": "draft_off",
"type": "date",
"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": {
"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_score_events": {
"name": "team_score_events",
"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
},
"scoring_event_id": {
"name": "scoring_event_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"scoring_event_name": {
"name": "scoring_event_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"sport_name": {
"name": "sport_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"match_id": {
"name": "match_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"participant_ids": {
"name": "participant_ids",
"type": "text[]",
"primaryKey": false,
"notNull": false
},
"points_delta": {
"name": "points_delta",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"occurred_at": {
"name": "occurred_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"team_score_events_match_unique": {
"name": "team_score_events_match_unique",
"columns": [
{
"expression": "team_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "match_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"where": "match_id IS NOT NULL",
"concurrently": false,
"method": "btree",
"with": {}
},
"team_score_events_event_unique": {
"name": "team_score_events_event_unique",
"columns": [
{
"expression": "team_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "scoring_event_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"where": "match_id IS NULL",
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"team_score_events_team_id_teams_id_fk": {
"name": "team_score_events_team_id_teams_id_fk",
"tableFrom": "team_score_events",
"tableTo": "teams",
"columnsFrom": [
"team_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"team_score_events_season_id_seasons_id_fk": {
"name": "team_score_events_season_id_seasons_id_fk",
"tableFrom": "team_score_events",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"team_score_events_scoring_event_id_scoring_events_id_fk": {
"name": "team_score_events_scoring_event_id_scoring_events_id_fk",
"tableFrom": "team_score_events",
"tableTo": "scoring_events",
"columnsFrom": [
"scoring_event_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"team_score_events_match_id_playoff_matches_id_fk": {
"name": "team_score_events_match_id_playoff_matches_id_fk",
"tableFrom": "team_score_events",
"tableTo": "playoff_matches",
"columnsFrom": [
"match_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"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": {
"team_standings_snapshots_unique": {
"name": "team_standings_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_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_season_participants_id_fk": {
"name": "tournament_group_members_participant_id_season_participants_id_fk",
"tableFrom": "tournament_group_members",
"tableTo": "season_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.tournament_results": {
"name": "tournament_results",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tournament_id": {
"name": "tournament_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
},
"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": {
"tournament_results_tournament_participant_unique": {
"name": "tournament_results_tournament_participant_unique",
"columns": [
{
"expression": "tournament_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "participant_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"tournament_results_tournament_id_tournaments_id_fk": {
"name": "tournament_results_tournament_id_tournaments_id_fk",
"tableFrom": "tournament_results",
"tableTo": "tournaments",
"columnsFrom": [
"tournament_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"tournament_results_participant_id_participants_id_fk": {
"name": "tournament_results_participant_id_participants_id_fk",
"tableFrom": "tournament_results",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.tournaments": {
"name": "tournaments",
"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
},
"starts_at": {
"name": "starts_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"ends_at": {
"name": "ends_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"surface": {
"name": "surface",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"location": {
"name": "location",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "tournament_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'scheduled'"
},
"external_key": {
"name": "external_key",
"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": {
"tournaments_sport_name_year_unique": {
"name": "tournaments_sport_name_year_unique",
"columns": [
{
"expression": "sport_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "name",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "year",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"tournaments_sport_id_sports_id_fk": {
"name": "tournaments_sport_id_sports_id_fk",
"tableFrom": "tournaments",
"tableTo": "sports",
"columnsFrom": [
"sport_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": false
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"email_verified": {
"name": "email_verified",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"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
},
"timezone": {
"name": "timezone",
"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": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"users_clerk_id_unique": {
"name": "users_clerk_id_unique",
"nullsNotDistinct": false,
"columns": [
"clerk_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.verifications": {
"name": "verifications",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"identifier": {
"name": "identifier",
"type": "text",
"primaryKey": false,
"notNull": true
},
"value": {
"name": "value",
"type": "text",
"primaryKey": false,
"notNull": true
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"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": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.watchlist": {
"name": "watchlist",
"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
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"watchlist_season_team_participant_unique": {
"name": "watchlist_season_team_participant_unique",
"columns": [
{
"expression": "season_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "team_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "participant_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"watchlist_season_id_seasons_id_fk": {
"name": "watchlist_season_id_seasons_id_fk",
"tableFrom": "watchlist",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"watchlist_team_id_teams_id_fk": {
"name": "watchlist_team_id_teams_id_fk",
"tableFrom": "watchlist",
"tableTo": "teams",
"columnsFrom": [
"team_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"watchlist_participant_id_season_participants_id_fk": {
"name": "watchlist_participant_id_season_participants_id_fk",
"tableFrom": "watchlist",
"tableTo": "season_participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {
"public.audit_action": {
"name": "audit_action",
"schema": "public",
"values": [
"league_settings_changed",
"draft_settings_changed",
"scoring_rules_changed",
"sports_changed",
"draft_order_set",
"draft_order_randomized",
"draft_started",
"draft_paused",
"draft_resumed",
"draft_reset",
"draft_rollback",
"force_autopick",
"force_manual_pick",
"draft_pick_changed",
"time_bank_edited"
]
},
"public.autodraft_mode": {
"name": "autodraft_mode",
"schema": "public",
"values": [
"next_pick",
"while_on"
]
},
"public.draft_timer_mode": {
"name": "draft_timer_mode",
"schema": "public",
"values": [
"chess_clock",
"standard"
]
},
"public.event_type": {
"name": "event_type",
"schema": "public",
"values": [
"playoff_game",
"major_tournament",
"final_standings",
"schedule_event"
]
},
"public.overnight_pause_mode": {
"name": "overnight_pause_mode",
"schema": "public",
"values": [
"none",
"league",
"per_user"
]
},
"public.picked_by_type": {
"name": "picked_by_type",
"schema": "public",
"values": [
"owner",
"commissioner",
"admin",
"auto"
]
},
"public.playoff_match_game_status": {
"name": "playoff_match_game_status",
"schema": "public",
"values": [
"scheduled",
"complete",
"postponed"
]
},
"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.simulator_type": {
"name": "simulator_type",
"schema": "public",
"values": [
"f1_standings",
"indycar_standings",
"golf_qualifying_points",
"playoff_bracket",
"ucl_bracket",
"ncaam_bracket",
"ncaaw_bracket",
"nba_bracket",
"nhl_bracket",
"nfl_bracket",
"afl_bracket",
"snooker_bracket",
"tennis_qualifying_points",
"mlb_bracket",
"wnba_bracket",
"world_cup",
"darts_bracket",
"cs2_major_qualifying_points",
"ncaa_football_bracket",
"llws_bracket"
]
},
"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"
]
},
"public.tournament_status": {
"name": "tournament_status",
"schema": "public",
"values": [
"scheduled",
"in_progress",
"completed"
]
}
},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}