diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-25 07:35:45 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-25 07:35:45 +0200 |
commit | 8554cd89897f9cbd1705592cf0318b3ef4e42665 (patch) | |
tree | a81469bcddd6bddd2eb89c12faa9c59169484b43 /odb/relational/schema.cxx | |
parent | 5ced83875191cf9e0f395af79f45babd6fae3d29 (diff) |
Add support for schema version table
Diffstat (limited to 'odb/relational/schema.cxx')
-rw-r--r-- | odb/relational/schema.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/odb/relational/schema.cxx b/odb/relational/schema.cxx index 2cf1a4c..b7498f6 100644 --- a/odb/relational/schema.cxx +++ b/odb/relational/schema.cxx @@ -53,6 +53,14 @@ namespace relational model->traverse (*ctx.model); } + + if (ctx.model->version () != 0 && + !ctx.options.suppress_schema_version ()) + { + instance<version_table> vt (*em, emos, f); + vt->create_table (); + vt->drop (); + } } void @@ -79,6 +87,17 @@ namespace relational model->traverse (*ctx.model); } + + if (ctx.model->version () != 0 && + !ctx.options.suppress_schema_version ()) + { + instance<version_table> vt (*em, emos, f); + + if (ctx.options.omit_drop ()) + vt->create_table (); + + vt->create (ctx.model->version ()); + } } void @@ -109,6 +128,12 @@ namespace relational changeset->traverse (cs); } + + if (!ctx.options.suppress_schema_version ()) + { + instance<version_table> vt (*em, emos, f); + vt->migrate_pre (cs.version ()); + } } void @@ -139,6 +164,12 @@ namespace relational changeset->traverse (cs); } + + if (!ctx.options.suppress_schema_version ()) + { + instance<version_table> vt (*em, emos, f); + vt->migrate_post (); + } } } } |