
Problem
Your Appway App uses the Runtime Data service. You need to migrate runtime data to a database system such as MySQL, Oracle, or MSSQL.

Solution

1. Identify the objects to be migrated, i.e. which runtime data bags need to be migrated as database tables.
2. Set up the new database:
- Set up a database like MySQL, Oracle, MSSQL or similar.
- Install the Data Store extension and map the Data Classes which were saved as runtime data.
- Define a data source connecting to your database (called "myDatasource" in the example below).
3. Identify references of RUNTIMEDATA in the app.
In the Library, create a smart list containing the following script as filter. This smart list will identify all Business Objects which use runtime data Functions.
Possible references are:
- RUNTIMEDATABAG
- RUNTIMEDATABAGMODIFICATION
- RUNTIMEDATACLEAR
- RUNTIMEDATADELETE
- RUNTIMEDATAID
- RUNTIMEDATALOAD
- RUNTIMEDATARETRIEVE
- RUNTIMEDATASAVE
- RUNTIMESELECT
4. For each Business Object listed in the smart list, find the reference(s) pointing to runtime data and rewrite the query. Runtime data Functions can be replaced with the corresponding Functions delivered with the Data Store extension:
- RUNTIMEDATALOAD -> LoadDataEntities
- RUNTIMEDATASAVE -> SaveDataEntity
- RUNTIMEDATADELETE -> DeleteDataEntity
- etc.
For example, one runtime data bag is called Persons. A script loads all Person records from this data bag.
This script can be replaced with:
5. Instead of replacing the queries directly by command, it is recommended to define them as Functions within the Data Class (in this example, "Person"). Alternatively, create a "Util" Data Class containing the utility functions.
Examples:
- Person.load()
- Person.loadActive();
- Person.loadByStatus('active');
- Person.save();
6. Once all queries have been rewritten, no more business objects should appear in the smart list any more.
7. For each object to be migrated, write a small conversion script which loads all records from the corresponding runtime data bag and saves them in the database table. For example:
8. Run the conversion scripts in the Interactive Script Editor.
9. Test the application to make sure the migration has been completed properly.
10. Remove the "Runtime Data" data source.

Comments (0)