SQLite
No edit summary
(Updated Edited template to July 12, 2025.)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
SQLite is a small database engine suitable to embed in applications as a data store for a single user.
<message>Write the content here to display this box</message>
SQLite is a small database engine suitable to embed in applications as a data store for a single user. It is possibly the world's most used database since all android phones have this included.


It is possibly the world's most used database since all android phones have this included.
Having a small footprint comes with a penalty - it does not support the Drop column! As MDriven is all about changing your mind when you want to, the Drop column is something you probably want to have.
 
Having a small footprint comes with a penalty - it does not support the Drop column!
 
As MDriven is all about changing your mind when you want to, the Drop column is something you probably want to have.


To adapt to this limitation, we added a new config setting named DropColumnsByRecreateTableTemplate.
To adapt to this limitation, we added a new config setting named DropColumnsByRecreateTableTemplate.
Line 21: Line 18:
We have added an extra pass in DBEvolution - so that we see if you want us to recreate the table this way for you.
We have added an extra pass in DBEvolution - so that we see if you want us to recreate the table this way for you.
[[Category:SQL]]
[[Category:SQL]]
{{Edited|July|12|2025}}

Latest revision as of 06:01, 20 January 2025

This page was created by Hans.karlsen@mdriven.net on 2019-10-06. Last edited by Edgar on 2025-01-20.

SQLite is a small database engine suitable to embed in applications as a data store for a single user. It is possibly the world's most used database since all android phones have this included.

Having a small footprint comes with a penalty - it does not support the Drop column! As MDriven is all about changing your mind when you want to, the Drop column is something you probably want to have.

To adapt to this limitation, we added a new config setting named DropColumnsByRecreateTableTemplate.

The updated SQLite persistence mapper now has this setting as default:

sb.AppendLine("CREATE TABLE <TableName>_backup(<KeepColumnsForCreate>);");
sb.AppendLine("INSERT INTO <TableName>_backup SELECT <KeepColumns> FROM <TableName>;");            
sb.AppendLine("DROP TABLE <TableName>;");            
sb.AppendLine("CREATE TABLE <TableName>(<KeepColumnsForCreate>);");            
sb.AppendLine("INSERT INTO <TableName> SELECT <KeepColumns> FROM <TableName>_backup;");            
sb.AppendLine("DROP TABLE <TableName>_backup;");            
config.DropColumnTemplate = ""; // SQLite does not support removing column by column            
config.DropIndexTemplate = "";            
config.DropColumnsByRecreateTableTemplate= sb.ToString(); 

We have added an extra pass in DBEvolution - so that we see if you want us to recreate the table this way for you.