Fix migration of hashversion 166/head
authorMichael Marley <michael@michaelmarley.com>
Tue, 1 Dec 2015 00:33:37 +0000 (19:33 -0500)
committerMichael Marley <michael@michaelmarley.com>
Tue, 1 Dec 2015 00:33:37 +0000 (19:33 -0500)
Previously, hashversion was not migrated.  This would cause the
value to default to 0, causing login failures for existing users.

src/core/SQL/PostgreSQL/17/migrate_write_quasseluser.sql
src/core/SQL/SQLite/18/migrate_read_quasseluser.sql
src/core/abstractsqlstorage.h
src/core/postgresqlstorage.cpp
src/core/sqlitestorage.cpp

index ae18c22..6b2f75c 100644 (file)
@@ -1,2 +1,2 @@
-INSERT INTO quasseluser (userid, username, password)
-VALUES (?, ?, ?)
+INSERT INTO quasseluser (userid, username, password, hashversion)
+VALUES (?, ?, ?, ?)
index 5adf0d9..210620e 100644 (file)
@@ -1,2 +1,2 @@
-SELECT userid, username, password
+SELECT userid, username, password, hashversion
 FROM quasseluser
 FROM quasseluser
index c39e826..0637d0e 100644 (file)
@@ -131,6 +131,7 @@ public:
         UserId id;
         QString username;
         QString password;
         UserId id;
         QString username;
         QString password;
+        int hashversion;
     };
 
     struct SenderMO {
     };
 
     struct SenderMO {
index 65460df..acb7f37 100644 (file)
@@ -1841,6 +1841,7 @@ bool PostgreSqlMigrationWriter::writeMo(const QuasselUserMO &user)
     bindValue(0, user.id.toInt());
     bindValue(1, user.username);
     bindValue(2, user.password);
     bindValue(0, user.id.toInt());
     bindValue(1, user.username);
     bindValue(2, user.password);
+    bindValue(3, user.hashversion);
     return exec();
 }
 
     return exec();
 }
 
index 354b340..e71c537 100644 (file)
@@ -1808,6 +1808,7 @@ bool SqliteMigrationReader::readMo(QuasselUserMO &user)
     user.id = value(0).toInt();
     user.username = value(1).toString();
     user.password = value(2).toString();
     user.id = value(0).toInt();
     user.username = value(1).toString();
     user.password = value(2).toString();
+    user.hashversion = value(3).toInt();
     return true;
 }
 
     return true;
 }