diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-25 07:35:45 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-25 07:35:45 +0200 |
commit | d78ba3e97cbe0d6c641120d94d47e25b198febfb (patch) | |
tree | 72d4a9ee1677fdd9a0e8ca9f3d5f08779839a227 /odb/schema-catalog.hxx | |
parent | 3b63c05dbbd64db3ebc793cf8eb9003dacfd4cba (diff) |
Add support for schema version table
Diffstat (limited to 'odb/schema-catalog.hxx')
-rw-r--r-- | odb/schema-catalog.hxx | 24 |
1 files changed, 17 insertions, 7 deletions
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. |