diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-06-14 20:36:37 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-06-14 20:36:37 +0200 |
commit | bb80d3feebdc9acc52e3f4ad24084d8425f043a2 (patch) | |
tree | 2084a84c39f159c6aea254775dc0880d52579d45 /src/db/Db.vala | |
parent | b26ff0798252a1a8072dd2c7a67f6205de9fde11 (diff) | |
parent | 31804433d72460cbe0a39f9f8ea5e76058d84cda (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/db/Db.vala')
-rw-r--r-- | src/db/Db.vala | 65 |
1 files changed, 63 insertions, 2 deletions
diff --git a/src/db/Db.vala b/src/db/Db.vala index 3eca8ce..5072967 100644 --- a/src/db/Db.vala +++ b/src/db/Db.vala @@ -293,7 +293,7 @@ private VerifyResult upgrade_database(int input_version) { } version = 16; - + // // Version 17: // * Added comment column to PhotoTable and VideoTable @@ -349,11 +349,72 @@ private VerifyResult upgrade_database(int input_version) { // version = 20; + // - // Finalize the upgrade process + // Version 21: + // * Add has_gps, gps_lat and gps_lon columns to PhotoTable + + if (!DatabaseTable.ensure_column("PhotoTable", "has_gps", "INTEGER DEFAULT -1", + "upgrade_database: adding gps_lat column to PhotoTable") + || !DatabaseTable.ensure_column("PhotoTable", "gps_lat", "REAL", + "upgrade_database: adding gps_lat column to PhotoTable") + || !DatabaseTable.ensure_column("PhotoTable", "gps_lon", "REAL", + "upgrade_database: adding gps_lon column to PhotoTable")) { + return VerifyResult.UPGRADE_ERROR; + } + + version = 21; + + // + // Version 22: + // * Create face detection tables even if feasture is not enabled + // * Added face pixels column to FaceLocationTable + // * Added face vector column to FaceTable // + FaceTable.get_instance(); + FaceLocationTable.get_instance(); + if (!DatabaseTable.has_column("FaceLocationTable", "vec")) { + message("upgrade_database: adding vec column to FaceLocationTable"); + if (!DatabaseTable.add_column("FaceLocationTable", "vec", "TEXT")) + return VerifyResult.UPGRADE_ERROR; + } + if (!DatabaseTable.has_column("FaceLocationTable", "guess")) { + message("upgrade_database: adding guess column to FaceLocationTable"); + if (!DatabaseTable.add_column("FaceLocationTable", "guess", "INTEGER DEFAULT 0")) + return VerifyResult.UPGRADE_ERROR; + } + if (!DatabaseTable.has_column("FaceTable", "ref")) { + message("upgrade_database: adding ref column to FaceTable"); + if (!DatabaseTable.add_column("FaceTable", "ref", "INTEGER DEFAULT -1")) + return VerifyResult.UPGRADE_ERROR; + } + version = 22; + + // + // Finalize the upgrade process + // + + if (input_version < 23) { + // Run the settings migrator to copy settings data from /org/yorba/shotwell to /org/gnome/shotwell + GSettingsConfigurationEngine.run_gsettings_migrator_v2(); + } + + version = 23; + + if (input_version < 24) { + // Convert timestamp 0 to NULL to represent unset date and free 0 to be 1.1.1970 00:00 + message("upgrade_database: Shifting times from 0 to null for unset times"); + try { + PhotoTable.upgrade_for_unset_timestamp(); + VideoTable.upgrade_for_unset_timestamp(); + version = 24; + } catch (DatabaseError err) { + critical("Failed to upgrade database to version 24: %s", err.message); + } + } + assert(version == DatabaseTable.SCHEMA_VERSION); VersionTable.get_instance().update_version(version, Resources.APP_VERSION); |