Prepare Codex database fields for equipment Mark and native rarity

This commit is contained in:
unimatrix 2026-11-17 17:57:17 +00:00
commit 8fd113ec86

View file

@ -0,0 +1,30 @@
# Codex equipment metadata
17 November 2026: storage preparation only.
The additive `codex_equipment_metadata` table stores equipment metadata by unique
Codex instance ID. It is independent of the consumable ledger so future persistent
equipment does not inherit one-time consumption semantics. The CP startup creates
the table idempotently; no existing kit, key, inventory or deed is migrated.
| Database field | Contract |
| --- | --- |
| `instance_id` | Unique Codex instance UUID; primary key |
| `equipment_mark` | Integer 1–14; default 1 (MK I) |
| `rarity` | Existing common/uncommon/rare/very_rare/legendary identifiers; default common |
| `enhancement_policy_version` | Nullable policy reference, up to 64 characters; null means none assigned |
Legacy equipment without a metadata row reads as MK I and retains its authoritative
native rarity through `nativeRarity`; it is not automatically reclassified Common.
Record creation is internal and insert-only. A domain adapter must verify the
instance and authority, supply its existing rarity and use the issuance transaction.
There is no public writer and no item is granted by creating a metadata row.
No multipliers, enchantment scaling, Legendary-policy changes, kit-generator
changes, Bukkit/PDC writes or game effects are enabled. The future equipment engine
must resolve a recorded policy version, enforce caps and prevent double counting.
The existing kits and organisation keys continue using their current handlers.
Tests persist all 70 Mark/rarity combinations, retain legacy Legendary rarity,
reject invalid values, enforce database bounds/native rarity constraints, and
verify restart, duplicate registration and transactional rollback behaviour.