SQLite
(Created page with "SQLite is a small database engine suitable to embed in applications as data store for a single user. It is possibly the worlds most used database since all android phones has...")
 
No edit summary
Line 20: Line 20:
  config.DropColumnsByRecreateTableTemplate= sb.ToString();  
  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.
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]]

Revision as of 07:42, 9 January 2023

SQLite is a small database engine suitable to embed in applications as data store for a single user.

It is possibly the worlds most used database since all android phones has this included.

Having a very small footprint comes with some penalty though - it does not support Drop column!

As MDriven is all about changing your mind when you want to - 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 has 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.

This page was edited 1 days ago on 06/17/2024. What links here