removing very old migration code
authorMarcus Eggenberger <egs@quassel-irc.org>
Fri, 21 Nov 2008 00:48:02 +0000 (01:48 +0100)
committerMarcus Eggenberger <egs@quassel-irc.org>
Fri, 21 Nov 2008 00:48:02 +0000 (01:48 +0100)
src/core/sqlitestorage.cpp
src/core/sqlitestorage.h

index eb6b3d8..613fa32 100644 (file)
@@ -798,51 +798,3 @@ QList<Message> SqliteStorage::requestMsgRange(UserId user, BufferId bufferId, in
 QString SqliteStorage::backlogFile() {
   return quasselDir().absolutePath() + "/quassel-storage.sqlite";  
 }
-
-
-// ONLY NEEDED FOR MIGRATION
-bool SqliteStorage::init(const QVariantMap &settings) {
-  if(!AbstractSqlStorage::init(settings))
-    return false;
-
-  QSqlQuery checkMigratedQuery(logDb());
-  checkMigratedQuery.prepare("SELECT DISTINCT typeOf(password) FROM quasseluser");
-  checkMigratedQuery.exec();
-  if(!watchQuery(checkMigratedQuery))
-    return false;
-
-  if(!checkMigratedQuery.first())
-    return true;               // table is empty -> no work to be done
-
-  QString passType = checkMigratedQuery.value(0).toString().toLower();
-  if(passType == "text")
-    return true; // allready migrated
-
-  Q_ASSERT(passType == "blob");
-  
-  QSqlQuery getPasswordsQuery(logDb());
-  getPasswordsQuery.prepare("SELECT userid, password FROM quasseluser");
-  getPasswordsQuery.exec();
-
-  if(!watchQuery(getPasswordsQuery)) {
-    qCritical() << "unable to migrate to new password format!";
-    return false;
-  }
-
-  QHash<int, QByteArray> passHash;
-  while(getPasswordsQuery.next()) {
-    passHash[getPasswordsQuery.value(0).toInt()] = getPasswordsQuery.value(1).toByteArray();
-  }
-
-  QSqlQuery setPasswordsQuery(logDb());
-  setPasswordsQuery.prepare("UPDATE quasseluser SET password = :password WHERE userid = :userid");
-  foreach(int userId, passHash.keys()) {
-    setPasswordsQuery.bindValue(":password", QString(passHash[userId]));
-    setPasswordsQuery.bindValue(":userid", userId);
-    setPasswordsQuery.exec();
-    watchQuery(setPasswordsQuery);
-  }
-
-  qDebug() << "successfully migrated passwords!";
-  return true;
-}
index 4b49d41..45f1c46 100644 (file)
@@ -89,8 +89,6 @@ protected:
   inline virtual QString driverName() { return "QSQLITE"; }
   inline virtual QString databaseName() { return backlogFile(); }
   virtual int installedSchemaVersion();
-
-  virtual bool init(const QVariantMap &settings = QVariantMap()); // only needed for migration
   
 private:
   static QString backlogFile();