feat(hint): H2 Phase C batch 3 — DML tier-3 hints (ADR-0053)
Per-form hints for querying/changing data: update, delete, show data/table/tables/relationships/indexes, seed, explain, replay (insert was the Phase-B exemplar). hint_ids wired on UPDATE/DELETE/ SHOW/SEED/EXPLAIN/REPLAY; catalogue + keys.rs registered. +2 spot tests (incl. multi-form SHOW disambiguation); 2493 pass / 1 ignored, clippy clean.
This commit is contained in:
@@ -505,6 +505,46 @@ hint:
|
||||
what: "Change a column's type, converting the existing values."
|
||||
example: "change column Customers: status (int)"
|
||||
concept: "The database converts each stored value to the new type; if a value can't convert it refuses the change, so you don't silently lose data. Flags let you force or skip the conversion."
|
||||
# DML — querying and changing data (Phase C batch 3).
|
||||
update:
|
||||
what: "Change values in the rows that match a condition."
|
||||
example: "update Customers set email = 'new@example.io' where id = 1"
|
||||
concept: "The `where` clause picks which rows change, and it's required — pass `--all-rows` to change the whole table on purpose — so you never update more than you meant to."
|
||||
delete:
|
||||
what: "Remove the rows that match a condition."
|
||||
example: "delete from Orders where status = 'cancelled'"
|
||||
concept: "A `where` is required (use `--all-rows` to clear the table on purpose). Rows a relationship points at may be blocked or cascade-deleted, per its `on delete` action."
|
||||
show_data:
|
||||
what: "Show the rows stored in a table."
|
||||
example: "show data Customers"
|
||||
concept: "This reads the data and never changes it. Add a `where` to show only matching rows."
|
||||
show_table:
|
||||
what: "Show a table's structure — its columns, types, keys, and relationships."
|
||||
example: "show table Customers"
|
||||
concept: "Structure, not data: the column definitions and how this table links to others. Use `show data` to see the rows themselves."
|
||||
show_tables:
|
||||
what: "List all the tables in the project."
|
||||
example: "show tables"
|
||||
show_relationships:
|
||||
what: "List all the relationships between tables."
|
||||
example: "show relationships"
|
||||
concept: "Each relationship is a foreign-key link from a child column to a parent's key, with an `on delete` / `on update` rule."
|
||||
show_indexes:
|
||||
what: "List all the indexes in the project."
|
||||
example: "show indexes"
|
||||
concept: "Indexes speed up lookups; this shows which columns each one covers and whether it enforces uniqueness."
|
||||
seed:
|
||||
what: "Fill a table with generated sample rows, or fill one column on existing rows."
|
||||
example: "seed Customers 50"
|
||||
concept: "Seeding invents realistic-looking data so you have something to query. Pin a value with `set col = …`, choose a generator with `as`, or give a numeric range with `between`."
|
||||
explain:
|
||||
what: "Show how the database will run a query — without running it."
|
||||
example: "explain show data Customers where email = 'a@example.io'"
|
||||
concept: "The plan reveals whether the database scans the whole table or jumps straight to rows through an index — the payoff of `add index`. `explain` never executes, so it's safe even on a delete."
|
||||
replay:
|
||||
what: "Re-run the commands recorded in a history file."
|
||||
example: "replay session.log"
|
||||
concept: "Every successful command is journalled, so replaying re-applies them in order to reproduce a project's state — handy for scripting or redoing a sequence."
|
||||
err:
|
||||
foreign_key:
|
||||
child_side:
|
||||
|
||||
Reference in New Issue
Block a user