X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fpostgresqlstorage.cpp;h=a2dffb591044e9983a6e782f644c6c0d0e1cf15e;hp=04212249da3d6249c36407c0bfaa80da3fe3ee4f;hb=2633dc0cbc05936ad551e2c2b871478b32514aaa;hpb=0446cc2c41de41575c92bdd0b32cf795ac10e6e2 diff --git a/src/core/postgresqlstorage.cpp b/src/core/postgresqlstorage.cpp index 04212249..a2dffb59 100644 --- a/src/core/postgresqlstorage.cpp +++ b/src/core/postgresqlstorage.cpp @@ -61,10 +61,18 @@ QString PostgreSqlStorage::description() const { return tr("PostgreSQL Turbo Bomber HD!"); } -QVariantMap PostgreSqlStorage::setupKeys() const { +QStringList PostgreSqlStorage::setupKeys() const { + QStringList keys; + keys << "Username" + << "Password" + << "Hostname" + << "Port" + << "Database"; + return keys; +} +QVariantMap PostgreSqlStorage::setupDefaults() const { QVariantMap map; map["Username"] = QVariant(QString("quassel")); - map["Password"] = QVariant(QString()); map["Hostname"] = QVariant(QString("localhost")); map["Port"] = QVariant(5432); map["Database"] = QVariant(QString("quassel")); @@ -1490,6 +1498,7 @@ bool PostgreSqlMigrationWriter::prepareQuery(MigrationObject mo) { query = queryString("migrate_write_sender"); break; case Identity: + _validIdentities.clear(); query = queryString("migrate_write_identity"); break; case IdentityNick: @@ -1532,6 +1541,7 @@ bool PostgreSqlMigrationWriter::writeMo(const SenderMO &sender) { //bool PostgreSqlMigrationWriter::writeIdentity(const IdentityMO &identity) { bool PostgreSqlMigrationWriter::writeMo(const IdentityMO &identity) { + _validIdentities << identity.id.toInt(); bindValue(0, identity.id.toInt()); bindValue(1, identity.userid.toInt()); bindValue(2, identity.identityname); @@ -1569,7 +1579,10 @@ bool PostgreSqlMigrationWriter::writeMo(const NetworkMO &network) { bindValue(0, network.networkid.toInt()); bindValue(1, network.userid.toInt()); bindValue(2, network.networkname); - bindValue(3, network.identityid.toInt()); + if(_validIdentities.contains(network.identityid.toInt())) + bindValue(3, network.identityid.toInt()); + else + bindValue(3, QVariant()); bindValue(4, network.encodingcodec); bindValue(5, network.decodingcodec); bindValue(6, network.servercodec); @@ -1649,6 +1662,7 @@ bool PostgreSqlMigrationWriter::postProcess() { QSqlDatabase db = logDb(); QList sequences; sequences << Sequence("backlog", "messageid") + << Sequence("buffer", "bufferid") << Sequence("identity", "identityid") << Sequence("identity_nick", "nickid") << Sequence("ircserver", "serverid")