How should I avoid partial migrations in Oracle #1489
-
I've recently started using FluentMigrator with Oracle. I've discovered that some migrations will fail when using the donet fm tool yet still commit a portion of the updates. I'm attempting to identify some general guidelines that will help me and others avoid partially failed migrations. It seems that using scripts can introduce a significant amount of risk if too many changes are contained in that script. Also, multiple changes in a single Up method are risky. Some of the guidelines that I'm discovering are the following:
Does this align with anyone else's experience? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@git-youzer In terms of how to avoid partial migrations, one answer you already guessed at is to cut up a single Up migration into smaller migrations. However, even SQL Server can have partial upgrades of a database, since most of us run in transaction-per-migration mode. I have done 112 releases with about 500 hotfixes with FluentMigrator, and our secret sauce is that we test our migrations daily using shadow copies of the production database. I am not sure if there is a database cloning feature in Oracle or through some third party vendor, but you might want to check that out. It really cuts down on partial migrations even being a thing. I realize that in some industries access to the production data or a copy of it is prohibited or impossible. But it is the best option process-wise. Other ways to mitigate migration failures is to have a Gitflow model, where only one branch gets pushed to production and there is only one "client" (such as a cloud service database). This again has nothing to do with FluentMigrator or Oracle, and is really about adopting processes that reduce the mean time to recover from failure by reducing special cases. The only Oracle workaround I can think of that might solve your problem in a creative way is to always use Execute.WithConnection and inside the connection callback code, if an error is detected via the DbConnection, call |
Beta Was this translation helpful? Give feedback.
@git-youzer
The problem is not FluentMigrator, but Oracle. Oracle does not have a transactional DDL. Postgres and SQL Server do. I think what you're experiencing is everyone's reaction when they use Oracle :)
In terms of how to avoid partial migrations, one answer you already guessed at is to cut up a single Up migration into smaller migrations.
However, even SQL Server can have partial upgrades of a database, since most of us run in transaction-per-migration mode. I have done 112 releases with about 500 hotfixes with FluentMigrator, and our secret sauce is that we test our migrations daily using shadow copies of the production database. I am not sure if there is a database cloning featur…