aboutsummaryrefslogtreecommitdiff
path: root/evolution/add-index/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'evolution/add-index/driver.cxx')
-rw-r--r--evolution/add-index/driver.cxx26
1 files changed, 25 insertions, 1 deletions
diff --git a/evolution/add-index/driver.cxx b/evolution/add-index/driver.cxx
index e4a6e17..ba9f837 100644
--- a/evolution/add-index/driver.cxx
+++ b/evolution/add-index/driver.cxx
@@ -11,6 +11,7 @@
#include <odb/database.hxx>
#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
#include <common/common.hxx>
@@ -27,7 +28,8 @@ main (int argc, char* argv[])
{
try
{
- auto_ptr<database> db (create_database (argc, argv));
+ auto_ptr<database> db (create_database (argc, argv, false));
+ bool embedded (schema_catalog::exists (*db, "test2"));
// 1 - base version
// 2 - migration
@@ -41,6 +43,15 @@ main (int argc, char* argv[])
{
using namespace v2;
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::create_schema (*db, "test2");
+ schema_catalog::create_schema (*db, "test1");
+ schema_catalog::migrate_schema (*db, 2, "test2");
+ t.commit ();
+ }
+
object o0 (0);
o0.num = 123;
@@ -65,6 +76,13 @@ main (int argc, char* argv[])
{
using namespace v3;
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_pre (*db, 3, "test2");
+ t.commit ();
+ }
+
object o3 (3);
o3.num = 234;
@@ -97,6 +115,12 @@ main (int argc, char* argv[])
t.commit ();
}
+ if (embedded)
+ {
+ transaction t (db->begin ());
+ schema_catalog::migrate_schema_post (*db, 3, "test2");
+ t.commit ();
+ }
break;
}
case 3: