Reputation: 8299
So I have a Dev
and a Staging
environments (Azure DevOps).
The CD
pipeline generates a migrations script of the Dev
environment DB
.
This latter is executed by Staging release
pipeline, to put the Staging
DB
up to date.
The generated script contains all the migrations (it is not a --from
, --to
script).
Although the command generating the migrations script uses the --idempotent
parameter, to avoid executing migrations that were already brought to the Staging
DB
, some queries would still cause errors (when being syntax checked), for instance when they use some table properties that don't exist any more.
Is there any way to completely bypass/NotExecute the already applied migrations ?
I don't want to go with the --from
, --to
when generating the migration script, as the CD pipeline(using the Dev
environment) can't know about what's been applied or not in the Staging
environment. That would necessit writing a complex dedicated Powershell script (not time for it).
Upvotes: 2
Views: 138
Reputation: 18988
Based on my experience, and confirmed with my colleagues, I’m afraid that if you don’t want to use from
to
in the generated migration script or use powershell script to achieve this , there’s no such other method can let you bypass the applied migration then only apply the changed migration script.
—-
In local command line, if there’s some script can achieve this, it would also can be used in Azure Devops. In this issue, if you don’t want to use from
to
in EF migration command, powershell script would be the only way can achieve what you want to do.
Upvotes: 2