如何判断您的迁移是否是最新的 migratordotnet?
我使用 migratordotnet 来管理我的数据库迁移。 我在这样的应用程序设置上运行它们,但我还想在应用程序启动时检查迁移是否是最新的,并提供迁移到最新版本的选项。 如何判断是否有需要应用的可用迁移? 我看到我可以像这样应用迁移,
var asm = Assembly.GetAssembly(typeof(Migration_0001));
var migrator = new Migrator.Migrator("SqlServer", setupInfo.DatabaseConnectionString, asm);
var applied = migrator.AppliedMigrations;
我喜欢做这样的事情:
var available = migrator.AvailableMigrations; //this property does not exist.
I'm using migratordotnet to manage my database migrations. I'm running them on application setup like this, but I would also like to check on application startup that the migrations are up to date, and provide the option to migrate to latest. How do I tell if there are available migrations that need to be applied? I see that I can get the migrations that were applied like this
var asm = Assembly.GetAssembly(typeof(Migration_0001));
var migrator = new Migrator.Migrator("SqlServer", setupInfo.DatabaseConnectionString, asm);
var applied = migrator.AppliedMigrations;
I like to do something like this:
var available = migrator.AvailableMigrations; //this property does not exist.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了路。 查看 migratordotnet 源代码会有所帮助。
I found the way. Looking at migratordotnet source code helps.