mirror of
https://github.com/simonw/datasette.git
synced 2026-07-06 23:54:34 +02:00
Expose foreign key targets to create table UI
- Add foreignKeyTargetsPath to create table page data - Filter hidden tables from database-level foreign key target results - Update JSON API docs and tests for filtered targets
This commit is contained in:
parent
a6ef65f90d
commit
21c156dfb1
4 changed files with 21 additions and 2 deletions
|
|
@ -1161,6 +1161,10 @@ async def test_foreign_key_targets(ds_write):
|
|||
"create table compound (a integer, b integer, primary key (a, b))"
|
||||
)
|
||||
await db.execute_write("create table no_pk (name text)")
|
||||
try:
|
||||
await db.execute_write("create virtual table search_docs using fts5(body)")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
response = await ds_write.client.get(
|
||||
"/data/-/foreign-key-targets",
|
||||
|
|
@ -1203,6 +1207,10 @@ async def test_foreign_key_targets(ds_write):
|
|||
},
|
||||
],
|
||||
}
|
||||
assert not any(
|
||||
target["fk_table"].startswith("search_docs_")
|
||||
for target in response.json()["targets"]
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue