army_lists

Top-level army record for users, imports, TO flows, and guest armies
SQL Army System Transactional
army_lists

Purpose

Stores the main army header record. This table represents a full army list owned by a user and provides the parent row for all army units. It supports normal persistent armies, TO-managed armies, and ephemeral guest armies tied to a game.

Role in the system

users
 └── army_lists
      └── army_units

This table is the bridge between identity and gameplay. It is used by army management screens, import commit endpoints, TO entrant-army workflows, game setup, and reporting.

Columns

Column Type Null Notes
idbigint unsignedNoPrimary key
user_idbigint unsignedNoOwning user
namevarchar(200)NoArmy name
systemvarchar(100)YesGame system text, usually the-old-world
race_idint unsignedYesResolved race reference
faction_idint unsignedYesResolved faction reference
factionvarchar(120)YesLegacy faction text copy
points_limitintYesArmy target points value
scaling_factordecimal(6,2)NoScaling multiplier, default 1.00
source_formatvarchar(50)YesImport/manual source identifier
source_textmediumtextYesOriginal imported text or source payload
created_atdatetime(3)NoCreation timestamp
updated_atdatetime(3)NoLast update timestamp
is_ephemeraltinyint(1)NoGuest / temporary army flag
ephemeral_game_idbigint unsignedYesGame link for ephemeral armies
ephemeral_side_codechar(1)YesGame side for ephemeral armies

Keys and indexes

  • PRIMARY KEY (id)
  • ix_army_lists_user (user_id)
  • idx_army_lists_race_id (race_id)
  • idx_army_lists_faction_id (faction_id)
  • idx_ephemeral (is_ephemeral, ephemeral_game_id, ephemeral_side_code)
  • idx_user_ephemeral (user_id, is_ephemeral)
  • idx_army_lists_ephemeral (user_id, is_ephemeral, ephemeral_game_id, ephemeral_side_code)

Foreign keys

  • fk_army_lists_user: army_lists.user_id → users.id ON DELETE CASCADE
  • fk_army_lists_race: army_lists.race_id → race.id
  • fk_army_lists_faction: army_lists.faction_id → factions.id

Relationships

Relationship Type Notes
army_lists.user_id → users.id Many-to-one Each army belongs to one user
army_units.army_list_id → army_lists.id One-to-many Army header owns its unit rows
tournament_entrant_armies.army_list_id → army_lists.id One-to-many / linking TO entrant linking layer references armies
games.side army selections Referenced externally Games point to army list ids during setup

Army types supported

Type How identified Typical usage
Persistent user army is_ephemeral = 0 Normal My Armies flows
TO-managed event army Normal row plus entrant linking Entrant management / imports
Ephemeral guest army is_ephemeral = 1 Unregistered opponent / temporary game setup

Used by

  • Armies create/get/list/update/delete endpoints
  • Import commit endpoints for OWB / NR / SIC
  • TO entrant army workflows
  • Game setup and guest army flows
  • Performance and reporting pages

Design notes

  • This table mixes reference links (race_id, faction_id) with user-entered/import metadata
  • faction is a legacy text copy kept for compatibility and display
  • source_text can become large because imported army text is stored here
  • Ephemeral support is built into the main table rather than split to a separate guest-army table

Risks

  • One table currently serves multiple conceptual army lifecycles
  • Ephemeral rows must be excluded carefully from normal user listings
  • Legacy faction text can drift conceptually from faction_id if update logic is inconsistent
  • Large source_text payloads may affect storage and backup size

Recommended future improvements

  • Document or enforce stronger lifecycle rules for ephemeral vs persistent armies
  • Consider whether TO-managed and ephemeral armies should remain in the same table long-term
  • Add clearer constraints around ephemeral_side_code values if needed
  • Consider normalised source/import metadata if imports expand further