Hi @rollypolly, sorry about that! We should be able to fix this problem, but it requires a little investigation.
This error usually occurs after after upgrading to a newer version of Codebook that changes the database structure, then downgrading to an older version, and upgrading again some time after that.
Older versions of Codebook, upon encountering a newer database, would overwrite the schema version in the database on down-grade, marking it as having the older schema, improperly (it no longer does this!) Then when the user goes to upgrade again, Codebook attempts to re-apply the database changes that have already been applied, causing errors like the one above.
So what we need to know is if you upgraded and then downgraded at some point, and if so, do you remember what version it was that you had upgraded to, that didn’t work out for you? If not, we can figure it out by inspecting the database directly, I will post directions for doing that. Once we determine what the schema version should be for your current database, we can then set it directly, which should allow Codebook to resume working as expected.
It sounds like your schema version in the database should be set to 23 and not 20, assuming the crash on launch of 4.4.0 was related to something else, and those database migrations were in fact run.
So I think the best way to proceed is to use the free tool DB Browser to open up the encrypted database, check on the state of the structure to confirm, and set the correct schema number.
Right-click (or hold down the command key and click) on the file named default.strip and select Show Package Contents from the menu
Click and drag the file named strip.db onto the DB Browser window (or onto the icon in your Dock)
DB Browser will prompt you for a password, enter the Master Password you use for Codebook
At this point you should be shown the Database Structure tab, listing all the tables in your encrypted database.
Let’s check the following to make sure we’ve got the right version:
Click the arrow icon next to the binaries table, and check that created_at and updated_at are in the list of columns
Click the arrow icon next to the thumbnails table, and check that it also has columns named created_at and updated_at
Expand the table named zetetic_sync and check that it does NOT have a column named local_queue_csn
If all those things are true, we are looking at schema 23, and we can now set that using DB Browser:
Click on the “Execute SQL” tab
In the editor that appears, enter this command:
PRAGMA user_version = '23';
Then click the play button to run the command, and look for Execution finished without errors. in the output below
Close DB Browser
Launch the latest version of Codebook for macOS (4.5.8) and attempt to sign in again
I realize that’s a lot of steps, but it should do the trick. Could you give it a try, and let us know how it goes, or if things break down at any step along the way?
Sorry again for all the trouble you’ve experienced with upgrades. Now that you’re on the latest version things should be smoother from here on out (including software updates). If you have any other questions or problems please let us know.
Hello Zetetic. Having a similar problem to @rollypolly. I was on 4.3.7 or something around that, updated to 4.5.8 and each time I enter my password Codebook crashes.
Tried the DB Browser and everything is good except for step 3: my db has a column named local_queue_csn.
We’re sorry to hear about the crash you were experiencing on upgrade!
If you still have a copy of the old database, and you want to try and get that upgraded, please let us know.
In order to figure out how your issue could be resolved, we’d want to take a look at the crash report, as well as any log messages from Codebook during start-up, prior to crashing.
Sorry for the trouble and glad to hear you had another copy of your data synced (and a backup of your Sync Key) or on another copy of Codebook so you could reset Codebook and restore your data.
For anyone else who runs into a similar issue, if you do indeed have a column named local_queue_csn in step 3 you’ll want to set your PRAGMA user_version = '24'; instead of PRAGMA user_version = '23'; (in step 2 of the second set of steps).
We have put measures in place in the newer versions of Codebook to prevent this from recurring.