[Kmymoney-devel] How to upgrades the database

Christian Dávid christian-david at web.de
Sun Aug 10 11:24:08 UTC 2014


Hi all,
Hi Fernando,

as you can see from [1] I started to familiarize myself with the database 
manager.

Now I added a new column to kmmFieldInfo in MyMoneyDbDef::FileInfo(void) 
using:

appendField(MyMoneyDbIntColumn("hiOnlineJobId", MyMoneyDbIntColumn::BIG, 
UNSIGNED, false, false, 8));

First question: is that correct?

If I open KMyMoney with a sql-database it crashes because it tries to select 
the new column "hiOnlineJobId" (or even tags if the version is 6) before it 
updated the database.

I did some investigation and noticed that the upgradeToVx() methods call 
readFileInfo() and writeFileInfo() quite often. But these methods use 
m_db.m_tables["kmmFileInfo"].selectAllString(). This leads to the request for 
non-existing columns (-> exception -> crash).

Have I done something wrong?

Btw: what is fixLevel in kmmFileInfo used for?

Have a nice day!
Christian

P.S.: I think we have to rethink how the hole storage system should work. For 
beginners like me it is a lot of work to understand it, way to much if you 
remember which tasks they solve. There are to many hacks, abstractions and 
methods which do nothing else then calling another method without any changes. 
I feel like being in a pinball machine :( But especially open source projects 
which are based on the work of volunteers must make it easy for new 
contributors to help. If I had known what work is waiting for me, I had never 
started contributing.

[1] https://git.reviewboard.kde.org/r/119647/


More information about the KMyMoney-devel mailing list