feat: add create-only seed mode to seed_domain() for production use #98
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 lhumina_code/hero_osis#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_modeparameter toseed_domain()inpackages/osis/src/rpc/server.rs:upsert(current behavior): always overwrite with seed datacreate-only: check if entity exists (viaexists(sid)) before callingSet. If it already exists, skip it.The mode should be passed through from
seed_from_config_dir()so that callers (like hero_osis) can control it.Suggested implementation in
seed_domain():Related