aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS11
-rw-r--r--doc/manual.xhtml27
2 files changed, 30 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index ccd7a42..9bb30a1 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,15 @@ Version 2.3.0
queries. For more information, refer to Section 4.1, "ODB Query Language"
in the ODB manual.
+ * The schema_catalog::create_schema() function now has a third argument
+ which indicates whether to drop the schema prior to creating the new one.
+ The default is true which is backwards-compatible. The schema_catalog
+ class now also provides the drop_schema() function which allows you to
+ drop the schema without creating the new one. Finally, the exists()
+ function now has the schema name argument default to the empty string
+ (the default schema name). For more information, refer to Section 3.4,
+ "Database" in the ODB manual.
+
* New option, --fkeys-deferrable-mode, specifies the alternative deferrable
mode for foreign keys. By default, the ODB compiler generates deferred
foreign keys for databases that support them (SQLite, PostgreSQL, and
@@ -14,7 +23,7 @@ Version 2.3.0
* New SQLite-specific exception, odb::sqlite::forced_rollback, which is
thrown if SQLite forces a transaction to roll back. For more information,
- refer to Section 16.5.6, "Forced Rollback".
+ refer to Section 16.5.6, "Forced Rollback" in the ODB manual.
* The --output-name option has been renamed to --input-name, which is more
semantically correct.
diff --git a/doc/manual.xhtml b/doc/manual.xhtml
index 2f68865..dfdca31 100644
--- a/doc/manual.xhtml
+++ b/doc/manual.xhtml
@@ -2852,13 +2852,18 @@ namespace odb
{
public:
static void
- create_schema (database&, const std::string& name = "");
+ create_schema (database&,
+ const std::string& name = "",
+ bool drop = true);
+
+ static void
+ drop_schema (database&, const std::string& name = "");
static bool
- exists (database_id, const std::string& name);
+ exists (database_id, const std::string& name = "");
static bool
- exists (const database&, const std::string& name)
+ exists (const database&, const std::string& name = "")
};
}
</pre>
@@ -2871,13 +2876,21 @@ namespace odb
have several separate schemas, you can use the
<code>--schema-name</code> ODB compiler option to assign
custom schema names and then use these names as a second argument
- to <code>create_schema()</code>. If the schema is not found,
- <code>create_schema()</code> throws the
+ to <code>create_schema()</code>. By default, <code>create_schema()</code>
+ will also delete all the database objects (tables, indexes, etc.) if
+ they exist prior to creating the new ones. You can change this
+ behavior by passing <code>false</code> as the third argument. The
+ <code>drop_schema()</code> function allows you to delete all the
+ database objects without creating the new ones.</p>
+
+ <p>If the schema is not found, the <code>create_schema()</code> and
+ <code>drop_schema()</code> functions throw the
<code>odb::unknown_schema</code> exception. You can use the
<code>exists()</code> function to check whether a schema for the
specified database and with the specified name exists in the
- catalog. Note also that the <code>create_schema()</code> function
- should be called within a transaction.</p>
+ catalog. Note also that the <code>create_schema()</code> and
+ <code>drop_schema()</code> functions should be called within a
+ transaction.</p>
<p>Finally, we can also use a custom database schema with ODB. This approach
can work similarly to the standalone SQL file described above except that