[odb-users] schema evolution, changelog xml and output .sql

MM finjulhich at gmail.com
Tue Aug 29 18:42:17 EDT 2023


Whenever I change the schema, I update

and then run the odb compiler like so

> odb -d sqlite --sqlite-override-null --std c++${CMAKE_CXX_STANDARD}
> --profile boost
>   --omit-drop --generate-query --generate-schema-only --schema-format sql
>   --at-once -I${CMAKE_SOURCE_DIR} -I${Boost_INCLUDE_DIRS}
>   --changelog-dir ${CMAKE_CURRENT_SOURCE_DIR} --input-name <mydbname>
> ${SRCS_TO_GEN_MYDB}


The SRCS include a common .hpp that has

> #ifdef ODB_COMPILER
> #pragma db model version(OldDate,NewDate)
> #endif
>

When building and no change in the pair OldDate,NewDate, then the odb run
doesn't change the changelog xml files and no sql files are changed.

However, when I've changed the C++ classes or the odb pragmas, I then
change NewDate as OldDate and use today as NewDate. That odb run then
updates the changelog xml and the sql files.

As part of the cmake based build system, can I examine the odb exit code to
see which situation I'm in?


More information about the odb-users mailing list