mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Removed db.get_outbound_foreign_keys method
It duplicated the functionality of db.foreign_keys_for_table.
This commit is contained in:
parent
4d798ca0e3
commit
124acf34a6
3 changed files with 2 additions and 9 deletions
|
|
@ -319,11 +319,6 @@ class Database:
|
||||||
async def get_all_foreign_keys(self):
|
async def get_all_foreign_keys(self):
|
||||||
return await self.execute_fn(get_all_foreign_keys)
|
return await self.execute_fn(get_all_foreign_keys)
|
||||||
|
|
||||||
async def get_outbound_foreign_keys(self, table):
|
|
||||||
return await self.execute_fn(
|
|
||||||
lambda conn: get_outbound_foreign_keys(conn, table)
|
|
||||||
)
|
|
||||||
|
|
||||||
async def get_table_definition(self, table, type_="table"):
|
async def get_table_definition(self, table, type_="table"):
|
||||||
table_definition_rows = list(
|
table_definition_rows = list(
|
||||||
await self.execute(
|
await self.execute(
|
||||||
|
|
|
||||||
|
|
@ -428,7 +428,7 @@ def get_outbound_foreign_keys(conn, table):
|
||||||
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
|
||||||
fks.append(
|
fks.append(
|
||||||
{"other_table": table_name, "column": from_, "other_column": to_}
|
{"column": from_, "other_table": table_name, "other_column": to_}
|
||||||
)
|
)
|
||||||
return fks
|
return fks
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -336,9 +336,7 @@ class TableView(RowTableShared):
|
||||||
through_table = through_data["table"]
|
through_table = through_data["table"]
|
||||||
other_column = through_data["column"]
|
other_column = through_data["column"]
|
||||||
value = through_data["value"]
|
value = through_data["value"]
|
||||||
outgoing_foreign_keys = await db.get_outbound_foreign_keys(
|
outgoing_foreign_keys = await db.foreign_keys_for_table(through_table)
|
||||||
through_table
|
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
fk_to_us = [
|
fk_to_us = [
|
||||||
fk for fk in outgoing_foreign_keys if fk["other_table"] == table
|
fk for fk in outgoing_foreign_keys if fk["other_table"] == table
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue