diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-25 07:35:45 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-25 09:58:53 +0200 |
commit | 40ae3082645ed3790eb1d5d6f04fb2ca36c19187 (patch) | |
tree | 5157fe5db532ec91b0c06ce5f81d4e92444b7fe9 /evolution/version/model.hxx | |
parent | 502926d96b0b5d79dc639b8388fbf19b11cda277 (diff) |
Add support for schema version table
Diffstat (limited to 'evolution/version/model.hxx')
-rw-r--r-- | evolution/version/model.hxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/evolution/version/model.hxx b/evolution/version/model.hxx new file mode 100644 index 0000000..b30a194 --- /dev/null +++ b/evolution/version/model.hxx @@ -0,0 +1,46 @@ +// file : evolution/version/model.hxx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef MODEL_VERSION +# error model.hxx included directly +#endif + +#include <odb/core.hxx> + +#pragma db model version(1, MODEL_VERSION) + +#define MODEL_NAMESPACE_IMPL(V) v##V +#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V) + +namespace MODEL_NAMESPACE(MODEL_VERSION) +{ +#if MODEL_VERSION == 2 + #pragma db object + struct object1 + { + object1 (unsigned long id = 0): id_ (id) {} + + #pragma db id + unsigned long id_; + + int num; + }; +#endif + +#if MODEL_VERSION == 3 + #pragma db object + struct object2 + { + object2 (unsigned long id = 0): id_ (id) {} + + #pragma db id + unsigned long id_; + + int num; + }; +#endif +} + +#undef MODEL_NAMESPACE +#undef MODEL_NAMESPACE_IMPL |