Skip to content

Commit 4a90a45

Browse files
author
Stephan Hener
committed
FIX location of geotrace update
1 parent af3810e commit 4a90a45

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

generator/res/content_subclass.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@
7373
return;
7474
}
7575

76-
if (oldVersion < 13 && "geotrace".equals(TABLE_NAME)) {
77-
//hacky workaround as the foxykeep code "generation" are just nested String.formats
78-
TractiveDbUpgradeHelper.upgradeLocationsJsonToLocationsPath(db);
79-
}
80-
8176
%18$s
8277

8378
if (oldVersion != newVersion) {

generator/res/content_subclass_upgrade.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55

66
db.execSQL("DROP TABLE " + TABLE_NAME + ";");
77
db.execSQL("ALTER TABLE " + TABLE_NAME + "_tmp RENAME TO " + TABLE_NAME + ";");
8+
%7$s
89
oldVersion = %1$d;
910
}

generator/src/com/foxykeep/cpcodegenerator/generator/DatabaseGenerator.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,11 @@ private static void generateContentClass(final String fileName, final String cla
360360
.getDefaultValue(fieldData.type));
361361
}
362362
}
363+
364+
String upgradeGeotrace = "";
365+
if (tableData.dbTableName.equals("geotrace") && curVers == 13) {
366+
upgradeGeotrace = "TractiveDbUpgradeHelper.upgradeLocationsJsonToLocationsPath(db);";
367+
}
363368
sbUpgradeTable.append(String.format(
364369
contentSubClassUpgrade, curVers,
365370
sbUpgradeTableCreateTmpTable.toString(),
@@ -368,7 +373,9 @@ private static void generateContentClass(final String fileName, final String cla
368373
hasPreviousUnique ? String.format(UNIQUE_FORMAT,
369374
sbUpgradeTableCreateTmpTableUnique.toString()) : "",
370375
sbUpgradeTableInsertFields.toString(),
371-
sbUpgradeTableInsertDefaultValues.toString()));
376+
sbUpgradeTableInsertDefaultValues.toString(), upgradeGeotrace));
377+
378+
372379

373380
hasPreviousUpgradeElements = false;
374381
for (FieldData fieldData : upgradeFieldDataList) {
@@ -379,9 +386,11 @@ private static void generateContentClass(final String fileName, final String cla
379386

380387
sbUpgradeTableCommentNewFields.append(fieldData.dbConstantName);
381388
}
389+
382390
sbUpgradeTableComment.append(String.format(UPGRADE_VERSION_COMMENT_FIELD,
383391
curVers, sbUpgradeTableCommentNewFields.toString(),
384392
upgradeFieldDataList.size() > 1 ? "s" : ""));
393+
385394
}
386395

387396
// No more changes for the last versions so add the code to jump to the latest
@@ -584,7 +593,6 @@ private static void generateProviderClass(final String fileName, final String cl
584593
sbUpgradeDatabaseComment.toString(),
585594
hasProviderSubclasses ? "" : "final ",
586595
sbCaseWithoutIdWithoutRaw));
587-
588596
}
589597

590598
private static void appendUpgradeDatabaseComment(final StringBuilder sb,

0 commit comments

Comments
 (0)