Project Description

NHibernate Schema Tool (NST) is a command line utility that allows developers to Create, Update, and Delete database schemas based on their NHibernate mappings. This tool allows for easy integration with CI frameworks like CruiseControl.NET

NHibernate allows for automatic schema creation, update, and deletion through the SchemaExport and SchemaUpdate classes. Unfortunately there is no command line tool provided that allows developers to quickly manage these common tasks. Many developers like myself resorted to using Unit Tests, administrative pages, or other mechanisms in order to automate this process.

The NHibernate Schema Tool is a command line utility backed by a general purpose class library that wraps the native NHibernate SchemaExport and SchemaUpdate classes. This utility allows for a variety of options so that developers can choose how best to supply NST with their mapping files and domain classes. Once supplied, the schema can be created, updated, or dropped based on the settings from your hibernate.cfg.xml file. The following is an example usage scenario for NST:

> nst /c:hibernate.cfg.xml /a:AssemblyWithMappingFilesAndDomainClasses.dll

The above command will use the database connection settings from the provided hibernate.cfg.xml file along with the given assembly to generate and execute a schema creation script. The full list of options and their meaning can be accessed using the following command:

> nst /h

The NHibernate Schema Tool is currently released as a single executable file that you can place in your environment's PATH attribute. You can then either use it as a normal command line tool, or build it into your Continuous Integration environment as a task.

NHibernate Version

The currently released version of the NHibernate Schema Tool is compiled against NHibernate version 2.1.2.GA. Future releases may be bound against future stable releases of NHibernate.

Last edited Feb 20, 2010 at 8:53 PM by dotnetnomad, version 3