How to migrate to another database
You can migrate your data to another database.
For example, you developed your project with SQLite database and want to move to PostgreSQL.
To do this, follow these steps:
Create an empty PostgreSQL database
Create a new project with this database
Export the metadata of the SQLite project to a zip file in the Application Builder by clicking the Export button.
Import the metadata to the new project. The web application with create database structures in the PostgreSQL database.
copy data from SQlite to PostgreSQL database using the copy_database method of the task:
within the ProjectTask create the following Server Module function (adjust the below database path with correct one):
from jam.common import consts def copy_db(task): task.copy_database(consts.SQLITE, 'demo.sqlite') def on_created(task): copy_db(task)
then, execute it with the one of the following ways:
refresing the Application or the Builder
create a button in some form and use the task server method to execute it
function on_view_form_created(item) { item.add_view_button('Copy DB').click(function() { task.server('copy_db') }); }
or run from from debugging console of the browser:
task.server('copy_db')
Remove or comment the code that was used immediately after this procedure.
Note
You can not migrate to SQLite database if the current database has foreign keys.