core: Track upgrade step within schema version
[quassel.git] / src / core / sqlitestorage.h
index f72a839..4a33bfc 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2018 by the Quassel Project                        *
+ *   Copyright (C) 2005-2019 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -121,7 +121,6 @@ public slots:
 
     /* Sysident handling */
     QMap<UserId, QString> getAllAuthUserNames() override;
-    QString getAuthUserName(UserId user) override;
 
 protected:
     void setConnectionProperties(const QVariantMap &properties,
@@ -135,8 +134,24 @@ protected:
     QString driverName()  override { return "QSQLITE"; }
     QString databaseName()  override { return backlogFile(); }
     int installedSchemaVersion() override;
-    bool updateSchemaVersion(int newVersion) override;
+    bool updateSchemaVersion(int newVersion, bool clearUpgradeStep) override;
     bool setupSchemaVersion(int version) override;
+
+    /**
+     * Gets the last successful schema upgrade step, or an empty string if no upgrade is in progress
+     *
+     * @return Filename of last successful schema upgrade query, or empty string if not upgrading
+     */
+    QString schemaVersionUpgradeStep() override;
+
+    /**
+     * Sets the last successful schema upgrade step
+     *
+     * @param upgradeQuery  The filename of the last successful schema upgrade query
+     * @return True if successfully set, otherwise false
+     */
+    virtual bool setSchemaVersionUpgradeStep(QString upgradeQuery) override;
+
     bool safeExec(QSqlQuery &query, int retryCount = 0);
 
 private:
@@ -175,7 +190,7 @@ public:
 
     bool prepareQuery(MigrationObject mo) override;
 
-    int stepSize() { return 50000; }
+    qint64 stepSize() { return 50000; }
 
 protected:
     bool transaction()  override { return logDb().transaction(); }