aboutsummaryrefslogtreecommitdiff
path: root/evolution/add-column/model.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-04-05 07:30:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-04-10 18:46:46 +0200
commita72909d40ce4b10d8d5950bec8f52c8a561e4596 (patch)
tree160eaa679a2dcff61b1ca5b95c1a791e5b42726a /evolution/add-column/model.hxx
parent31b400b73be9aa98c0fd448423677db212667c43 (diff)
Generate add/drop column migration statements
Diffstat (limited to 'evolution/add-column/model.hxx')
-rw-r--r--evolution/add-column/model.hxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/evolution/add-column/model.hxx b/evolution/add-column/model.hxx
new file mode 100644
index 0000000..e1e805a
--- /dev/null
+++ b/evolution/add-column/model.hxx
@@ -0,0 +1,39 @@
+// file : evolution/add-column/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 <string>
+
+#include <odb/core.hxx>
+#include <odb/nullable.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)
+{
+ #pragma db object
+ struct object
+ {
+ object (unsigned long id = 0): id_ (id) {}
+
+ #pragma db id
+ unsigned long id_;
+
+#if MODEL_VERSION == 3
+ odb::nullable<std::string> str;
+
+ #pragma db default(999)
+ unsigned long num;
+#endif
+ };
+}
+
+#undef MODEL_NAMESPACE
+#undef MODEL_NAMESPACE_IMPL