How to update SQLite complex tables in SQLite, if the tables you designed earlier do not meet your needs, you need to update the tables, such as modifying names and adding columns. If it is relatively easy to modify for a simple table, use the ALTER command provided directly. However, if the table is associated with views, triggers, and indexes, it is relatively cumbersome to handle. Here's how to modify this type of table. (1) Use the following command to back up the SQL script for the view, trigger. SELECT SQL from Main.sqlite_master WHERE type= ' view ' or type= ' trigger ' (2) Closes the foreign KEY constraint. PRAGMA Foreign_keys=off (3) Remove the associated views, triggers, and triggers. Drop view Name drop trigger name the drop index name (4) Opens the FOREIGN key constraint. PRAGMA Foreign_keys=on (5) modifies the table structure. (6) Modify the backup view, trigger SQL script and rebuild the corresponding view and trigger. Re-build the index.
How to update SQLite complex tables