mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-29 04:14:32 +02:00
Added db.index_foreign_keys() method plus test
This commit is contained in:
parent
093c3e66db
commit
61164d98cf
3 changed files with 21 additions and 7 deletions
|
|
@ -361,6 +361,16 @@ def test_add_foreign_key_guess_table(fresh_db):
|
|||
)
|
||||
|
||||
|
||||
def test_index_foreign_keys(fresh_db):
|
||||
test_add_foreign_key_guess_table(fresh_db)
|
||||
assert [] == fresh_db["dogs"].indexes
|
||||
fresh_db.index_foreign_keys()
|
||||
assert [["breed_id"]] == [i.columns for i in fresh_db["dogs"].indexes]
|
||||
# Calling it a second time should do nothing
|
||||
fresh_db.index_foreign_keys()
|
||||
assert [["breed_id"]] == [i.columns for i in fresh_db["dogs"].indexes]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"extra_data,expected_new_columns",
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue