[odb-users] Startup processes

Boris Kolpackov boris at codesynthesis.com
Sun Dec 21 03:19:09 EST 2014


Hi Brian,

Bourke-Martin, Brian <bbourke-martin at darkfield.com> writes:

> When I add the pragma line "#pragma db model version(1, 1)" to one of my
> data models it seems to work ok, but the documentation seems to imply that
> this line should be on *each* of my data models.

Correct. I assume by "data model" you mean a header file that defines one
or more persistent objects.


> When I try adding it to another one, I get a error stating the
> "schema_version" relationship already exists.

This is because you generate the database schema into multiple .sql
files and ODB places the statement for creating the schema_version
table into each of them (ODB has no way of knowing that there is
another .sql file that would create it).

The recommended way to handle this (which also has other benefits)
is to generate a combined .sql file for all of your persistent
classes. Look for a paragraph that starts with "If your object
model consists of a large number of header files..." in Section
13.1, "Object Model Version and Changelog".

Alternatively, if you would prefer to have separate .sql files,
then you will need to use the --suppress-schema-version option
when generating all of them except one.

Boris



More information about the odb-users mailing list