feat: add --seed-mode CLI flag (create-only vs upsert) #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
PR #2 fixed duplicate seeding by adding stable SIDs to all mock TOML files. With stable SIDs,
db.set()performs an upsert instead of creating new records on every restart.However, the current seeding behavior always overwrites existing records. In production, this means user edits to seeded entities get reset on every server restart.
Proposed Change
Add a
--seed-modeCLI flag tosrc/bin/server.rs:Pass this through to
seed_from_config_dir()/seed_domain()in herolib-osis.This also requires a corresponding change in hero_lib to support the mode in
seed_domain()— tracked as lhumina_code/hero_lib#98Behavior
--seed-mode=upsert(default): current behavior, always overwrite seed data on restart--seed-mode=create-only: check if entity exists before seeding, skip if it does — preserves user editshero_zero integration
Once implemented, the hero_zero service template (
services/hero_osis.toml) could be updated:Related