User Story
As a developer, I need the station_inventory_item table created to replace the old user_inventory_item entity, so that inventory records are backed by the finalized schema with proper catalog and location references.
Background
The existing user_inventory_item entity is incompatible with the finalized schema. It references UexItem via integer uex_item_id, uses a polymorphic location_type/location_uex_id pair, and has no list support. It must be replaced entirely. See docs/schema/inventory-catalog-design.md.
Definition of Done
Schema
| Column |
Type |
Nullable |
Default |
Notes |
id |
UUID |
NO |
UUIDv7 |
PK |
owner_type |
VARCHAR(10) |
NO |
|
user | org | alliance (future) |
owner_id |
UUID |
NO |
|
Polymorphic FK to users or organizations |
catalog_entry_id |
UUID |
NO |
|
FK → station_catalog_entry |
location_id |
UUID |
NO |
|
FK → station_location |
quantity |
NUMERIC(12,4) |
NO |
1 |
Handles SCU fractions and whole unit counts |
is_org_available |
BOOLEAN |
NO |
FALSE |
User-owned but flagged as available to org |
notes |
TEXT |
YES |
NULL |
|
created_at |
TIMESTAMPTZ |
NO |
now() |
|
updated_at |
TIMESTAMPTZ |
NO |
now() |
|
Unique constraint: (owner_type, owner_id, catalog_entry_id, location_id)
Depends on
Related
User Story
As a developer, I need the
station_inventory_itemtable created to replace the olduser_inventory_itementity, so that inventory records are backed by the finalized schema with proper catalog and location references.Background
The existing
user_inventory_itementity is incompatible with the finalized schema. It referencesUexItemvia integeruex_item_id, uses a polymorphiclocation_type/location_uex_idpair, and has no list support. It must be replaced entirely. Seedocs/schema/inventory-catalog-design.md.Definition of Done
station_inventory_itemtableuser_inventory_itemtable (with data migration plan if needed)UserInventoryItementity and related files removed or updatedUserInventoryModuleandOrgInventoryModuleupdated to use new entitystation_inventory_item(owner_type, owner_id, catalog_entry_id, location_id)enforcedpnpm testpassespnpm migration:reverttestedSchema
idowner_typeuser|org|alliance(future)owner_idcatalog_entry_idstation_catalog_entrylocation_idstation_locationquantityis_org_availablenotescreated_atupdated_atUnique constraint:
(owner_type, owner_id, catalog_entry_id, location_id)Depends on
station_catalog_entry(prerequisite)station_location(prerequisite)Related
docs/schema/inventory-catalog-design.md