@@ -127,7 +127,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
127127 // name of the database file for your application. Stored in data/data/de.symeda.sormas.app/databases
128128 public static final String DATABASE_NAME = "sormas.db" ;
129129 // any time you make changes to your database objects, you may have to increase the database version
130- public static final int DATABASE_VERSION = 211 ;
130+ public static final int DATABASE_VERSION = 212 ;
131131
132132 private static DatabaseHelper instance = null ;
133133
@@ -1414,7 +1414,16 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
14141414 getDao (EpiDataBurial .class ).executeRaw ("UPDATE epidataburial SET changeDate = 0 WHERE changeDate IS NOT NULL;" );
14151415 getDao (EpiDataTravel .class ).executeRaw ("UPDATE epidatatravel SET changeDate = 0 WHERE changeDate IS NOT NULL;" );
14161416 getDao (EpiDataGathering .class ).executeRaw ("UPDATE epidatagathering SET changeDate = 0 WHERE changeDate IS NOT NULL;" );
1417-
1417+ case 211 :
1418+ // Re-synchronize all contacts and epi data to prevent missing embedded entities
1419+ currentVersion = 211 ;
1420+ getDao (Sample .class ).executeRaw ("ALTER TABLE contacts ADD COLUMN epiData_id bigint REFERENCES epidata (id);" );
1421+ getDao (Contact .class ).executeRaw ("UPDATE contacts SET changeDate = 0 WHERE changeDate IS NOT NULL;" );
1422+ getDao (EpiData .class ).executeRaw ("UPDATE epidata SET changeDate = 0 WHERE changeDate IS NOT NULL;" );
1423+ getDao (EpiDataBurial .class ).executeRaw ("UPDATE epidataburial SET changeDate = 0 WHERE changeDate IS NOT NULL;" );
1424+ getDao (EpiDataTravel .class ).executeRaw ("UPDATE epidatatravel SET changeDate = 0 WHERE changeDate IS NOT NULL;" );
1425+ getDao (EpiDataGathering .class ).executeRaw ("UPDATE epidatagathering SET changeDate = 0 WHERE changeDate IS NOT NULL;" );
1426+ getDao (Location .class ).executeRaw ("UPDATE location SET changeDate = 0 WHERE changeDate IS NOT NULL;" );
14181427
14191428 // ATTENTION: break should only be done after last version
14201429
0 commit comments