Skip to content

feat: extend seed with phases, object waiting, schema creation, and MiniJinja templating (#15)#16

Merged
mikkeldamsgaard merged 2 commits intomainfrom
feature/seed-phases-15
Feb 24, 2026
Merged

feat: extend seed with phases, object waiting, schema creation, and MiniJinja templating (#15)#16
mikkeldamsgaard merged 2 commits intomainfrom
feature/seed-phases-15

Conversation

@mikkeldamsgaard
Copy link
Copy Markdown
Contributor

Summary

Extends the seed subsystem with schema version 2, adding phase-based execution, embedded schema/database creation, object waiting, and MiniJinja template rendering.

New Features

  • Seed schema v2 with ordered phases: create → wait → seed lifecycle
  • MiniJinja templating for all seed specs (v1 and v2): {{ env.VAR }}, conditionals, loops
  • Embedded create logic: create_if_missing creates databases/schemas (PostgreSQL, MySQL)
  • Embedded wait logic: poll for tables, views, schemas, databases with per-phase and per-object timeouts
  • Cross-phase references: @ref: references resolve across phases
  • Driver-aware errors: clear messages when operations are unsupported on the target database

Changes

  • src/seed/schema.rs — v2 schema structs (SeedPhase, WaitForObject), dual-version validation
  • src/seed/db.rs — New trait methods: create_database, create_schema, object_exists, driver_name
  • src/seed/executor.rs — Phase execution with create/wait/seed, timeout polling loop
  • src/seed/mod.rs — MiniJinja template rendering before YAML/JSON parsing
  • docs/seeding.md — v2 schema reference, driver support tables, MiniJinja guide, failure modes
  • docs/usage.md — Updated seed behavior section for v2
  • README.md — Updated seed description
  • CHANGELOG.md — 8 new Added entries
  • examples/seed/phased-seed.yaml — Multi-phase PostgreSQL example

How to verify

cargo build       # 0 warnings
cargo clippy       # 0 warnings
cargo fmt -- --check  # no diffs
cargo test         # 98 tests pass

32 new tests covering v2 schema parsing, phase execution, wait conditions with timeouts, unsupported operations, MiniJinja rendering (env vars, conditionals, loops, invalid templates), and edge cases.

Closes #15

…iniJinja templating. Add seed schema version 2 with phase-based execution supporting ordered phases with create/wait/seed lifecycle, MiniJinja template rendering, embedded database/schema creation via create_if_missing, wait-for logic polling for tables/views/schemas/databases with timeouts, cross-phase @ref: references, and driver-aware error reporting. New Database trait methods: create_database, create_schema, object_exists, driver_name for SQLite, PostgreSQL, MySQL. 32 new tests, all 98 pass. Closes #15
@mikkeldamsgaard mikkeldamsgaard merged commit ed6ff81 into main Feb 24, 2026
4 checks passed
@mikkeldamsgaard mikkeldamsgaard deleted the feature/seed-phases-15 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.

Extend Seed with Embedded Schema Creation, Object Waiting, Repetition & MiniJinja Format

1 participant