How to update SQLite complex tables

Source: Internet
Author: User
Tags sqlite
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.