Jump to content

SQLite migration tool in FMX application

Recommended Posts

What is a way in Delphi FMX application to apply changes in SQLite database.

F.e., there is an application v 1.0 in PlayMarked with the SQLite database v 0.1.

New version 1.1 of an application comes with the database v 0.2 where was added new table, removed one field etc.

How Delphi do (or not do and you did it instead) those migration work?

When I was developing an application in Xamarin, there was a tool and it generated a "migration" script based on changes in DB classes, then Entity framework did all hard work.

Share this post

Link to post
5 hours ago, at3s said:

How Delphi do (or not do and you did it instead) those migration work?


if you don't have this tool at hand, you could do something like:

  1. read the structure of your old SQLite DB
  2. create a new SQLite DB based on old structure with new fields, of course!
  3. add old records to the new DB

Since SQLite is a DB that is easy to use and install (you only need to have the file without any Engine installations (DLL) etc ...), it is easy to do the task!

Using FireDAC, which will give you everything in a much easier way, you will be able to make use of FDBatchMove's components / classes for the task of feeding your new DB extremely quickly!

As SQLite allows you to create a file (DB file) either on disk or memory, you have the entire environment ready to create the new SQLite DB.

Using FDMemTable, you can still work with data, select fields, values, data definitions, etc ...

In general, FireDAC will be your simple and easy solution to do this or any other migration.

At the end, you can delete the old file and define the new one as your DB.

It looks complicated, but it really isn't! It all depends on your skill and complexity of the old file!



Share this post

Link to post

Thanks, FDBatchMove seems like a good start point.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now