From fc81588cc31df58374c996884c67cedd98a06f4a Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Fri, 28 Jun 2019 23:23:16 -0700 Subject: [PATCH] Loop through correct list --- sqlite_utils/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index 9be09f6..582017f 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -289,7 +289,7 @@ class Database: # Construct SQL for use with "UPDATE sqlite_master SET sql = ? WHERE name = ?" table_sql = {} - for table, column, other_table, other_column in foreign_keys: + for table, column, other_table, other_column in foreign_keys_to_create: old_sql = table_sql.get(table, self[table].schema) extra_sql = ",\n FOREIGN KEY({column}) REFERENCES {other_table}({other_column})\n".format( column=column, other_table=other_table, other_column=other_column