SchemaUpdate is not updating the schema of the database
The problem I have is that the code below runs but it no longer updates the schema in the database for some reason. Everything else works, I can load and save entities , but everytime I add a new property to one of the entities it does not get added to the db. I have ensured that that I added the properties to the the classMap as well, what have I missed ? (the connectionstring is censored ;) )
private static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(
MySQLConfiguration.Standard.ConnectionString(cs =>
cs
.Database("qwerty")
.Server("qwert")
.Password("qwerty")
.Username("qwerty")))
.Mappings(m =>
m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
.ExposeConfigurat开发者_StackOverflow社区ion(cfg => new SchemaUpdate(cfg).Execute(true,true))
.BuildSessionFactory();
}
Okey, I have solved it.
I had a column that needed to contain a very long text (CLOB) and for some reason when I specified that in the classMap it didn't work, so I changed it manually in the DB.
That is what made nhibernate freak out, so I changed back to the the type that nhibernate selected and everything stared working again!
solution: don't change datatypes in the columns with out permission from nhibernate ;)
精彩评论