Skip to content

Commit

Permalink
Fix database upgrade paths for iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
tmancey committed Jan 12, 2021
1 parent 201969f commit f622ace
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ void Campaigns::Migrate(
DCHECK(transaction);

switch (to_version) {
case 3: {
MigrateToV3(transaction);
case 8: {
MigrateToV8(transaction);
break;
}

Expand Down Expand Up @@ -117,7 +117,7 @@ std::string Campaigns::BuildInsertOrUpdateQuery(
BuildBindingParameterPlaceholders(7, count).c_str());
}

void Campaigns::CreateTableV3(
void Campaigns::CreateTableV8(
DBTransaction* transaction) {
DCHECK(transaction);

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ void CreativeAdNotifications::Migrate(
DCHECK(transaction);

switch (to_version) {
case 3: {
MigrateToV3(transaction);
case 8: {
MigrateToV8(transaction);
break;
}

Expand Down Expand Up @@ -410,7 +410,7 @@ CreativeAdNotificationInfo CreativeAdNotifications::GetFromRecord(
return creative_ad_notification;
}

void CreativeAdNotifications::CreateTableV3(
void CreativeAdNotifications::CreateTableV8(
DBTransaction* transaction) {
DCHECK(transaction);

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void CreativeAds::Migrate(
DCHECK(transaction);

switch (to_version) {
case 6: {
MigrateToV6(transaction);
case 8: {
MigrateToV8(transaction);
break;
}

Expand Down Expand Up @@ -112,7 +112,7 @@ std::string CreativeAds::BuildInsertOrUpdateQuery(
BuildBindingParameterPlaceholders(5, count).c_str());
}

void CreativeAds::CreateTableV6(
void CreativeAds::CreateTableV8(
DBTransaction* transaction) {
DCHECK(transaction);

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ void CreativeNewTabPageAds::Migrate(
DCHECK(transaction);

switch (to_version) {
case 3: {
MigrateToV3(transaction);
case 8: {
MigrateToV8(transaction);
break;
}

Expand Down Expand Up @@ -516,7 +516,7 @@ CreativeNewTabPageAdInfo CreativeNewTabPageAds::GetFromRecord(
return creative_new_tab_page_ad;
}

void CreativeNewTabPageAds::CreateTableV3(
void CreativeNewTabPageAds::CreateTableV8(
DBTransaction* transaction) {
DCHECK(transaction);

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ void Dayparts::Migrate(
DCHECK(transaction);

switch (to_version) {
case 6: {
MigrateToV6(transaction);
case 8: {
MigrateToV8(transaction);
break;
}

Expand Down Expand Up @@ -117,7 +117,7 @@ std::string Dayparts::BuildInsertOrUpdateQuery(
BuildBindingParameterPlaceholders(4, count).c_str());
}

void Dayparts::CreateTableV6(
void Dayparts::CreateTableV8(
DBTransaction* transaction) {
DCHECK(transaction);

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void GeoTargets::Migrate(
DCHECK(transaction);

switch (to_version) {
case 3: {
MigrateToV3(transaction);
case 8: {
MigrateToV8(transaction);
break;
}

Expand Down Expand Up @@ -108,7 +108,7 @@ std::string GeoTargets::BuildInsertOrUpdateQuery(
BuildBindingParameterPlaceholders(2, count).c_str());
}

void GeoTargets::CreateTableV3(
void GeoTargets::CreateTableV8(
DBTransaction* transaction) {
DCHECK(transaction);

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ void Segments::Migrate(
DCHECK(transaction);

switch (to_version) {
case 7: {
MigrateToV7(transaction);
case 8: {
MigrateToV8(transaction);
break;
}

Expand Down Expand Up @@ -107,7 +107,7 @@ std::string Segments::BuildInsertOrUpdateQuery(
BuildBindingParameterPlaceholders(2, count).c_str());
}

void Segments::CreateTableV7(
void Segments::CreateTableV8(
DBTransaction* transaction) {
DCHECK(transaction);

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down

0 comments on commit f622ace

Please sign in to comment.