We have moved to a new Sailfish OS Forum. Please start new discussions there.
3

[Uitukka] BUG - all phonenumbers 'dissappeared'

asked 2014-10-27 19:19:54 +0200

Keeper-of-the-Keys gravatar image

I just updated to Uitukka (1.1.0.39) and now all my contacts show without their phone numbers...

I checked contacts.db (sqlite3) and found that it still contained all the numbers and the contacts application even showed one of the numbers I verified for a few seconds after I restarted contactsd.service.

I would hugely appreciate it if whoever handles this can not just answer me here but actually contact me so that we can fix my db properly once and for all... Afterwards also maybe write a nice page explaining the different fields etc....

edit retag flag offensive close delete

Comments

journalctl is showing a lot of warnings that suggest I am missing a table called Families which should either live in contacts.db or in commhist or both, I know that I never deleted such a table....

(In general I never deleted tables, just entries, the backup of contacts.db the only db I ever touched manually does not contain Families either....)

Keeper-of-the-Keys ( 2014-10-27 19:25:46 +0200 )edit

The 'Families' table should have been added by a schema upgrade script, on updating from version 11 to 12. You need to use "pragma user_version[=X]" to show and to modify the version - you will need to create the tables yourself now, using sqlite3.

The schema and the upgrade sequence are shown here: https://github.com/nemomobile/qtcontacts-sqlite/blob/master/src/engine/contactsdatabase.cpp Once Uitukka has completed installation, you should have version 14 of the schema (which is equivalent to the current master branch).

Note that you should have nothing related running while manipulating the DB schema; it is best to stop lipstick and all contacts-related services before trying to modify the schema.

MattVogt ( 2014-10-27 23:50:13 +0200 )edit

Apparently I am at version 9 of the schema... I see how my jolla may not have like my messed up db much (though my manual interventions only started in the update 8 period which should have been schema version 12 if I understand you correctly).

Keeper-of-the-Keys ( 2014-10-28 14:34:31 +0200 )edit

1 Answer

Sort by » oldest newest most voted
3

answered 2014-10-28 18:32:11 +0200

Keeper-of-the-Keys gravatar image

updated 2014-10-28 18:33:51 +0200

With Matts' pointer I manually rebuilt my db completely (I still left the junk in there, the next step will be to remove a lot more junk).

Basically the steps I took:

  1. stop contactsd.service

  2. copy contacts.db to my PC

  3. dump it to SQL:

2a. sqlite3 contacts.db

2b. .mode insert

2c. .output contactsDb.sql

2d. .dump

2e. .exit

  1. add the various pragma setup statements found in the source file mentioned above to the sql file (encoding, temp_store, journal_mode, synchronous)

  2. create a new sqlite db from the sql file: sqlite3 contacts.db < contactsDb.sql (mv/rm contacts.db first)

  3. ran updates 10, 11, 12, 13 on the newly created db: sqlite3 contacts.db < update10.sql

  4. copy contacts.db back to phone & reboot phone (may also work with just a restart of contactsd.service)

The end result was a db that was smaller then my previous db file and performance also seems a bit better, I still have the deleted contacts entries and probably want to cull them from the db too at some point but for now this is an excellent result.

I will put the update1?.sql files on my github later today and post a link so that if others need it... BTW I suspect that since I based everything on the new schema update10 may have already done all the work, if I have time I'll look closer at the changes in update 11, 12 (I rolled 13 into 12) to see if they really matter or if at the end of update10 I can already set user_version=14.

Either way, maybe a warning by the contacts program when it detects a db that is not at the right version is in order?

edit flag offensive delete publish link more

Comments

The SQL files for the updates can be found here: https://github.com/Keeper-of-the-Keys/jolla-utils/tree/master

Keeper-of-the-Keys ( 2014-10-28 19:06:18 +0200 )edit
1

A couple of comments:

  • You can't really expect to copy/move the .db file independently - the state of the database is in a coherent set of DB file and log files, so you should treat the entire directory containing the .db file as a consistent database entity

  • The upgrade process runs at boot time (the very first process to open the DB after boot runs the check-and-upgrade process), so the database should not be used while on a wrong version. I guess the upgrade script could fail if you have manually modified the DB somehow; in that case there should be error messages from the upgrade attempt in the system log, shortly after boot.

MattVogt ( 2014-10-28 23:21:47 +0200 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2014-10-27 19:19:54 +0200

Seen: 329 times

Last updated: Oct 28 '14