Commit 798149b
committed
Add --update-incoming-fks CLI flag for transform command
When renaming columns that are referenced by foreign keys in other
tables, the --update-incoming-fks flag will automatically update
those FK constraints.
Example:
sqlite-utils transform mydb.db authors \
--rename id author_pk \
--update-incoming-fks
This will rename the 'id' column to 'author_pk' and also update any
foreign key constraints in other tables (e.g., books.author_id)
that reference the renamed column.1 parent e22b34e commit 798149b
2 files changed
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2545 | 2545 | | |
2546 | 2546 | | |
2547 | 2547 | | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
2548 | 2553 | | |
2549 | 2554 | | |
2550 | 2555 | | |
| |||
2562 | 2567 | | |
2563 | 2568 | | |
2564 | 2569 | | |
| 2570 | + | |
2565 | 2571 | | |
2566 | 2572 | | |
2567 | 2573 | | |
| |||
2615 | 2621 | | |
2616 | 2622 | | |
2617 | 2623 | | |
| 2624 | + | |
| 2625 | + | |
2618 | 2626 | | |
2619 | 2627 | | |
2620 | 2628 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1810 | 1810 | | |
1811 | 1811 | | |
1812 | 1812 | | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
1813 | 1851 | | |
1814 | 1852 | | |
1815 | 1853 | | |
| |||
0 commit comments