From 516523183fad016a26c7400d784eb9c0343b7964 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 3 Apr 2013 11:22:42 +0200 Subject: Generate add/drop table migration statements --- evolution/drop-table/model.hxx | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 evolution/drop-table/model.hxx (limited to 'evolution/drop-table/model.hxx') diff --git a/evolution/drop-table/model.hxx b/evolution/drop-table/model.hxx new file mode 100644 index 0000000..f5bbd9e --- /dev/null +++ b/evolution/drop-table/model.hxx @@ -0,0 +1,49 @@ +// file : evolution/drop-table/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 +#include + +#include + +#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_; + + std::string str; + }; + +#if MODEL_VERSION == 2 + #pragma db object + struct object1 + { + object1 (): o (0) {} + ~object1 () {delete o;} + + #pragma db id auto + unsigned long id_; + + object* o; + std::vector nums; + }; +#endif +} + +#undef MODEL_NAMESPACE +#undef MODEL_NAMESPACE_IMPL -- cgit v1.1