aboutsummaryrefslogtreecommitdiff
path: root/evolution/drop-table/model.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'evolution/drop-table/model.hxx')
-rw-r--r--evolution/drop-table/model.hxx51
1 files changed, 47 insertions, 4 deletions
diff --git a/evolution/drop-table/model.hxx b/evolution/drop-table/model.hxx
index 64022bb..55035e6 100644
--- a/evolution/drop-table/model.hxx
+++ b/evolution/drop-table/model.hxx
@@ -29,11 +29,7 @@ namespace MODEL_NAMESPACE(MODEL_VERSION)
std::string str;
};
-#if MODEL_VERSION > 1
#pragma db object
-#if MODEL_VERSION == 3
- #pragma db deleted(3)
-#endif
struct object1
{
object1 (): o (0) {}
@@ -45,6 +41,53 @@ namespace MODEL_NAMESPACE(MODEL_VERSION)
object* o;
std::vector<int> nums;
};
+
+#if MODEL_VERSION == 3
+ #pragma db object(object1) deleted(3)
+#endif
+
+ // Make sure we also clean up base tables when dropping a
+ // table corresponding to the polymorphic derived object.
+ //
+ #pragma db value
+ struct value
+ {
+ value (unsigned long n = 0, const std::string& s = ""): num (n), str (s) {}
+
+ unsigned long num;
+ std::string str;
+ };
+
+ #pragma db object polymorphic
+ struct root
+ {
+ root (unsigned long n = 0, const std::string& s = ""): id (n, s) {}
+ virtual ~root () {}
+
+ #pragma db id
+ value id;
+ };
+
+ #pragma db object
+ struct base: root
+ {
+ base (unsigned long n = 0, const std::string& s = "")
+ : root (n, s), num (n) {}
+
+ unsigned long num;
+ };
+
+ #pragma db object
+ struct derived: base
+ {
+ derived (unsigned long n = 0, const std::string& s = "")
+ : base (n, s), str (s) {}
+
+ std::string str;
+ };
+
+#if MODEL_VERSION == 3
+ #pragma db object(derived) deleted(3)
#endif
}