mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fixed weird edge-case with foreign key detection
It turns out it is possible for a SQLite table to define a foreign key relationship to a table that does not actually exist We should still be able to handle these databases.
This commit is contained in:
parent
45e502aace
commit
0b702f3679
1 changed files with 4 additions and 0 deletions
|
|
@ -219,6 +219,10 @@ def get_all_foreign_keys(conn):
|
|||
for info in infos:
|
||||
if info is not None:
|
||||
id, seq, table_name, from_, to_, on_update, on_delete, match = info
|
||||
if table_name not in table_to_foreign_keys:
|
||||
# Weird edge case where something refers to a table that does
|
||||
# not actually exist
|
||||
continue
|
||||
table_to_foreign_keys[table_name]['incoming'].append({
|
||||
'other_table': table,
|
||||
'column': to_,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue