File indexing completed on 2025-01-19 03:53:46

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-05-29
0007  * Description : Thumbnail DB schema update
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  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_THUMBS_DB_SCHEMA_UPDATER_H
0017 #define DIGIKAM_THUMBS_DB_SCHEMA_UPDATER_H
0018 
0019 // Local includes
0020 
0021 #include "digikam_export.h"
0022 
0023 namespace Digikam
0024 {
0025 
0026 class ThumbsDbAccess;
0027 class InitializationObserver;
0028 
0029 class DIGIKAM_EXPORT ThumbsDbSchemaUpdater
0030 {
0031 public:
0032 
0033     static int schemaVersion();
0034 
0035 public:
0036 
0037     explicit ThumbsDbSchemaUpdater(ThumbsDbAccess* const dbAccess);
0038     ~ThumbsDbSchemaUpdater();
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 
0054 private:
0055 
0056     // Disable
0057     ThumbsDbSchemaUpdater(const ThumbsDbSchemaUpdater&)            = delete;
0058     ThumbsDbSchemaUpdater& operator=(const ThumbsDbSchemaUpdater&) = delete;
0059 
0060     class Private;
0061     Private* const d;
0062 };
0063 
0064 } // namespace Digikam
0065 
0066 #endif // DIGIKAM_THUMBS_DB_SCHEMA_UPDATER_H