diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-08-28 07:52:50 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-08-28 07:52:50 +0200 |
commit | 08022a07eead928949be5581f1202a197bf68551 (patch) | |
tree | 657fb45ee2b1510d157b8146a0bd02684a12e3c2 /odb/schema-version.hxx | |
parent | 74f50a3bc6890c96532fe9e76e387171aec3a8c3 (diff) |
Support for added and deleted data member pragmas
Diffstat (limited to 'odb/schema-version.hxx')
-rw-r--r-- | odb/schema-version.hxx | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/odb/schema-version.hxx b/odb/schema-version.hxx new file mode 100644 index 0000000..fc7ec0d --- /dev/null +++ b/odb/schema-version.hxx @@ -0,0 +1,73 @@ +// file : odb/schema-version.hxx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_SCHEMA_VERSION_HXX +#define ODB_SCHEMA_VERSION_HXX + +#include <odb/pre.hxx> + +#include <odb/forward.hxx> // schema_version +#include <odb/details/export.hxx> + +namespace odb +{ + struct LIBODB_EXPORT schema_version_migration + { + schema_version_migration (schema_version v = 0, bool m = false) + : version (v), migration (m) {} + + schema_version version; + bool migration; + }; + + // Version ordering is as follows: {1,f} < {2,t} < {2,f} < {3,t} + // + inline bool + operator== (const schema_version_migration& x, + const schema_version_migration& y) + { + return x.version == y.version && x.migration == y.migration; + } + + inline bool + operator!= (const schema_version_migration& x, + const schema_version_migration& y) + { + return !(x == y); + } + + inline bool + operator< (const schema_version_migration& x, + const schema_version_migration& y) + { + return x.version < y.version || + (x.version == y.version && x.migration && !y.migration); + } + + inline bool + operator> (const schema_version_migration& x, + const schema_version_migration& y) + { + return x.version > y.version || + (x.version == y.version && !x.migration && y.migration); + } + + inline bool + operator<= (const schema_version_migration& x, + const schema_version_migration& y) + { + return !(x > y); + } + + inline bool + operator>= (const schema_version_migration& x, + const schema_version_migration& y) + { + return !(x < y); + } +} + +#include <odb/post.hxx> + +#endif // ODB_SCHEMA_VERSION_HXX |