diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-03-28 17:28:35 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-03-28 17:28:44 -0700 |
commit | 13882a31e478466b98dd4dfb7eebbd97c0627e06 (patch) | |
tree | d4251193c1f88cacbdc433899fcbdfa57c07c16d /test | |
parent | 635aebbb89d205a52806ebfa18214d3a649c7291 (diff) | |
download | qtlocation-mapboxgl-13882a31e478466b98dd4dfb7eebbd97c0627e06.tar.gz |
[core] Set schema version to 3 after upgrading
The migration was upgrading the schema, but not the schema version. As a result, the (expensive) migration was running every time an OfflineDatabase was constructed with a v2 database.
Fixes #4501
Diffstat (limited to 'test')
-rw-r--r-- | test/storage/offline_database.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/storage/offline_database.cpp b/test/storage/offline_database.cpp index 11d56c237b..65812c6e8d 100644 --- a/test/storage/offline_database.cpp +++ b/test/storage/offline_database.cpp @@ -669,6 +669,13 @@ static int databasePageCount(const std::string& path) { return stmt.get<int>(0); } +static int databaseUserVersion(const std::string& path) { + mapbox::sqlite::Database db(path, mapbox::sqlite::ReadOnly); + mapbox::sqlite::Statement stmt = db.prepare("pragma user_version"); + stmt.run(); + return stmt.get<int>(0); +} + TEST(OfflineDatabase, MigrateFromV2Schema) { using namespace mbgl; @@ -685,6 +692,7 @@ TEST(OfflineDatabase, MigrateFromV2Schema) { } } + EXPECT_EQ(3, databaseUserVersion("test/fixtures/offline/v3.db")); EXPECT_LT(databasePageCount("test/fixtures/offline/v3.db"), databasePageCount("test/fixtures/offline/v2.db")); } |