aboutsummaryrefslogtreecommitdiff
path: root/odb/relational/oracle
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-09-15 12:46:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-09-15 12:46:09 +0200
commit51956f409ec7ebea8b6790b0c5d4f0b51513d683 (patch)
tree66f30e68fa3c8080d0d3d8d50c30e11914fc82b9 /odb/relational/oracle
parentd9ea777539b166c7347c44a6b7784626405bc029 (diff)
Cleanup polymorphic base tables when dropping derived one
Diffstat (limited to 'odb/relational/oracle')
-rw-r--r--odb/relational/oracle/schema.cxx29
1 files changed, 22 insertions, 7 deletions
diff --git a/odb/relational/oracle/schema.cxx b/odb/relational/oracle/schema.cxx
index 5856dd2..829a37a 100644
--- a/odb/relational/oracle/schema.cxx
+++ b/odb/relational/oracle/schema.cxx
@@ -140,13 +140,8 @@ namespace relational
drop_table (base const& x): base (x) {}
virtual void
- traverse (sema_rel::table& t, bool migration)
+ drop (sema_rel::table& t, bool migration)
{
- // For Oracle we use the CASCADE clause to drop foreign keys.
- //
- if (pass_ != 2)
- return;
-
using sema_rel::primary_key;
sema_rel::table::names_iterator i (t.find ("")); // Special name.
@@ -162,7 +157,7 @@ namespace relational
if (migration)
{
pre_statement ();
- os << "DROP TABLE " << qt << " CASCADE CONSTRAINTS" << endl;
+ os << "DROP TABLE " << qt << endl;
post_statement ();
// Drop the sequence if we have auto primary key.
@@ -207,6 +202,26 @@ namespace relational
post_statement ();
}
}
+
+ virtual void
+ traverse (sema_rel::table& t, bool migration)
+ {
+ // For migration drop foreign keys explicitly in pre-migration.
+ //
+ if (migration)
+ {
+ base::traverse (t, migration);
+ return;
+ }
+
+ // For schema creation we use the CASCADE clause to drop foreign
+ // keys.
+ //
+ if (pass_ != 2)
+ return;
+
+ drop (t, migration);
+ }
};
entry<drop_table> drop_table_;