Rewrite upgrade db versin 6 to 7

Rewrite DB upgrade without the need to export and import, which also eliminates the need for DbAdapters.

This will remove the need to maintain legacy support for old db format.

However, the CREDIT/DEBIT (split.type) confused me. I'm not sure whether they are correct.

I test upgrading from 1.3.3, wiht CASH/INCOME/EXPENSE account, create one transaction in INCOME which increases CASH, one transaction in EXPENSE which decreases CASH. After the upgrade, the money change in CASH seem to be correct.
However, upgrading from 1.3.3 to 1.4.3 gave me a wired result, with both transactions decreases CASH.
I think you mush check that part to see whether it is correct.

Other than that, the code should work. I tried to import my whole account tree with no problem.
"It is correct that if one transaction increases the main account in 1.3.x, it will also increase the account (when displayed) in 1.4.x ?  And the increase/decrease in the other account may be inverted (when displayed) in the migration?"

Yes, this is correct. That is how the migration should work. But in my testing, the SQL sometimes maintained the balance of the transfer account and then modified the split of the main account (which may be inverted after migration). 

To achieve this, we consider the transaction that increases/decreases the balance of the main account, and (based on the account type and amount sign) we figure out kind of split to create in the main account to also increase/decrease the balance. Then we invert that split for the transfer account. (Hence the transfer account balance in v1.4.x may not be the same as in 1.3.x before migration).