mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-28 11:54:32 +02:00
Fixed bug with add_foreign_key against columns with spaces, closes #238
This commit is contained in:
parent
16987bd56e
commit
a76e3b33ac
4 changed files with 32 additions and 17 deletions
|
|
@ -593,7 +593,7 @@ class Database:
|
|||
table_sql = {}
|
||||
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(
|
||||
extra_sql = ",\n FOREIGN KEY([{column}]) REFERENCES [{other_table}]([{other_column}])\n".format(
|
||||
column=column, other_table=other_table, other_column=other_column
|
||||
)
|
||||
# Stick that bit in at the very end just before the closing ')'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue