aboutsummaryrefslogtreecommitdiff
path: root/odb/database.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/database.cxx')
-rw-r--r--odb/database.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/odb/database.cxx b/odb/database.cxx
index ad71b4f..c9692ba 100644
--- a/odb/database.cxx
+++ b/odb/database.cxx
@@ -4,6 +4,8 @@
#include <odb/database.hxx>
+using namespace std;
+
namespace odb
{
database::
@@ -17,4 +19,35 @@ namespace odb
connection_type& c (transaction::current ().connection ());
return c.execute (st, n);
}
+
+ const database::schema_version_info& database::
+ schema_version_migration_ (const string& name) const
+ {
+ schema_version_map::const_iterator i (schema_version_map_.find (name));
+ const schema_version_info& svi (
+ i != schema_version_map_.end () && i->second.version != 0
+ ? i->second
+ : load_schema_version (name));
+
+ if (default_schema_version_ == 0 && name.empty ())
+ default_schema_version_ = &svi;
+
+ return svi;
+ }
+
+ void database::
+ schema_version_migration (const schema_version_migration_type& svm,
+ const string& name)
+ {
+ schema_version_info& svi (schema_version_map_[name]);
+ if (svi.version != svm.version || svi.migration != svm.migration)
+ {
+ svi.version = svm.version;
+ svi.migration = svm.migration;
+ schema_version_seq_++;
+ }
+
+ if (default_schema_version_ == 0 && name.empty ())
+ default_schema_version_ = &svi;
+ }
}