Grammar: with-pk column specs use name(type), matching add column

`create table … with pk` parsed column types as `name:type`,
while `add column` uses `name(type)`. Unify on the parens
form so column-type syntax is consistent across the DSL:

    create table T with pk id(serial), name(text)

Only `COL_SPEC` changes (`:` → `( … )`); `build_create_table`
reads columns by role, so it is unaffected. The `:` that
separates table from column in `add column` / `drop column`
is unchanged. Sweeps the test suite, the typing-surface
matrix (two `after_colon` cells renamed to `after_paren`,
4 snapshots regenerated), the friendly catalog's usage
templates, ADR-0009's example, and requirements.md.

1039 passing / 0 failing / 1 ignored; clippy clean.
This commit is contained in:
claude@clouddev1
2026-05-18 21:51:52 +00:00
parent 9aa7e2ede0
commit d9a98bbd49
20 changed files with 68 additions and 67 deletions
+11 -11
View File
@@ -70,7 +70,7 @@ fn create_table_writes_yaml_and_history() {
ColumnSpec { name: "Name".to_string(), ty: Type::Text },
],
vec!["id".to_string()],
Some("create table Customers with pk id:serial".to_string()),
Some("create table Customers with pk id(serial)".to_string()),
)
.await
.unwrap();
@@ -84,7 +84,7 @@ fn create_table_writes_yaml_and_history() {
let history = read_history(&path);
assert_eq!(history.len(), 1, "expected one history line; got {history:?}");
assert!(history[0].ends_with("|ok|create table Customers with pk id:serial"));
assert!(history[0].ends_with("|ok|create table Customers with pk id(serial)"));
}
#[test]
@@ -100,7 +100,7 @@ fn insert_writes_csv_and_history() {
ColumnSpec { name: "Name".to_string(), ty: Type::Text },
],
vec!["id".to_string()],
Some("create table Customers with pk id:serial".to_string()),
Some("create table Customers with pk id(serial)".to_string()),
)
.await
.unwrap();
@@ -136,7 +136,7 @@ fn drop_table_removes_its_csv() {
"Customers".to_string(),
vec![ColumnSpec { name: "id".to_string(), ty: Type::Serial }],
vec!["id".to_string()],
Some("create table Customers with pk id:serial".to_string()),
Some("create table Customers with pk id(serial)".to_string()),
)
.await
.unwrap();
@@ -174,7 +174,7 @@ fn delete_with_cascade_rewrites_both_csvs() {
"Customers".to_string(),
vec![ColumnSpec { name: "id".to_string(), ty: Type::Serial }],
vec!["id".to_string()],
Some("create table Customers with pk id:serial".to_string()),
Some("create table Customers with pk id(serial)".to_string()),
)
.await
.unwrap();
@@ -185,7 +185,7 @@ fn delete_with_cascade_rewrites_both_csvs() {
ColumnSpec { name: "CustId".to_string(), ty: Type::Int },
],
vec!["id".to_string()],
Some("create table Orders with pk id:serial, CustId:int".to_string()),
Some("create table Orders with pk id(serial), CustId(int)".to_string()),
)
.await
.unwrap();
@@ -266,7 +266,7 @@ fn create_table_does_not_write_csv_for_empty_table() {
ColumnSpec { name: "Name".to_string(), ty: Type::Text },
],
vec!["id".to_string()],
Some("create table Customers with pk id:serial".to_string()),
Some("create table Customers with pk id(serial)".to_string()),
)
.await
.unwrap();
@@ -295,7 +295,7 @@ fn delete_all_rows_removes_csv() {
ColumnSpec { name: "Name".to_string(), ty: Type::Text },
],
vec!["id".to_string()],
Some("create table Customers with pk id:serial".to_string()),
Some("create table Customers with pk id(serial)".to_string()),
)
.await
.unwrap();
@@ -335,7 +335,7 @@ fn show_table_appends_history_only() {
"Customers".to_string(),
vec![ColumnSpec { name: "id".to_string(), ty: Type::Serial }],
vec!["id".to_string()],
Some("create table Customers with pk id:serial".to_string()),
Some("create table Customers with pk id(serial)".to_string()),
)
.await
.unwrap();
@@ -368,7 +368,7 @@ fn failed_command_does_not_append_history_or_change_yaml() {
"Customers".to_string(),
vec![ColumnSpec { name: "id".to_string(), ty: Type::Serial }],
vec!["id".to_string()],
Some("create table Customers with pk id:serial".to_string()),
Some("create table Customers with pk id(serial)".to_string()),
)
.await
.unwrap();
@@ -380,7 +380,7 @@ fn failed_command_does_not_append_history_or_change_yaml() {
"Customers".to_string(),
vec![ColumnSpec { name: "id".to_string(), ty: Type::Serial }],
vec!["id".to_string()],
Some("create table Customers with pk id:serial".to_string()),
Some("create table Customers with pk id(serial)".to_string()),
)
.await
.expect_err("must fail");