How to plan mode changes in the SQLite database?

I’m currently developing an application that stores data in a SQLite database. The database will have more read access (in fact, it will be filled with data once, and then almost Only read). Therefore, read performance is very important. The schema I am currently developing is likely to change in the future, and additional columns and tables are added. I generally don’t have much experience with databases. My problem is , Especially in SQLite, are there any pitfalls to consider when changing the architecture? Are there any patterns or best practices to plan such cases in advance?
Here are some suggestions:

>Don’t use select * from …because* The meaning of changes with the schema; explicitly name the columns used by the query> keep the schema version number in the database, and keep the code in the application in order to convert from the schema version N to the version N 1; then the application All the code in uses the latest schema version; this may mean using default values ​​to populate the added columns> You can avoid using SQLite version 3.1.3 or later that supports ALTER TABLE ADD COLUMN to copy tables for schema updates…

I am currently developing an application that stores data in a SQLite database. The database will have more read access (in fact, it will be populated once Data, and then almost only read). Therefore, read performance is very important. The schema I am currently developing is likely to change in the future and add additional columns and tables. I generally don’t have much experience with databases. My question is, especially in SQLite, are there any pitfalls to consider when changing the architecture? Are there any patterns or best practices to plan such cases in advance?

The following are some suggestions:

>Do not use select * from …because the meaning of * changes with changes in the architecture; explicit Name the columns used by the query> keep the pattern version number in the database, and keep the code in the application to convert from pattern version N to version N 1; then all codes in the application use the latest pattern version; this It may mean using default values ​​to populate the added columns> You can avoid using SQLite version 3.1.3 or later that supports ALTER TABLE ADD COLUMN to copy tables for schema updates…

< /p>

Leave a Comment

Your email address will not be published.