[odb-users] Database upgrade issue

Lonnie French lfrench at globalscape.com
Fri Jun 16 09:20:25 EDT 2017


Hello Boris,
    Thank you for the quick response! You are correct; the section you pointed to explained my issue and resolution exactly. I do have a question regarding your second recommendation. As I understand it, I don't believe using the default value pragma will help since this defaults the value for both migrations and new instances to the same value which is not what I am trying to achieve. I wanted to set the value to X if migrating from an older database that pre-dates the addition of the column, but set the value to Y for all new instances of the entry thereafter. Apologies if I misunderstand your intent. Thanks again for your help.

Kind regards,

Lonnie French | Software Engineer Manager-EFT
globalscape | +1 (210) 308-8267 ext 5188 | NYSE MKT:GSB

This communication, including attachments, is for the exclusive use of the addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies.
-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Monday, June 12, 2017 8:45 AM
To: Lonnie French <lfrench at globalscape.com>
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] Database upgrade issue

Hi Lonnie,

Lonnie French <lfrench at globalscape.com> writes:

> When I upgrade only the Workspace table everything works great, but 
> when I add the Participation table change to the upgrade an exception 
> (1: no such column: Participation.type) gets thrown and both tables 
> are empty after the upgrade. The "type" column was added to the 
> Participation table in v4.

The problem you are having (and a possible solution) is described in Section 13.4, "Soft Object Model Changes", specifically, the third paragraph.


> static void migrate_notification_period(odb::database& db) {
>        // Default notification setting for all pre-existing workspaces
>        for (Workspace& ws : db.query<Workspace>())
>        {
>              ws.wi.defaultNotifs.period = static_cast<uint32_t>(Shared::Period::Never);
>              db.update(ws);
>        }
> 
>        // Default notification setting for all pre-existing participants
>        for (Participation& part : db.query<Participation>())
>        {
>              part.notifs.period = static_cast<uint32_t>(Shared::Period::Never);
>              db.update(part);
>        }
> }

Seeing that you set period to a fixed value, using the default value pragma might be a simpler way to accomplish this (which also sidesteps the above issue).

Boris



More information about the odb-users mailing list