Is NHibernate SchemaUpdate safe in production code?

前端 未结 4 2244
忘了有多久
忘了有多久 2021-02-07 14:19

For simplicity\'s sake. I\'m using Fluent NHibernate\'s Automapping combined with NHibernate\'s SchemaUpdate during runtime. On each run Automapper creates mappings for all enti

相关标签:
4条回答
  • 2021-02-07 14:54

    It depends on how critical the data is! I doubt that's such a good idea for a banking system. I have not had any problems with the update apart from one thing. Sometimes it does not rename properly. Further more it's a security risk connecting with an account that can modify the schema like that :)

    0 讨论(0)
  • 2021-02-07 15:04

    I wouldn't risk it. What works well is to run it on a staging server that has been restored from production, then use a database comparison tool (such as Red Gate) to examine the changes and generate a script.

    0 讨论(0)
  • 2021-02-07 15:07

    For this to be able to run in production code, the account that the production application uses to connect to your database would have to have permission to change the database schema.

    That alone should deter you from this approach, irrespective of the quality/reliability of the NHibernate code.

    0 讨论(0)
  • 2021-02-07 15:09

    You may want to consider that SchemaUpdate will always make additive and non-destructive changes, resulting in stale columns and nullable columns where they should be non-nullable.

    In other words, absolutely not for production use.

    0 讨论(0)
提交回复
热议问题