Skip to content

feat: station_location migration and ETL population from discrete location tables #278

@GitAddRemote

Description

@GitAddRemote

User Story

As a developer, I need the station_location table created and populated by the ETL from discrete location tables, so that inventory records can reference a single clean location FK.

Background

Part of the finalized inventory and catalog schema. See docs/schema/inventory-catalog-design.md for full design rationale including is_locally_managed flag behavior and ETL warning strategy.

Definition of Done

  • Migration creates station_location table with all columns
  • ETL step upserts from station_city, station_space_station, station_outpost, station_poi
  • Only is_available_live = TRUE rows from discrete tables are synced
  • Rows with is_locally_managed = TRUE are skipped — ETL logs warning to station_etl_warning if UEX would have changed them
  • is_locally_managed flag added to each discrete location table (station_city, station_space_station, station_outpost, station_poi)
  • Auto-set is_locally_managed = TRUE logic implemented at service layer when admin saves a changed value
  • Migration down() drops the table cleanly
  • pnpm migration:revert tested

Schema

Column Type Nullable Default Notes
id UUID NO UUIDv7 PK
source_type VARCHAR(20) NO city | space_station | outpost | poi
source_id BIGINT NO FK to originating discrete table row
name VARCHAR(255) NO
star_system_uex_id INTEGER YES NULL For hierarchy rollup queries
planet_uex_id INTEGER YES NULL For hierarchy rollup queries
moon_uex_id INTEGER YES NULL For hierarchy rollup queries
is_available_live BOOLEAN NO FALSE
is_locally_managed BOOLEAN NO FALSE Auto-set TRUE on admin edit; ETL skips when TRUE
created_at TIMESTAMPTZ NO now()
updated_at TIMESTAMPTZ NO now()

ETL warning behavior

When the ETL would update a row with is_locally_managed = TRUE, log to station_etl_warning:

  • Table name
  • Row identity (source_type + source_id + name)
  • What UEX wanted to change
  • Timestamp

Depends on

  • Discrete location tables must exist and be populated (existing ETL steps)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend services and logicdatabaseSchema, migrations, indexingenhancementNew feature or requestlocationsVerse locations and locations datatech-storyTechnical implementation story

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions