mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 18:04:32 +02:00
sqlite-utils transform --add-foreign-key option, closes #585
This commit is contained in:
parent
70717dc0e1
commit
56093de078
4 changed files with 83 additions and 30 deletions
|
|
@ -455,20 +455,25 @@ See :ref:`cli_transform_table`.
|
|||
--rename column2 column_renamed
|
||||
|
||||
Options:
|
||||
--type <TEXT CHOICE>... Change column type to INTEGER, TEXT, FLOAT or BLOB
|
||||
--drop TEXT Drop this column
|
||||
--rename <TEXT TEXT>... Rename this column to X
|
||||
-o, --column-order TEXT Reorder columns
|
||||
--not-null TEXT Set this column to NOT NULL
|
||||
--not-null-false TEXT Remove NOT NULL from this column
|
||||
--pk TEXT Make this column the primary key
|
||||
--pk-none Remove primary key (convert to rowid table)
|
||||
--default <TEXT TEXT>... Set default value for this column
|
||||
--default-none TEXT Remove default from this column
|
||||
--drop-foreign-key TEXT Drop foreign key constraint for this column
|
||||
--sql Output SQL without executing it
|
||||
--load-extension TEXT Path to SQLite extension, with optional :entrypoint
|
||||
-h, --help Show this message and exit.
|
||||
--type <TEXT CHOICE>... Change column type to INTEGER, TEXT, FLOAT or
|
||||
BLOB
|
||||
--drop TEXT Drop this column
|
||||
--rename <TEXT TEXT>... Rename this column to X
|
||||
-o, --column-order TEXT Reorder columns
|
||||
--not-null TEXT Set this column to NOT NULL
|
||||
--not-null-false TEXT Remove NOT NULL from this column
|
||||
--pk TEXT Make this column the primary key
|
||||
--pk-none Remove primary key (convert to rowid table)
|
||||
--default <TEXT TEXT>... Set default value for this column
|
||||
--default-none TEXT Remove default from this column
|
||||
--add-foreign-key <TEXT TEXT TEXT>...
|
||||
Add a foreign key constraint from a column to
|
||||
another table with another column
|
||||
--drop-foreign-key TEXT Drop foreign key constraint for this column
|
||||
--sql Output SQL without executing it
|
||||
--load-extension TEXT Path to SQLite extension, with optional
|
||||
:entrypoint
|
||||
-h, --help Show this message and exit.
|
||||
|
||||
|
||||
.. _cli_ref_extract:
|
||||
|
|
|
|||
|
|
@ -2061,6 +2061,9 @@ Every option for this table (with the exception of ``--pk-none``) can be specifi
|
|||
``--drop-foreign-key column``
|
||||
Drop the specified foreign key.
|
||||
|
||||
``--add-foregn-key column other_table other_column``
|
||||
Add a foreign key constraint to ``column`` pointing to ``other_table.other_column``.
|
||||
|
||||
If you want to see the SQL that will be executed to make the change without actually executing it, add the ``--sql`` flag. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue