File indexing completed on 2025-03-09 03:54:59

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-05-29
0007  * Description : Face database schema updater
0008  *
0009  * SPDX-FileCopyrightText: 2007-2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText:      2020 by Nghia Duong <minhnghiaduong997 at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_FACE_DB_SCHEMA_UPDATER_H
0018 #define DIGIKAM_FACE_DB_SCHEMA_UPDATER_H
0019 
0020 // Local includes
0021 
0022 #include "collectionscannerobserver.h"
0023 
0024 namespace Digikam
0025 {
0026 
0027 class FaceDbAccess;
0028 
0029 class FaceDbSchemaUpdater
0030 {
0031 public:
0032 
0033     static int schemaVersion();
0034 
0035 public:
0036 
0037     explicit FaceDbSchemaUpdater(FaceDbAccess* const dbAccess);
0038     ~FaceDbSchemaUpdater();
0039 
0040     bool update();
0041     void setObserver(InitializationObserver* const observer);
0042 
0043 private:
0044 
0045     bool startUpdates();
0046     bool makeUpdates();
0047     bool createDatabase();
0048     bool createTables();
0049     bool createIndices();
0050     bool createTriggers();
0051     bool updateV1ToV2();
0052     bool updateV2ToV3();
0053     bool updateV3ToV4();
0054 
0055 private:
0056 
0057     // Disable
0058     FaceDbSchemaUpdater(const FaceDbSchemaUpdater&)            = delete;
0059     FaceDbSchemaUpdater& operator=(const FaceDbSchemaUpdater&) = delete;
0060 
0061 private:
0062 
0063     class Private;
0064     Private* const d;
0065 };
0066 
0067 } // namespace Digikam
0068 
0069 #endif // DIGIKAM_FACE_DB_SCHEMA_UPDATER_H