UltraLite Database User's Guide
UltraLite Databases
Databases and schema files
If you develop a new version of an UltraLite application, you may wish to alter the schema of the database. You can deploy an upgraded UltraLite schema and maintain the data in existing end-user databases subject to some restrictions. This feature is not available to UltraLite applications built using the static Java API.
The mechanism for deploying an upgraded schema depends on whether you use an UltraLite component (which requires a new schema file) or whether you use a static interface (in which case the schema definition is held in the generated application code).
To deploy a new schema (UltraLite components)
Create a new schema file.
You can create your new schema using the Schema Painter or using ulinit. If you use the schema painter, you can rename columns. If you use ulinit to create the new schema, you lose any data held in renamed columns—the schema is interpreted as dropping the old column and creating a new column.
Apply the schema file to the existing database.
The components expose a database schema as a DatabaseSchema or ULDatabaseSchema object. You obtain a schema object using the DatabaseSchema property on the Connection or ULConnection object.
Use the ApplyFile method on the ULDatabaseSchema object to apply the new schema.
To deploy a new schema (embedded SQL and static C++ API)
Modify the schema in your reference database.
Create the new version of your application.
Ensure that your application calls ULEnableGenericSchema().
When a new UltraLite application built with a static interface is deployed to a device, UltraLite by default re-creates an empty database, losing any data that was in the database before the new application was deployed. If you call ULEnableGenericSchema, the existing database is instead upgraded to the schema of the new application.
The schema is upgraded automatically when the new application is applied.
For information on how the schema upgrade happens, see