[odb-users] Database upgrade issue

Boris Kolpackov boris at codesynthesis.com
Fri Jun 16 11:46:27 EDT 2017


Hi Lonnie,

Lonnie French <lfrench at globalscape.com> writes:

> 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.

In ODB the only way to trigger a column to get assigned a default value
on the database side is to persist it as NULL. So if you have a data
member like this:

uint32_t period;

ODB will never send it as NULL. So provided you don't insert into this
table by other means, the only time the default value will be used is
during migration.

Boris



More information about the odb-users mailing list