I'd like to create schema automatically, if not exists. Currently I use this code to create schema:
new SchemaExport(_configuration)
.SetDelimiter(";").SetOutputFile("schema.sql").Create(true, true);
But I have two problems with that:
1) It needs to have an empty schema to work. I'd like it to create an empty schema and user for itself, if I give it admin credentials for one time use.
2) I'd like it to create schema only if it is empty, or obsolete. Is it possible to make nhibernate check for that? Of course, in case of obsolete schema, I need a way to ask user whether to regenerate schema and loose data.
I'm using MySql 5, but I hope this is possible to achive without binding to concrete database provider.
Update: User needs to just install MySql and enter some admin credentials while installing it. After that he can run my application, and it should create it's own schema, user and assign rights, by asking admin credentials from user.