[odb-users] Schema Migration not working correctly

Tschoche.Jonas at ddv-mediengruppe.de Tschoche.Jonas at ddv-mediengruppe.de
Wed Apr 29 12:03:42 EDT 2020


Hello,

now i use the schema migration and i have some problems. Tody i rename a field on database. I increase the version and compiled and run it. But it throw a error that the table alredy exist.

So i looked in the changelog file and i saw that only a add-table statement was there and no alter-table.

I think the reason for that is following:

<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="mysql" version="1">
  <model version="1"/>
</changelog>

The Version “1” is not created as model. Only empty, but I don’t know why. When I change a table and increase the version then the table appers as add-table.

Why odb don’t generate model for first version?

I build with cmake and modified use-odb script for cmake from github:


odb_compile(SOURCES FILES ${ODB_HEADERS}
      DB ${DATABASE_LOWER}
      GENERATE_QUERY
      GENERATE_SCHEMA
      SCHEMA_FORMAT separate
      STANDARD c++17
      PROFILE boost/date-time boost/optional boost/uuid
      INCLUDE_REGEX "%(.*)/(.+)%$2%"
      CHANGELOG odb-changelog.log
      CHANGELOG_DIR ${CMAKE_SOURCE_DIR}
      FKEYS_DEFERRABLE_MODE not_deferrable
      DEFAULT_POINTER std::shared_ptr
      INCLUDE ${JSONCPP_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIR}
      )



More information about the odb-users mailing list