I looked in the source code for SchemaUpdate. I knew SchemaUpdate could detect a missing table and then generate a create script, rather than an update script. Sure enough, the answer was in there.
The GetTableMetadata
function in NHibernate.Tool.hbm2ddl.DatabaseMetadata
object will return null if a table does not exist in a database.
Normally, SchemaUpdate creates a DatabaseMetadata object and passes in into a Configuration
object. But it looks like all you need to create a DatabaseMetadata is a DBConnection and Dialect object.
SchemaUpdate creates a DatabaseMetadata thusly:
connectionHelper.Prepare();
connection = connectionHelper.Connection;
meta = new DatabaseMetadata(connection, dialect);
NHibernate.Cfg.Configuration
then calls
ITableMetadata tableInfo = databaseMetadata.GetTableMetadata(...);