refactor: remove isRequired field from season sports and templates

This commit is contained in:
Chris Parsons 2025-10-13 15:00:59 -07:00
parent bd38e7495c
commit 94586564e2
9 changed files with 965 additions and 108 deletions

View file

@ -7,8 +7,7 @@ export type NewSeasonSport = typeof schema.seasonSports.$inferInsert;
export async function linkSportToSeason(
seasonId: string,
sportsSeasonId: string,
isRequired: boolean = true
sportsSeasonId: string
): Promise<SeasonSport> {
const db = database();
const [link] = await db
@ -16,7 +15,6 @@ export async function linkSportToSeason(
.values({
seasonId,
sportsSeasonId,
isRequired,
})
.returning();
return link;
@ -79,24 +77,6 @@ export async function findSeasonSportsBySportsSeasonId(
});
}
export async function updateSeasonSport(
seasonId: string,
sportsSeasonId: string,
isRequired: boolean
): Promise<SeasonSport> {
const db = database();
const [link] = await db
.update(schema.seasonSports)
.set({ isRequired })
.where(
and(
eq(schema.seasonSports.seasonId, seasonId),
eq(schema.seasonSports.sportsSeasonId, sportsSeasonId)
)
)
.returning();
return link;
}
export async function deleteSeasonSport(id: string): Promise<void> {
const db = database();
@ -123,7 +103,6 @@ export async function applySportsFromTemplate(
templateSports.map((ts) => ({
seasonId,
sportsSeasonId: ts.sportsSeasonId,
isRequired: ts.isRequired,
}))
);
}

View file

@ -7,8 +7,7 @@ export type NewSeasonTemplateSport = typeof schema.seasonTemplateSports.$inferIn
export async function addSportToTemplate(
templateId: string,
sportsSeasonId: string,
isRequired: boolean = true
sportsSeasonId: string
): Promise<SeasonTemplateSport> {
const db = database();
const [link] = await db
@ -16,7 +15,6 @@ export async function addSportToTemplate(
.values({
templateId,
sportsSeasonId,
isRequired,
})
.returning();
return link;
@ -75,24 +73,6 @@ export async function findSeasonTemplateSportsBySportsSeasonId(
});
}
export async function updateSeasonTemplateSport(
templateId: string,
sportsSeasonId: string,
isRequired: boolean
): Promise<SeasonTemplateSport> {
const db = database();
const [link] = await db
.update(schema.seasonTemplateSports)
.set({ isRequired })
.where(
and(
eq(schema.seasonTemplateSports.templateId, templateId),
eq(schema.seasonTemplateSports.sportsSeasonId, sportsSeasonId)
)
)
.returning();
return link;
}
export async function deleteSeasonTemplateSport(id: string): Promise<void> {
const db = database();

View file

@ -9,7 +9,6 @@ export type SeasonStatus = "pre_draft" | "draft" | "active" | "completed";
export interface SeasonWithSportsSeasons extends Season {
seasonSports: Array<{
id: string;
isRequired: boolean;
sportsSeason: {
id: string;
name: string;

View file

@ -9,15 +9,13 @@ import {
} from "~/models/season-template";
import {
addSportToTemplate,
removeSportFromTemplate,
updateSeasonTemplateSport
removeSportFromTemplate
} from "~/models/season-template-sport";
import { findAllSportsSeasons } from "~/models/sports-season";
import { Button } from "~/components/ui/button";
import { Input } from "~/components/ui/input";
import { Label } from "~/components/ui/label";
import { Textarea } from "~/components/ui/textarea";
import { Checkbox } from "~/components/ui/checkbox";
import {
Card,
CardContent,
@ -79,10 +77,9 @@ export async function action({ request, params }: Route.ActionArgs) {
if (intent === "add-sport") {
const sportsSeasonId = formData.get("sportsSeasonId");
const isRequired = formData.get("isRequired") === "on";
if (typeof sportsSeasonId === "string") {
await addSportToTemplate(params.id, sportsSeasonId, isRequired);
await addSportToTemplate(params.id, sportsSeasonId);
}
return { success: true };
}
@ -96,16 +93,6 @@ export async function action({ request, params }: Route.ActionArgs) {
return { success: true };
}
if (intent === "toggle-required") {
const sportsSeasonId = formData.get("sportsSeasonId");
const isRequired = formData.get("isRequired") === "true";
if (typeof sportsSeasonId === "string") {
await updateSeasonTemplateSport(params.id, sportsSeasonId, isRequired);
}
return { success: true };
}
// Update template
const name = formData.get("name");
const year = formData.get("year");
@ -141,7 +128,6 @@ export async function action({ request, params }: Route.ActionArgs) {
export default function EditTemplate({ loaderData, actionData }: Route.ComponentProps) {
const { template, allSportsSeasons } = loaderData;
const [selectedSportId, setSelectedSportId] = useState("");
const [isRequired, setIsRequired] = useState(true);
const includedSeasonIds = new Set(
template.seasonTemplateSports.map((s) => s.sportsSeasonId)
@ -257,7 +243,6 @@ export default function EditTemplate({ loaderData, actionData }: Route.Component
key={templateSport.id}
className="flex items-center justify-between p-3 border rounded-lg"
>
<div className="flex items-center gap-3">
<div>
<p className="font-medium">
{templateSport.sportsSeason.sport.name} - {templateSport.sportsSeason.name}
@ -266,19 +251,6 @@ export default function EditTemplate({ loaderData, actionData }: Route.Component
{templateSport.sportsSeason.year} {templateSport.sportsSeason.scoringType.replace("_", " ")}
</p>
</div>
<Badge variant={templateSport.isRequired ? "default" : "outline"}>
{templateSport.isRequired ? "Required" : "Optional"}
</Badge>
</div>
<div className="flex items-center gap-2">
<Form method="post">
<input type="hidden" name="intent" value="toggle-required" />
<input type="hidden" name="sportsSeasonId" value={templateSport.sportsSeasonId} />
<input type="hidden" name="isRequired" value={(!templateSport.isRequired).toString()} />
<Button type="submit" variant="ghost" size="sm">
Toggle
</Button>
</Form>
<Form method="post">
<input type="hidden" name="intent" value="remove-sport" />
<input type="hidden" name="sportsSeasonId" value={templateSport.sportsSeasonId} />
@ -292,7 +264,6 @@ export default function EditTemplate({ loaderData, actionData }: Route.Component
</Button>
</Form>
</div>
</div>
))}
</div>
)}
@ -317,15 +288,6 @@ export default function EditTemplate({ loaderData, actionData }: Route.Component
))}
</SelectContent>
</Select>
<div className="flex items-center gap-2">
<Checkbox
id="isRequired"
name="isRequired"
checked={isRequired}
onCheckedChange={(checked) => setIsRequired(checked === true)}
/>
<Label htmlFor="isRequired" className="text-sm">Required</Label>
</div>
<Button type="submit">
<Plus className="h-4 w-4" />
</Button>

View file

@ -37,7 +37,6 @@ interface ExportData {
sportSlug: string;
seasonName: string;
seasonYear: number;
isRequired: boolean;
}>;
}>;
}
@ -125,7 +124,6 @@ export async function exportSportsDataToJSON(): Promise<ExportData> {
sportSlug: ts.sportsSeason.sport.slug,
seasonName: ts.sportsSeason.name,
seasonYear: ts.sportsSeason.year,
isRequired: ts.isRequired,
})),
})),
};
@ -324,7 +322,6 @@ export async function importSportsDataFromJSON(
await db.insert(schema.seasonTemplateSports).values({
templateId,
sportsSeasonId,
isRequired: templateSport.isRequired,
});
}
}

View file

@ -138,7 +138,6 @@ export const seasonTemplateSports = pgTable("season_template_sports", {
sportsSeasonId: uuid("sports_season_id")
.notNull()
.references(() => sportsSeasons.id, { onDelete: "cascade" }),
isRequired: boolean("is_required").notNull().default(true),
createdAt: timestamp("created_at").defaultNow().notNull(),
});
@ -150,7 +149,6 @@ export const seasonSports = pgTable("season_sports", {
sportsSeasonId: uuid("sports_season_id")
.notNull()
.references(() => sportsSeasons.id, { onDelete: "cascade" }),
isRequired: boolean("is_required").notNull().default(true),
createdAt: timestamp("created_at").defaultNow().notNull(),
});

View file

@ -0,0 +1,2 @@
ALTER TABLE "season_sports" DROP COLUMN IF EXISTS "is_required";--> statement-breakpoint
ALTER TABLE "season_template_sports" DROP COLUMN IF EXISTS "is_required";

View file

@ -0,0 +1,933 @@
{
"id": "d7b8574f-85c3-45ec-99cb-a49e2bec7e18",
"prevId": "a87c9793-9d30-4cf6-b1f5-d3f6322128e2",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.commissioners": {
"name": "commissioners",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"league_id": {
"name": "league_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"commissioners_league_id_leagues_id_fk": {
"name": "commissioners_league_id_leagues_id_fk",
"tableFrom": "commissioners",
"tableTo": "leagues",
"columnsFrom": [
"league_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.leagues": {
"name": "leagues",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"created_by": {
"name": "created_by",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"current_season_id": {
"name": "current_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.participant_results": {
"name": "participant_results",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"participant_id": {
"name": "participant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"final_position": {
"name": "final_position",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"points_awarded": {
"name": "points_awarded",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"qualifying_points": {
"name": "qualifying_points",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"participant_results_participant_id_participants_id_fk": {
"name": "participant_results_participant_id_participants_id_fk",
"tableFrom": "participant_results",
"tableTo": "participants",
"columnsFrom": [
"participant_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"participant_results_sports_season_id_sports_seasons_id_fk": {
"name": "participant_results_sports_season_id_sports_seasons_id_fk",
"tableFrom": "participant_results",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.participants": {
"name": "participants",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"short_name": {
"name": "short_name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false
},
"external_id": {
"name": "external_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"participants_sports_season_id_sports_seasons_id_fk": {
"name": "participants_sports_season_id_sports_seasons_id_fk",
"tableFrom": "participants",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.season_sports": {
"name": "season_sports",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"season_sports_season_id_seasons_id_fk": {
"name": "season_sports_season_id_seasons_id_fk",
"tableFrom": "season_sports",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"season_sports_sports_season_id_sports_seasons_id_fk": {
"name": "season_sports_sports_season_id_sports_seasons_id_fk",
"tableFrom": "season_sports",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.season_template_sports": {
"name": "season_template_sports",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"template_id": {
"name": "template_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"sports_season_id": {
"name": "sports_season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"season_template_sports_template_id_season_templates_id_fk": {
"name": "season_template_sports_template_id_season_templates_id_fk",
"tableFrom": "season_template_sports",
"tableTo": "season_templates",
"columnsFrom": [
"template_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"season_template_sports_sports_season_id_sports_seasons_id_fk": {
"name": "season_template_sports_sports_season_id_sports_seasons_id_fk",
"tableFrom": "season_template_sports",
"tableTo": "sports_seasons",
"columnsFrom": [
"sports_season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.season_templates": {
"name": "season_templates",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"year": {
"name": "year",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.seasons": {
"name": "seasons",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"league_id": {
"name": "league_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"year": {
"name": "year",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "season_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'pre_draft'"
},
"template_id": {
"name": "template_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"flex_spots": {
"name": "flex_spots",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"seasons_league_id_leagues_id_fk": {
"name": "seasons_league_id_leagues_id_fk",
"tableFrom": "seasons",
"tableTo": "leagues",
"columnsFrom": [
"league_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"seasons_template_id_season_templates_id_fk": {
"name": "seasons_template_id_season_templates_id_fk",
"tableFrom": "seasons",
"tableTo": "season_templates",
"columnsFrom": [
"template_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.sports": {
"name": "sports",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "sport_type",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"slug": {
"name": "slug",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"icon_url": {
"name": "icon_url",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"sports_slug_unique": {
"name": "sports_slug_unique",
"nullsNotDistinct": false,
"columns": [
"slug"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.sports_seasons": {
"name": "sports_seasons",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"sport_id": {
"name": "sport_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"year": {
"name": "year",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"start_date": {
"name": "start_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"end_date": {
"name": "end_date",
"type": "date",
"primaryKey": false,
"notNull": false
},
"status": {
"name": "status",
"type": "sports_season_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'upcoming'"
},
"scoring_type": {
"name": "scoring_type",
"type": "scoring_type",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"sports_seasons_sport_id_sports_id_fk": {
"name": "sports_seasons_sport_id_sports_id_fk",
"tableFrom": "sports_seasons",
"tableTo": "sports",
"columnsFrom": [
"sport_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.teams": {
"name": "teams",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"season_id": {
"name": "season_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"owner_id": {
"name": "owner_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"teams_season_id_seasons_id_fk": {
"name": "teams_season_id_seasons_id_fk",
"tableFrom": "teams",
"tableTo": "seasons",
"columnsFrom": [
"season_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"clerk_id": {
"name": "clerk_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"display_name": {
"name": "display_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"first_name": {
"name": "first_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"last_name": {
"name": "last_name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"image_url": {
"name": "image_url",
"type": "varchar(512)",
"primaryKey": false,
"notNull": false
},
"is_admin": {
"name": "is_admin",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"users_clerk_id_unique": {
"name": "users_clerk_id_unique",
"nullsNotDistinct": false,
"columns": [
"clerk_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {
"public.scoring_type": {
"name": "scoring_type",
"schema": "public",
"values": [
"playoffs",
"regular_season",
"majors"
]
},
"public.season_status": {
"name": "season_status",
"schema": "public",
"values": [
"pre_draft",
"draft",
"active",
"completed"
]
},
"public.sport_type": {
"name": "sport_type",
"schema": "public",
"values": [
"team",
"individual"
]
},
"public.sports_season_status": {
"name": "sports_season_status",
"schema": "public",
"values": [
"upcoming",
"active",
"completed"
]
}
},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -64,6 +64,13 @@
"when": 1760375514773,
"tag": "0008_salty_trauma",
"breakpoints": true
},
{
"idx": 9,
"version": "7",
"when": 1760392647508,
"tag": "0009_fuzzy_korvac",
"breakpoints": true
}
]
}