From d78ba3e97cbe0d6c641120d94d47e25b198febfb Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 25 Apr 2013 07:35:45 +0200 Subject: Add support for schema version table --- odb/database.ixx | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'odb/database.ixx') diff --git a/odb/database.ixx b/odb/database.ixx index d58e5e7..b7c1917 100644 --- a/odb/database.ixx +++ b/odb/database.ixx @@ -21,6 +21,44 @@ namespace odb return id_; } + inline database::schema_version_type database:: + schema_version (const std::string& name) const + { + schema_version_map::const_iterator i (schema_version_map_.find (name)); + return i != schema_version_map_.end () && i->second.version != 0 + ? i->second.version + : load_schema_version (name).version; + } + + inline bool database:: + schema_migration (const std::string& name) const + { + schema_version_map::const_iterator i (schema_version_map_.find (name)); + return i != schema_version_map_.end () && i->second.version != 0 + ? i->second.migration + : load_schema_version (name).migration; + } + + inline void database:: + schema_version (schema_version_type v, bool m, const std::string& name) + { + schema_version_info& svi (schema_version_map_[name]); + svi.version = v; + svi.migration = m; + } + + inline void database:: + schema_version_table (const std::string& tname) + { + schema_version_table_ = tname; + } + + inline void database:: + schema_version_table (const std::string& tname, const std::string& sname) + { + schema_version_map_[sname].version_table = tname; + } + inline connection_ptr database:: connection () { -- cgit v1.1