C++ ODB ORM SQLite数据库迁移

C++ ODB ORM SQLite数据库迁移,c++,database,sqlite,orm,odb,C++,Database,Sqlite,Orm,Odb,我已经阅读了ODB手册第13章,现在我尝试迁移我的数据库版本。 我使用第13.2章末尾的样本: schema_version v (db.schema_version ()); schema_version bv (schema_catalog::base_version (db)); schema_version cv (schema_catalog::current_version (db)); if (v == 0) { // No schema in the database. C

我已经阅读了ODB手册第13章,现在我尝试迁移我的数据库版本。 我使用第13.2章末尾的样本:

schema_version v (db.schema_version ());
schema_version bv (schema_catalog::base_version (db));
schema_version cv (schema_catalog::current_version (db));

if (v == 0)
{
  // No schema in the database. Create the schema and
  // initialize the database.
  //
  transaction t (db.begin ());
  schema_catalog::create_schema (db);

  // Populate the database with initial data, if any.

  t.commit ();
}
else if (v < cv)
{
  // Old schema (and data) in the database, migrate them.
  //

  if (v < bv)
  {
    // Error: migration from this version is no longer supported.
  }

  for (v = schema_catalog::next_version (db, v);
       v <= cv;
       v = schema_catalog::next_version (db, v))
  {
    transaction t (db.begin ());
    schema_catalog::migrate_schema_pre (db, v);

    // Data migration goes here.

    schema_catalog::migrate_schema_post (db, v);
    t.commit ();
  }
}
else if (v > cv)
{
  // Error: old application trying to access new database.
}
在旧版本(第1版方案)中,类的符号如下:

#pragma db model version(2, 2, open)
#pragma db model version(1, 1, closed)
为什么migrate_schema不为新类创建表?(如果我删除了数据库,上面的代码会成功地用类从头创建数据库)