Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit be8c56e

Browse files
authored
Fix 3408 first contact date db migration (SORMAS-Foundation#3720)
* SORMAS-Foundation#3408 added contact history on backend and fixed column naming case on android * SORMAS-Foundation#3408 added missing dto mapping for multiDayContact and firstContactDate * SORMAS-Foundation#3408 removed default for contact history and exception catching when updating schema
1 parent ea86e12 commit be8c56e

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,9 +1775,8 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
17751775
getDao(EpiData.class).executeRaw("DROP TABLE tmp_epidata;");
17761776
case 247:
17771777
currentVersion = 247;
1778-
1779-
getDao(Contact.class).executeRaw("ALTER TABLE contacts ADD column multidaycontact boolean default false;");
1780-
getDao(Contact.class).executeRaw("ALTER TABLE contacts ADD column firstcontactdate timestamp;");
1778+
getDao(Contact.class).executeRaw("ALTER TABLE contacts ADD column multiDayContact boolean default false;");
1779+
getDao(Contact.class).executeRaw("ALTER TABLE contacts ADD column firstContactDate timestamp;");
17811780
case 248:
17821781
currentVersion = 248;
17831782

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/contact/ContactDtoHelper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public void fillInnerFromDto(Contact target, ContactDto source) {
8888
target.setContactOfficer(DatabaseHelper.getUserDao().getByReferenceDto(source.getContactOfficer()));
8989

9090
target.setMultiDayContact(source.isMultiDayContact());
91+
target.setFirstContactDate(source.getFirstContactDate());
9192
target.setLastContactDate(source.getLastContactDate());
9293
target.setContactIdentificationSource(source.getContactIdentificationSource());
9394
target.setContactIdentificationSourceDetails(source.getContactIdentificationSourceDetails());
@@ -206,6 +207,8 @@ public void fillInnerFromAdo(ContactDto target, Contact source) {
206207
}
207208
target.setReportDateTime(source.getReportDateTime());
208209

210+
target.setMultiDayContact(source.isMultiDayContact());
211+
target.setFirstContactDate(source.getFirstContactDate());
209212
target.setLastContactDate(source.getLastContactDate());
210213
target.setContactIdentificationSource(source.getContactIdentificationSource());
211214
target.setContactIdentificationSourceDetails(source.getContactIdentificationSourceDetails());

sormas-backend/src/main/resources/sql/sormas_schema.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5982,4 +5982,11 @@ ALTER TABLE person_history
59825982

59835983
INSERT INTO schema_version (version_number, comment) VALUES (285, 'SurvNet Adaptations - Create new field “name of guardians” for persons #3413');
59845984

5985+
-- 2020-12-08 SurvNet Adaptations - Add multi day contat to contact history #3408
5986+
5987+
ALTER TABLE contact_history ADD column multidaycontact boolean;
5988+
ALTER TABLE contact_history ADD column firstcontactdate timestamp;
5989+
5990+
INSERT INTO schema_version (version_number, comment) VALUES (286, 'Add date of first contact for contact history #3408');
5991+
59855992
-- *** Insert new sql commands BEFORE this line ***

0 commit comments

Comments
 (0)