summaryrefslogtreecommitdiff
path: root/odb/relational/oracle/schema.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/relational/oracle/schema.cxx')
-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_;