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/schema-catalog.hxx | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'odb/schema-catalog.hxx') diff --git a/odb/schema-catalog.hxx b/odb/schema-catalog.hxx index a186de4..07e625b 100644 --- a/odb/schema-catalog.hxx +++ b/odb/schema-catalog.hxx @@ -52,28 +52,38 @@ namespace odb migrate_schema_impl (db, v, name, migrate_both); } + // Migrate both schema and data to the specified version. If version + // is not specified, then migrate to the latest version. + // + static void + migrate (database& db, schema_version v = 0, const std::string& name = ""); + // Return 0 if current is greater or equal to the latest version. + // If current is not specified, get the current version from the + // database. // - schema_version + static schema_version next_version (const database& db, - schema_version current /*= 0*/, + schema_version current = 0, const std::string& name = "") { - return next_version (db.id (), current, name); + return next_version (db.id (), + current == 0 ? db.schema_version () : current, + name); } - schema_version + static schema_version next_version (database_id, - schema_version current /*= 0*/, + schema_version current, const std::string& name = ""); - schema_version + static schema_version latest_version (const database& db, const std::string& name = "") { return latest_version (db.id (), name); } - schema_version + static schema_version latest_version (database_id, const std::string& name = ""); // Test for presence of a schema with a specific name. -- cgit v1.1