[odb-users] Load old DB after adding new class data member

Justin Huang yohuang at nvidia.com
Tue Jan 5 09:03:55 EST 2021

Hi Boris,

I added a new line '#pragma db model version(1, 2)' at the top of class header file, and added '#pragma db added(2)' before the newly added bool data member in class definition, then the old db can be loaded successfully. I see a new table named by 'schema_version' is created in newly created db.

Thanks a lot for quick suggestion.


-----Original Message-----
From: Boris Kolpackov <boris at codesynthesis.com> 
Sent: Tuesday, January 5, 2021 9:22 PM
To: Justin Huang <yohuang at nvidia.com>
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] Load old DB after adding new class data member

External email: Use caution opening links or attachments

Justin Huang <yohuang at nvidia.com> writes:

> I added a new boolean data member (with default value false) for a 
> class, but I want to load a DB generated before adding this new data 
> member.  I got '1: no such column' error when I tried to load old DB 
> after updating the class.
> Is there a way that ODB can load this old db?

I think the soft object model changes support should allow you to achieve this, see "Soft Object Model Changes" for details:


More information about the odb-users mailing list