factions

Reference-data table for faction definitions under each race
SQL Core Data Reference
factions

Purpose

Stores faction definitions for each race. Factions are the bridge between top-level race identity and the canonical unit library used by imports, army construction, filtering, and reporting.

Hierarchy position

race
 └── factions
      └── units

Columns

Column Type Null Notes
idint unsignedNoPrimary key
namevarchar(200)NoFaction name
race_idint unsignedNoParent race
created_atdatetimeNoCreation timestamp
updated_atdatetimeNoLast update timestamp
deleted_atdatetimeYesSoft delete marker

Keys and indexes

  • PRIMARY KEY (id)
  • idx_factions_race_id (race_id)
  • idx_factions_deleted_at (deleted_at)

Foreign keys

  • fk_factions_race: factions.race_id → race.id

Relationships

Relationship Type Notes
factions.race_id → race.id Many-to-one Faction belongs to one race
units.faction_id → factions.id One-to-many Faction owns canonical unit definitions
army_lists.faction_id → factions.id One-to-many Army lists may reference faction directly

Used by

  • Army creation and update validation
  • Import commit flows
  • Meta endpoints that return factions by race
  • Stats and usage reporting by faction

Design notes

  • Soft delete is supported
  • Current schema does not enforce unique faction names within a race
  • Application logic often assumes faction belongs to exactly one race

Risks

  • Duplicate faction names can exist unless prevented outside the DB
  • Changing faction names can affect import expectations and legacy text storage
  • Soft-deleted factions require consistent filtering in all queries

Recommended future improvements

  • Add uniqueness constraint such as (race_id, name) if desired
  • Document soft delete semantics clearly for admin tooling
  • Consider storing a normalized name if import matching expands