Repository navigation
Commit 483cc84
committed
fix(databases): declare --schema on create, with or without --table
`databases create` takes `--schema`, defaulting to `public`, but only sent it
when `--table` was also given: `schemas` was built inside `if !tables
.is_empty()`. Create a database without tables and the flag was silently
discarded, leaving the database with only the engine's auto-declared `main`.
Every later attempt to declare a table in `public` on it then fails with
"Schema 'public' is not declared", and nothing before that point says so —
`databases list` and `databases <id>` show a healthy database either way.
`schemas` now always goes out, carrying at least the chosen schema name. An
empty schema is a first-class request: `DatabaseDefaultSchemaDecl` documents
`tables` as optional, "so you can declare just a schema name and add tables
later", and skips the field when absent.
Two existing tests asserted the old body — `req == {}` with no name or tables,
and `schemas` absent when only a name was given — so this is not purely
additive; both encoded the missing declaration as intended behaviour. The new
round-trip test drives the typed builder, which deserialises into the SDK's
CreateDatabaseRequest and panics on a shape the model rejects, so a wrong body
fails here rather than at runtime.1 parent c11d226 commit 483cc84
1 file changed
Lines changed: 45 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
562 | 565 | | |
563 | 566 | | |
564 | 567 | | |
| |||
579 | 582 | | |
580 | 583 | | |
581 | 584 | | |
582 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
583 | 593 | | |
584 | 594 | | |
585 | 595 | | |
| |||
595 | 605 | | |
596 | 606 | | |
597 | 607 | | |
598 | | - | |
| 608 | + | |
599 | 609 | | |
600 | 610 | | |
601 | 611 | | |
602 | 612 | | |
603 | 613 | | |
604 | 614 | | |
605 | 615 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
612 | 622 | | |
613 | 623 | | |
614 | 624 | | |
| |||
2215 | 2225 | | |
2216 | 2226 | | |
2217 | 2227 | | |
2218 | | - | |
| 2228 | + | |
2219 | 2229 | | |
2220 | | - | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
2221 | 2255 | | |
2222 | 2256 | | |
2223 | 2257 | | |
2224 | 2258 | | |
2225 | 2259 | | |
2226 | 2260 | | |
2227 | | - | |
| 2261 | + | |
2228 | 2262 | | |
2229 | 2263 | | |
2230 | 2264 | | |
| |||
0 commit comments