Skip to content

feat: add structured database seeding with YAML/JSON schema and tracking table#14

Merged
mikkeldamsgaard merged 3 commits intomainfrom
feature/structured-seed-12
Feb 24, 2026
Merged

feat: add structured database seeding with YAML/JSON schema and tracking table#14
mikkeldamsgaard merged 3 commits intomainfrom
feature/structured-seed-12

Conversation

@mikkeldamsgaard
Copy link
Copy Markdown
Contributor

Summary

Replaces the previous shell-out seed command with a declarative, structured approach that reads seed plans from YAML/JSON spec files.

Features

  • Seed tracking table (initium_seed by default) for idempotent application
  • Database drivers: PostgreSQL, MySQL, and SQLite
  • Auto-generated IDs and cross-table references via _ref / @ref: syntax
  • Environment variable substitution via $env:VAR_NAME
  • Unique key detection to prevent duplicate row insertion
  • Reset mode (--reset) to delete and re-apply seeds
  • Transaction safety with rollback on failure
  • Ordered seed sets and tables via order field

Changes

  • New src/seed/ module: schema parsing, database abstraction, seed executor
  • New docs/seeding.md: full schema reference, K8s usage (env vars + volume mounts), failure modes
  • New example seed specs in examples/seed/
  • Updated src/main.rs: new --spec and --reset CLI flags for seed subcommand
  • Updated README.md, docs/usage.md, CHANGELOG.md

How to verify

cargo fmt -- --check
cargo test
cargo build

All 65 tests pass including 30+ new seed-specific tests covering schema parsing, database operations, executor logic, references, idempotency, reset mode, and edge cases.

Closes #12

…ing table. Replaces shell-out seed with declarative YAML/JSON spec files. Supports PostgreSQL, MySQL, SQLite, tracking table, auto-generated IDs, cross-table references, unique key detection, reset mode, transactions, env var substitution, and ordered seed sets. Includes docs/seeding.md, example specs, 30+ unit tests. Closes #12
@mikkeldamsgaard mikkeldamsgaard force-pushed the feature/structured-seed-12 branch from 894f4de to ffbf240 Compare February 24, 2026 00:07
@mikkeldamsgaard mikkeldamsgaard merged commit ac6e592 into main Feb 24, 2026
4 checks passed
@mikkeldamsgaard mikkeldamsgaard deleted the feature/structured-seed-12 branch February 26, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add structured database seeding with YAML/JSON schema and steering table

1 participant