From bd24b45000f979fc4926a45f7d4e9f580359ad56 Mon Sep 17 00:00:00 2001 From: Zac Jones Date: Sat, 20 Jun 2026 18:03:30 -0600 Subject: [PATCH] feat: add benchmark schema primitives --- .../requirements.md | 2 +- .../hillerfit-benchmark-leaderboard/tasks.md | 17 +- .../technical-design.md | 9 +- .../test-strategy.md | 4 +- .../traceability.md | 9 +- .../src/server/crew-judge-rotations.server.ts | 4 +- .../src/components/cohost-sidebar.tsx | 4 +- .../compete/scoring-config-form.tsx | 16 + .../src/components/competition-sidebar.tsx | 4 +- .../components/leaderboard-page-content.tsx | 2 +- .../components/organizer-competition-form.tsx | 77 +- .../src/db/schemas/benchmarks.ts | 1 + .../src/lib/scoring/algorithms/index.ts | 6 + .../judges/judge-scheduling-container.tsx | 2 +- .../organizer-competition-edit-form.tsx | 85 +- .../src/schemas/benchmark.schema.ts | 106 + .../src/schemas/scoring.schema.ts | 19 + .../src/server-fns/check-in-fns.ts | 2 +- .../server-fns/competition-server-logic.ts | 6 +- apps/wodsmith-start/src/types/scoring.ts | 2 + .../organizer-competition-edit-form.test.tsx | 127 + .../test/lib/scoring/factory.test.ts | 29 + .../test/schemas/benchmark.test.ts | 103 + .../test/schemas/scoring.test.ts | 56 +- lat.md/competition-type-capabilities.md | 4 + lat.md/domain.md | 10 + .../0003_benchmark-battery.sql | 70 + .../mysql-migrations/meta/0003_snapshot.json | 13277 ++++++++++++++++ .../mysql-migrations/meta/_journal.json | 7 + packages/wodsmith-db/src/schema.ts | 1 + .../wodsmith-db/src/schemas/benchmarks.ts | 186 + packages/wodsmith-db/src/schemas/common.ts | 5 + .../wodsmith-db/src/schemas/competitions.ts | 3 +- .../wodsmith-db/src/schemas/programming.ts | 5 + packages/wodsmith-db/src/schemas/scores.ts | 6 + 35 files changed, 14169 insertions(+), 97 deletions(-) create mode 100644 apps/wodsmith-start/src/db/schemas/benchmarks.ts create mode 100644 apps/wodsmith-start/src/schemas/benchmark.schema.ts create mode 100644 apps/wodsmith-start/test/components/organizer-competition-edit-form.test.tsx create mode 100644 apps/wodsmith-start/test/schemas/benchmark.test.ts create mode 100644 packages/wodsmith-db/mysql-migrations/0003_benchmark-battery.sql create mode 100644 packages/wodsmith-db/mysql-migrations/meta/0003_snapshot.json create mode 100644 packages/wodsmith-db/src/schemas/benchmarks.ts diff --git a/ai/research/hillerfit-benchmark-leaderboard/requirements.md b/ai/research/hillerfit-benchmark-leaderboard/requirements.md index 16e5e7042..b4c58bdba 100644 --- a/ai/research/hillerfit-benchmark-leaderboard/requirements.md +++ b/ai/research/hillerfit-benchmark-leaderboard/requirements.md @@ -53,4 +53,4 @@ v1 is done when a seeded benchmark board can be created, a qualified athlete can ## Current Repository Baseline -As of this packet, `apps/wodsmith-start/src/lib/competitions/capabilities.ts` already defines `competitionCan`, `leaderboardVariant`, selectability helpers, result-entry helpers, and a registry for `in-person` and `online`. The existing test suite intentionally expects `benchmark` to be unknown and fail closed. The first benchmark task updates that baseline deliberately. +As of M0a, `apps/wodsmith-start/src/lib/competitions/capabilities.ts` defines `competitionCan`, `leaderboardVariant`, selectability helpers, result-entry helpers, and registered entries for `in-person`, `online`, and `benchmark`. Benchmark declares `videoSubmissions` and `perpetual`, remains hidden from the generic create picker, and still requires M1 schema/seed work before real benchmark rows can exist. diff --git a/ai/research/hillerfit-benchmark-leaderboard/tasks.md b/ai/research/hillerfit-benchmark-leaderboard/tasks.md index 47e661ec9..bced274ac 100644 --- a/ai/research/hillerfit-benchmark-leaderboard/tasks.md +++ b/ai/research/hillerfit-benchmark-leaderboard/tasks.md @@ -16,9 +16,9 @@ Acceptance criteria: - Benchmark-capable registry entry can be added without reintroducing literal online/in-person checks at those chokepoints. - `scoringAlgorithm === "online"` branches remain untouched. -## M1 Schema And PDF-Derived Seed +## M1a Schema Primitives -Add benchmark type, benchmark tables, shared columns, validation schemas, and the training-PDF-derived seed. +Add benchmark persistence primitives, shared columns, and validation schemas. This slice does not seed PDF-derived benchmark rows. Acceptance criteria: @@ -26,9 +26,20 @@ Acceptance criteria: - `benchmark_batteries`, `benchmark_tests`, and `benchmark_tier_thresholds` are defined and exported. - `trackWorkouts.benchmarkTestId`, `trackWorkouts.benchmarkCategory`, and `scores.benchmarkVariant` are migrated. - Categories JSON validates on write, publish, and read; `testCount` is treated as a validated cache. +- `absolute_tier` config validation requires `absoluteTier.batteryId`, while the scoring dispatcher fails closed until M2 implements the engine. +- Generic create/edit forms do not expose `benchmark` as a selectable type or render in-person-only venue fields for stored benchmark rows. +- No task creates HillerFit-branded pages, routes, product navigation, marketing copy, logos, or theme treatments. + +## M1b PDF-Derived Seed And Receipt + +Create the first generic benchmark battery from the local training PDF and record the extraction assumptions. + +Acceptance criteria: + - Seed creates one Open division, individual-only tests, benchmark competition settings, included/deferred tests, and pre-encoded thresholds from `/Users/zacjones/Downloads/HillerFit_Training_Guide.pdf`. - Seed or companion receipt records extraction assumptions and any intentionally deferred tests. -- No task creates HillerFit-branded pages, routes, marketing copy, logos, or theme treatments. +- Seed validation proves every included test has 10 thresholds per supported variant and a matching tagged `trackWorkout`. +- No task creates HillerFit-branded pages, routes, product navigation, marketing copy, logos, or theme treatments. ## M2 Absolute-Tier Scoring diff --git a/ai/research/hillerfit-benchmark-leaderboard/technical-design.md b/ai/research/hillerfit-benchmark-leaderboard/technical-design.md index 901fad07f..e424ec307 100644 --- a/ai/research/hillerfit-benchmark-leaderboard/technical-design.md +++ b/ai/research/hillerfit-benchmark-leaderboard/technical-design.md @@ -18,7 +18,7 @@ This design defines the components and contracts engineers should build for v1. ### New Tables -- `benchmark_batteries`: named product, owner, slug, categories JSON, rating bands JSON, `maxTier`, `scoreMax`, `videoPolicy`, `isOpenJoin`, `variantScalingGroupId`, `competitionId`, status, and non-null `ownerKey` for global slug uniqueness. +- `benchmark_batteries`: named product, owner, slug, categories JSON payload, rating bands JSON payload, `maxTier`, `scoreMax`, `videoPolicy`, `isOpenJoin`, `variantScalingGroupId`, `competitionId`, status, and non-null `ownerKey` for global slug uniqueness. The current MySQL schema stores these JSON payloads in text columns; every write/read/publish path must parse and validate them fail-closed. - `benchmark_tests`: one test per battery test, with category key, name, position, workout scheme, score type, input unit, `includedInScoring`, optional time cap, and nullable v2 hybrid metadata. - `benchmark_tier_thresholds`: one pre-encoded threshold per `(test, variant, tier)`, with raw display value preserved. @@ -35,10 +35,11 @@ This design defines the components and contracts engineers should build for v1. ## Core Dependencies - M0a registry extension must land before benchmark submission and leaderboard chokepoints. The base registry already exists for current competition types. -- M1 schema/seed must land before M2 integration tests can use real benchmark rows. +- M1a schema primitives must land before M1b can seed benchmark rows. +- M1b PDF-derived seed and extraction receipt must land before M2 integration tests can use real benchmark rows. - M2 absolute-tier algorithm must land before M3 can implement keep-best-on-write correctly. - M3 submission must land before M4 can verify real leaderboard and stats flows. -- M1 seed data depends on extracting tests/thresholds from the local training PDF and recording extraction assumptions. +- M1b seed data depends on extracting tests/thresholds from the local training PDF and recording extraction assumptions. ## Read Flow @@ -73,4 +74,4 @@ This design defines the components and contracts engineers should build for v1. ## Branding Boundary -Benchmark routes, tabs, headings, empty states, and stats components use WODsmith's generic benchmark language. The PDF may influence seed data names, test labels, thresholds, categories, and rating bands, but it must not introduce HillerFit-branded pages, routes, logos, marketing sections, or visual theme. +Benchmark routes, tabs, product navigation, headings, empty states, and stats components use WODsmith's generic benchmark language. The PDF may influence seed data names, test labels, thresholds, categories, and rating bands, but it must not introduce HillerFit-branded pages, routes, navigation entries, logos, marketing sections, or visual theme. diff --git a/ai/research/hillerfit-benchmark-leaderboard/test-strategy.md b/ai/research/hillerfit-benchmark-leaderboard/test-strategy.md index c8a406bf0..5ba061bd8 100644 --- a/ai/research/hillerfit-benchmark-leaderboard/test-strategy.md +++ b/ai/research/hillerfit-benchmark-leaderboard/test-strategy.md @@ -30,7 +30,7 @@ This strategy makes the implementation testable without requiring the full histo - Leaderboard chooses online visual variant for benchmark through `leaderboardVariant` while avoiding publish gating. - Stats tab appears only for `absolute_tier` competitions. - Stats page distinguishes untested, attempted tier 0, unavailable config, pending, verified, adjusted, and invalid/excluded states. -- Route/component assertions confirm benchmark pages use generic WODsmith benchmark language and do not introduce HillerFit-branded pages/routes. +- Route/component/navigation assertions confirm benchmark pages use generic WODsmith benchmark language and do not introduce HillerFit-branded pages, routes, tabs, product navigation entries, or calls to action. - Benchmark event detail submission UI blocks missing gender and surfaces the profile-completion path. - Open-join flow rejects unpublished/private boards and duplicate races collapse to one registration. @@ -51,7 +51,7 @@ This strategy makes the implementation testable without requiring the full histo 6. Mark a score invalid and confirm public leaderboard/stat page excludes it. 7. Confirm the leaderboard shows Overall/100, category scores, rating band, verification state, and no publish-required empty board. 8. Confirm standard online and in-person competition smoke paths still behave as before for the refactored chokepoints. -9. Confirm no HillerFit-branded page, route, logo, marketing section, or theme treatment was added. +9. Confirm no HillerFit-branded page, route, tab, product navigation entry, logo, marketing section, call to action, or theme treatment was added. ## Required Checks diff --git a/ai/research/hillerfit-benchmark-leaderboard/traceability.md b/ai/research/hillerfit-benchmark-leaderboard/traceability.md index 55e508b47..285064201 100644 --- a/ai/research/hillerfit-benchmark-leaderboard/traceability.md +++ b/ai/research/hillerfit-benchmark-leaderboard/traceability.md @@ -4,13 +4,14 @@ This matrix links implementation artifacts back to the guide and the required te | Contract | Guide Source | Implementation Artifact | Tests | | --- | --- | --- | --- | -| Distinct benchmark competition type | Guide §0 D-A, §5.2, §10 M0a/M1 | `requirements.md`, `technical-design.md`, `tasks.md` M0a/M1 | Extend current registry, capability truth table, chokepoint characterization | +| Distinct benchmark competition type | Guide §0 D-A, §5.2, §10 M0a/M1 | `requirements.md`, `technical-design.md`, `tasks.md` M0a/M1a | Extend current registry, capability truth table, chokepoint characterization | +| Benchmark schema primitives | Guide §5.2, §6.3, §10 M1 | `technical-design.md` data model, `tasks.md` M1a, `lat.md/domain.md` | Migration, schema ownership, JSON validators, scoring-config validation, fail-closed scoring dispatch | | Variant snapshot, not division | Guide §5.1, §8.1, §13.5 | `requirements.md`, `technical-design.md` data/write flow, `tasks.md` M3 | Submission integration, leaderboard variant read, missing variant fail-closed | | Best-to-date v1 | Guide §7, §8.1, §10 M3 | `requirements.md`, `technical-design.md` write flow, `tasks.md` M3 | Keep-best-on-write, worse/equal retest ignored | | No publish gate for benchmark | Guide §5.2, §7.4, §13.19 | `requirements.md`, `technical-design.md` failure behavior, `tasks.md` M4 | Public visibility without `divisionResults`, invalid rows excluded | -| 55-test training-guide Lite denominator | Guide §2.1, §9, §10 M1 | `requirements.md`, `technical-design.md` data model, `tasks.md` M1/M2 | PDF-derived seed validation, derived denominator, deferred tests excluded | +| 55-test training-guide Lite denominator | Guide §2.1, §9, §10 M1 | `requirements.md`, `technical-design.md` data model, `tasks.md` M1b/M2 | PDF-derived seed validation, derived denominator, deferred tests excluded | | Absolute tier scoring | Guide §6.1-§6.5, §10 M2 | `technical-design.md`, `tasks.md` M2 | Tier, direction, half-tier, tiebreak, aggregation unit tests | | Stats page | Guide §8.3, §10 M4 | `requirements.md`, `technical-design.md`, `tasks.md` M4 | Route/component tests and manual QA | | V2 boundary | Guide §7, §10 V2 | `requirements.md`, `tasks.md` V2, `assumptions-and-decisions.md` | Migration check excludes `score_attempts` | -| No HillerFit-branded pages | Guide §0 D-D, §12.12 | `requirements.md`, `technical-design.md`, `assumptions-and-decisions.md` | Route/component assertions and manual QA | -| PDF source data | Guide §0 D-D, §12.12 | `requirements.md`, `tasks.md` M1, `test-strategy.md` | Extraction receipt and seed validation | +| No HillerFit-branded pages or navigation | Guide §0 D-D, §12.12 | `requirements.md`, `technical-design.md`, `tasks.md`, `assumptions-and-decisions.md` | Route/component/navigation assertions and manual QA | +| PDF source data | Guide §0 D-D, §12.12 | `requirements.md`, `tasks.md` M1b, `test-strategy.md` | Extraction receipt and seed validation | diff --git a/apps/crew/src/server/crew-judge-rotations.server.ts b/apps/crew/src/server/crew-judge-rotations.server.ts index b2f87761d..5400b1b90 100644 --- a/apps/crew/src/server/crew-judge-rotations.server.ts +++ b/apps/crew/src/server/crew-judge-rotations.server.ts @@ -48,6 +48,8 @@ type RotationQueryDb = Pick type CompetitionJudgeRotation = typeof competitionJudgeRotationsTable.$inferSelect type JudgeAssignmentVersion = typeof judgeAssignmentVersionsTable.$inferSelect +type StoredCompetitionType = + (typeof competitionsTable.$inferSelect)["competitionType"] type CrewJudgeHeatRow = { id: string trackWorkoutId: string @@ -71,7 +73,7 @@ export interface CrewJudgeEvent { startDate: string endDate: string timezone: string | null - competitionType: "in-person" | "online" + competitionType: StoredCompetitionType } export interface CrewJudgeWorkout { diff --git a/apps/wodsmith-start/src/components/cohost-sidebar.tsx b/apps/wodsmith-start/src/components/cohost-sidebar.tsx index 07e332dad..4905daa67 100644 --- a/apps/wodsmith-start/src/components/cohost-sidebar.tsx +++ b/apps/wodsmith-start/src/components/cohost-sidebar.tsx @@ -55,7 +55,7 @@ import { canDisplayPhysicalVenue } from "@/lib/competitions/venue-volunteer-gate interface CohostSidebarProps { competitionId: string competitionName: string - competitionType?: "in-person" | "online" + competitionType?: string permissions: CohostMembershipMetadata children: React.ReactNode } @@ -74,7 +74,7 @@ interface NavGroup { const getNavigation = ( basePath: string, - competitionType?: "in-person" | "online", + competitionType?: string, permissions?: CohostMembershipMetadata, ): { overview: NavItem; groups: NavGroup[] } => { const type = competitionType ?? "" diff --git a/apps/wodsmith-start/src/components/compete/scoring-config-form.tsx b/apps/wodsmith-start/src/components/compete/scoring-config-form.tsx index c6d4f2b36..d4dbe72be 100644 --- a/apps/wodsmith-start/src/components/compete/scoring-config-form.tsx +++ b/apps/wodsmith-start/src/components/compete/scoring-config-form.tsx @@ -58,6 +58,18 @@ function EditablePointsPreview({ ) } + if (!basePoints && algorithm === "absolute_tier") { + return ( +
+

Points Preview

+

+ Absolute-tier scoring uses fixed benchmark thresholds from the + selected benchmark battery. +

+
+ ) + } + // scoringAlgorithm axis, not competitionType. // Online scoring - static display, no customization if (algorithm === "online" || baseTemplate === "online") { @@ -257,6 +269,7 @@ function getBaseTemplateFromAlgorithm( case "custom": case "p_score": case "online": + case "absolute_tier": return "traditional" case "winner_takes_more": return "winner_takes_more" @@ -273,6 +286,7 @@ function getPreviewTemplateFromAlgorithm( case "traditional": case "custom": case "p_score": + case "absolute_tier": return "traditional" case "winner_takes_more": return "winner_takes_more" @@ -477,6 +491,8 @@ export function ScoringConfigForm({ return null // P-Score is dynamic case "online": return null // Online is handled separately in preview + case "absolute_tier": + return null // Benchmark thresholds are displayed by benchmark-specific UI default: return generatePointsTable("traditional", 100) } diff --git a/apps/wodsmith-start/src/components/competition-sidebar.tsx b/apps/wodsmith-start/src/components/competition-sidebar.tsx index ad68c287a..e3226cbc6 100644 --- a/apps/wodsmith-start/src/components/competition-sidebar.tsx +++ b/apps/wodsmith-start/src/components/competition-sidebar.tsx @@ -64,7 +64,7 @@ import { cn } from "@/utils/cn" interface CompetitionSidebarProps { competitionId: string - competitionType?: "in-person" | "online" + competitionType?: string children: React.ReactNode } @@ -82,7 +82,7 @@ interface NavGroup { const getNavigation = ( basePath: string, - competitionType?: "in-person" | "online", + competitionType?: string, ): { overview: NavItem; groups: NavGroup[] } => { const type = competitionType ?? "" diff --git a/apps/wodsmith-start/src/components/leaderboard-page-content.tsx b/apps/wodsmith-start/src/components/leaderboard-page-content.tsx index 825982656..8e8a55faa 100644 --- a/apps/wodsmith-start/src/components/leaderboard-page-content.tsx +++ b/apps/wodsmith-start/src/components/leaderboard-page-content.tsx @@ -49,7 +49,7 @@ interface LeaderboardDivision { interface LeaderboardCompetitionInfo { slug: string - competitionType: "in-person" | "online" + competitionType: string } /** diff --git a/apps/wodsmith-start/src/components/organizer-competition-form.tsx b/apps/wodsmith-start/src/components/organizer-competition-form.tsx index 8db847071..d5a9c1143 100644 --- a/apps/wodsmith-start/src/components/organizer-competition-form.tsx +++ b/apps/wodsmith-start/src/components/organizer-competition-form.tsx @@ -155,6 +155,12 @@ export function OrganizerCompetitionForm({ const navigate = useNavigate() const router = useRouter() const isEditMode = !!competition + const initialCompetitionType: CompetitionTypeId = + isSelectableCompetitionTypeValue(competition?.competitionType) + ? competition.competitionType + : "in-person" + const showCompetitionTypeField = + !isEditMode || isSelectableCompetitionTypeValue(competition?.competitionType) // Determine if existing competition is multi-day (start and end dates differ) const existingIsMultiDay = competition @@ -168,7 +174,7 @@ export function OrganizerCompetitionForm({ teamId: competition?.organizingTeamId ?? selectedTeamId, name: competition?.name ?? "", slug: competition?.slug ?? "", - competitionType: competition?.competitionType ?? "in-person", + competitionType: initialCompetitionType, isMultiDay: existingIsMultiDay, startDate: competition?.startDate ? formatDateForInput(competition.startDate) @@ -442,40 +448,41 @@ export function OrganizerCompetitionForm({ )} /> - {/* Competition Type */} - ( - - Competition Type - - - {field.value === "online" - ? "Athletes submit video recordings of their workouts" - : "Athletes compete at a physical venue"} - - - - )} - /> + {showCompetitionTypeField && ( + ( + + Competition Type + + + {field.value === "online" + ? "Athletes submit video recordings of their workouts" + : "Athletes compete at a physical venue"} + + + + )} + /> + )} {/* Series/Group Selector */} {groups.length > 0 && ( diff --git a/apps/wodsmith-start/src/db/schemas/benchmarks.ts b/apps/wodsmith-start/src/db/schemas/benchmarks.ts new file mode 100644 index 000000000..5d9a85732 --- /dev/null +++ b/apps/wodsmith-start/src/db/schemas/benchmarks.ts @@ -0,0 +1 @@ +export * from "@repo/wodsmith-db/schemas/benchmarks" diff --git a/apps/wodsmith-start/src/lib/scoring/algorithms/index.ts b/apps/wodsmith-start/src/lib/scoring/algorithms/index.ts index 1858ce3a1..359353e85 100644 --- a/apps/wodsmith-start/src/lib/scoring/algorithms/index.ts +++ b/apps/wodsmith-start/src/lib/scoring/algorithms/index.ts @@ -177,6 +177,8 @@ export function calculateEventPoints( return calculateOnlineEventPoints(scores, scheme, config) case "custom": return calculateCustomEventPoints(scores, scheme, config) + case "absolute_tier": + throw new Error("absolute_tier scoring is configured but not implemented") default: { // TypeScript exhaustiveness check const _exhaustive: never = config.algorithm @@ -656,6 +658,8 @@ export function calculatePointsForPlace({ ) case "p_score": return 0 + case "absolute_tier": + throw new Error("absolute_tier place points are not available") default: { const _exhaustive: never = config.algorithm throw new Error(`Unknown scoring algorithm: ${_exhaustive}`) @@ -680,6 +684,8 @@ export function getScoringAlgorithmName( return "Online" case "custom": return "Custom" + case "absolute_tier": + return "Absolute Tier" } } diff --git a/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/-components/judges/judge-scheduling-container.tsx b/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/-components/judges/judge-scheduling-container.tsx index 608f9c22f..0e6dee654 100644 --- a/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/-components/judges/judge-scheduling-container.tsx +++ b/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/-components/judges/judge-scheduling-container.tsx @@ -121,7 +121,7 @@ interface JudgeSchedulingContainerProps { competitionId: string competitionSlug: string organizingTeamId: string - competitionType: "in-person" | "online" + competitionType: string events: CompetitionWorkout[] heats: HeatWithAssignments[] judges: JudgeVolunteerInfo[] diff --git a/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/-components/organizer-competition-edit-form.tsx b/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/-components/organizer-competition-edit-form.tsx index 2a65ed6fc..4975ee192 100644 --- a/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/-components/organizer-competition-edit-form.tsx +++ b/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/-components/organizer-competition-edit-form.tsx @@ -42,6 +42,7 @@ import { isSelectableCompetitionTypeValue, selectableCompetitionTypeOptions, } from "@/lib/competitions/capabilities" +import { canDisplayPhysicalVenue } from "@/lib/competitions/venue-volunteer-gates" import { updateCompetitionFn } from "@/server-fns/competition-fns" import { COMMON_US_TIMEZONES, DEFAULT_TIMEZONE } from "@/utils/timezone-utils" @@ -194,13 +195,20 @@ export function OrganizerCompetitionEditForm({ const existingIsMultiDay = formatDateForInput(competition.startDate) !== formatDateForInput(competition.endDate) + const initialCompetitionType: CompetitionTypeId = + isSelectableCompetitionTypeValue(competition.competitionType) + ? competition.competitionType + : "in-person" + const showCompetitionTypeField = isSelectableCompetitionTypeValue( + competition.competitionType, + ) const form = useForm({ resolver: standardSchemaResolver(formSchema), defaultValues: { name: competition.name, slug: competition.slug, - competitionType: competition.competitionType ?? "in-person", + competitionType: initialCompetitionType, isMultiDay: existingIsMultiDay, startDate: formatDateForInput(competition.startDate), endDate: formatDateForInput(competition.endDate), @@ -228,6 +236,10 @@ export function OrganizerCompetitionEditForm({ const isMultiDay = form.watch("isMultiDay") const competitionType = form.watch("competitionType") + const effectiveCompetitionType = showCompetitionTypeField + ? competitionType + : competition.competitionType + const showLocationSection = canDisplayPhysicalVenue(effectiveCompetitionType) // Auto-generate slug from name const handleNameChange = (name: string) => { @@ -261,11 +273,13 @@ export function OrganizerCompetitionEditForm({ groupId: data.groupId, visibility: data.visibility, status: data.status, - competitionType: data.competitionType, + ...(showCompetitionTypeField + ? { competitionType: data.competitionType } + : {}), profileImageUrl, bannerImageUrl, timezone: data.timezone, - address: data.address, + address: showLocationSection ? data.address : undefined, }, }) toast.success("Competition updated successfully") @@ -337,39 +351,40 @@ export function OrganizerCompetitionEditForm({ )} /> - {/* Competition Type */} - ( - - Competition Type - - - {field.value === "online" - ? "Athletes submit video recordings of their workouts" - : "Athletes compete at a physical venue"} - - - - )} - /> + {showCompetitionTypeField && ( + ( + + Competition Type + + + {field.value === "online" + ? "Athletes submit video recordings of their workouts" + : "Athletes compete at a physical venue"} + + + + )} + /> + )} - {/* Location Section - Only shown for in-person competitions */} - {competitionType === "in-person" && ( + {/* Location Section - Only shown for competition types with physical venues */} + {showLocationSection && (
diff --git a/apps/wodsmith-start/src/schemas/benchmark.schema.ts b/apps/wodsmith-start/src/schemas/benchmark.schema.ts new file mode 100644 index 000000000..49de73906 --- /dev/null +++ b/apps/wodsmith-start/src/schemas/benchmark.schema.ts @@ -0,0 +1,106 @@ +import { z } from "zod" + +export const benchmarkKeySchema = z + .string() + .min(1) + .max(64) + .regex(/^[a-z][a-z0-9_]*$/, "Use lowercase letters, numbers, and underscores") + +export const benchmarkCategorySchema = z + .object({ + key: benchmarkKeySchema, + label: z.string().min(1).max(80), + testCount: z.number().int().nonnegative(), + weight: z.number().positive().default(1), + }) + .strict() + +export const benchmarkCategoriesSchema = z + .array(benchmarkCategorySchema) + .min(1) + .superRefine((categories, ctx) => { + const seen = new Set() + + for (const [index, category] of categories.entries()) { + if (seen.has(category.key)) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: `Duplicate benchmark category key: ${category.key}`, + path: [index, "key"], + }) + } + seen.add(category.key) + } + }) + +export const benchmarkRatingBandSchema = z + .object({ + key: benchmarkKeySchema, + label: z.string().min(1).max(80), + minScore: z.number().min(0), + maxScore: z.number().min(0), + }) + .strict() + .refine((band) => band.maxScore >= band.minScore, { + message: "maxScore must be greater than or equal to minScore", + path: ["maxScore"], + }) + +export const benchmarkRatingBandsSchema = z + .array(benchmarkRatingBandSchema) + .min(1) + +export const benchmarkVideoPolicySchema = z.enum([ + "never", + "for_top_scores", + "always", +]) + +export const benchmarkThresholdValuesSchema = z.array(z.number().int()).length(10) + +export const benchmarkVariantSchema = z.enum(["male", "female"]) + +export interface BenchmarkCategoryCountTest { + categoryKey: string + includedInScoring: boolean +} + +export function getBenchmarkCategoryCountIssues( + categories: ReadonlyArray, + tests: Iterable, +): string[] { + const actualCounts = new Map() + + for (const test of tests) { + if (!test.includedInScoring) continue + actualCounts.set( + test.categoryKey, + (actualCounts.get(test.categoryKey) ?? 0) + 1, + ) + } + + const categoryKeys = new Set(categories.map((category) => category.key)) + const issues: string[] = [] + + for (const category of categories) { + const actualCount = actualCounts.get(category.key) ?? 0 + if (actualCount !== category.testCount) { + issues.push( + `Category ${category.key} declares testCount ${category.testCount} but has ${actualCount} included tests`, + ) + } + } + + for (const categoryKey of actualCounts.keys()) { + if (!categoryKeys.has(categoryKey)) { + issues.push(`Included test references unknown category ${categoryKey}`) + } + } + + return issues +} + +export type BenchmarkCategory = z.infer +export type BenchmarkRatingBand = z.infer +export type BenchmarkVideoPolicy = z.infer +export type BenchmarkVariant = z.infer diff --git a/apps/wodsmith-start/src/schemas/scoring.schema.ts b/apps/wodsmith-start/src/schemas/scoring.schema.ts index 4df11cc03..ac0fe362f 100644 --- a/apps/wodsmith-start/src/schemas/scoring.schema.ts +++ b/apps/wodsmith-start/src/schemas/scoring.schema.ts @@ -16,6 +16,7 @@ import { z } from "zod" * - winner_takes_more: Top positions get disproportionately more points (like Functional Fitness Games) * - online: Place-based scoring (1st=1pt, 2nd=2pts...) - lowest total wins * - custom: User-defined points table with overrides + * - absolute_tier: Fixed benchmark thresholds scored as absolute tiers */ export const scoringAlgorithmSchema = z.enum([ "traditional", @@ -23,6 +24,7 @@ export const scoringAlgorithmSchema = z.enum([ "winner_takes_more", "online", "custom", + "absolute_tier", ]) export type ScoringAlgorithm = z.infer @@ -75,6 +77,12 @@ export const customTableConfigSchema = z.object({ }) export type CustomTableConfig = z.infer +export const absoluteTierConfigSchema = z.object({ + /** Benchmark battery whose category/test/threshold rows define the scoring table */ + batteryId: z.string().min(1), +}) +export type AbsoluteTierConfig = z.infer + /** * Tiebreaker configuration (base schema without default) */ @@ -134,10 +142,21 @@ export const scoringConfigSchema = z.object({ /** Custom points table settings (optional) */ customTable: customTableConfigSchema.optional(), + /** Absolute-tier benchmark settings (required for absolute_tier) */ + absoluteTier: absoluteTierConfigSchema.optional(), + /** Tiebreaker configuration */ tiebreaker: tiebreakerConfigSchema, /** DNF/DNS/Withdrawn handling */ statusHandling: statusHandlingConfigSchema, +}).superRefine((config, ctx) => { + if (config.algorithm === "absolute_tier" && !config.absoluteTier?.batteryId) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: "absoluteTier.batteryId is required for absolute_tier scoring", + path: ["absoluteTier", "batteryId"], + }) + } }) export type ScoringConfig = z.infer diff --git a/apps/wodsmith-start/src/server-fns/check-in-fns.ts b/apps/wodsmith-start/src/server-fns/check-in-fns.ts index f9e7f4f59..c2aaef845 100644 --- a/apps/wodsmith-start/src/server-fns/check-in-fns.ts +++ b/apps/wodsmith-start/src/server-fns/check-in-fns.ts @@ -51,7 +51,7 @@ async function requireCheckInAccess(competitionId: string): Promise<{ id: string organizingTeamId: string competitionTeamId: string | null - competitionType: "in-person" | "online" + competitionType: string } userId: string }> { diff --git a/apps/wodsmith-start/src/server-fns/competition-server-logic.ts b/apps/wodsmith-start/src/server-fns/competition-server-logic.ts index 2d0ea4bdf..a005da453 100644 --- a/apps/wodsmith-start/src/server-fns/competition-server-logic.ts +++ b/apps/wodsmith-start/src/server-fns/competition-server-logic.ts @@ -18,6 +18,8 @@ import { import { teamTable } from "@/db/schemas/teams" import { generateSlug } from "@/utils/slugify" +type StoredCompetitionType = Competition["competitionType"] + /* -------------------------------------------------------------------------- */ /* Competition Group Functions */ /* -------------------------------------------------------------------------- */ @@ -193,7 +195,7 @@ export async function createCompetition(params: { groupId?: string settings?: string timezone?: string // IANA timezone string (e.g., "America/Denver") - competitionType?: "in-person" | "online" + competitionType?: StoredCompetitionType }): Promise<{ competitionId: string; competitionTeamId: string }> { const db = getDb() @@ -340,7 +342,7 @@ export async function updateCompetition( settings: string | null visibility: "public" | "private" status: "draft" | "published" - competitionType: "in-person" | "online" + competitionType: StoredCompetitionType profileImageUrl: string | null bannerImageUrl: string | null timezone: string // IANA timezone string diff --git a/apps/wodsmith-start/src/types/scoring.ts b/apps/wodsmith-start/src/types/scoring.ts index 2c7f034ae..00f2887ae 100644 --- a/apps/wodsmith-start/src/types/scoring.ts +++ b/apps/wodsmith-start/src/types/scoring.ts @@ -11,6 +11,7 @@ // Re-export all types from the Zod schema file // This provides a single import point for types without needing to import Zod export type { + AbsoluteTierConfig, CustomTableConfig, PScoreConfig, ScoringAlgorithm, @@ -23,6 +24,7 @@ export type { // Re-export schemas for validation use export { + absoluteTierConfigSchema, customTableConfigSchema, pScoreConfigSchema, scoringAlgorithmSchema, diff --git a/apps/wodsmith-start/test/components/organizer-competition-edit-form.test.tsx b/apps/wodsmith-start/test/components/organizer-competition-edit-form.test.tsx new file mode 100644 index 000000000..857bcc6e5 --- /dev/null +++ b/apps/wodsmith-start/test/components/organizer-competition-edit-form.test.tsx @@ -0,0 +1,127 @@ +import { fireEvent, render, screen, waitFor } from "@testing-library/react" +import type { ComponentProps } from "react" +import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest" +import { OrganizerCompetitionEditForm } from "@/routes/compete/organizer/$competitionId/-components/organizer-competition-edit-form" + +const updateCompetitionFnMock = vi.hoisted(() => vi.fn()) + +vi.mock("@tanstack/react-router", () => ({ + useRouter: () => ({ navigate: vi.fn(), invalidate: vi.fn() }), +})) + +vi.mock("@tanstack/react-start", () => ({ + useServerFn: (fn: unknown) => fn, +})) + +vi.mock("@/server-fns/competition-fns", () => ({ + updateCompetitionFn: updateCompetitionFnMock, +})) + +vi.mock("@/components/forms/address-fields", () => ({ + AddressFields: () =>
Address fields
, +})) + +vi.mock("@/components/ui/image-upload", () => ({ + ImageUpload: () =>
, +})) + +type EditCompetition = ComponentProps< + typeof OrganizerCompetitionEditForm +>["competition"] + +beforeAll(() => { + globalThis.ResizeObserver ??= class ResizeObserver { + observe() {} + unobserve() {} + disconnect() {} + } +}) + +function createCompetition(competitionType: string): EditCompetition { + return { + id: "comp_test", + organizingTeamId: "team_org", + competitionTeamId: "team_event", + groupId: null, + slug: "benchmark-board", + name: "Benchmark Board", + description: null, + startDate: "2026-01-01", + endDate: "2026-01-01", + registrationOpensAt: null, + registrationClosesAt: null, + timezone: "America/Boise", + settings: null, + defaultRegistrationFeeCents: 0, + platformFeePercentage: 0, + platformFeeFixed: 0, + passStripeFeesToCustomer: false, + passPlatformFeesToCustomer: false, + visibility: "public", + status: "draft", + competitionType, + profileImageUrl: null, + bannerImageUrl: null, + defaultHeatsPerRotation: null, + defaultLaneShiftPattern: null, + defaultMaxSpotsPerDivision: null, + maxTotalRegistrations: null, + primaryAddressId: "addr_test", + primaryAddress: { + name: "Test Venue", + streetLine1: "123 Main St", + streetLine2: null, + city: "Boise", + stateProvince: "ID", + postalCode: "83702", + countryCode: "US", + notes: null, + }, + createdAt: new Date("2026-01-01T00:00:00Z"), + updatedAt: new Date("2026-01-01T00:00:00Z"), + updateCounter: 0, + } as EditCompetition +} + +describe("OrganizerCompetitionEditForm", () => { + beforeEach(() => { + updateCompetitionFnMock.mockReset() + updateCompetitionFnMock.mockResolvedValue({}) + }) + + // @lat: [[competition-type-capabilities#Venue and Volunteer Gates Test#Edit Form Physical Venue Gate]] + it("hides venue fields for stored benchmark competitions and omits address updates", async () => { + render( + , + ) + + expect(screen.queryByRole("heading", { name: "Location" })).toBeNull() + expect(screen.queryByTestId("address-fields")).toBeNull() + + fireEvent.click(screen.getByRole("button", { name: "Save changes" })) + + await waitFor(() => { + expect(updateCompetitionFnMock).toHaveBeenCalled() + }) + + const [{ data }] = updateCompetitionFnMock.mock.calls[0] + expect(data.competitionId).toBe("comp_test") + expect(Object.hasOwn(data, "address")).toBe(true) + expect(data.address).toBeUndefined() + }) + + it("keeps venue fields visible for stored in-person competitions", () => { + render( + , + ) + + expect(screen.getByRole("heading", { name: "Location" })).toBeInTheDocument() + expect(screen.getByTestId("address-fields")).toBeInTheDocument() + }) +}) diff --git a/apps/wodsmith-start/test/lib/scoring/factory.test.ts b/apps/wodsmith-start/test/lib/scoring/factory.test.ts index 5ddde51cb..70a59c33c 100644 --- a/apps/wodsmith-start/test/lib/scoring/factory.test.ts +++ b/apps/wodsmith-start/test/lib/scoring/factory.test.ts @@ -246,6 +246,21 @@ describe("Scoring Factory", () => { expect(results.get("c")?.rank).toBe(3) }) }) + + describe("Absolute-tier algorithm", () => { + const config: ScoringConfig = { + algorithm: "absolute_tier", + absoluteTier: { batteryId: "bbat_01JZ0000000000000000000000" }, + tiebreaker: { primary: "none" }, + statusHandling: { dnf: "zero", dns: "zero", withdrawn: "zero" }, + } + + it("fails closed until the benchmark scoring engine is implemented", () => { + expect(() => + calculateEventPoints("e1", baseScores, "time", config), + ).toThrow("absolute_tier scoring is configured but not implemented") + }) + }) }) describe("Utility functions", () => { @@ -256,6 +271,7 @@ describe("Scoring Factory", () => { expect(getScoringAlgorithmName("winner_takes_more")).toBe("Winner Takes More") expect(getScoringAlgorithmName("online")).toBe("Online") expect(getScoringAlgorithmName("custom")).toBe("Custom") + expect(getScoringAlgorithmName("absolute_tier")).toBe("Absolute Tier") }) }) @@ -377,5 +393,18 @@ describe("Scoring Factory", () => { } expect(calculatePointsForPlace({ place: 6, config })).toBe(0) }) + + it("fails closed for absolute_tier until static place points are implemented", () => { + const config: ScoringConfig = { + algorithm: "absolute_tier", + absoluteTier: { batteryId: "bbat_01JZ0000000000000000000000" }, + tiebreaker: { primary: "none" }, + statusHandling: { dnf: "zero", dns: "zero", withdrawn: "zero" }, + } + + expect(() => calculatePointsForPlace({ place: 1, config })).toThrow( + "absolute_tier place points are not available", + ) + }) }) }) diff --git a/apps/wodsmith-start/test/schemas/benchmark.test.ts b/apps/wodsmith-start/test/schemas/benchmark.test.ts new file mode 100644 index 000000000..cd14490a1 --- /dev/null +++ b/apps/wodsmith-start/test/schemas/benchmark.test.ts @@ -0,0 +1,103 @@ +import { describe, expect, it } from "vitest" +import { + benchmarkCategoriesSchema, + benchmarkVariantSchema, + getBenchmarkCategoryCountIssues, + benchmarkRatingBandsSchema, + benchmarkThresholdValuesSchema, + benchmarkVideoPolicySchema, +} from "@/schemas/benchmark.schema" + +describe("Benchmark schema", () => { + it("accepts categories with validated test counts and default weights", () => { + const result = benchmarkCategoriesSchema.safeParse([ + { key: "strength", label: "Strength", testCount: 12 }, + { key: "gymnastics", label: "Gymnastics", testCount: 15, weight: 2 }, + ]) + + expect(result.success).toBe(true) + expect(result.data?.[0]?.weight).toBe(1) + expect(result.data?.[1]?.testCount).toBe(15) + }) + + it("rejects duplicate category keys", () => { + const result = benchmarkCategoriesSchema.safeParse([ + { key: "strength", label: "Strength", testCount: 12 }, + { key: "strength", label: "Strength Again", testCount: 3 }, + ]) + + expect(result.success).toBe(false) + }) + + it("rejects malformed category cache values", () => { + const result = benchmarkCategoriesSchema.safeParse([ + { key: "Upper Body", label: "Upper Body", testCount: -1 }, + ]) + + expect(result.success).toBe(false) + }) + + it("accepts only profile-gender variants for v1 scoring", () => { + expect(benchmarkVariantSchema.safeParse("male").success).toBe(true) + expect(benchmarkVariantSchema.safeParse("female").success).toBe(true) + expect(benchmarkVariantSchema.safeParse("masters").success).toBe(false) + }) + + it("validates cached category counts against included tests", () => { + const categories = benchmarkCategoriesSchema.parse([ + { key: "strength", label: "Strength", testCount: 2 }, + { key: "engine", label: "Engine", testCount: 1 }, + ]) + + expect( + getBenchmarkCategoryCountIssues(categories, [ + { categoryKey: "strength", includedInScoring: true }, + { categoryKey: "strength", includedInScoring: true }, + { categoryKey: "engine", includedInScoring: true }, + { categoryKey: "engine", includedInScoring: false }, + ]), + ).toEqual([]) + }) + + it("reports stale category counts and unknown included-test categories", () => { + const categories = benchmarkCategoriesSchema.parse([ + { key: "strength", label: "Strength", testCount: 2 }, + ]) + + expect( + getBenchmarkCategoryCountIssues(categories, [ + { categoryKey: "strength", includedInScoring: true }, + { categoryKey: "engine", includedInScoring: true }, + ]), + ).toEqual([ + "Category strength declares testCount 2 but has 1 included tests", + "Included test references unknown category engine", + ]) + }) + + it("requires ten threshold values for a standard tier table", () => { + expect( + benchmarkThresholdValuesSchema.safeParse([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) + .success, + ).toBe(true) + expect(benchmarkThresholdValuesSchema.safeParse([1, 2, 3]).success).toBe( + false, + ) + }) + + it("accepts benchmark video policies", () => { + expect(benchmarkVideoPolicySchema.safeParse("never").success).toBe(true) + expect(benchmarkVideoPolicySchema.safeParse("for_top_scores").success).toBe( + true, + ) + expect(benchmarkVideoPolicySchema.safeParse("sometimes").success).toBe(false) + }) + + it("rejects rating bands with inverted score ranges", () => { + const result = benchmarkRatingBandsSchema.safeParse([ + { key: "advanced", label: "Advanced", minScore: 80, maxScore: 70 }, + ]) + + expect(result.success).toBe(false) + }) +}) diff --git a/apps/wodsmith-start/test/schemas/scoring.test.ts b/apps/wodsmith-start/test/schemas/scoring.test.ts index 3ba42c532..f48cef310 100644 --- a/apps/wodsmith-start/test/schemas/scoring.test.ts +++ b/apps/wodsmith-start/test/schemas/scoring.test.ts @@ -13,6 +13,7 @@ import { traditionalConfigSchema, pScoreConfigSchema, customTableConfigSchema, + absoluteTierConfigSchema, tiebreakerConfigSchema, statusHandlingConfigSchema, type ScoringConfig, @@ -39,6 +40,12 @@ describe("ScoringAlgorithm Schema", () => { expect(result.data).toBe("custom") }) + it("accepts 'absolute_tier' algorithm", () => { + const result = scoringAlgorithmSchema.safeParse("absolute_tier") + expect(result.success).toBe(true) + expect(result.data).toBe("absolute_tier") + }) + it("rejects invalid algorithm", () => { const result = scoringAlgorithmSchema.safeParse("invalid_algo") expect(result.success).toBe(false) @@ -178,6 +185,23 @@ describe("CustomTableConfig Schema", () => { }) }) +describe("AbsoluteTierConfig Schema", () => { + it("accepts valid absolute-tier config", () => { + const result = absoluteTierConfigSchema.safeParse({ + batteryId: "bbat_01JZ0000000000000000000000", + }) + + expect(result.success).toBe(true) + expect(result.data?.batteryId).toBe("bbat_01JZ0000000000000000000000") + }) + + it("rejects missing battery id", () => { + const result = absoluteTierConfigSchema.safeParse({}) + + expect(result.success).toBe(false) + }) +}) + describe("TiebreakerConfig Schema", () => { it("accepts valid tiebreaker config with primary only", () => { const result = tiebreakerConfigSchema.safeParse({ @@ -347,6 +371,34 @@ describe("ScoringConfig Schema", () => { expect(result.data?.customTable?.baseTemplate).toBe("winner_takes_more") }) + it("accepts absolute_tier config with battery id", () => { + const config: ScoringConfig = { + algorithm: "absolute_tier", + absoluteTier: { batteryId: "bbat_01JZ0000000000000000000000" }, + tiebreaker: { primary: "none" }, + statusHandling: { + dnf: "zero", + dns: "zero", + withdrawn: "zero", + }, + } + const result = scoringConfigSchema.safeParse(config) + expect(result.success).toBe(true) + expect(result.data?.absoluteTier?.batteryId).toBe( + "bbat_01JZ0000000000000000000000", + ) + }) + + it("rejects absolute_tier config without battery id", () => { + const result = scoringConfigSchema.safeParse({ + algorithm: "absolute_tier", + tiebreaker: { primary: "none" }, + statusHandling: { dnf: "zero", dns: "zero", withdrawn: "zero" }, + }) + + expect(result.success).toBe(false) + }) + it("rejects missing algorithm", () => { const result = scoringConfigSchema.safeParse({ tiebreaker: { primary: "countback" }, @@ -382,8 +434,8 @@ describe("ScoringConfig Schema", () => { describe("Type inference", () => { it("infers correct type for ScoringAlgorithm", () => { - const algo: ScoringAlgorithm = "traditional" - expect(["traditional", "p_score", "custom"]).toContain(algo) + const algo: ScoringAlgorithm = "absolute_tier" + expect(["traditional", "p_score", "custom", "absolute_tier"]).toContain(algo) }) it("infers correct type for TiebreakerMethod", () => { diff --git a/lat.md/competition-type-capabilities.md b/lat.md/competition-type-capabilities.md index 3505e1674..a5ac35346 100644 --- a/lat.md/competition-type-capabilities.md +++ b/lat.md/competition-type-capabilities.md @@ -92,6 +92,10 @@ These tests pin the capability helpers that control physical venue display and v This test verifies physical venue display remains available only for in-person competitions. +### Edit Form Physical Venue Gate + +This test verifies stored benchmark competitions do not render or submit generic edit-form venue fields through the in-person picker fallback. + ### Volunteer Scheduling Availability This test verifies volunteer scheduling remains available only for in-person competitions. diff --git a/lat.md/domain.md b/lat.md/domain.md index d253b5d42..443ffbe74 100644 --- a/lat.md/domain.md +++ b/lat.md/domain.md @@ -154,6 +154,16 @@ All write paths that touch multi-round `time-with-cap` scores now thread `capped The organizer review page at [[apps/wodsmith-start/src/routes/compete/organizer/$competitionId/events/$eventId/submissions/$submissionId.tsx]] can apply a penalty to a selected subset of rounds on a multi-round submission. The penalty form renders a checkbox + before/after line per round (all rounds checked by default) and, on submit, scales each selected round's encoded value through `calculatePenaltyScore` with a forced `"scored"` status (per-round time values always grow under a penalty, even if the round hit the cap — the parent `"cap"` status is irrelevant at the round level). The resulting round values are decoded to display strings and sent as `adjustedRoundScores[]` alongside `penaltyType`/`penaltyPercentage` via `verifySubmissionScoreFn`, so the server re-derives per-round status, parent aggregate, `cappedRoundCount`, and `sortKey` just like a round-level adjust. The single-value "reps-at-cap" preview and the direct-override textbox are only shown for single-round submissions, where `secondaryValue` actually carries the penalizable reps count. +## Benchmark Batteries + +Benchmark batteries define reusable threshold tables for generic benchmark competitions. + +[[packages/wodsmith-db/src/schemas/benchmarks.ts#benchmarkBatteriesTable]] stores the battery metadata, category cache, rating bands, scoring scale, video policy, optional open-join flag, variant scaling group, and linked competition. [[packages/wodsmith-db/src/schemas/benchmarks.ts#benchmarkTestsTable]] stores the ordered benchmark tests inside a battery, including category, score scheme, score type, input unit, included/deferred state, and nullable v2 hybrid metadata. [[packages/wodsmith-db/src/schemas/benchmarks.ts#benchmarkTierThresholdsTable]] stores one encoded threshold per test, variant, and tier while preserving the source display value for extraction receipts. + +Benchmark competitions reuse the normal competition shell. [[packages/wodsmith-db/src/schemas/programming.ts#trackWorkoutsTable]] carries nullable `benchmarkTestId` and `benchmarkCategory` columns so leaderboard reads can bind each competition event to its source test and category. [[packages/wodsmith-db/src/schemas/scores.ts#scoresTable]] carries nullable `benchmarkVariant` so each score snapshots the athlete's scoring variant at submission time. + +Benchmark configuration validates before write/read code consumes it. [[apps/wodsmith-start/src/schemas/benchmark.schema.ts#benchmarkCategoriesSchema]] rejects duplicate or malformed category caches, [[apps/wodsmith-start/src/schemas/benchmark.schema.ts#getBenchmarkCategoryCountIssues]] compares cached `testCount` values to included tests, [[apps/wodsmith-start/src/schemas/benchmark.schema.ts#benchmarkVariantSchema]] limits v1 score variants to the profile gender values, [[apps/wodsmith-start/src/schemas/benchmark.schema.ts#benchmarkThresholdValuesSchema]] requires ten tier thresholds per standard row, and [[apps/wodsmith-start/src/schemas/scoring.schema.ts#scoringConfigSchema]] requires `absoluteTier.batteryId` whenever `algorithm` is `absolute_tier`. Until the M2 scoring engine lands, [[apps/wodsmith-start/src/lib/scoring/algorithms/index.ts#calculateEventPoints]] fails closed for `absolute_tier` instead of returning placeholder points. + ## Volunteers Volunteers are competition staff assigned roles like judge, scorekeeper, medical, and emcee. diff --git a/packages/wodsmith-db/mysql-migrations/0003_benchmark-battery.sql b/packages/wodsmith-db/mysql-migrations/0003_benchmark-battery.sql new file mode 100644 index 000000000..8ac180aed --- /dev/null +++ b/packages/wodsmith-db/mysql-migrations/0003_benchmark-battery.sql @@ -0,0 +1,70 @@ +CREATE TABLE `benchmark_batteries` ( + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + `update_counter` int DEFAULT 0, + `id` varchar(255) NOT NULL, + `owner_team_id` varchar(255), + `owner_key` varchar(255) NOT NULL, + `slug` varchar(255) NOT NULL, + `name` varchar(255) NOT NULL, + `description` text, + `categories` text NOT NULL, + `rating_bands` text NOT NULL, + `max_tier` int NOT NULL DEFAULT 10, + `score_max` int NOT NULL DEFAULT 100, + `video_policy` varchar(20) NOT NULL DEFAULT 'never', + `is_open_join` boolean NOT NULL DEFAULT false, + `variant_scaling_group_id` varchar(255), + `competition_id` varchar(255), + `status` varchar(20) NOT NULL DEFAULT 'draft', + CONSTRAINT `benchmark_batteries_id` PRIMARY KEY(`id`), + CONSTRAINT `benchmark_batteries_owner_key_unique` UNIQUE(`owner_key`), + CONSTRAINT `benchmark_batteries_competition_unique` UNIQUE(`competition_id`) +); +--> statement-breakpoint +CREATE TABLE `benchmark_tests` ( + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + `update_counter` int DEFAULT 0, + `id` varchar(255) NOT NULL, + `battery_id` varchar(255) NOT NULL, + `category_key` varchar(64) NOT NULL, + `name` varchar(255) NOT NULL, + `position` int NOT NULL, + `scheme` varchar(255) NOT NULL, + `score_type` varchar(255) NOT NULL, + `input_unit` varchar(64) NOT NULL, + `included_in_scoring` boolean NOT NULL DEFAULT true, + `time_cap_ms` int, + `score_model` varchar(20) NOT NULL DEFAULT 'standard', + `hybrid_flip_tier` int, + `hybrid_scale` text, + CONSTRAINT `benchmark_tests_id` PRIMARY KEY(`id`), + CONSTRAINT `benchmark_tests_battery_position_unique` UNIQUE(`battery_id`,`position`) +); +--> statement-breakpoint +CREATE TABLE `benchmark_tier_thresholds` ( + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + `update_counter` int DEFAULT 0, + `id` varchar(255) NOT NULL, + `test_id` varchar(255) NOT NULL, + `variant` varchar(64) NOT NULL, + `tier` int NOT NULL, + `threshold_value` int NOT NULL, + `raw_value` varchar(255) NOT NULL, + CONSTRAINT `benchmark_tier_thresholds_id` PRIMARY KEY(`id`), + CONSTRAINT `benchmark_thresholds_test_variant_tier_unique` UNIQUE(`test_id`,`variant`,`tier`) +); +--> statement-breakpoint +ALTER TABLE `track_workouts` ADD `benchmark_test_id` varchar(255);--> statement-breakpoint +ALTER TABLE `track_workouts` ADD `benchmark_category` varchar(64);--> statement-breakpoint +ALTER TABLE `scores` ADD `benchmark_variant` varchar(64);--> statement-breakpoint +CREATE INDEX `benchmark_batteries_owner_team_idx` ON `benchmark_batteries` (`owner_team_id`);--> statement-breakpoint +CREATE INDEX `benchmark_batteries_status_idx` ON `benchmark_batteries` (`status`);--> statement-breakpoint +CREATE INDEX `benchmark_tests_battery_idx` ON `benchmark_tests` (`battery_id`);--> statement-breakpoint +CREATE INDEX `benchmark_tests_category_idx` ON `benchmark_tests` (`battery_id`,`category_key`);--> statement-breakpoint +CREATE INDEX `benchmark_thresholds_test_variant_idx` ON `benchmark_tier_thresholds` (`test_id`,`variant`);--> statement-breakpoint +CREATE INDEX `track_workout_benchmark_test_idx` ON `track_workouts` (`benchmark_test_id`);--> statement-breakpoint +CREATE INDEX `track_workout_benchmark_category_idx` ON `track_workouts` (`benchmark_category`);--> statement-breakpoint +CREATE INDEX `idx_scores_benchmark_variant` ON `scores` (`competition_event_id`,`benchmark_variant`); diff --git a/packages/wodsmith-db/mysql-migrations/meta/0003_snapshot.json b/packages/wodsmith-db/mysql-migrations/meta/0003_snapshot.json new file mode 100644 index 000000000..db9bc8d39 --- /dev/null +++ b/packages/wodsmith-db/mysql-migrations/meta/0003_snapshot.json @@ -0,0 +1,13277 @@ +{ + "version": "5", + "dialect": "mysql", + "id": "2214f2bf-814c-414a-9c2b-5add225588f3", + "prevId": "0bf9aa44-63e3-4b9e-a6c3-78e64ee4e39e", + "tables": { + "addresses": { + "name": "addresses", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "address_type": { + "name": "address_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "street_line1": { + "name": "street_line1", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "street_line2": { + "name": "street_line2", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "city": { + "name": "city", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "state_province": { + "name": "state_province", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "postal_code": { + "name": "postal_code", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "country_code": { + "name": "country_code", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "addresses_id": { + "name": "addresses_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "product_coupon_redemptions": { + "name": "product_coupon_redemptions", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "coupon_id": { + "name": "coupon_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "purchase_id": { + "name": "purchase_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "amount_off_cents": { + "name": "amount_off_cents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "stripe_coupon_id": { + "name": "stripe_coupon_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "redeemed_at": { + "name": "redeemed_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "product_coupon_redemptions_coupon_idx": { + "name": "product_coupon_redemptions_coupon_idx", + "columns": [ + "coupon_id" + ], + "isUnique": false + }, + "product_coupon_redemptions_user_idx": { + "name": "product_coupon_redemptions_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "product_coupon_redemptions_purchase_idx": { + "name": "product_coupon_redemptions_purchase_idx", + "columns": [ + "purchase_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "product_coupon_redemptions_id": { + "name": "product_coupon_redemptions_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "product_coupons": { + "name": "product_coupons", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "code": { + "name": "code", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'competition'" + }, + "product_id": { + "name": "product_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_by": { + "name": "created_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "amount_off_cents": { + "name": "amount_off_cents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "max_redemptions": { + "name": "max_redemptions", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "current_redemptions": { + "name": "current_redemptions", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "expires_at": { + "name": "expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "tinyint", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "product_coupons_code_idx": { + "name": "product_coupons_code_idx", + "columns": [ + "code" + ], + "isUnique": true + }, + "product_coupons_team_product_idx": { + "name": "product_coupons_team_product_idx", + "columns": [ + "team_id", + "product_id" + ], + "isUnique": false + }, + "product_coupons_product_active_idx": { + "name": "product_coupons_product_active_idx", + "columns": [ + "product_id", + "is_active" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "product_coupons_id": { + "name": "product_coupons_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "affiliates": { + "name": "affiliates", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "location": { + "name": "location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "verification_status": { + "name": "verification_status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'unverified'" + }, + "owner_team_id": { + "name": "owner_team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "affiliates_name_idx": { + "name": "affiliates_name_idx", + "columns": [ + "name" + ], + "isUnique": false + }, + "affiliates_owner_team_idx": { + "name": "affiliates_owner_team_idx", + "columns": [ + "owner_team_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "affiliates_id": { + "name": "affiliates_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": { + "affiliates_name_unique": { + "name": "affiliates_name_unique", + "columns": [ + "name" + ] + } + }, + "checkConstraint": {} + }, + "benchmark_batteries": { + "name": "benchmark_batteries", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "owner_team_id": { + "name": "owner_team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "owner_key": { + "name": "owner_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "categories": { + "name": "categories", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rating_bands": { + "name": "rating_bands", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "max_tier": { + "name": "max_tier", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 10 + }, + "score_max": { + "name": "score_max", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 100 + }, + "video_policy": { + "name": "video_policy", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'never'" + }, + "is_open_join": { + "name": "is_open_join", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "variant_scaling_group_id": { + "name": "variant_scaling_group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'draft'" + } + }, + "indexes": { + "benchmark_batteries_owner_key_unique": { + "name": "benchmark_batteries_owner_key_unique", + "columns": [ + "owner_key" + ], + "isUnique": true + }, + "benchmark_batteries_competition_unique": { + "name": "benchmark_batteries_competition_unique", + "columns": [ + "competition_id" + ], + "isUnique": true + }, + "benchmark_batteries_owner_team_idx": { + "name": "benchmark_batteries_owner_team_idx", + "columns": [ + "owner_team_id" + ], + "isUnique": false + }, + "benchmark_batteries_status_idx": { + "name": "benchmark_batteries_status_idx", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "benchmark_batteries_id": { + "name": "benchmark_batteries_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "benchmark_tests": { + "name": "benchmark_tests", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "battery_id": { + "name": "battery_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "category_key": { + "name": "category_key", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "position": { + "name": "position", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scheme": { + "name": "scheme", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "score_type": { + "name": "score_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "input_unit": { + "name": "input_unit", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "included_in_scoring": { + "name": "included_in_scoring", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "time_cap_ms": { + "name": "time_cap_ms", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "score_model": { + "name": "score_model", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'standard'" + }, + "hybrid_flip_tier": { + "name": "hybrid_flip_tier", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "hybrid_scale": { + "name": "hybrid_scale", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "benchmark_tests_battery_position_unique": { + "name": "benchmark_tests_battery_position_unique", + "columns": [ + "battery_id", + "position" + ], + "isUnique": true + }, + "benchmark_tests_battery_idx": { + "name": "benchmark_tests_battery_idx", + "columns": [ + "battery_id" + ], + "isUnique": false + }, + "benchmark_tests_category_idx": { + "name": "benchmark_tests_category_idx", + "columns": [ + "battery_id", + "category_key" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "benchmark_tests_id": { + "name": "benchmark_tests_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "benchmark_tier_thresholds": { + "name": "benchmark_tier_thresholds", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "test_id": { + "name": "test_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "variant": { + "name": "variant", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tier": { + "name": "tier", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "threshold_value": { + "name": "threshold_value", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "raw_value": { + "name": "raw_value", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "benchmark_thresholds_test_variant_tier_unique": { + "name": "benchmark_thresholds_test_variant_tier_unique", + "columns": [ + "test_id", + "variant", + "tier" + ], + "isUnique": true + }, + "benchmark_thresholds_test_variant_idx": { + "name": "benchmark_thresholds_test_variant_idx", + "columns": [ + "test_id", + "variant" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "benchmark_tier_thresholds_id": { + "name": "benchmark_tier_thresholds_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_broadcast_recipients": { + "name": "competition_broadcast_recipients", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "broadcast_id": { + "name": "broadcast_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "registration_id": { + "name": "registration_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invitation_id": { + "name": "invitation_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email_delivery_status": { + "name": "email_delivery_status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'queued'" + } + }, + "indexes": { + "broadcast_recipients_broadcast_user_idx": { + "name": "broadcast_recipients_broadcast_user_idx", + "columns": [ + "broadcast_id", + "user_id" + ], + "isUnique": true + }, + "broadcast_recipients_broadcast_invite_idx": { + "name": "broadcast_recipients_broadcast_invite_idx", + "columns": [ + "broadcast_id", + "invitation_id" + ], + "isUnique": true + }, + "broadcast_recipients_broadcast_idx": { + "name": "broadcast_recipients_broadcast_idx", + "columns": [ + "broadcast_id" + ], + "isUnique": false + }, + "broadcast_recipients_user_idx": { + "name": "broadcast_recipients_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "broadcast_recipients_invitation_idx": { + "name": "broadcast_recipients_invitation_idx", + "columns": [ + "invitation_id" + ], + "isUnique": false + }, + "broadcast_recipients_status_idx": { + "name": "broadcast_recipients_status_idx", + "columns": [ + "email_delivery_status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_broadcast_recipients_id": { + "name": "competition_broadcast_recipients_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_broadcasts": { + "name": "competition_broadcasts", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "audience_filter": { + "name": "audience_filter", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "recipient_count": { + "name": "recipient_count", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'draft'" + }, + "scheduled_at": { + "name": "scheduled_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sent_at": { + "name": "sent_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_by_id": { + "name": "created_by_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "competition_broadcasts_competition_idx": { + "name": "competition_broadcasts_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "competition_broadcasts_team_idx": { + "name": "competition_broadcasts_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "competition_broadcasts_status_idx": { + "name": "competition_broadcasts_status_idx", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_broadcasts_id": { + "name": "competition_broadcasts_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "credit_transactions": { + "name": "credit_transactions", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "amount": { + "name": "amount", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "remaining_amount": { + "name": "remaining_amount", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expiration_date": { + "name": "expiration_date", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expiration_date_processed_at": { + "name": "expiration_date_processed_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "payment_intent_id": { + "name": "payment_intent_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "credit_transaction_user_id_idx": { + "name": "credit_transaction_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "credit_transaction_type_idx": { + "name": "credit_transaction_type_idx", + "columns": [ + "type" + ], + "isUnique": false + }, + "credit_transaction_created_at_idx": { + "name": "credit_transaction_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + }, + "credit_transaction_expiration_date_idx": { + "name": "credit_transaction_expiration_date_idx", + "columns": [ + "expiration_date" + ], + "isUnique": false + }, + "credit_transaction_payment_intent_id_idx": { + "name": "credit_transaction_payment_intent_id_idx", + "columns": [ + "payment_intent_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "credit_transactions_id": { + "name": "credit_transactions_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "purchased_items": { + "name": "purchased_items", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "item_type": { + "name": "item_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "item_id": { + "name": "item_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "purchased_at": { + "name": "purchased_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "purchased_item_user_id_idx": { + "name": "purchased_item_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "purchased_item_type_idx": { + "name": "purchased_item_type_idx", + "columns": [ + "item_type" + ], + "isUnique": false + }, + "purchased_item_user_item_idx": { + "name": "purchased_item_user_item_idx", + "columns": [ + "user_id", + "item_type", + "item_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "purchased_items_id": { + "name": "purchased_items_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "commerce_products": { + "name": "commerce_products", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "resource_id": { + "name": "resource_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "price_cents": { + "name": "price_cents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "commerce_product_resource_idx": { + "name": "commerce_product_resource_idx", + "columns": [ + "type", + "resource_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "commerce_products_id": { + "name": "commerce_products_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "commerce_purchases": { + "name": "commerce_purchases", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "product_id": { + "name": "product_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "division_id": { + "name": "division_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "total_cents": { + "name": "total_cents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "platform_fee_cents": { + "name": "platform_fee_cents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "stripe_fee_cents": { + "name": "stripe_fee_cents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organizer_net_cents": { + "name": "organizer_net_cents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "stripe_checkout_session_id": { + "name": "stripe_checkout_session_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_payment_intent_id": { + "name": "stripe_payment_intent_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "completed_at": { + "name": "completed_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "commerce_purchase_user_idx": { + "name": "commerce_purchase_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "commerce_purchase_product_idx": { + "name": "commerce_purchase_product_idx", + "columns": [ + "product_id" + ], + "isUnique": false + }, + "commerce_purchase_status_idx": { + "name": "commerce_purchase_status_idx", + "columns": [ + "status" + ], + "isUnique": false + }, + "commerce_purchase_stripe_session_idx": { + "name": "commerce_purchase_stripe_session_idx", + "columns": [ + "stripe_checkout_session_id" + ], + "isUnique": false + }, + "commerce_purchase_competition_idx": { + "name": "commerce_purchase_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "commerce_purchase_stripe_pi_idx": { + "name": "commerce_purchase_stripe_pi_idx", + "columns": [ + "stripe_payment_intent_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "commerce_purchases_id": { + "name": "commerce_purchases_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_divisions": { + "name": "competition_divisions", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "division_id": { + "name": "division_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fee_cents": { + "name": "fee_cents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "max_spots": { + "name": "max_spots", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "competition_divisions_unique_idx": { + "name": "competition_divisions_unique_idx", + "columns": [ + "competition_id", + "division_id" + ], + "isUnique": true + }, + "competition_divisions_competition_idx": { + "name": "competition_divisions_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_divisions_id": { + "name": "competition_divisions_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "purchase_transfers": { + "name": "purchase_transfers", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "purchase_id": { + "name": "purchase_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_user_id": { + "name": "source_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_email": { + "name": "target_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accepted_email": { + "name": "accepted_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_user_id": { + "name": "target_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "transfer_state": { + "name": "transfer_state", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'INITIATED'" + }, + "initiated_by": { + "name": "initiated_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "completed_at": { + "name": "completed_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cancelled_at": { + "name": "cancelled_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "purchase_transfers_purchase_idx": { + "name": "purchase_transfers_purchase_idx", + "columns": [ + "purchase_id" + ], + "isUnique": false + }, + "purchase_transfers_source_idx": { + "name": "purchase_transfers_source_idx", + "columns": [ + "source_user_id" + ], + "isUnique": false + }, + "purchase_transfers_target_email_idx": { + "name": "purchase_transfers_target_email_idx", + "columns": [ + "target_email" + ], + "isUnique": false + }, + "purchase_transfers_state_idx": { + "name": "purchase_transfers_state_idx", + "columns": [ + "transfer_state" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "purchase_transfers_id": { + "name": "purchase_transfers_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_invite_source_division_allocations": { + "name": "competition_invite_source_division_allocations", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_id": { + "name": "source_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "championship_division_id": { + "name": "championship_division_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "spots": { + "name": "spots", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "competition_invite_source_division_allocations_source_div_unique": { + "name": "competition_invite_source_division_allocations_source_div_unique", + "columns": [ + "source_id", + "championship_division_id" + ], + "isUnique": true + }, + "competition_invite_source_division_allocations_div_idx": { + "name": "competition_invite_source_division_allocations_div_idx", + "columns": [ + "championship_division_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_invite_source_division_allocations_id": { + "name": "competition_invite_source_division_allocations_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_invite_sources": { + "name": "competition_invite_sources", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "championship_competition_id": { + "name": "championship_competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_competition_id": { + "name": "source_competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_group_id": { + "name": "source_group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "global_spots": { + "name": "global_spots", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "division_mappings": { + "name": "division_mappings", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "competition_invite_sources_championship_sort_idx": { + "name": "competition_invite_sources_championship_sort_idx", + "columns": [ + "championship_competition_id", + "sort_order" + ], + "isUnique": false + }, + "competition_invite_sources_source_competition_idx": { + "name": "competition_invite_sources_source_competition_idx", + "columns": [ + "source_competition_id" + ], + "isUnique": false + }, + "competition_invite_sources_source_group_idx": { + "name": "competition_invite_sources_source_group_idx", + "columns": [ + "source_group_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_invite_sources_id": { + "name": "competition_invite_sources_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_invites": { + "name": "competition_invites", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "championship_competition_id": { + "name": "championship_competition_id", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "round_id": { + "name": "round_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "origin": { + "name": "origin", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_id": { + "name": "source_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_competition_id": { + "name": "source_competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_placement": { + "name": "source_placement", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_placement_label": { + "name": "source_placement_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "bespoke_reason": { + "name": "bespoke_reason", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "championship_division_id": { + "name": "championship_division_id", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invitee_first_name": { + "name": "invitee_first_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invitee_last_name": { + "name": "invitee_last_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "claim_token": { + "name": "claim_token", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "send_attempt": { + "name": "send_attempt", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "paid_at": { + "name": "paid_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "declined_at": { + "name": "declined_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "revoked_by_user_id": { + "name": "revoked_by_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "claimed_registration_id": { + "name": "claimed_registration_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email_delivery_status": { + "name": "email_delivery_status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'queued'" + }, + "email_last_error": { + "name": "email_last_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "active_marker": { + "name": "active_marker", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "competition_invites_active_invite_idx": { + "name": "competition_invites_active_invite_idx", + "columns": [ + "championship_competition_id", + "email", + "championship_division_id", + "active_marker" + ], + "isUnique": true + }, + "competition_invites_claim_token_idx": { + "name": "competition_invites_claim_token_idx", + "columns": [ + "claim_token" + ], + "isUnique": true + }, + "competition_invites_round_idx": { + "name": "competition_invites_round_idx", + "columns": [ + "round_id" + ], + "isUnique": false + }, + "competition_invites_source_idx": { + "name": "competition_invites_source_idx", + "columns": [ + "source_id" + ], + "isUnique": false + }, + "competition_invites_origin_idx": { + "name": "competition_invites_origin_idx", + "columns": [ + "origin" + ], + "isUnique": false + }, + "competition_invites_status_idx": { + "name": "competition_invites_status_idx", + "columns": [ + "status" + ], + "isUnique": false + }, + "competition_invites_email_idx": { + "name": "competition_invites_email_idx", + "columns": [ + "email" + ], + "isUnique": false + }, + "competition_invites_championship_idx": { + "name": "competition_invites_championship_idx", + "columns": [ + "championship_competition_id" + ], + "isUnique": false + }, + "competition_invites_user_idx": { + "name": "competition_invites_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_invites_id": { + "name": "competition_invites_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_events": { + "name": "competition_events", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_workout_id": { + "name": "track_workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "submission_opens_at": { + "name": "submission_opens_at", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "submission_closes_at": { + "name": "submission_closes_at", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "competition_events_competition_idx": { + "name": "competition_events_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "competition_events_workout_idx": { + "name": "competition_events_workout_idx", + "columns": [ + "track_workout_id" + ], + "isUnique": false + }, + "competition_events_comp_workout_idx": { + "name": "competition_events_comp_workout_idx", + "columns": [ + "competition_id", + "track_workout_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_events_id": { + "name": "competition_events_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_groups": { + "name": "competition_groups", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organizing_team_id": { + "name": "organizing_team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "settings": { + "name": "settings", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "competition_groups_org_slug_idx": { + "name": "competition_groups_org_slug_idx", + "columns": [ + "organizing_team_id", + "slug" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_groups_id": { + "name": "competition_groups_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_heat_assignments": { + "name": "competition_heat_assignments", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "heat_id": { + "name": "heat_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "registration_id": { + "name": "registration_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "lane_number": { + "name": "lane_number", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "competition_heat_assignments_heat_idx": { + "name": "competition_heat_assignments_heat_idx", + "columns": [ + "heat_id" + ], + "isUnique": false + }, + "competition_heat_assignments_reg_idx": { + "name": "competition_heat_assignments_reg_idx", + "columns": [ + "heat_id", + "registration_id" + ], + "isUnique": true + }, + "competition_heat_assignments_lane_idx": { + "name": "competition_heat_assignments_lane_idx", + "columns": [ + "heat_id", + "lane_number" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_heat_assignments_id": { + "name": "competition_heat_assignments_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_heats": { + "name": "competition_heats", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_workout_id": { + "name": "track_workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "venue_id": { + "name": "venue_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "heat_number": { + "name": "heat_number", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scheduled_time": { + "name": "scheduled_time", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "duration_minutes": { + "name": "duration_minutes", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "division_id": { + "name": "division_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "schedule_published_at": { + "name": "schedule_published_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "competition_heats_competition_idx": { + "name": "competition_heats_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "competition_heats_workout_idx": { + "name": "competition_heats_workout_idx", + "columns": [ + "track_workout_id" + ], + "isUnique": false + }, + "competition_heats_time_idx": { + "name": "competition_heats_time_idx", + "columns": [ + "scheduled_time" + ], + "isUnique": false + }, + "competition_heats_workout_number_idx": { + "name": "competition_heats_workout_number_idx", + "columns": [ + "track_workout_id", + "heat_number" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_heats_id": { + "name": "competition_heats_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_registration_answers": { + "name": "competition_registration_answers", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "question_id": { + "name": "question_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "registration_id": { + "name": "registration_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "comp_reg_answers_question_idx": { + "name": "comp_reg_answers_question_idx", + "columns": [ + "question_id" + ], + "isUnique": false + }, + "comp_reg_answers_registration_idx": { + "name": "comp_reg_answers_registration_idx", + "columns": [ + "registration_id" + ], + "isUnique": false + }, + "comp_reg_answers_user_idx": { + "name": "comp_reg_answers_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "comp_reg_answers_unique_idx": { + "name": "comp_reg_answers_unique_idx", + "columns": [ + "question_id", + "registration_id", + "user_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_registration_answers_id": { + "name": "competition_registration_answers_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_registration_questions": { + "name": "competition_registration_questions", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "group_id": { + "name": "group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "varchar(500)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "help_text": { + "name": "help_text", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "options": { + "name": "options", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "required": { + "name": "required", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "for_teammates": { + "name": "for_teammates", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "sort_order": { + "name": "sort_order", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "question_target": { + "name": "question_target", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'athlete'" + } + }, + "indexes": { + "comp_reg_questions_competition_idx": { + "name": "comp_reg_questions_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "comp_reg_questions_sort_idx": { + "name": "comp_reg_questions_sort_idx", + "columns": [ + "competition_id", + "sort_order" + ], + "isUnique": false + }, + "comp_reg_questions_group_idx": { + "name": "comp_reg_questions_group_idx", + "columns": [ + "group_id" + ], + "isUnique": false + }, + "comp_reg_questions_target_idx": { + "name": "comp_reg_questions_target_idx", + "columns": [ + "question_target" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_registration_questions_id": { + "name": "competition_registration_questions_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_registrations": { + "name": "competition_registrations", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "event_id": { + "name": "event_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_member_id": { + "name": "team_member_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "division_id": { + "name": "division_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "registered_at": { + "name": "registered_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'active'" + }, + "team_name": { + "name": "team_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "captain_user_id": { + "name": "captain_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "athlete_team_id": { + "name": "athlete_team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pending_teammates": { + "name": "pending_teammates", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "commerce_purchase_id": { + "name": "commerce_purchase_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "payment_status": { + "name": "payment_status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "paid_at": { + "name": "paid_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "checked_in_at": { + "name": "checked_in_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "checked_in_by": { + "name": "checked_in_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "competition_registrations_event_user_division_idx": { + "name": "competition_registrations_event_user_division_idx", + "columns": [ + "event_id", + "user_id", + "division_id" + ], + "isUnique": true + }, + "competition_registrations_user_idx": { + "name": "competition_registrations_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "competition_registrations_event_idx": { + "name": "competition_registrations_event_idx", + "columns": [ + "event_id" + ], + "isUnique": false + }, + "competition_registrations_division_idx": { + "name": "competition_registrations_division_idx", + "columns": [ + "division_id" + ], + "isUnique": false + }, + "competition_registrations_captain_idx": { + "name": "competition_registrations_captain_idx", + "columns": [ + "captain_user_id" + ], + "isUnique": false + }, + "competition_registrations_athlete_team_idx": { + "name": "competition_registrations_athlete_team_idx", + "columns": [ + "athlete_team_id" + ], + "isUnique": false + }, + "competition_registrations_purchase_idx": { + "name": "competition_registrations_purchase_idx", + "columns": [ + "commerce_purchase_id" + ], + "isUnique": false + }, + "competition_registrations_status_idx": { + "name": "competition_registrations_status_idx", + "columns": [ + "event_id", + "status" + ], + "isUnique": false + }, + "competition_registrations_checked_in_idx": { + "name": "competition_registrations_checked_in_idx", + "columns": [ + "event_id", + "checked_in_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_registrations_id": { + "name": "competition_registrations_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_venues": { + "name": "competition_venues", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "lane_count": { + "name": "lane_count", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 3 + }, + "transition_minutes": { + "name": "transition_minutes", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 3 + }, + "sort_order": { + "name": "sort_order", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "address_id": { + "name": "address_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "competition_venues_competition_idx": { + "name": "competition_venues_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "competition_venues_sort_idx": { + "name": "competition_venues_sort_idx", + "columns": [ + "competition_id", + "sort_order" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_venues_id": { + "name": "competition_venues_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competitions": { + "name": "competitions", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organizing_team_id": { + "name": "organizing_team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_team_id": { + "name": "competition_team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "group_id": { + "name": "group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "start_date": { + "name": "start_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "end_date": { + "name": "end_date", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "registration_opens_at": { + "name": "registration_opens_at", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "registration_closes_at": { + "name": "registration_closes_at", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "timezone": { + "name": "timezone", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'America/Denver'" + }, + "settings": { + "name": "settings", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "default_registration_fee_cents": { + "name": "default_registration_fee_cents", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "platform_fee_percentage": { + "name": "platform_fee_percentage", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "platform_fee_fixed": { + "name": "platform_fee_fixed", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pass_stripe_fees_to_customer": { + "name": "pass_stripe_fees_to_customer", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "pass_platform_fees_to_customer": { + "name": "pass_platform_fees_to_customer", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "visibility": { + "name": "visibility", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'public'" + }, + "status": { + "name": "status", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'draft'" + }, + "competition_type": { + "name": "competition_type", + "type": "varchar(15)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'in-person'" + }, + "profile_image_url": { + "name": "profile_image_url", + "type": "varchar(600)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banner_image_url": { + "name": "banner_image_url", + "type": "varchar(600)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "default_heats_per_rotation": { + "name": "default_heats_per_rotation", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 4 + }, + "default_lane_shift_pattern": { + "name": "default_lane_shift_pattern", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'shift_right'" + }, + "default_max_spots_per_division": { + "name": "default_max_spots_per_division", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "max_total_registrations": { + "name": "max_total_registrations", + "type": "int unsigned", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "primary_address_id": { + "name": "primary_address_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "competitions_organizing_team_idx": { + "name": "competitions_organizing_team_idx", + "columns": [ + "organizing_team_id" + ], + "isUnique": false + }, + "competitions_competition_team_idx": { + "name": "competitions_competition_team_idx", + "columns": [ + "competition_team_id" + ], + "isUnique": false + }, + "competitions_group_idx": { + "name": "competitions_group_idx", + "columns": [ + "group_id" + ], + "isUnique": false + }, + "competitions_start_date_idx": { + "name": "competitions_start_date_idx", + "columns": [ + "start_date" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competitions_id": { + "name": "competitions_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": { + "competitions_slug_unique": { + "name": "competitions_slug_unique", + "columns": [ + "slug" + ] + } + }, + "checkConstraint": {} + }, + "volunteer_registration_answers": { + "name": "volunteer_registration_answers", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "question_id": { + "name": "question_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "invitation_id": { + "name": "invitation_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "vol_reg_answers_question_idx": { + "name": "vol_reg_answers_question_idx", + "columns": [ + "question_id" + ], + "isUnique": false + }, + "vol_reg_answers_invitation_idx": { + "name": "vol_reg_answers_invitation_idx", + "columns": [ + "invitation_id" + ], + "isUnique": false + }, + "vol_reg_answers_unique_idx": { + "name": "vol_reg_answers_unique_idx", + "columns": [ + "question_id", + "invitation_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "volunteer_registration_answers_id": { + "name": "volunteer_registration_answers_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "crew_event_settings": { + "name": "crew_event_settings", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "crew_only": { + "name": "crew_only", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "source_platform": { + "name": "source_platform", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_event_url": { + "name": "source_event_url", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "external_registration_url": { + "name": "external_registration_url", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lifecycle": { + "name": "lifecycle", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'draft'" + }, + "concierge_status": { + "name": "concierge_status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'not_started'" + }, + "crew_plan": { + "name": "crew_plan", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'self_serve'" + }, + "full_platform_credit_cents": { + "name": "full_platform_credit_cents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "acquisition_source": { + "name": "acquisition_source", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "settings": { + "name": "settings", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "crew_event_settings_competition_unique_idx": { + "name": "crew_event_settings_competition_unique_idx", + "columns": [ + "competition_id" + ], + "isUnique": true + }, + "crew_event_settings_lifecycle_idx": { + "name": "crew_event_settings_lifecycle_idx", + "columns": [ + "lifecycle" + ], + "isUnique": false + }, + "crew_event_settings_plan_idx": { + "name": "crew_event_settings_plan_idx", + "columns": [ + "crew_plan" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "crew_event_settings_id": { + "name": "crew_event_settings_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "crew_assignment_confirmations": { + "name": "crew_assignment_confirmations", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "assignment_type": { + "name": "assignment_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "assignment_id": { + "name": "assignment_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "membership_id": { + "name": "membership_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invitation_id": { + "name": "invitation_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "competition_invite_id": { + "name": "competition_invite_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "token_hash": { + "name": "token_hash", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "sent_at": { + "name": "sent_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "responded_at": { + "name": "responded_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_note": { + "name": "response_note", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_reminder_at": { + "name": "last_reminder_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reminder_count": { + "name": "reminder_count", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + } + }, + "indexes": { + "crew_assignment_confirmations_competition_idx": { + "name": "crew_assignment_confirmations_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "crew_assignment_confirmations_assignment_idx": { + "name": "crew_assignment_confirmations_assignment_idx", + "columns": [ + "assignment_type", + "assignment_id" + ], + "isUnique": false + }, + "crew_assignment_confirmations_status_idx": { + "name": "crew_assignment_confirmations_status_idx", + "columns": [ + "status" + ], + "isUnique": false + }, + "crew_assignment_confirmations_membership_idx": { + "name": "crew_assignment_confirmations_membership_idx", + "columns": [ + "membership_id" + ], + "isUnique": false + }, + "crew_assignment_confirmations_invitation_idx": { + "name": "crew_assignment_confirmations_invitation_idx", + "columns": [ + "invitation_id" + ], + "isUnique": false + }, + "crew_assignment_confirmations_competition_invite_idx": { + "name": "crew_assignment_confirmations_competition_invite_idx", + "columns": [ + "competition_invite_id" + ], + "isUnique": false + }, + "crew_assignment_confirmations_email_idx": { + "name": "crew_assignment_confirmations_email_idx", + "columns": [ + "email" + ], + "isUnique": false + }, + "crew_assignment_confirmations_expires_idx": { + "name": "crew_assignment_confirmations_expires_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + }, + "crew_assignment_confirmations_token_hash_unique_idx": { + "name": "crew_assignment_confirmations_token_hash_unique_idx", + "columns": [ + "token_hash" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "crew_assignment_confirmations_id": { + "name": "crew_assignment_confirmations_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "crew_import_rows": { + "name": "crew_import_rows", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "import_id": { + "name": "import_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "row_number": { + "name": "row_number", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "raw_row": { + "name": "raw_row", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "normalized_row": { + "name": "normalized_row", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_type": { + "name": "target_type", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "warnings": { + "name": "warnings", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "errors": { + "name": "errors", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "crew_import_rows_import_idx": { + "name": "crew_import_rows_import_idx", + "columns": [ + "import_id" + ], + "isUnique": false + }, + "crew_import_rows_import_row_unique_idx": { + "name": "crew_import_rows_import_row_unique_idx", + "columns": [ + "import_id", + "row_number" + ], + "isUnique": true + }, + "crew_import_rows_target_idx": { + "name": "crew_import_rows_target_idx", + "columns": [ + "target_type", + "target_id" + ], + "isUnique": false + }, + "crew_import_rows_action_idx": { + "name": "crew_import_rows_action_idx", + "columns": [ + "action" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "crew_import_rows_id": { + "name": "crew_import_rows_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "crew_imports": { + "name": "crew_imports", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'unknown'" + }, + "source_platform": { + "name": "source_platform", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "original_filename": { + "name": "original_filename", + "type": "varchar(500)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "file_key": { + "name": "file_key", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'uploaded'" + }, + "parser_version": { + "name": "parser_version", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "headers": { + "name": "headers", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "column_mapping": { + "name": "column_mapping", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "summary": { + "name": "summary", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "warning_count": { + "name": "warning_count", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "error_count": { + "name": "error_count", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "row_count": { + "name": "row_count", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_count": { + "name": "created_count", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "updated_count": { + "name": "updated_count", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "skipped_count": { + "name": "skipped_count", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "applied_at": { + "name": "applied_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "applied_by": { + "name": "applied_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "crew_imports_competition_idx": { + "name": "crew_imports_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "crew_imports_status_idx": { + "name": "crew_imports_status_idx", + "columns": [ + "status" + ], + "isUnique": false + }, + "crew_imports_kind_idx": { + "name": "crew_imports_kind_idx", + "columns": [ + "kind" + ], + "isUnique": false + }, + "crew_imports_uploaded_by_idx": { + "name": "crew_imports_uploaded_by_idx", + "columns": [ + "uploaded_by" + ], + "isUnique": false + }, + "crew_imports_applied_by_idx": { + "name": "crew_imports_applied_by_idx", + "columns": [ + "applied_by" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "crew_imports_id": { + "name": "crew_imports_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "crew_department_leads": { + "name": "crew_department_leads", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "membership_id": { + "name": "membership_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invitation_id": { + "name": "invitation_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "role_type": { + "name": "role_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "venue_id": { + "name": "venue_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "starts_at": { + "name": "starts_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ends_at": { + "name": "ends_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scope": { + "name": "scope", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'invited'" + }, + "assigned_by": { + "name": "assigned_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "crew_department_leads_competition_idx": { + "name": "crew_department_leads_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "crew_department_leads_team_idx": { + "name": "crew_department_leads_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "crew_department_leads_membership_idx": { + "name": "crew_department_leads_membership_idx", + "columns": [ + "membership_id" + ], + "isUnique": false + }, + "crew_department_leads_invitation_idx": { + "name": "crew_department_leads_invitation_idx", + "columns": [ + "invitation_id" + ], + "isUnique": false + }, + "crew_department_leads_email_idx": { + "name": "crew_department_leads_email_idx", + "columns": [ + "email" + ], + "isUnique": false + }, + "crew_department_leads_role_idx": { + "name": "crew_department_leads_role_idx", + "columns": [ + "role_type" + ], + "isUnique": false + }, + "crew_department_leads_venue_idx": { + "name": "crew_department_leads_venue_idx", + "columns": [ + "venue_id" + ], + "isUnique": false + }, + "crew_department_leads_status_idx": { + "name": "crew_department_leads_status_idx", + "columns": [ + "status" + ], + "isUnique": false + }, + "crew_department_leads_time_idx": { + "name": "crew_department_leads_time_idx", + "columns": [ + "starts_at", + "ends_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "crew_department_leads_id": { + "name": "crew_department_leads_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "crew_import_mapping_presets": { + "name": "crew_import_mapping_presets", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_platform": { + "name": "source_platform", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'csv'" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "header_fingerprint": { + "name": "header_fingerprint", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headers": { + "name": "headers", + "type": "json", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "column_mapping": { + "name": "column_mapping", + "type": "json", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "parser_version": { + "name": "parser_version", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_used_at": { + "name": "last_used_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_by": { + "name": "created_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_by": { + "name": "updated_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "crew_import_mapping_presets_lookup_unique_idx": { + "name": "crew_import_mapping_presets_lookup_unique_idx", + "columns": [ + "team_id", + "source_platform", + "kind", + "header_fingerprint" + ], + "isUnique": true + }, + "crew_import_mapping_presets_team_kind_idx": { + "name": "crew_import_mapping_presets_team_kind_idx", + "columns": [ + "team_id", + "kind" + ], + "isUnique": false + }, + "crew_import_mapping_presets_competition_idx": { + "name": "crew_import_mapping_presets_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "crew_import_mapping_presets_last_used_idx": { + "name": "crew_import_mapping_presets_last_used_idx", + "columns": [ + "last_used_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "crew_import_mapping_presets_id": { + "name": "crew_import_mapping_presets_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "crew_template_presets": { + "name": "crew_template_presets", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "varchar(40)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "preset_data": { + "name": "preset_data", + "type": "json", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_by": { + "name": "created_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_by": { + "name": "updated_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_archived": { + "name": "is_archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + } + }, + "indexes": { + "crew_template_presets_team_kind_idx": { + "name": "crew_template_presets_team_kind_idx", + "columns": [ + "team_id", + "kind" + ], + "isUnique": false + }, + "crew_template_presets_competition_idx": { + "name": "crew_template_presets_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "crew_template_presets_created_by_idx": { + "name": "crew_template_presets_created_by_idx", + "columns": [ + "created_by" + ], + "isUnique": false + }, + "crew_template_presets_archived_idx": { + "name": "crew_template_presets_archived_idx", + "columns": [ + "is_archived" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "crew_template_presets_id": { + "name": "crew_template_presets_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "entitlements": { + "name": "entitlements", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "entitlement_type_id": { + "name": "entitlement_type_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_type": { + "name": "source_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_id": { + "name": "source_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "entitlement_user_id_idx": { + "name": "entitlement_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "entitlement_team_id_idx": { + "name": "entitlement_team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "entitlement_type_idx": { + "name": "entitlement_type_idx", + "columns": [ + "entitlement_type_id" + ], + "isUnique": false + }, + "entitlement_source_idx": { + "name": "entitlement_source_idx", + "columns": [ + "source_type", + "source_id" + ], + "isUnique": false + }, + "entitlement_deleted_at_idx": { + "name": "entitlement_deleted_at_idx", + "columns": [ + "deleted_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "entitlements_id": { + "name": "entitlements_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "entitlement_types": { + "name": "entitlement_types", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "entitlement_types_id": { + "name": "entitlement_types_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": { + "entitlement_types_name_unique": { + "name": "entitlement_types_name_unique", + "columns": [ + "name" + ] + } + }, + "checkConstraint": {} + }, + "features": { + "name": "features", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "category": { + "name": "category", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "features_id": { + "name": "features_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": { + "features_key_unique": { + "name": "features_key_unique", + "columns": [ + "key" + ] + } + }, + "checkConstraint": {} + }, + "limits": { + "name": "limits", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "unit": { + "name": "unit", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reset_period": { + "name": "reset_period", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'never'" + }, + "is_active": { + "name": "is_active", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "limits_id": { + "name": "limits_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": { + "limits_key_unique": { + "name": "limits_key_unique", + "columns": [ + "key" + ] + } + }, + "checkConstraint": {} + }, + "plan_features": { + "name": "plan_features", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "plan_id": { + "name": "plan_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "feature_id": { + "name": "feature_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "plan_feature_plan_id_idx": { + "name": "plan_feature_plan_id_idx", + "columns": [ + "plan_id" + ], + "isUnique": false + }, + "plan_feature_feature_id_idx": { + "name": "plan_feature_feature_id_idx", + "columns": [ + "feature_id" + ], + "isUnique": false + }, + "plan_feature_unique_idx": { + "name": "plan_feature_unique_idx", + "columns": [ + "plan_id", + "feature_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "plan_features_id": { + "name": "plan_features_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "plan_limits": { + "name": "plan_limits", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "plan_id": { + "name": "plan_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "limit_id": { + "name": "limit_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "plan_limit_plan_id_idx": { + "name": "plan_limit_plan_id_idx", + "columns": [ + "plan_id" + ], + "isUnique": false + }, + "plan_limit_limit_id_idx": { + "name": "plan_limit_limit_id_idx", + "columns": [ + "limit_id" + ], + "isUnique": false + }, + "plan_limit_unique_idx": { + "name": "plan_limit_unique_idx", + "columns": [ + "plan_id", + "limit_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "plan_limits_id": { + "name": "plan_limits_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "plans": { + "name": "plans", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "price": { + "name": "price", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "interval": { + "name": "interval", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "is_public": { + "name": "is_public", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "sort_order": { + "name": "sort_order", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "entitlements": { + "name": "entitlements", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_price_id": { + "name": "stripe_price_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_product_id": { + "name": "stripe_product_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "plans_id": { + "name": "plans_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "team_addons": { + "name": "team_addons", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "addon_id": { + "name": "addon_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "quantity": { + "name": "quantity", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_subscription_item_id": { + "name": "stripe_subscription_item_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "team_addon_team_id_idx": { + "name": "team_addon_team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "team_addon_status_idx": { + "name": "team_addon_status_idx", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "team_addons_id": { + "name": "team_addons_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "team_entitlement_overrides": { + "name": "team_entitlement_overrides", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_by": { + "name": "created_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "team_entitlement_override_team_id_idx": { + "name": "team_entitlement_override_team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "team_entitlement_override_type_idx": { + "name": "team_entitlement_override_type_idx", + "columns": [ + "type" + ], + "isUnique": false + }, + "team_entitlement_override_team_type_key_unique": { + "name": "team_entitlement_override_team_type_key_unique", + "columns": [ + "team_id", + "type", + "key" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "team_entitlement_overrides_id": { + "name": "team_entitlement_overrides_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "team_feature_entitlements": { + "name": "team_feature_entitlements", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "feature_id": { + "name": "feature_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'plan'" + }, + "source_plan_id": { + "name": "source_plan_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "team_feature_entitlement_team_id_idx": { + "name": "team_feature_entitlement_team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "team_feature_entitlement_feature_id_idx": { + "name": "team_feature_entitlement_feature_id_idx", + "columns": [ + "feature_id" + ], + "isUnique": false + }, + "team_feature_entitlement_team_feature_unique": { + "name": "team_feature_entitlement_team_feature_unique", + "columns": [ + "team_id", + "feature_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "team_feature_entitlements_id": { + "name": "team_feature_entitlements_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "team_limit_entitlements": { + "name": "team_limit_entitlements", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "limit_id": { + "name": "limit_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'plan'" + }, + "source_plan_id": { + "name": "source_plan_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "team_limit_entitlement_team_id_idx": { + "name": "team_limit_entitlement_team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "team_limit_entitlement_limit_id_idx": { + "name": "team_limit_entitlement_limit_id_idx", + "columns": [ + "limit_id" + ], + "isUnique": false + }, + "team_limit_entitlement_team_limit_unique": { + "name": "team_limit_entitlement_team_limit_unique", + "columns": [ + "team_id", + "limit_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "team_limit_entitlements_id": { + "name": "team_limit_entitlements_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "team_subscriptions": { + "name": "team_subscriptions", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "plan_id": { + "name": "plan_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "current_period_start": { + "name": "current_period_start", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "current_period_end": { + "name": "current_period_end", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cancel_at_period_end": { + "name": "cancel_at_period_end", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "trial_start": { + "name": "trial_start", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "trial_end": { + "name": "trial_end", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_subscription_id": { + "name": "stripe_subscription_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_customer_id": { + "name": "stripe_customer_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "team_subscription_team_id_idx": { + "name": "team_subscription_team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "team_subscription_status_idx": { + "name": "team_subscription_status_idx", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "team_subscriptions_id": { + "name": "team_subscriptions_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "team_usages": { + "name": "team_usages", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "limit_key": { + "name": "limit_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "current_value": { + "name": "current_value", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "period_start": { + "name": "period_start", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "period_end": { + "name": "period_end", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "team_usage_team_id_idx": { + "name": "team_usage_team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "team_usage_limit_key_idx": { + "name": "team_usage_limit_key_idx", + "columns": [ + "limit_key" + ], + "isUnique": false + }, + "team_usage_unique_idx": { + "name": "team_usage_unique_idx", + "columns": [ + "team_id", + "limit_key", + "period_start" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "team_usages_id": { + "name": "team_usages_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "event_division_mappings": { + "name": "event_division_mappings", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_workout_id": { + "name": "track_workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "division_id": { + "name": "division_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "edm_comp_event_div_idx": { + "name": "edm_comp_event_div_idx", + "columns": [ + "competition_id", + "track_workout_id", + "division_id" + ], + "isUnique": true + }, + "edm_competition_idx": { + "name": "edm_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "edm_event_idx": { + "name": "edm_event_idx", + "columns": [ + "track_workout_id" + ], + "isUnique": false + }, + "edm_division_idx": { + "name": "edm_division_idx", + "columns": [ + "division_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "event_division_mappings_id": { + "name": "event_division_mappings_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "event_resources": { + "name": "event_resources", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "event_id": { + "name": "event_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "event_resources_event_idx": { + "name": "event_resources_event_idx", + "columns": [ + "event_id" + ], + "isUnique": false + }, + "event_resources_event_order_idx": { + "name": "event_resources_event_order_idx", + "columns": [ + "event_id", + "sort_order" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "event_resources_id": { + "name": "event_resources_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "financial_events": { + "name": "financial_events", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "purchase_id": { + "name": "purchase_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "event_type": { + "name": "event_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "amount_cents": { + "name": "amount_cents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "currency": { + "name": "currency", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'usd'" + }, + "stripe_payment_intent_id": { + "name": "stripe_payment_intent_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_refund_id": { + "name": "stripe_refund_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_dispute_id": { + "name": "stripe_dispute_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_event_timestamp": { + "name": "stripe_event_timestamp", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "financial_event_purchase_idx": { + "name": "financial_event_purchase_idx", + "columns": [ + "purchase_id" + ], + "isUnique": false + }, + "financial_event_team_idx": { + "name": "financial_event_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "financial_event_type_idx": { + "name": "financial_event_type_idx", + "columns": [ + "event_type" + ], + "isUnique": false + }, + "financial_event_stripe_pi_idx": { + "name": "financial_event_stripe_pi_idx", + "columns": [ + "stripe_payment_intent_id" + ], + "isUnique": false + }, + "financial_event_stripe_refund_idx": { + "name": "financial_event_stripe_refund_idx", + "columns": [ + "stripe_refund_id" + ], + "isUnique": false + }, + "financial_event_stripe_dispute_idx": { + "name": "financial_event_stripe_dispute_idx", + "columns": [ + "stripe_dispute_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "financial_events_id": { + "name": "financial_events_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "event_judging_sheets": { + "name": "event_judging_sheets", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_workout_id": { + "name": "track_workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "r2_key": { + "name": "r2_key", + "type": "varchar(600)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "varchar(600)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_filename": { + "name": "original_filename", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "file_size": { + "name": "file_size", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "mime_type": { + "name": "mime_type", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + } + }, + "indexes": { + "event_judging_sheets_competition_idx": { + "name": "event_judging_sheets_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "event_judging_sheets_event_idx": { + "name": "event_judging_sheets_event_idx", + "columns": [ + "track_workout_id" + ], + "isUnique": false + }, + "event_judging_sheets_uploaded_by_idx": { + "name": "event_judging_sheets_uploaded_by_idx", + "columns": [ + "uploaded_by" + ], + "isUnique": false + }, + "event_judging_sheets_sort_idx": { + "name": "event_judging_sheets_sort_idx", + "columns": [ + "track_workout_id", + "sort_order" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "event_judging_sheets_id": { + "name": "event_judging_sheets_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "submission_window_notifications": { + "name": "submission_window_notifications", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_event_id": { + "name": "competition_event_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "registration_id": { + "name": "registration_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sent_to_email": { + "name": "sent_to_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "submission_window_notif_competition_idx": { + "name": "submission_window_notif_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "submission_window_notif_event_idx": { + "name": "submission_window_notif_event_idx", + "columns": [ + "competition_event_id" + ], + "isUnique": false + }, + "submission_window_notif_user_idx": { + "name": "submission_window_notif_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "submission_window_notif_unique_idx": { + "name": "submission_window_notif_unique_idx", + "columns": [ + "competition_event_id", + "registration_id", + "type" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "submission_window_notifications_id": { + "name": "submission_window_notifications_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "organizer_requests": { + "name": "organizer_requests", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "admin_notes": { + "name": "admin_notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reviewed_by": { + "name": "reviewed_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reviewed_at": { + "name": "reviewed_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "organizer_request_team_idx": { + "name": "organizer_request_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "organizer_request_user_idx": { + "name": "organizer_request_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "organizer_request_status_idx": { + "name": "organizer_request_status_idx", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "organizer_requests_id": { + "name": "organizer_requests_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "programming_tracks": { + "name": "programming_tracks", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "owner_team_id": { + "name": "owner_team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scaling_group_id": { + "name": "scaling_group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_public": { + "name": "is_public", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "programming_track_type_idx": { + "name": "programming_track_type_idx", + "columns": [ + "type" + ], + "isUnique": false + }, + "programming_track_owner_idx": { + "name": "programming_track_owner_idx", + "columns": [ + "owner_team_id" + ], + "isUnique": false + }, + "programming_track_scaling_idx": { + "name": "programming_track_scaling_idx", + "columns": [ + "scaling_group_id" + ], + "isUnique": false + }, + "programming_track_competition_idx": { + "name": "programming_track_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "programming_tracks_id": { + "name": "programming_tracks_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "scheduled_workout_instances": { + "name": "scheduled_workout_instances", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_workout_id": { + "name": "track_workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "workout_id": { + "name": "workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scheduled_date": { + "name": "scheduled_date", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_specific_notes": { + "name": "team_specific_notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scaling_guidance_for_day": { + "name": "scaling_guidance_for_day", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "class_times": { + "name": "class_times", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "scheduled_workout_instance_team_idx": { + "name": "scheduled_workout_instance_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "scheduled_workout_instance_date_idx": { + "name": "scheduled_workout_instance_date_idx", + "columns": [ + "scheduled_date" + ], + "isUnique": false + }, + "scheduled_workout_instance_workout_idx": { + "name": "scheduled_workout_instance_workout_idx", + "columns": [ + "workout_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "scheduled_workout_instances_id": { + "name": "scheduled_workout_instances_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "team_programming_tracks": { + "name": "team_programming_tracks", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_id": { + "name": "track_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "subscribed_at": { + "name": "subscribed_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "start_day_offset": { + "name": "start_day_offset", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + } + }, + "indexes": { + "team_programming_track_active_idx": { + "name": "team_programming_track_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + }, + "team_programming_track_team_idx": { + "name": "team_programming_track_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "team_programming_tracks_team_id_track_id_pk": { + "name": "team_programming_tracks_team_id_track_id_pk", + "columns": [ + "team_id", + "track_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "track_workouts": { + "name": "track_workouts", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_id": { + "name": "track_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workout_id": { + "name": "workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "parent_event_id": { + "name": "parent_event_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "track_order": { + "name": "track_order", + "type": "decimal(6,2)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "points_multiplier": { + "name": "points_multiplier", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 100 + }, + "heat_status": { + "name": "heat_status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'draft'" + }, + "event_status": { + "name": "event_status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'draft'" + }, + "sponsor_id": { + "name": "sponsor_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "default_heats_count": { + "name": "default_heats_count", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "default_lane_shift_pattern": { + "name": "default_lane_shift_pattern", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "min_heat_buffer": { + "name": "min_heat_buffer", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 2 + }, + "benchmark_test_id": { + "name": "benchmark_test_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "benchmark_category": { + "name": "benchmark_category", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "track_workout_track_idx": { + "name": "track_workout_track_idx", + "columns": [ + "track_id" + ], + "isUnique": false + }, + "track_workout_order_idx": { + "name": "track_workout_order_idx", + "columns": [ + "track_order" + ], + "isUnique": false + }, + "track_workout_parent_idx": { + "name": "track_workout_parent_idx", + "columns": [ + "parent_event_id" + ], + "isUnique": false + }, + "track_workout_workoutid_idx": { + "name": "track_workout_workoutid_idx", + "columns": [ + "workout_id" + ], + "isUnique": false + }, + "track_workout_unique_idx": { + "name": "track_workout_unique_idx", + "columns": [ + "track_id", + "workout_id", + "track_order" + ], + "isUnique": false + }, + "track_workout_sponsor_idx": { + "name": "track_workout_sponsor_idx", + "columns": [ + "sponsor_id" + ], + "isUnique": false + }, + "track_workout_benchmark_test_idx": { + "name": "track_workout_benchmark_test_idx", + "columns": [ + "benchmark_test_id" + ], + "isUnique": false + }, + "track_workout_benchmark_category_idx": { + "name": "track_workout_benchmark_category_idx", + "columns": [ + "benchmark_category" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "track_workouts_id": { + "name": "track_workouts_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "route_doc_routes": { + "name": "route_doc_routes", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "doc_id": { + "name": "doc_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "route_id": { + "name": "route_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "route_doc_routes_route_idx": { + "name": "route_doc_routes_route_idx", + "columns": [ + "route_id" + ], + "isUnique": false + }, + "route_doc_routes_doc_route_unique": { + "name": "route_doc_routes_doc_route_unique", + "columns": [ + "doc_id", + "route_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "route_doc_routes_id": { + "name": "route_doc_routes_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "route_doc_versions": { + "name": "route_doc_versions", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "doc_id": { + "name": "doc_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "enum('markdown','video','link')", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "video_url": { + "name": "video_url", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "link_url": { + "name": "link_url", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "route_doc_versions_doc_idx": { + "name": "route_doc_versions_doc_idx", + "columns": [ + "doc_id" + ], + "isUnique": false + }, + "route_doc_versions_doc_version_unique": { + "name": "route_doc_versions_doc_version_unique", + "columns": [ + "doc_id", + "version" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "route_doc_versions_id": { + "name": "route_doc_versions_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "route_docs": { + "name": "route_docs", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "varchar(1024)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "enum('markdown','video','link')", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'markdown'" + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "video_url": { + "name": "video_url", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "link_url": { + "name": "link_url", + "type": "varchar(2048)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_published": { + "name": "is_published", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "sort_order": { + "name": "sort_order", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "route_docs_published_idx": { + "name": "route_docs_published_idx", + "columns": [ + "is_published" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "route_docs_id": { + "name": "route_docs_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "scaling_groups": { + "name": "scaling_groups", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "is_system": { + "name": "is_system", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + } + }, + "indexes": { + "scaling_groups_team_idx": { + "name": "scaling_groups_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "scaling_groups_default_idx": { + "name": "scaling_groups_default_idx", + "columns": [ + "is_default" + ], + "isUnique": false + }, + "scaling_groups_system_idx": { + "name": "scaling_groups_system_idx", + "columns": [ + "is_system" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "scaling_groups_id": { + "name": "scaling_groups_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "scaling_levels": { + "name": "scaling_levels", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scaling_group_id": { + "name": "scaling_group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "position": { + "name": "position", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_size": { + "name": "team_size", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": { + "scaling_levels_group_idx": { + "name": "scaling_levels_group_idx", + "columns": [ + "scaling_group_id" + ], + "isUnique": false + }, + "scaling_levels_position_idx": { + "name": "scaling_levels_position_idx", + "columns": [ + "scaling_group_id", + "position" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "scaling_levels_id": { + "name": "scaling_levels_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "workout_scaling_descriptions": { + "name": "workout_scaling_descriptions", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workout_id": { + "name": "workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scaling_level_id": { + "name": "scaling_level_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "workout_scaling_desc_workout_idx": { + "name": "workout_scaling_desc_workout_idx", + "columns": [ + "workout_id" + ], + "isUnique": false + }, + "workout_scaling_desc_unique_idx": { + "name": "workout_scaling_desc_unique_idx", + "columns": [ + "workout_id", + "scaling_level_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "workout_scaling_descriptions_id": { + "name": "workout_scaling_descriptions_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "series_division_mappings": { + "name": "series_division_mappings", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "group_id": { + "name": "group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_division_id": { + "name": "competition_division_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "series_division_id": { + "name": "series_division_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "sdm_group_comp_div_idx": { + "name": "sdm_group_comp_div_idx", + "columns": [ + "group_id", + "competition_id", + "competition_division_id" + ], + "isUnique": true + }, + "sdm_group_idx": { + "name": "sdm_group_idx", + "columns": [ + "group_id" + ], + "isUnique": false + }, + "sdm_competition_idx": { + "name": "sdm_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "series_division_mappings_id": { + "name": "series_division_mappings_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "series_event_mappings": { + "name": "series_event_mappings", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "group_id": { + "name": "group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_event_id": { + "name": "competition_event_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "template_event_id": { + "name": "template_event_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "sem_group_comp_event_idx": { + "name": "sem_group_comp_event_idx", + "columns": [ + "group_id", + "competition_id", + "competition_event_id" + ], + "isUnique": true + }, + "sem_group_template_idx": { + "name": "sem_group_template_idx", + "columns": [ + "group_id", + "template_event_id" + ], + "isUnique": false + }, + "sem_competition_idx": { + "name": "sem_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "series_event_mappings_id": { + "name": "series_event_mappings_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "series_template_divisions": { + "name": "series_template_divisions", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "group_id": { + "name": "group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "division_id": { + "name": "division_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fee_cents": { + "name": "fee_cents", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "max_spots": { + "name": "max_spots", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "std_group_division_idx": { + "name": "std_group_division_idx", + "columns": [ + "group_id", + "division_id" + ], + "isUnique": true + }, + "std_group_idx": { + "name": "std_group_idx", + "columns": [ + "group_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "series_template_divisions_id": { + "name": "series_template_divisions_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "class_catalogs": { + "name": "class_catalogs", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "duration_minutes": { + "name": "duration_minutes", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 60 + }, + "max_participants": { + "name": "max_participants", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 20 + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "class_catalogs_id": { + "name": "class_catalogs_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "class_catalog_to_skills": { + "name": "class_catalog_to_skills", + "columns": { + "class_catalog_id": { + "name": "class_catalog_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "skill_id": { + "name": "skill_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "class_catalog_to_skills_class_catalog_id_skill_id_pk": { + "name": "class_catalog_to_skills_class_catalog_id_skill_id_pk", + "columns": [ + "class_catalog_id", + "skill_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "coach_blackout_dates": { + "name": "coach_blackout_dates", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "coach_id": { + "name": "coach_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "start_date": { + "name": "start_date", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "end_date": { + "name": "end_date", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "coach_blackout_dates_id": { + "name": "coach_blackout_dates_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "coach_recurring_unavailability": { + "name": "coach_recurring_unavailability", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "coach_id": { + "name": "coach_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "day_of_week": { + "name": "day_of_week", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "start_time": { + "name": "start_time", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "end_time": { + "name": "end_time", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "coach_recurring_unavailability_id": { + "name": "coach_recurring_unavailability_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "coach_to_skills": { + "name": "coach_to_skills", + "columns": { + "coach_id": { + "name": "coach_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "skill_id": { + "name": "skill_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "coach_to_skills_coach_id_skill_id_pk": { + "name": "coach_to_skills_coach_id_skill_id_pk", + "columns": [ + "coach_id", + "skill_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "coaches": { + "name": "coaches", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "weekly_class_limit": { + "name": "weekly_class_limit", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scheduling_preference": { + "name": "scheduling_preference", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scheduling_notes": { + "name": "scheduling_notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + } + }, + "indexes": { + "coach_user_team_unique_idx": { + "name": "coach_user_team_unique_idx", + "columns": [ + "user_id", + "team_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "coaches_id": { + "name": "coaches_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "generated_schedules": { + "name": "generated_schedules", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "location_id": { + "name": "location_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "week_start_date": { + "name": "week_start_date", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "generated_schedules_id": { + "name": "generated_schedules_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "locations": { + "name": "locations", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "capacity": { + "name": "capacity", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 20 + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "locations_id": { + "name": "locations_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "schedule_template_class_required_skills": { + "name": "schedule_template_class_required_skills", + "columns": { + "template_class_id": { + "name": "template_class_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "skill_id": { + "name": "skill_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "sched_class_skills_pk": { + "name": "sched_class_skills_pk", + "columns": [ + "template_class_id", + "skill_id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "schedule_template_classes": { + "name": "schedule_template_classes", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "template_id": { + "name": "template_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "day_of_week": { + "name": "day_of_week", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "start_time": { + "name": "start_time", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "end_time": { + "name": "end_time", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "required_coaches": { + "name": "required_coaches", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "schedule_template_classes_id": { + "name": "schedule_template_classes_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "schedule_templates": { + "name": "schedule_templates", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "class_catalog_id": { + "name": "class_catalog_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "location_id": { + "name": "location_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "schedule_templates_id": { + "name": "schedule_templates_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "scheduled_classes": { + "name": "scheduled_classes", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schedule_id": { + "name": "schedule_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "coach_id": { + "name": "coach_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "class_catalog_id": { + "name": "class_catalog_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "location_id": { + "name": "location_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "start_time": { + "name": "start_time", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "end_time": { + "name": "end_time", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "scheduled_classes_id": { + "name": "scheduled_classes_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "skills": { + "name": "skills", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "skills_id": { + "name": "skills_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "score_rounds": { + "name": "score_rounds", + "columns": { + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "score_id": { + "name": "score_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "round_number": { + "name": "round_number", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scheme_override": { + "name": "scheme_override", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "secondary_value": { + "name": "secondary_value", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_score_rounds_score": { + "name": "idx_score_rounds_score", + "columns": [ + "score_id", + "round_number" + ], + "isUnique": false + }, + "idx_score_rounds_unique": { + "name": "idx_score_rounds_unique", + "columns": [ + "score_id", + "round_number" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "score_rounds_id": { + "name": "score_rounds_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "score_verification_logs": { + "name": "score_verification_logs", + "columns": { + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "score_id": { + "name": "score_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "track_workout_id": { + "name": "track_workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "athlete_user_id": { + "name": "athlete_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action": { + "name": "action", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_score_value": { + "name": "original_score_value", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "original_status": { + "name": "original_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "original_secondary_value": { + "name": "original_secondary_value", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "original_tiebreak_value": { + "name": "original_tiebreak_value", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "new_score_value": { + "name": "new_score_value", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "new_status": { + "name": "new_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "new_secondary_value": { + "name": "new_secondary_value", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "new_tiebreak_value": { + "name": "new_tiebreak_value", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "penalty_type": { + "name": "penalty_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "penalty_percentage": { + "name": "penalty_percentage", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "no_rep_count": { + "name": "no_rep_count", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "performed_by_user_id": { + "name": "performed_by_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "performed_at": { + "name": "performed_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_svlog_score": { + "name": "idx_svlog_score", + "columns": [ + "score_id" + ], + "isUnique": false + }, + "idx_svlog_performer": { + "name": "idx_svlog_performer", + "columns": [ + "performed_by_user_id", + "performed_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "score_verification_logs_id": { + "name": "score_verification_logs_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "scores": { + "name": "scores", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workout_id": { + "name": "workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_event_id": { + "name": "competition_event_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scheduled_workout_instance_id": { + "name": "scheduled_workout_instance_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scheme": { + "name": "scheme", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "score_type": { + "name": "score_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'max'" + }, + "score_value": { + "name": "score_value", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "tiebreak_scheme": { + "name": "tiebreak_scheme", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "tiebreak_value": { + "name": "tiebreak_value", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "time_cap_ms": { + "name": "time_cap_ms", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "secondary_value": { + "name": "secondary_value", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'scored'" + }, + "status_order": { + "name": "status_order", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "sort_key": { + "name": "sort_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scaling_level_id": { + "name": "scaling_level_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "as_rx": { + "name": "as_rx", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "benchmark_variant": { + "name": "benchmark_variant", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "recorded_at": { + "name": "recorded_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "verification_status": { + "name": "verification_status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "verified_at": { + "name": "verified_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "verified_by_user_id": { + "name": "verified_by_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "penalty_type": { + "name": "penalty_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "penalty_percentage": { + "name": "penalty_percentage", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "no_rep_count": { + "name": "no_rep_count", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "idx_scores_user": { + "name": "idx_scores_user", + "columns": [ + "user_id", + "recorded_at" + ], + "isUnique": false + }, + "idx_scores_workout": { + "name": "idx_scores_workout", + "columns": [ + "workout_id", + "team_id", + "status_order", + "sort_key" + ], + "isUnique": false + }, + "idx_scores_competition": { + "name": "idx_scores_competition", + "columns": [ + "competition_event_id", + "status_order", + "sort_key" + ], + "isUnique": false + }, + "idx_scores_scheduled": { + "name": "idx_scores_scheduled", + "columns": [ + "scheduled_workout_instance_id" + ], + "isUnique": false + }, + "idx_scores_competition_user_unique": { + "name": "idx_scores_competition_user_unique", + "columns": [ + "competition_event_id", + "user_id", + "scaling_level_id" + ], + "isUnique": true + }, + "idx_scores_benchmark_variant": { + "name": "idx_scores_benchmark_variant", + "columns": [ + "competition_event_id", + "benchmark_variant" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "scores_id": { + "name": "scores_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "sponsor_groups": { + "name": "sponsor_groups", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "display_order": { + "name": "display_order", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + } + }, + "indexes": { + "sponsor_groups_competition_idx": { + "name": "sponsor_groups_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "sponsor_groups_order_idx": { + "name": "sponsor_groups_order_idx", + "columns": [ + "competition_id", + "display_order" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "sponsor_groups_id": { + "name": "sponsor_groups_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "sponsors": { + "name": "sponsors", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "group_id": { + "name": "group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "logo_url": { + "name": "logo_url", + "type": "varchar(600)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "website": { + "name": "website", + "type": "varchar(600)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "display_order": { + "name": "display_order", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + } + }, + "indexes": { + "sponsors_competition_idx": { + "name": "sponsors_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "sponsors_user_idx": { + "name": "sponsors_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "sponsors_group_idx": { + "name": "sponsors_group_idx", + "columns": [ + "group_id" + ], + "isUnique": false + }, + "sponsors_competition_order_idx": { + "name": "sponsors_competition_order_idx", + "columns": [ + "competition_id", + "group_id", + "display_order" + ], + "isUnique": false + }, + "sponsors_user_order_idx": { + "name": "sponsors_user_order_idx", + "columns": [ + "user_id", + "display_order" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "sponsors_id": { + "name": "sponsors_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "team_invitations": { + "name": "team_invitations", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role_id": { + "name": "role_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_system_role": { + "name": "is_system_role", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "token": { + "name": "token", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "invited_by": { + "name": "invited_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accepted_at": { + "name": "accepted_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "accepted_by": { + "name": "accepted_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "team_invitation_team_id_idx": { + "name": "team_invitation_team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "team_invitation_email_idx": { + "name": "team_invitation_email_idx", + "columns": [ + "email" + ], + "isUnique": false + }, + "team_invitation_token_idx": { + "name": "team_invitation_token_idx", + "columns": [ + "token" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "team_invitations_id": { + "name": "team_invitations_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": { + "team_invitations_token_unique": { + "name": "team_invitations_token_unique", + "columns": [ + "token" + ] + } + }, + "checkConstraint": {} + }, + "team_memberships": { + "name": "team_memberships", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role_id": { + "name": "role_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_system_role": { + "name": "is_system_role", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "invited_by": { + "name": "invited_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invited_at": { + "name": "invited_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "joined_at": { + "name": "joined_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "team_membership_team_id_idx": { + "name": "team_membership_team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "team_membership_user_id_idx": { + "name": "team_membership_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "team_membership_unique_idx": { + "name": "team_membership_unique_idx", + "columns": [ + "team_id", + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "team_memberships_id": { + "name": "team_memberships_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "team_roles": { + "name": "team_roles", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "permissions": { + "name": "permissions", + "type": "json", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_editable": { + "name": "is_editable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + } + }, + "indexes": { + "team_role_team_id_idx": { + "name": "team_role_team_id_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "team_role_name_unique_idx": { + "name": "team_role_name_unique_idx", + "columns": [ + "team_id", + "name" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "team_roles_id": { + "name": "team_roles_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "teams": { + "name": "teams", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "avatar_url": { + "name": "avatar_url", + "type": "varchar(600)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "settings": { + "name": "settings", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "billing_email": { + "name": "billing_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "plan_id": { + "name": "plan_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "plan_expires_at": { + "name": "plan_expires_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "credit_balance": { + "name": "credit_balance", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "current_plan_id": { + "name": "current_plan_id", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "default_track_id": { + "name": "default_track_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "default_scaling_group_id": { + "name": "default_scaling_group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_personal_team": { + "name": "is_personal_team", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "personal_team_owner_id": { + "name": "personal_team_owner_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'gym'" + }, + "parent_organization_id": { + "name": "parent_organization_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "competition_metadata": { + "name": "competition_metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_connected_account_id": { + "name": "stripe_connected_account_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_account_status": { + "name": "stripe_account_status", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_account_type": { + "name": "stripe_account_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stripe_onboarding_completed_at": { + "name": "stripe_onboarding_completed_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "organizer_fee_percentage": { + "name": "organizer_fee_percentage", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "organizer_fee_fixed": { + "name": "organizer_fee_fixed", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "team_slug_idx": { + "name": "team_slug_idx", + "columns": [ + "slug" + ], + "isUnique": false + }, + "team_personal_owner_idx": { + "name": "team_personal_owner_idx", + "columns": [ + "personal_team_owner_id" + ], + "isUnique": false + }, + "team_default_scaling_idx": { + "name": "team_default_scaling_idx", + "columns": [ + "default_scaling_group_id" + ], + "isUnique": false + }, + "team_type_idx": { + "name": "team_type_idx", + "columns": [ + "type" + ], + "isUnique": false + }, + "team_parent_org_idx": { + "name": "team_parent_org_idx", + "columns": [ + "parent_organization_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "teams_id": { + "name": "teams_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": { + "teams_slug_unique": { + "name": "teams_slug_unique", + "columns": [ + "slug" + ] + } + }, + "checkConstraint": {} + }, + "passkey_credentials": { + "name": "passkey_credentials", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "credential_id": { + "name": "credential_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "credential_public_key": { + "name": "credential_public_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "counter": { + "name": "counter", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "transports": { + "name": "transports", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "aaguid": { + "name": "aaguid", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_agent": { + "name": "user_agent", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ip_address": { + "name": "ip_address", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "user_id_idx": { + "name": "user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "credential_id_idx": { + "name": "credential_id_idx", + "columns": [ + "credential_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "passkey_credentials_id": { + "name": "passkey_credentials_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": { + "passkey_credentials_credentialId_unique": { + "name": "passkey_credentials_credentialId_unique", + "columns": [ + "credential_id" + ] + } + }, + "checkConstraint": {} + }, + "users": { + "name": "users", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "first_name": { + "name": "first_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_name": { + "name": "last_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "password_hash": { + "name": "password_hash", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'user'" + }, + "email_verified": { + "name": "email_verified", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sign_up_ip_address": { + "name": "sign_up_ip_address", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "google_account_id": { + "name": "google_account_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "avatar": { + "name": "avatar", + "type": "varchar(600)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "current_credits": { + "name": "current_credits", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_credit_refresh_at": { + "name": "last_credit_refresh_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "gender": { + "name": "gender", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "date_of_birth": { + "name": "date_of_birth", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "affiliate_name": { + "name": "affiliate_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "athlete_profile": { + "name": "athlete_profile", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "email_idx": { + "name": "email_idx", + "columns": [ + "email" + ], + "isUnique": false + }, + "google_account_id_idx": { + "name": "google_account_id_idx", + "columns": [ + "google_account_id" + ], + "isUnique": false + }, + "role_idx": { + "name": "role_idx", + "columns": [ + "role" + ], + "isUnique": false + }, + "user_gender_idx": { + "name": "user_gender_idx", + "columns": [ + "gender" + ], + "isUnique": false + }, + "user_dob_idx": { + "name": "user_dob_idx", + "columns": [ + "date_of_birth" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "users_id": { + "name": "users_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "columns": [ + "email" + ] + } + }, + "checkConstraint": {} + }, + "review_notes": { + "name": "review_notes", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "video_submission_id": { + "name": "video_submission_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "enum('general','no-rep')", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'general'" + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "timestamp_seconds": { + "name": "timestamp_seconds", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "movement_id": { + "name": "movement_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "review_notes_submission_idx": { + "name": "review_notes_submission_idx", + "columns": [ + "video_submission_id" + ], + "isUnique": false + }, + "review_notes_user_idx": { + "name": "review_notes_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "review_notes_team_idx": { + "name": "review_notes_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "review_notes_id": { + "name": "review_notes_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "video_submissions": { + "name": "video_submissions", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "registration_id": { + "name": "registration_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_workout_id": { + "name": "track_workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "video_index": { + "name": "video_index", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "video_url": { + "name": "video_url", + "type": "varchar(2000)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "review_status": { + "name": "review_status", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "status_updated_at": { + "name": "status_updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reviewer_notes": { + "name": "reviewer_notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reviewed_at": { + "name": "reviewed_at", + "type": "datetime", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reviewed_by": { + "name": "reviewed_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "video_submissions_reg_event_idx": { + "name": "video_submissions_reg_event_idx", + "columns": [ + "registration_id", + "track_workout_id", + "video_index" + ], + "isUnique": true + }, + "video_submissions_user_idx": { + "name": "video_submissions_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "video_submissions_event_idx": { + "name": "video_submissions_event_idx", + "columns": [ + "track_workout_id" + ], + "isUnique": false + }, + "video_submissions_registration_idx": { + "name": "video_submissions_registration_idx", + "columns": [ + "registration_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "video_submissions_id": { + "name": "video_submissions_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "video_votes": { + "name": "video_votes", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "video_submission_id": { + "name": "video_submission_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "vote_type": { + "name": "vote_type", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reason_detail": { + "name": "reason_detail", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "voted_at": { + "name": "voted_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "video_votes_user_submission_idx": { + "name": "video_votes_user_submission_idx", + "columns": [ + "user_id", + "video_submission_id" + ], + "isUnique": true + }, + "video_votes_submission_idx": { + "name": "video_votes_submission_idx", + "columns": [ + "video_submission_id" + ], + "isUnique": false + }, + "video_votes_user_idx": { + "name": "video_votes_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "video_votes_id": { + "name": "video_votes_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "competition_judge_rotations": { + "name": "competition_judge_rotations", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_workout_id": { + "name": "track_workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "membership_id": { + "name": "membership_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "starting_heat": { + "name": "starting_heat", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "starting_lane": { + "name": "starting_lane", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "heats_count": { + "name": "heats_count", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "lane_shift_pattern": { + "name": "lane_shift_pattern", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'stay'" + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "competition_judge_rotations_competition_idx": { + "name": "competition_judge_rotations_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "competition_judge_rotations_workout_idx": { + "name": "competition_judge_rotations_workout_idx", + "columns": [ + "track_workout_id" + ], + "isUnique": false + }, + "competition_judge_rotations_membership_idx": { + "name": "competition_judge_rotations_membership_idx", + "columns": [ + "membership_id" + ], + "isUnique": false + }, + "competition_judge_rotations_event_heat_idx": { + "name": "competition_judge_rotations_event_heat_idx", + "columns": [ + "track_workout_id", + "starting_heat" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "competition_judge_rotations_id": { + "name": "competition_judge_rotations_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "judge_assignment_versions": { + "name": "judge_assignment_versions", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "track_workout_id": { + "name": "track_workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "version": { + "name": "version", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "published_at": { + "name": "published_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "published_by": { + "name": "published_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + } + }, + "indexes": { + "judge_assignment_versions_workout_idx": { + "name": "judge_assignment_versions_workout_idx", + "columns": [ + "track_workout_id" + ], + "isUnique": false + }, + "judge_assignment_versions_active_idx": { + "name": "judge_assignment_versions_active_idx", + "columns": [ + "track_workout_id", + "is_active" + ], + "isUnique": false + }, + "judge_assignment_versions_unique_idx": { + "name": "judge_assignment_versions_unique_idx", + "columns": [ + "track_workout_id", + "version" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "judge_assignment_versions_id": { + "name": "judge_assignment_versions_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "judge_heat_assignments": { + "name": "judge_heat_assignments", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "heat_id": { + "name": "heat_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "membership_id": { + "name": "membership_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rotation_id": { + "name": "rotation_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "version_id": { + "name": "version_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lane_number": { + "name": "lane_number", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "position": { + "name": "position", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "instructions": { + "name": "instructions", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_manual_override": { + "name": "is_manual_override", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + } + }, + "indexes": { + "judge_heat_assignments_heat_idx": { + "name": "judge_heat_assignments_heat_idx", + "columns": [ + "heat_id" + ], + "isUnique": false + }, + "judge_heat_assignments_membership_idx": { + "name": "judge_heat_assignments_membership_idx", + "columns": [ + "membership_id" + ], + "isUnique": false + }, + "judge_heat_assignments_rotation_idx": { + "name": "judge_heat_assignments_rotation_idx", + "columns": [ + "rotation_id" + ], + "isUnique": false + }, + "judge_heat_assignments_version_idx": { + "name": "judge_heat_assignments_version_idx", + "columns": [ + "version_id" + ], + "isUnique": false + }, + "judge_heat_assignments_unique_idx": { + "name": "judge_heat_assignments_unique_idx", + "columns": [ + "heat_id", + "membership_id", + "version_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "judge_heat_assignments_id": { + "name": "judge_heat_assignments_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "volunteer_shift_assignments": { + "name": "volunteer_shift_assignments", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "shift_id": { + "name": "shift_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "membership_id": { + "name": "membership_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "volunteer_shift_assignments_shift_idx": { + "name": "volunteer_shift_assignments_shift_idx", + "columns": [ + "shift_id" + ], + "isUnique": false + }, + "volunteer_shift_assignments_membership_idx": { + "name": "volunteer_shift_assignments_membership_idx", + "columns": [ + "membership_id" + ], + "isUnique": false + }, + "volunteer_shift_assignments_unique_idx": { + "name": "volunteer_shift_assignments_unique_idx", + "columns": [ + "shift_id", + "membership_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "volunteer_shift_assignments_id": { + "name": "volunteer_shift_assignments_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "volunteer_shifts": { + "name": "volunteer_shifts", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role_type": { + "name": "role_type", + "type": "varchar(50)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "start_time": { + "name": "start_time", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "end_time": { + "name": "end_time", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "location": { + "name": "location", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "capacity": { + "name": "capacity", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "volunteer_shifts_competition_idx": { + "name": "volunteer_shifts_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "volunteer_shifts_start_time_idx": { + "name": "volunteer_shifts_start_time_idx", + "columns": [ + "start_time" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "volunteer_shifts_id": { + "name": "volunteer_shifts_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "waiver_signatures": { + "name": "waiver_signatures", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "waiver_id": { + "name": "waiver_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "registration_id": { + "name": "registration_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "signed_at": { + "name": "signed_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ip_address": { + "name": "ip_address", + "type": "varchar(45)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "waiver_signatures_waiver_idx": { + "name": "waiver_signatures_waiver_idx", + "columns": [ + "waiver_id" + ], + "isUnique": false + }, + "waiver_signatures_user_idx": { + "name": "waiver_signatures_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "waiver_signatures_registration_idx": { + "name": "waiver_signatures_registration_idx", + "columns": [ + "registration_id" + ], + "isUnique": false + }, + "waiver_signatures_waiver_user_unique": { + "name": "waiver_signatures_waiver_user_unique", + "columns": [ + "waiver_id", + "user_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "waiver_signatures_id": { + "name": "waiver_signatures_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "waivers": { + "name": "waivers", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "competition_id": { + "name": "competition_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "required": { + "name": "required", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "required_for_volunteers": { + "name": "required_for_volunteers", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "position": { + "name": "position", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + } + }, + "indexes": { + "waivers_competition_idx": { + "name": "waivers_competition_idx", + "columns": [ + "competition_id" + ], + "isUnique": false + }, + "waivers_position_idx": { + "name": "waivers_position_idx", + "columns": [ + "competition_id", + "position" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "waivers_id": { + "name": "waivers_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "movements": { + "name": "movements", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "movements_id": { + "name": "movements_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "results": { + "name": "results", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "date": { + "name": "date", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workout_id": { + "name": "workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "programming_track_id": { + "name": "programming_track_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scheduled_workout_instance_id": { + "name": "scheduled_workout_instance_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scale": { + "name": "scale", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scaling_level_id": { + "name": "scaling_level_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "as_rx": { + "name": "as_rx", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "wod_score": { + "name": "wod_score", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "set_count": { + "name": "set_count", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "distance": { + "name": "distance", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "time": { + "name": "time", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "competition_event_id": { + "name": "competition_event_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "competition_registration_id": { + "name": "competition_registration_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "score_status": { + "name": "score_status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "tie_break_score": { + "name": "tie_break_score", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "secondary_score": { + "name": "secondary_score", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "entered_by": { + "name": "entered_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "results_scaling_level_idx": { + "name": "results_scaling_level_idx", + "columns": [ + "scaling_level_id" + ], + "isUnique": false + }, + "results_workout_scaling_idx": { + "name": "results_workout_scaling_idx", + "columns": [ + "workout_id", + "scaling_level_id" + ], + "isUnique": false + }, + "results_leaderboard_idx": { + "name": "results_leaderboard_idx", + "columns": [ + "workout_id", + "scaling_level_id", + "wod_score" + ], + "isUnique": false + }, + "results_user_idx": { + "name": "results_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "results_date_idx": { + "name": "results_date_idx", + "columns": [ + "date" + ], + "isUnique": false + }, + "results_workout_idx": { + "name": "results_workout_idx", + "columns": [ + "workout_id" + ], + "isUnique": false + }, + "results_competition_event_idx": { + "name": "results_competition_event_idx", + "columns": [ + "competition_event_id", + "scaling_level_id" + ], + "isUnique": false + }, + "results_competition_unique_idx": { + "name": "results_competition_unique_idx", + "columns": [ + "competition_event_id", + "user_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "results_id": { + "name": "results_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "sets": { + "name": "sets", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "result_id": { + "name": "result_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "set_number": { + "name": "set_number", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reps": { + "name": "reps", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "weight": { + "name": "weight", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "distance": { + "name": "distance", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "time": { + "name": "time", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "score": { + "name": "score", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "sets_id": { + "name": "sets_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "spicy_tags": { + "name": "spicy_tags", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "spicy_tags_id": { + "name": "spicy_tags_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": { + "spicy_tags_name_unique": { + "name": "spicy_tags_name_unique", + "columns": [ + "name" + ] + } + }, + "checkConstraint": {} + }, + "workout_movements": { + "name": "workout_movements", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workout_id": { + "name": "workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "movement_id": { + "name": "movement_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "workout_movements_workout_idx": { + "name": "workout_movements_workout_idx", + "columns": [ + "workout_id" + ], + "isUnique": false + }, + "workout_movements_movement_idx": { + "name": "workout_movements_movement_idx", + "columns": [ + "movement_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "workout_movements_id": { + "name": "workout_movements_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "workout_tags": { + "name": "workout_tags", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workout_id": { + "name": "workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tag_id": { + "name": "tag_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "workout_tags_workout_idx": { + "name": "workout_tags_workout_idx", + "columns": [ + "workout_id" + ], + "isUnique": false + }, + "workout_tags_tag_idx": { + "name": "workout_tags_tag_idx", + "columns": [ + "tag_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "workout_tags_id": { + "name": "workout_tags_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "workouts": { + "name": "workouts", + "columns": { + "created_at": { + "name": "created_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "datetime", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "update_counter": { + "name": "update_counter", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scope": { + "name": "scope", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'private'" + }, + "scheme": { + "name": "scheme", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "score_type": { + "name": "score_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reps_per_round": { + "name": "reps_per_round", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rounds_to_score": { + "name": "rounds_to_score", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 1 + }, + "team_id": { + "name": "team_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sugar_id": { + "name": "sugar_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "tiebreak_scheme": { + "name": "tiebreak_scheme", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "time_cap": { + "name": "time_cap", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_track_id": { + "name": "source_track_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source_workout_id": { + "name": "source_workout_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scaling_group_id": { + "name": "scaling_group_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "workouts_scaling_group_idx": { + "name": "workouts_scaling_group_idx", + "columns": [ + "scaling_group_id" + ], + "isUnique": false + }, + "workouts_team_idx": { + "name": "workouts_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "workouts_source_track_idx": { + "name": "workouts_source_track_idx", + "columns": [ + "source_track_id" + ], + "isUnique": false + }, + "workouts_source_workout_idx": { + "name": "workouts_source_workout_idx", + "columns": [ + "source_workout_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "workouts_id": { + "name": "workouts_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + } + }, + "views": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "tables": {}, + "indexes": {} + } +} \ No newline at end of file diff --git a/packages/wodsmith-db/mysql-migrations/meta/_journal.json b/packages/wodsmith-db/mysql-migrations/meta/_journal.json index 44b3e05b6..104a621c5 100644 --- a/packages/wodsmith-db/mysql-migrations/meta/_journal.json +++ b/packages/wodsmith-db/mysql-migrations/meta/_journal.json @@ -22,6 +22,13 @@ "when": 1781971335691, "tag": "0002_crew-self-serve-preset-schema", "breakpoints": true + }, + { + "idx": 3, + "version": "5", + "when": 1781999669189, + "tag": "0003_benchmark-battery", + "breakpoints": true } ] } diff --git a/packages/wodsmith-db/src/schema.ts b/packages/wodsmith-db/src/schema.ts index 1f1c3ea95..c1d99ac15 100644 --- a/packages/wodsmith-db/src/schema.ts +++ b/packages/wodsmith-db/src/schema.ts @@ -3,6 +3,7 @@ export * from "./schemas/addresses" export * from "./schemas/coupons" export * from "./schemas/affiliates" +export * from "./schemas/benchmarks" export * from "./schemas/broadcasts" export * from "./schemas/billing" export * from "./schemas/commerce" diff --git a/packages/wodsmith-db/src/schemas/benchmarks.ts b/packages/wodsmith-db/src/schemas/benchmarks.ts new file mode 100644 index 000000000..239b7c478 --- /dev/null +++ b/packages/wodsmith-db/src/schemas/benchmarks.ts @@ -0,0 +1,186 @@ +import type { InferSelectModel } from "drizzle-orm" +import { relations } from "drizzle-orm" +import { + boolean, + index, + int, + mysqlTable, + text, + uniqueIndex, + varchar, +} from "drizzle-orm/mysql-core" +import { + commonColumns, + createBenchmarkBatteryId, + createBenchmarkTestId, + createBenchmarkTierThresholdId, +} from "./common" +import { competitionsTable } from "./competitions" +import { scalingGroupsTable } from "./scaling" + +export const BENCHMARK_VIDEO_POLICIES = [ + "never", + "for_top_scores", + "always", +] as const +export type BenchmarkVideoPolicy = (typeof BENCHMARK_VIDEO_POLICIES)[number] + +export const BENCHMARK_BATTERY_STATUS = { + DRAFT: "draft", + PUBLISHED: "published", + ARCHIVED: "archived", +} as const +export type BenchmarkBatteryStatus = + (typeof BENCHMARK_BATTERY_STATUS)[keyof typeof BENCHMARK_BATTERY_STATUS] + +export const BENCHMARK_SCORE_MODELS = ["standard", "hybrid"] as const +export type BenchmarkScoreModel = (typeof BENCHMARK_SCORE_MODELS)[number] + +// @lat: [[domain#Domain Model#Benchmark Batteries]] +export const benchmarkBatteriesTable = mysqlTable( + "benchmark_batteries", + { + ...commonColumns, + id: varchar({ length: 255 }) + .primaryKey() + .$defaultFn(() => createBenchmarkBatteryId()) + .notNull(), + ownerTeamId: varchar({ length: 255 }), + ownerKey: varchar({ length: 255 }).notNull(), + slug: varchar({ length: 255 }).notNull(), + name: varchar({ length: 255 }).notNull(), + description: text(), + categories: text().notNull(), + ratingBands: text().notNull(), + maxTier: int().default(10).notNull(), + scoreMax: int().default(100).notNull(), + videoPolicy: varchar({ length: 20 }) + .$type() + .default("never") + .notNull(), + isOpenJoin: boolean().default(false).notNull(), + variantScalingGroupId: varchar({ length: 255 }), + competitionId: varchar({ length: 255 }), + status: varchar({ length: 20 }) + .$type() + .default("draft") + .notNull(), + }, + (table) => [ + uniqueIndex("benchmark_batteries_owner_key_unique").on(table.ownerKey), + uniqueIndex("benchmark_batteries_competition_unique").on( + table.competitionId, + ), + index("benchmark_batteries_owner_team_idx").on(table.ownerTeamId), + index("benchmark_batteries_status_idx").on(table.status), + ], +) + +export const benchmarkTestsTable = mysqlTable( + "benchmark_tests", + { + ...commonColumns, + id: varchar({ length: 255 }) + .primaryKey() + .$defaultFn(() => createBenchmarkTestId()) + .notNull(), + batteryId: varchar({ length: 255 }).notNull(), + categoryKey: varchar({ length: 64 }).notNull(), + name: varchar({ length: 255 }).notNull(), + position: int().notNull(), + scheme: varchar({ length: 255 }).notNull(), + scoreType: varchar({ length: 255 }).notNull(), + inputUnit: varchar({ length: 64 }).notNull(), + includedInScoring: boolean().default(true).notNull(), + timeCapMs: int(), + scoreModel: varchar({ length: 20 }) + .$type() + .default("standard") + .notNull(), + hybridFlipTier: int(), + hybridScale: text(), + }, + (table) => [ + uniqueIndex("benchmark_tests_battery_position_unique").on( + table.batteryId, + table.position, + ), + index("benchmark_tests_battery_idx").on(table.batteryId), + index("benchmark_tests_category_idx").on(table.batteryId, table.categoryKey), + ], +) + +export const benchmarkTierThresholdsTable = mysqlTable( + "benchmark_tier_thresholds", + { + ...commonColumns, + id: varchar({ length: 255 }) + .primaryKey() + .$defaultFn(() => createBenchmarkTierThresholdId()) + .notNull(), + testId: varchar({ length: 255 }).notNull(), + variant: varchar({ length: 64 }).notNull(), + tier: int().notNull(), + thresholdValue: int().notNull(), + rawValue: varchar({ length: 255 }).notNull(), + }, + (table) => [ + uniqueIndex("benchmark_thresholds_test_variant_tier_unique").on( + table.testId, + table.variant, + table.tier, + ), + index("benchmark_thresholds_test_variant_idx").on( + table.testId, + table.variant, + ), + ], +) + +export const benchmarkBatteriesRelations = relations( + benchmarkBatteriesTable, + ({ one, many }) => ({ + competition: one(competitionsTable, { + fields: [benchmarkBatteriesTable.competitionId], + references: [competitionsTable.id], + }), + variantScalingGroup: one(scalingGroupsTable, { + fields: [benchmarkBatteriesTable.variantScalingGroupId], + references: [scalingGroupsTable.id], + }), + tests: many(benchmarkTestsTable), + }), +) + +export const benchmarkTestsRelations = relations( + benchmarkTestsTable, + ({ one, many }) => ({ + battery: one(benchmarkBatteriesTable, { + fields: [benchmarkTestsTable.batteryId], + references: [benchmarkBatteriesTable.id], + }), + thresholds: many(benchmarkTierThresholdsTable), + }), +) + +export const benchmarkTierThresholdsRelations = relations( + benchmarkTierThresholdsTable, + ({ one }) => ({ + test: one(benchmarkTestsTable, { + fields: [benchmarkTierThresholdsTable.testId], + references: [benchmarkTestsTable.id], + }), + }), +) + +export type BenchmarkBattery = InferSelectModel< + typeof benchmarkBatteriesTable +> +export type BenchmarkBatteryInsert = typeof benchmarkBatteriesTable.$inferInsert +export type BenchmarkTest = InferSelectModel +export type BenchmarkTestInsert = typeof benchmarkTestsTable.$inferInsert +export type BenchmarkTierThreshold = InferSelectModel< + typeof benchmarkTierThresholdsTable +> +export type BenchmarkTierThresholdInsert = + typeof benchmarkTierThresholdsTable.$inferInsert diff --git a/packages/wodsmith-db/src/schemas/common.ts b/packages/wodsmith-db/src/schemas/common.ts index d680fb1eb..01e5ed35f 100644 --- a/packages/wodsmith-db/src/schemas/common.ts +++ b/packages/wodsmith-db/src/schemas/common.ts @@ -148,6 +148,11 @@ export const createRouteDocId = () => `rdoc_${ulid()}` export const createRouteDocRouteId = () => `rdocrt_${ulid()}` export const createRouteDocVersionId = () => `rdocver_${ulid()}` +// Benchmark battery ID generators +export const createBenchmarkBatteryId = () => `bbat_${ulid()}` +export const createBenchmarkTestId = () => `btst_${ulid()}` +export const createBenchmarkTierThresholdId = () => `bthr_${ulid()}` + // Crew event settings ID generators export const createCrewEventSettingsId = () => `crewset_${ulid()}` diff --git a/packages/wodsmith-db/src/schemas/competitions.ts b/packages/wodsmith-db/src/schemas/competitions.ts index 044082676..4da5fe1a8 100644 --- a/packages/wodsmith-db/src/schemas/competitions.ts +++ b/packages/wodsmith-db/src/schemas/competitions.ts @@ -116,7 +116,7 @@ export const competitionsTable = mysqlTable( .notNull(), // Competition type: in-person = traditional venue-based, online = virtual/remote with video submissions competitionType: varchar({ length: 15 }) - .$type<"in-person" | "online">() + .$type<"in-person" | "online" | "benchmark">() .default("in-person") .notNull(), // Competition branding images @@ -486,6 +486,7 @@ export type CompetitionVisibility = export const COMPETITION_TYPES = { IN_PERSON: "in-person", ONLINE: "online", + BENCHMARK: "benchmark", } as const export type CompetitionType = diff --git a/packages/wodsmith-db/src/schemas/programming.ts b/packages/wodsmith-db/src/schemas/programming.ts index c2b0d64c6..269e81f1a 100644 --- a/packages/wodsmith-db/src/schemas/programming.ts +++ b/packages/wodsmith-db/src/schemas/programming.ts @@ -120,6 +120,9 @@ export const trackWorkoutsTable = mysqlTable( // Minimum number of heats a judge must rest between rotations // Nullable = inherit from competition default or system default of 2 minHeatBuffer: int().default(2), + // Benchmark batteries bind competition events to source test definitions. + benchmarkTestId: varchar({ length: 255 }), + benchmarkCategory: varchar({ length: 64 }), }, (table) => [ index("track_workout_track_idx").on(table.trackId), @@ -132,6 +135,8 @@ export const trackWorkoutsTable = mysqlTable( table.trackOrder, ), index("track_workout_sponsor_idx").on(table.sponsorId), + index("track_workout_benchmark_test_idx").on(table.benchmarkTestId), + index("track_workout_benchmark_category_idx").on(table.benchmarkCategory), ], ) diff --git a/packages/wodsmith-db/src/schemas/scores.ts b/packages/wodsmith-db/src/schemas/scores.ts index 67fa3111f..2b0d18dfa 100644 --- a/packages/wodsmith-db/src/schemas/scores.ts +++ b/packages/wodsmith-db/src/schemas/scores.ts @@ -80,6 +80,8 @@ export const scoresTable = mysqlTable( // Scaling scalingLevelId: varchar({ length: 255 }), asRx: boolean().notNull().default(false), + // Benchmark score variant snapshot, usually the athlete profile gender at submission. + benchmarkVariant: varchar({ length: 64 }), // Metadata notes: text(), @@ -128,6 +130,10 @@ export const scoresTable = mysqlTable( table.userId, table.scalingLevelId, ), + index("idx_scores_benchmark_variant").on( + table.competitionEventId, + table.benchmarkVariant, + ), ], )