parser: make to and table independently optional in add column

Previously the grammar accepted only `to table` together or
neither. The user-stated convention is that bare table
identifiers are accepted in unambiguous positions (matching
how `add 1:n relationship from <T>.<col> to <T>.<col>` takes
bare table names). Both `to` and `table` are now or_not'd
independently, so all four combinations parse identically.

Updates the in-app `help` listing to advertise the new
shape: `add column [to] [table] <T>: <col> (<type>)`.

3 new parser tests cover the variants.
This commit is contained in:
claude@clouddev1
2026-05-08 09:16:50 +00:00
parent 1b27a0c9b1
commit 41cef5399b
2 changed files with 52 additions and 7 deletions
+1 -1
View File
@@ -1108,7 +1108,7 @@ impl App {
"DSL data commands (in simple mode):",
" create table <T> with pk [<col>:<type>...]",
" drop table <T>",
" add column [to table] <T>: <col> (<type>)",
" add column [to] [table] <T>: <col> (<type>)",
" add 1:n relationship [as <name>] from <P>.<col> to <C>.<col>",
" [on delete <action>] [on update <action>] [--create-fk]",
" drop relationship <name>",