feat(seed): set override clause + column-fill (ADR-0048 Phase 2)
Build the two SD2 surfaces Phase 1 deferred:
- `set` override clause (D2): comma-separated per-column pins —
`= 'v'` (fixed), `in ('a','b')` (pick-list), `as <generator>`
(named), `between x and y` (range; numeric and quoted dates).
Type-aware via the typed `current_column_value` slot; an override
drops its column from the generic-fill advisory (D13). Folded from
the flat matched path (build_seed_overrides) and applied to the
per-column plan (apply_seed_overrides).
- `<table>.<column>` column-fill (D1 form 2): an UPDATE over existing
rows. Refuses PK/autogen targets, empty-table no-op, FK-samples the
parent, collision-free for UNIQUE/identifier targets, one undo step;
`set` may only adjust the filled column.
Supporting work: KNOWN_GENERATORS vocabulary + generator_for_name
(src/seed/vocabulary.rs, D9); a range Generator + range_bounds_reason;
IdentSource::Generators and HighlightClass::Function; completion of the
generator vocabulary after `as` and the set/.col column slots; the
typing-time validity indicator for an unknown generator; help,
parse-error pedagogy rows, and the D13 advisory's Phase-2/3 wording.
A bounded override (fixed value / too-short pick-list) on a
single-column-UNIQUE target is a friendly error rather than a silent
uniqueness cap (post-implementation /runda finding, user-chosen).
Dates in the range form are quoted (no date-literal token exists);
ADR-0048 D2 amended accordingly. Both modes (D5); reproducible (D4).
This commit is contained in:
+10
-1
@@ -2097,9 +2097,14 @@ impl App {
|
||||
self.note_system(line);
|
||||
}
|
||||
if !result.advisory_columns.is_empty() {
|
||||
// `column` (the first advised column) seeds the concrete
|
||||
// repair examples (D13 Phase 2/3 wording); `columns` lists
|
||||
// them all.
|
||||
self.push_category_three_prose(crate::t!(
|
||||
"seed.advisory_generic",
|
||||
columns = result.advisory_columns.join(", ")
|
||||
columns = result.advisory_columns.join(", "),
|
||||
column = result.advisory_columns[0],
|
||||
table = result.table
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -6268,7 +6273,9 @@ mod tests {
|
||||
app.update(AppEvent::DslSeedSucceeded {
|
||||
command: Command::Seed {
|
||||
table: "users".to_string(),
|
||||
target_column: None,
|
||||
count: Some(20),
|
||||
overrides: Vec::new(),
|
||||
rng_seed: None,
|
||||
},
|
||||
result: crate::db::SeedResult {
|
||||
@@ -6304,7 +6311,9 @@ mod tests {
|
||||
app.update(AppEvent::DslSeedSucceeded {
|
||||
command: Command::Seed {
|
||||
table: "J".to_string(),
|
||||
target_column: None,
|
||||
count: Some(10),
|
||||
overrides: Vec::new(),
|
||||
rng_seed: None,
|
||||
},
|
||||
result: crate::db::SeedResult {
|
||||
|
||||
Reference in New Issue
Block a user