mirror of
https://github.com/simonw/datasette.git
synced 2026-11-28 04:49:41 +01:00
Don't link a foreign key that points at a table that does not exist
Closes #1515
This commit is contained in:
parent
d9f9ed5027
commit
83cef452ea
2 changed files with 36 additions and 0 deletions
|
|
@ -2317,6 +2317,10 @@ ORDER BY allowed.parent, allowed.child
|
|||
from datasette.resources import TableResource
|
||||
|
||||
other_table = fk["other_table"]
|
||||
if not await db.table_exists(other_table):
|
||||
# SQLite accepts a foreign key to a table that does not exist, and
|
||||
# linking to it would only lead to a 404
|
||||
return {}
|
||||
other_column = fk["other_column"]
|
||||
if other_column is None:
|
||||
other_pks = await db.primary_keys(other_table)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue