summaryrefslogtreecommitdiff
path: root/odb/relational/mysql
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-04-08 14:34:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-04-10 18:46:44 +0200
commit8295d4bd02946b7bdbff2a9cfa7763232e2d2fd0 (patch)
tree3edef4af4087be023b5a1095955c449283fe0ad9 /odb/relational/mysql
parent7c2d91d07bbd32e81de6139776f0f5c5adbfb2ac (diff)
Clean up class order in schema generators
Diffstat (limited to 'odb/relational/mysql')
-rw-r--r--odb/relational/mysql/schema.cxx93
1 files changed, 49 insertions, 44 deletions
diff --git a/odb/relational/mysql/schema.cxx b/odb/relational/mysql/schema.cxx
index 9b04e6b..8e71f92 100644
--- a/odb/relational/mysql/schema.cxx
+++ b/odb/relational/mysql/schema.cxx
@@ -21,6 +21,7 @@ namespace relational
//
// Drop.
//
+
struct drop_foreign_key: relational::drop_foreign_key, context
{
drop_foreign_key (base const& x): base (x) {}
@@ -109,6 +110,21 @@ namespace relational
};
entry<drop_foreign_key> drop_foreign_key_;
+ struct drop_index: relational::drop_index, context
+ {
+ drop_index (base const& x): base (x) {}
+
+ virtual void
+ drop (sema_rel::index& in)
+ {
+ sema_rel::table& t (static_cast<sema_rel::table&> (in.scope ()));
+
+ os << "DROP INDEX " << name (in) << " ON " <<
+ quote_id (t.name ()) << endl;
+ }
+ };
+ entry<drop_index> drop_index_;
+
//
// Create.
//
@@ -184,6 +200,36 @@ namespace relational
};
entry<create_foreign_key> create_foreign_key_;
+ struct create_index: relational::create_index, context
+ {
+ create_index (base const& x): base (x) {}
+
+ virtual void
+ create (sema_rel::index& in)
+ {
+ os << "CREATE ";
+
+ if (!in.type ().empty ())
+ os << in.type () << ' ';
+
+ os << "INDEX " << name (in);
+
+ if (!in.method ().empty ())
+ os << " USING " << in.method ();
+
+ os << endl
+ << " ON " << table_name (in) << " (";
+
+ columns (in);
+
+ os << ")" << endl;
+
+ if (!in.options ().empty ())
+ os << ' ' << in.options () << endl;
+ }
+ };
+ entry<create_index> create_index_;
+
struct create_table: relational::create_table, context
{
create_table (base const& x): base (x) {}
@@ -268,50 +314,9 @@ namespace relational
};
entry<create_table> create_table_;
- struct create_index: relational::create_index, context
- {
- create_index (base const& x): base (x) {}
-
- virtual void
- create (sema_rel::index& in)
- {
- os << "CREATE ";
-
- if (!in.type ().empty ())
- os << in.type () << ' ';
-
- os << "INDEX " << name (in);
-
- if (!in.method ().empty ())
- os << " USING " << in.method ();
-
- os << endl
- << " ON " << table_name (in) << " (";
-
- columns (in);
-
- os << ")" << endl;
-
- if (!in.options ().empty ())
- os << ' ' << in.options () << endl;
- }
- };
- entry<create_index> create_index_;
-
- struct drop_index: relational::drop_index, context
- {
- drop_index (base const& x): base (x) {}
-
- virtual void
- drop (sema_rel::index& in)
- {
- sema_rel::table& t (static_cast<sema_rel::table&> (in.scope ()));
-
- os << "DROP INDEX " << name (in) << " ON " <<
- quote_id (t.name ()) << endl;
- }
- };
- entry<drop_index> drop_index_;
+ //
+ // Alter.
+ //
struct alter_column: relational::alter_column, context
{