pub async fn seed_templates(
pool: &SqlitePool,
templates: Vec<DcsTemplate>,
origin: TemplateOrigin,
now: DateTime<Utc>,
) -> DbResult<Vec<SeedResult>>Expand description
Upserts every template in templates into dcs_templates, all attributed to origin.
Safe to call on every startup: inserts any missing template, brings existing rows that
already carry origin in line with the current definition, and never touches a row whose
name collides with one being seeded but which carries a different origin — that row
belongs to a different catalog (or a user), not this seed pass.
The one caller today is seed_builtin_templates, seeding
bhtune_core::built_in_templates with TemplateOrigin::Builtin. template-user-catalog
will be the first caller to seed a user-supplied catalog file with TemplateOrigin::Catalog,
reusing this exact upsert logic rather than duplicating it.