[odb-users] Database upgrade issue
Boris Kolpackov
boris at codesynthesis.com
Mon Jun 12 09:44:37 EDT 2017
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