feat: ADR-0035 4h — ALTER TABLE … RENAME TO
The one genuinely new low-level op in Phase 4: a native engine RENAME TO
plus one-transaction reconciliation (commit-db-last) of everything the
engine does not track —
- every metadata row naming the table: __rdbms_playground_columns, both
ends of __rdbms_playground_relationships (FK parent, child, and
self-referential), and __rdbms_playground_table_checks;
- the CSV file, via the existing persistence rewrite+delete path
(rewritten_tables=[new], deleted_tables=[old]) — no new method;
- CHECK text that qualifies a column with the old table name
(T.age → U.age, column- and table-level): the engine rewrites the live
CHECK but the stored text would drift and break a fresh rebuild (a
planning-/runda finding); rewrite_check_table_qualifier keeps them in
step. Bounded — a CHECK references only its own table.
Grammar: a fifth AlterTableAction (RenameTable { new }), added by
splitting the `rename` verb into one branch with an inner Choice on a
distinct second keyword (column vs to); the new-name slot mirrors the
CREATE TABLE name slot (NewName + reject_internal_table validator).
Refusals are engine-neutral and case-insensitive (the engine matches
names that way): same-name, case-only, existing-target, __rdbms_*, and
non-existent source. Auto-named indexes and relationships keep their
stale names (only table-name columns update — §6 scope). One undo step;
advanced-mode only; closes the rename half of C1.
Tests: 8 Tier-3 e2e + rewrite-helper unit tests + parse-dispatch tests.
Full suite 1903 passing / 0 failing / 1 ignored; clippy clean.
This commit is contained in:
+11
-2
@@ -150,7 +150,10 @@ handoff-14 cleanup; 449 after B2/C2.)
|
||||
## DSL data commands
|
||||
|
||||
- [ ] **C1** Table operations: create / drop / rename.
|
||||
*(Progress: create + drop done; rename pending.)*
|
||||
*(Progress: create + drop done; **rename done on the advanced
|
||||
surface** — `ALTER TABLE … RENAME TO`, ADR-0035 §6 / 4h. A simple-mode
|
||||
rename-table verb is deliberately not provided — table rename is
|
||||
advanced-mode only.)*
|
||||
- [x] **C2** Column operations: add / drop / rename / change
|
||||
type. `drop column` and `rename column` use SQLite native
|
||||
ALTER TABLE (3.35+ / 3.25+); `change column` routes through
|
||||
@@ -247,7 +250,13 @@ handoff-14 cleanup; 449 after B2/C2.)
|
||||
`name` column on `__rdbms_playground_table_checks` + a `project.yaml`
|
||||
`check_constraints` `{expr, name}` extension; the internal-table guard
|
||||
completed across `do_add_constraint`/`do_add_relationship`)).
|
||||
Remaining DDL — `ALTER TABLE … RENAME TO` (4h) — is phased per
|
||||
then `ALTER TABLE … RENAME TO` (4h — the one genuinely new low-level
|
||||
op, `do_rename_table`: native rename + one-transaction reconciliation of
|
||||
the CSV file and every metadata row naming the table, incl. **rewriting
|
||||
CHECK text that qualifies a column with the old table name** so a fresh
|
||||
rebuild round-trips; refuses same-name / existing-target / `__rdbms_*` /
|
||||
non-existent; auto-named indexes + relationships kept stale per §6
|
||||
scope; one undo step). Remaining: the 4i verification sweep per
|
||||
ADR-0035 §13.)*
|
||||
- [ ] **Q2** Non-standard syntax rejected with a clear message
|
||||
pointing at the supported subset.
|
||||
|
||||
Reference in New Issue
Block a user