kopia lustrzana https://github.com/simonw/datasette
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.pull/118/head
rodzic
45e502aace
commit
0b702f3679
|
@ -219,6 +219,10 @@ def get_all_foreign_keys(conn):
|
||||||
for info in infos:
|
for info in infos:
|
||||||
if info is not None:
|
if info is not None:
|
||||||
id, seq, table_name, from_, to_, on_update, on_delete, match = info
|
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({
|
table_to_foreign_keys[table_name]['incoming'].append({
|
||||||
'other_table': table,
|
'other_table': table,
|
||||||
'column': to_,
|
'column': to_,
|
||||||
|
|
Ładowanie…
Reference in New Issue