sqlite-utils index-foreign-keys / db.index_foreign_keys()

Closes #33
This commit is contained in:
Simon Willison 2019-06-30 16:50:54 -07:00 committed by GitHub
commit e8f887ef4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 0 deletions

View file

@ -310,6 +310,15 @@ If you omit the other table and other column references ``sqlite-utils`` will at
See :ref:`python_api_add_foreign_key` in the Python API documentation for further details, including how the automatic table guessing mechanism works.
.. _cli_index_foreign_keys:
Adding indexes for all foreign keys
-----------------------------------
If you want to ensure that every foreign key column in your database has a corresponding index, you can do so like this::
$ sqlite-utils index-foreign-keys books.db
.. _cli_defaults_not_null:
Setting defaults and not null constraints