All files / web/src/db/schema seed-profile-players.ts

100% Statements 33/33
100% Branches 2/2
100% Functions 1/1
100% Lines 33/33

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 342x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 39x 39x 2x 2x 2x 2x  
import { integer, primaryKey, sqliteTable, text } from 'drizzle-orm/sqlite-core'
import { players } from './players'
 
/**
 * Seed profile to player mapping
 *
 * Links seeded test players to the profile definition that created them.
 * A profile can be seeded multiple times (creating new players each time),
 * and this table tracks all of them.
 */
export const seedProfilePlayers = sqliteTable(
  'seed_profile_players',
  {
    /** Seed profile name (matches TestStudentProfile.name) */
    profileId: text('profile_id').notNull(),
 
    /** The player created from this profile */
    playerId: text('player_id')
      .notNull()
      .references(() => players.id, { onDelete: 'cascade' }),
 
    /** When this player was seeded */
    seededAt: integer('seeded_at', { mode: 'timestamp' })
      .notNull()
      .$defaultFn(() => new Date()),
  },
  (table) => ({
    pk: primaryKey({ columns: [table.profileId, table.playerId] }),
  })
)
 
export type SeedProfilePlayer = typeof seedProfilePlayers.$inferSelect
export type NewSeedProfilePlayer = typeof seedProfilePlayers.$inferInsert