Merge pull request #7567 from brave/issues/13495
Fix database upgrade paths for iOS
This commit is contained in:
@@ -9,11 +9,11 @@ namespace ads {
|
||||
namespace database {
|
||||
|
||||
int32_t version() {
|
||||
return 7;
|
||||
return 8;
|
||||
}
|
||||
|
||||
int32_t compatible_version() {
|
||||
return 7;
|
||||
return 8;
|
||||
}
|
||||
|
||||
} // namespace database
|
||||
|
||||
+5
-5
@@ -63,8 +63,8 @@ void Campaigns::Migrate(
|
||||
DCHECK(transaction);
|
||||
|
||||
switch (to_version) {
|
||||
case 3: {
|
||||
MigrateToV3(transaction);
|
||||
case 8: {
|
||||
MigrateToV8(transaction);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ std::string Campaigns::BuildInsertOrUpdateQuery(
|
||||
BuildBindingParameterPlaceholders(7, count).c_str());
|
||||
}
|
||||
|
||||
void Campaigns::CreateTableV3(
|
||||
void Campaigns::CreateTableV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
@@ -139,13 +139,13 @@ void Campaigns::CreateTableV3(
|
||||
transaction->commands.push_back(std::move(command));
|
||||
}
|
||||
|
||||
void Campaigns::MigrateToV3(
|
||||
void Campaigns::MigrateToV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
util::Drop(transaction, get_table_name());
|
||||
|
||||
CreateTableV3(transaction);
|
||||
CreateTableV8(transaction);
|
||||
}
|
||||
|
||||
} // namespace table
|
||||
|
||||
+2
-2
@@ -45,9 +45,9 @@ class Campaigns : public Table {
|
||||
DBCommand* command,
|
||||
const CreativeAdList& creative_ads);
|
||||
|
||||
void CreateTableV3(
|
||||
void CreateTableV8(
|
||||
DBTransaction* transaction);
|
||||
void MigrateToV3(
|
||||
void MigrateToV8(
|
||||
DBTransaction* transaction);
|
||||
};
|
||||
|
||||
|
||||
+5
-5
@@ -261,8 +261,8 @@ void CreativeAdNotifications::Migrate(
|
||||
DCHECK(transaction);
|
||||
|
||||
switch (to_version) {
|
||||
case 3: {
|
||||
MigrateToV3(transaction);
|
||||
case 8: {
|
||||
MigrateToV8(transaction);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ CreativeAdNotificationInfo CreativeAdNotifications::GetFromRecord(
|
||||
return creative_ad_notification;
|
||||
}
|
||||
|
||||
void CreativeAdNotifications::CreateTableV3(
|
||||
void CreativeAdNotifications::CreateTableV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
@@ -431,13 +431,13 @@ void CreativeAdNotifications::CreateTableV3(
|
||||
transaction->commands.push_back(std::move(command));
|
||||
}
|
||||
|
||||
void CreativeAdNotifications::MigrateToV3(
|
||||
void CreativeAdNotifications::MigrateToV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
util::Drop(transaction, get_table_name());
|
||||
|
||||
CreateTableV3(transaction);
|
||||
CreateTableV8(transaction);
|
||||
}
|
||||
|
||||
} // namespace table
|
||||
|
||||
+2
-2
@@ -84,9 +84,9 @@ class CreativeAdNotifications : public Table {
|
||||
CreativeAdNotificationInfo GetFromRecord(
|
||||
DBRecord* record) const;
|
||||
|
||||
void CreateTableV3(
|
||||
void CreateTableV8(
|
||||
DBTransaction* transaction);
|
||||
void MigrateToV3(
|
||||
void MigrateToV8(
|
||||
DBTransaction* transaction);
|
||||
|
||||
int batch_size_;
|
||||
|
||||
+5
-5
@@ -62,8 +62,8 @@ void CreativeAds::Migrate(
|
||||
DCHECK(transaction);
|
||||
|
||||
switch (to_version) {
|
||||
case 6: {
|
||||
MigrateToV6(transaction);
|
||||
case 8: {
|
||||
MigrateToV8(transaction);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ std::string CreativeAds::BuildInsertOrUpdateQuery(
|
||||
BuildBindingParameterPlaceholders(5, count).c_str());
|
||||
}
|
||||
|
||||
void CreativeAds::CreateTableV6(
|
||||
void CreativeAds::CreateTableV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
@@ -133,13 +133,13 @@ void CreativeAds::CreateTableV6(
|
||||
transaction->commands.push_back(std::move(command));
|
||||
}
|
||||
|
||||
void CreativeAds::MigrateToV6(
|
||||
void CreativeAds::MigrateToV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
util::Drop(transaction, get_table_name());
|
||||
|
||||
CreateTableV6(transaction);
|
||||
CreateTableV8(transaction);
|
||||
}
|
||||
|
||||
} // namespace table
|
||||
|
||||
+2
-2
@@ -45,9 +45,9 @@ class CreativeAds : public Table {
|
||||
DBCommand* command,
|
||||
const CreativeAdList& creative_ads);
|
||||
|
||||
void CreateTableV6(
|
||||
void CreateTableV8(
|
||||
DBTransaction* transaction);
|
||||
void MigrateToV6(
|
||||
void MigrateToV8(
|
||||
DBTransaction* transaction);
|
||||
};
|
||||
|
||||
|
||||
+5
-5
@@ -343,8 +343,8 @@ void CreativeNewTabPageAds::Migrate(
|
||||
DCHECK(transaction);
|
||||
|
||||
switch (to_version) {
|
||||
case 3: {
|
||||
MigrateToV3(transaction);
|
||||
case 8: {
|
||||
MigrateToV8(transaction);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ CreativeNewTabPageAdInfo CreativeNewTabPageAds::GetFromRecord(
|
||||
return creative_new_tab_page_ad;
|
||||
}
|
||||
|
||||
void CreativeNewTabPageAds::CreateTableV3(
|
||||
void CreativeNewTabPageAds::CreateTableV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
@@ -537,13 +537,13 @@ void CreativeNewTabPageAds::CreateTableV3(
|
||||
transaction->commands.push_back(std::move(command));
|
||||
}
|
||||
|
||||
void CreativeNewTabPageAds::MigrateToV3(
|
||||
void CreativeNewTabPageAds::MigrateToV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
util::Drop(transaction, get_table_name());
|
||||
|
||||
CreateTableV3(transaction);
|
||||
CreateTableV8(transaction);
|
||||
}
|
||||
|
||||
} // namespace table
|
||||
|
||||
+2
-2
@@ -96,9 +96,9 @@ class CreativeNewTabPageAds : public Table {
|
||||
CreativeNewTabPageAdInfo GetFromRecord(
|
||||
DBRecord* record) const;
|
||||
|
||||
void CreateTableV3(
|
||||
void CreateTableV8(
|
||||
DBTransaction* transaction);
|
||||
void MigrateToV3(
|
||||
void MigrateToV8(
|
||||
DBTransaction* transaction);
|
||||
|
||||
int batch_size_;
|
||||
|
||||
+5
-5
@@ -66,8 +66,8 @@ void Dayparts::Migrate(
|
||||
DCHECK(transaction);
|
||||
|
||||
switch (to_version) {
|
||||
case 6: {
|
||||
MigrateToV6(transaction);
|
||||
case 8: {
|
||||
MigrateToV8(transaction);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ std::string Dayparts::BuildInsertOrUpdateQuery(
|
||||
BuildBindingParameterPlaceholders(4, count).c_str());
|
||||
}
|
||||
|
||||
void Dayparts::CreateTableV6(
|
||||
void Dayparts::CreateTableV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
@@ -139,13 +139,13 @@ void Dayparts::CreateTableV6(
|
||||
transaction->commands.push_back(std::move(command));
|
||||
}
|
||||
|
||||
void Dayparts::MigrateToV6(
|
||||
void Dayparts::MigrateToV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
util::Drop(transaction, get_table_name());
|
||||
|
||||
CreateTableV6(transaction);
|
||||
CreateTableV8(transaction);
|
||||
}
|
||||
|
||||
} // namespace table
|
||||
|
||||
+2
-2
@@ -45,9 +45,9 @@ class Dayparts : public Table {
|
||||
DBCommand* command,
|
||||
const CreativeAdList& creative_ads);
|
||||
|
||||
void CreateTableV6(
|
||||
void CreateTableV8(
|
||||
DBTransaction* transaction);
|
||||
void MigrateToV6(
|
||||
void MigrateToV8(
|
||||
DBTransaction* transaction);
|
||||
};
|
||||
|
||||
|
||||
+5
-5
@@ -62,8 +62,8 @@ void GeoTargets::Migrate(
|
||||
DCHECK(transaction);
|
||||
|
||||
switch (to_version) {
|
||||
case 3: {
|
||||
MigrateToV3(transaction);
|
||||
case 8: {
|
||||
MigrateToV8(transaction);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ std::string GeoTargets::BuildInsertOrUpdateQuery(
|
||||
BuildBindingParameterPlaceholders(2, count).c_str());
|
||||
}
|
||||
|
||||
void GeoTargets::CreateTableV3(
|
||||
void GeoTargets::CreateTableV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
@@ -127,13 +127,13 @@ void GeoTargets::CreateTableV3(
|
||||
transaction->commands.push_back(std::move(command));
|
||||
}
|
||||
|
||||
void GeoTargets::MigrateToV3(
|
||||
void GeoTargets::MigrateToV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
util::Drop(transaction, get_table_name());
|
||||
|
||||
CreateTableV3(transaction);
|
||||
CreateTableV8(transaction);
|
||||
}
|
||||
|
||||
} // namespace table
|
||||
|
||||
+2
-2
@@ -45,9 +45,9 @@ class GeoTargets : public Table {
|
||||
DBCommand* command,
|
||||
const CreativeAdList& creative_ads);
|
||||
|
||||
void CreateTableV3(
|
||||
void CreateTableV8(
|
||||
DBTransaction* transaction);
|
||||
void MigrateToV3(
|
||||
void MigrateToV8(
|
||||
DBTransaction* transaction);
|
||||
};
|
||||
|
||||
|
||||
+5
-5
@@ -63,8 +63,8 @@ void Segments::Migrate(
|
||||
DCHECK(transaction);
|
||||
|
||||
switch (to_version) {
|
||||
case 7: {
|
||||
MigrateToV7(transaction);
|
||||
case 8: {
|
||||
MigrateToV8(transaction);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ std::string Segments::BuildInsertOrUpdateQuery(
|
||||
BuildBindingParameterPlaceholders(2, count).c_str());
|
||||
}
|
||||
|
||||
void Segments::CreateTableV7(
|
||||
void Segments::CreateTableV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
@@ -126,13 +126,13 @@ void Segments::CreateTableV7(
|
||||
transaction->commands.push_back(std::move(command));
|
||||
}
|
||||
|
||||
void Segments::MigrateToV7(
|
||||
void Segments::MigrateToV8(
|
||||
DBTransaction* transaction) {
|
||||
DCHECK(transaction);
|
||||
|
||||
util::Drop(transaction, "categories");
|
||||
|
||||
CreateTableV7(transaction);
|
||||
CreateTableV8(transaction);
|
||||
}
|
||||
|
||||
} // namespace table
|
||||
|
||||
+2
-2
@@ -45,9 +45,9 @@ class Segments : public Table {
|
||||
DBCommand* command,
|
||||
const CreativeAdList& creative_ads);
|
||||
|
||||
void CreateTableV7(
|
||||
void CreateTableV8(
|
||||
DBTransaction* transaction);
|
||||
void MigrateToV7(
|
||||
void MigrateToV8(
|
||||
DBTransaction* transaction);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user