Indexes: add index / drop index, persistence, display (ADR-0025)
Implement ADR-0025 — indexes as a DSL DDL feature. - Grammar: `add index [as <name>] on <T> (<cols>)`, `drop index <name>` / `drop index on <T> (<cols>)`, plus a `--cascade` flag on `drop column`. - db.rs: index operations over the engine's native index catalog (no metadata table). The rebuild-table primitive now captures and recreates indexes, so `change column` and the relationship operations no longer silently drop them. - `drop column` refuses an indexed column unless `--cascade`, which drops the covering indexes and reports each. - Persistence: additive `indexes:` list in `project.yaml` (version unchanged); round-trips through rebuild/export/import. - Display: an `Indexes:` section in the structure view and a nested tables/indexes items panel (S2). Reconciles requirements.md (C3 index portion, S2 satisfied) and CLAUDE.md. 1038 tests passing (+31), clippy clean.
This commit is contained in:
@@ -67,6 +67,8 @@ pub enum IdentSource {
|
||||
Columns,
|
||||
/// Existing relationship name.
|
||||
Relationships,
|
||||
/// Existing index name.
|
||||
Indexes,
|
||||
/// Closed set from `Type::all()` — surfaced by the walker's
|
||||
/// content validator on column-type slots; not user-listable
|
||||
/// from the schema.
|
||||
@@ -82,7 +84,10 @@ impl IdentSource {
|
||||
/// entities rather than user invention or a closed set).
|
||||
#[must_use]
|
||||
pub const fn completes_from_schema(self) -> bool {
|
||||
matches!(self, Self::Tables | Self::Columns | Self::Relationships)
|
||||
matches!(
|
||||
self,
|
||||
Self::Tables | Self::Columns | Self::Relationships | Self::Indexes
|
||||
)
|
||||
}
|
||||
|
||||
/// Human-facing label used in parse-error wording
|
||||
@@ -97,6 +102,7 @@ impl IdentSource {
|
||||
Self::Tables => "table name",
|
||||
Self::Columns => "column name",
|
||||
Self::Relationships => "relationship name",
|
||||
Self::Indexes => "index name",
|
||||
Self::Types => "type",
|
||||
}
|
||||
}
|
||||
@@ -113,6 +119,7 @@ impl IdentSource {
|
||||
"table name" => Some(Self::Tables),
|
||||
"column name" => Some(Self::Columns),
|
||||
"relationship name" => Some(Self::Relationships),
|
||||
"index name" => Some(Self::Indexes),
|
||||
"type" => Some(Self::Types),
|
||||
_ => None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user