feat: V5 show tables / relationships / indexes list commands
Add the list-all show family as one Command::ShowList { kind }
variant. A read-only worker show_list formats count-headed lists
(reusing do_list_tables / read_all_relationships /
read_table_indexes, so it never drifts from the items panel);
internal __rdbms_* tables excluded. Help + parse-usage entries
added; 10 integration tests in tests/it/show_list.rs.
Mark V5 [x]. Split the singular show relationship/index <name>
detail forms (the [<name>] half) into a new tracked V5a [ ] item
rather than leaving them as an untracked footnote.
This commit is contained in:
@@ -332,6 +332,13 @@ pub enum Command {
|
||||
ShowTable {
|
||||
name: String,
|
||||
},
|
||||
/// Re-display a whole schema collection — every table,
|
||||
/// relationship, or index — as a list in the output (V5). The
|
||||
/// read-only "all items" sibling of `ShowTable`; pure display,
|
||||
/// no schema change.
|
||||
ShowList {
|
||||
kind: ShowListKind,
|
||||
},
|
||||
/// Insert a single row. `columns` is `None` for the natural-
|
||||
/// order short form (`insert into T values (...)`); the
|
||||
/// executor fills in the column list by walking the schema.
|
||||
@@ -746,6 +753,36 @@ pub enum IndexSelector {
|
||||
Columns { table: String, columns: Vec<String> },
|
||||
}
|
||||
|
||||
/// Which schema collection a `show <kind>` list command displays (V5).
|
||||
///
|
||||
/// The bare plural forms list every item of the kind across the
|
||||
/// project; the singular `show table <name>` (a separate
|
||||
/// `Command::ShowTable`) shows one. The singular `show
|
||||
/// relationship <name>` / `show index <name>` forms are not yet
|
||||
/// provided — only the list-all forms land here.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ShowListKind {
|
||||
/// `show tables` — every user table (internal `__rdbms_*`
|
||||
/// tables excluded, as in the items panel).
|
||||
Tables,
|
||||
/// `show relationships` — every declared FK relationship.
|
||||
Relationships,
|
||||
/// `show indexes` — every index across all tables.
|
||||
Indexes,
|
||||
}
|
||||
|
||||
impl ShowListKind {
|
||||
/// The full command name for the `name()` / echo surface.
|
||||
#[must_use]
|
||||
pub const fn command_name(self) -> &'static str {
|
||||
match self {
|
||||
Self::Tables => "show tables",
|
||||
Self::Relationships => "show relationships",
|
||||
Self::Indexes => "show indexes",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The action of an advanced-mode `ALTER TABLE` (ADR-0035 §4).
|
||||
///
|
||||
/// Sub-phase 4e carries the column actions; 4f adds `AlterColumnType`;
|
||||
@@ -860,6 +897,7 @@ impl Command {
|
||||
Self::AddConstraint { .. } => "add constraint",
|
||||
Self::DropConstraint { .. } => "drop constraint",
|
||||
Self::ShowTable { .. } => "show table",
|
||||
Self::ShowList { kind } => kind.command_name(),
|
||||
Self::Insert { .. } => "insert into",
|
||||
Self::Update { .. } => "update",
|
||||
Self::Delete { .. } => "delete from",
|
||||
@@ -948,6 +986,10 @@ impl Command {
|
||||
// result renders as a data view, not a structure
|
||||
// view, so an empty target is correct here.
|
||||
Self::Select { .. } => "",
|
||||
// A `show <kind>` list spans every table (or none) —
|
||||
// there is no single structure-target table; it renders
|
||||
// as a list, not a structure view.
|
||||
Self::ShowList { .. } => "",
|
||||
// A SQL `INSERT` carries its parsed target table (for
|
||||
// CSV re-persistence and ok-summary subject).
|
||||
Self::SqlInsert { target_table, .. }
|
||||
|
||||
Reference in New Issue
Block a user