I'm trying to figure out how to use NHibernate configuration with mapping to update table schemas, rather than dropping and recreating them.
Currently I'm using the NHibernate.Tool.hbm2ddl.SchemaExport
obj with FluentNHibernate to generate the database schema for a mysql database. While I can't say it's a huge problem, whenever I call SchemaExport.Execute
on the database, it's going to drop all the tables and then recreate them.
What would be way cooler is if I could just have it update the existing table structures retaining data where possible. But I don't really want to use a commerical product, or a code generator, because I don't like code generation in general, and I don't need this enough that I would consider paying for it. So hopefully any answer would keep these caveats in mind.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…