On Friday, October 3, 2014 12:29:47 PM Christian Dávid wrote: > Hi Fernando, > > finally I want to finish the online banking stuff for the database backend. > So I have more questions… > > Am Sonntag, 21. September 2014, 15:33:46 schrieb Fernando Vilas: > > > I even think, this behavior will prevent the upgrades to v1, and v7 as > > > they > > > call readFileInfo() and new columns were created in that versions. If > > > you > > > have to upgrade more versions than just on (vN -> vM | m >= n+2) it will > > > even fail if you start with any version before v7 (= all possible update > > > processes). > > > > > > Actually the test databases which I just created (using master branch) > > > identifies itself as version 6 but it should be v7. This indicates a bug > > > in > > > the upgrade process. > > > > > > _ Solution _ > > > > > > I would recommend not to use readFileInfo() and writeFileInfo() in any > > > upgrade methods anymore and just call writeFileInfo() at the end of the > > > upgrade process. Also the m_hi…Id vars need to be set somewhere. > > > > That sounds reasonable. The system was designed to make upgrades easy, but > > there are always cases you did not consider. I do not remember us > > considering removing columns, just adding/changing them, so this is new > > territory. > > I think this is a misunderstanding. To solve that: Where/when exactly are > columns added to the database? I cannot find any piece of code that triggers > that :( >
It looks like I was mistaken. There is code to create new tables, but it is in the upgradeToV<num>() calls that the call to generateDDL on the new columns is executed. There is probably a good way to abstract it if we want to automate the adding of columns. If not, the calls look like what is in upgradeToV1(). > The errors I got are not caused by removed columns (I do not drop any > column) but it is caused by columns which are going to be created (well, > actually won't be created, because KMyMoney crashes first…). > The upgradeDb() call that invokes upgradeToV<num>() should take care of adding the columns. If it still crashes afterwards, then that is a different bug. > > > How is the database created if you create a new database from scratch: > > > 1) Is the most recent database version created directly? Or > > > 2) do you create a database of version 0 and then call all upgrade > > > methods? > > > > It should be option 1: just creating the database using the current state > > of affairs for tables/views. That definitely simplifies things, but can > > make testing the upgrade functions non-trivial. > > Has somebody a database (with test data) from version 0? I can just compile > KMyMoney 4.5, all earlier versions do not compile on my system anymore. Or a > database of any other version (e.g. 6.0)? That could help me testing. > > We should create some database files and .xml files for each version and > save them for later test of the upgrade routines. > Yes!!! That has been a gap in our testing until now. I usually just took a snapshot of my database and then practiced upgrading until it worked, then did it on the master copy. I tended to make a backup first, though. We definitely could use a version 0 file for testing the upgrade path as part of the test harness. Also, I hope you don't misinterpret my delays in responses or vague guidance. I am in the middle of a stretch of long weeks at $dayjob and have not been able to dedicate the time that KMM deserves. I really appreciate that someone else is digging into the code and improving it. Thanks, Fernando _______________________________________________ KMyMoney-devel mailing list KMyMoney-devel@kde.org https://mail.kde.org/mailman/listinfo/kmymoney-devel