Skip to content

Commit

Permalink
Upgrade database for new Vienna Developer URL
Browse files Browse the repository at this point in the history
Closes ViennaRSS#1251.
After moving to GitHub pages our RSS feed URL changed.
The only way to really redirect is through changing the URL in the DB.
  • Loading branch information
josh64x2 committed Mar 31, 2019
1 parent 139833d commit 4022d99
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Vienna/Sources/Database/Database.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ + (NSString *)databasePath;

// The current database version number
const NSInteger MA_Min_Supported_DB_Version = 12;
const NSInteger MA_Current_DB_Version = 19;
const NSInteger MA_Current_DB_Version = 20;

@implementation Database

Expand Down
16 changes: 16 additions & 0 deletions Vienna/Sources/Database/VNADatabaseMigration.m
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,22 @@ + (void)migrateDatabase:(FMDatabase *)db fromVersion:(NSInteger)fromVersion {
db.userVersion = (uint32_t)19;
NSLog(@"Updated database schema to version 19.");
}
case 20: {
// Upgrade to rev 20.
// Update the Vienna Developer's blog RSS URL after moved to github pages

FMResultSet *results = [db executeQuery:@"SELECT folder_id FROM rss_folders WHERE feed_url LIKE ?", @"%%www.vienna-rss.com/?feed=rss2%%"];

if([results next]) {
int viennaFolderId = [results intForColumn:@"folder_id"];
[db executeUpdate:@"UPDATE rss_folders SET feed_url=? WHERE folder_id=?",
@"https://www.vienna-rss.com/feed.xml",
@(viennaFolderId)];
}
[results close];
db.userVersion = (uint32_t)20;
NSLog(@"Updated database schema to version 20.");
}
}

}
Expand Down

0 comments on commit 4022d99

Please sign in to comment.