feat(seed): command plumbing + walking skeleton (ADR-0048 P1.2)
End-to-end `seed <table> [count]` path, both modes: - Command::Seed AST + grammar node (show-data table slot + optional positional count) + REGISTRY registration + build_seed. - Runtime dispatch -> Database::seed -> Request::Seed worker arm -> do_seed. - do_seed (Phase-1 skeleton): generates whole rows for non-FK, non-autogen columns via the seed library and inserts them one at a time through do_insert (reusing validation / autogen autofill / FK-error / persistence). One undo step (snapshot_then wraps it) and one history.log line (only the first row carries the source); default count 20. - help (`help seed`) + parse-usage catalog entries. - Reuses CommandOutcome::Insert for the auto-show; a dedicated SeedResult (capped preview + advisory) replaces it in P1.3. 5 Tier-3 integration tests (parse, populate+persist, default-20, reproducible --seed, one history line). 2327 pass / 0 fail / 0 skip, clippy all-targets clean. Deferred to P1.3: FK sampling, identifier/constraint uniqueness, CHECK derivation, block guard, capped preview, advisory, multi-row path. Deferred to P1.4: completion/highlight/hint/validity wiring + --seed flag.
This commit is contained in:
@@ -402,6 +402,16 @@ pub enum Command {
|
||||
filter: Option<Expr>,
|
||||
limit: Option<u64>,
|
||||
},
|
||||
/// Populate a table with generated fake data (ADR-0048, SD1).
|
||||
/// `count` defaults to 20 when omitted; `rng_seed` (from a future
|
||||
/// `--seed <n>` flag) makes generation reproducible. Phase 1 is
|
||||
/// whole-row generation; the `set` override clause and the
|
||||
/// `<table>.<column>` column-fill form arrive in later phases.
|
||||
Seed {
|
||||
table: String,
|
||||
count: Option<u64>,
|
||||
rng_seed: Option<u64>,
|
||||
},
|
||||
/// Replay a sequence of DSL commands from a file. Each line
|
||||
/// is parsed and dispatched through the same pipeline as
|
||||
/// interactive input. Blank lines and lines whose first
|
||||
@@ -949,6 +959,7 @@ impl Command {
|
||||
} => "show index",
|
||||
Self::ShowList { kind, .. } => kind.command_name(),
|
||||
Self::Insert { .. } => "insert into",
|
||||
Self::Seed { .. } => "seed",
|
||||
Self::Update { .. } => "update",
|
||||
Self::Delete { .. } => "delete from",
|
||||
Self::ShowData { .. } => "show data",
|
||||
@@ -997,6 +1008,7 @@ impl Command {
|
||||
| Self::AddConstraint { table, .. }
|
||||
| Self::DropConstraint { table, .. }
|
||||
| Self::Insert { table, .. }
|
||||
| Self::Seed { table, .. }
|
||||
| Self::Update { table, .. }
|
||||
| Self::Delete { table, .. } => table,
|
||||
// For relationships we focus on the parent (1-side):
|
||||
|
||||
Reference in New Issue
Block a user