diff --git a/app/models/regular-season-standings.ts b/app/models/regular-season-standings.ts index b332455..3b867ee 100644 --- a/app/models/regular-season-standings.ts +++ b/app/models/regular-season-standings.ts @@ -1,6 +1,6 @@ import { database } from "~/database/context"; import * as schema from "~/database/schema"; -import { eq, and, max } from "drizzle-orm"; +import { eq, and, max, sql } from "drizzle-orm"; export interface UpsertRegularSeasonStandingData { participantId: string; @@ -73,25 +73,25 @@ export async function upsertRegularSeasonStandings( schema.regularSeasonStandings.sportsSeasonId, ], set: { - wins: schema.regularSeasonStandings.wins, - losses: schema.regularSeasonStandings.losses, - otLosses: schema.regularSeasonStandings.otLosses, - ties: schema.regularSeasonStandings.ties, - winPct: schema.regularSeasonStandings.winPct, - gamesPlayed: schema.regularSeasonStandings.gamesPlayed, - gamesBack: schema.regularSeasonStandings.gamesBack, - conference: schema.regularSeasonStandings.conference, - division: schema.regularSeasonStandings.division, - conferenceRank: schema.regularSeasonStandings.conferenceRank, - divisionRank: schema.regularSeasonStandings.divisionRank, - leagueRank: schema.regularSeasonStandings.leagueRank, - streak: schema.regularSeasonStandings.streak, - lastTen: schema.regularSeasonStandings.lastTen, - homeRecord: schema.regularSeasonStandings.homeRecord, - awayRecord: schema.regularSeasonStandings.awayRecord, - externalTeamId: schema.regularSeasonStandings.externalTeamId, - syncedAt: schema.regularSeasonStandings.syncedAt, - updatedAt: schema.regularSeasonStandings.updatedAt, + wins: sql`excluded.wins`, + losses: sql`excluded.losses`, + otLosses: sql`excluded.ot_losses`, + ties: sql`excluded.ties`, + winPct: sql`excluded.win_pct`, + gamesPlayed: sql`excluded.games_played`, + gamesBack: sql`excluded.games_back`, + conference: sql`excluded.conference`, + division: sql`excluded.division`, + conferenceRank: sql`excluded.conference_rank`, + divisionRank: sql`excluded.division_rank`, + leagueRank: sql`excluded.league_rank`, + streak: sql`excluded.streak`, + lastTen: sql`excluded.last_ten`, + homeRecord: sql`excluded.home_record`, + awayRecord: sql`excluded.away_record`, + externalTeamId: sql`excluded.external_team_id`, + syncedAt: sql`excluded.synced_at`, + updatedAt: sql`excluded.updated_at`, }, }) .returning();