UltraLite Database User's Guide
UltraLite Databases
Databases and schema files
Altering the schema of UltraLite databases
Backup before upgradingIt is strongly recommended that you backup your data before attempting an upgrade, either by copying the database file or by synchronizing. |
The schema upgrading process relies on matching names in the old and new schema. If a row in the database is incompatible with the new schema, that row is deleted from the database. In general, adding constraints to tables that have data in them or carrying out unpredictable column conversions may result in lost rows.
The schema upgrade proceeds as follows:
Any tables that were in the old schema but not in the new schema are dropped.
Any tables that are in the new schema but were not in the old are created.
For any table that exists in both old and new, but with a different definition, columns are added and dropped as needed. If a new column is not nullable and has no default value, it is filled with zeros (numeric data types), the empty string (character data types) and an empty binary value.
Columns whose properties have changed are then modified.
Caution If an error occurs during conversion for any row, that row is dropped and the SQL warning SQLE_ROW_DROPPED_DURING_SCHEMA_UPGRADE is set. |
Indexes and constraints are rebuilt. This step may also result in rows being dropped if, for example, an index is redefined as UNIQUE but has duplicate values.