Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm using Umbraco Migrations to update a bespoke database in our code for an Umbraco 7.3.0 web app.
Currently I have an app setting in the web.config which tells an MigrationRunner which version of the product the web app should be running on.
My code is done in various version 1.0.0., 1.1.0, 1.2.0, etc where 1 is the initial base DB and each version after is altering those existing database tables.
My question is if I set the MigrationRunner to version 1.2.0 is there any way I can decorate previous migrations so it will know it needs to run a prior version first.
My goal is if I have 1.2.0 set at the latest version of the code and any migrations haven't been run before on that instance it will run the other versions first. A use case for this would be pushing to a live environment where no migrations have been run before or for a developer who is picking up a fresh copy of the web app for the first time and wants to have their db schemas in check.
Have you tried this? Think it should "just" work.
So: Install v1.0.0, upgrade to 1.20 and all migrations in between should run. That's how the core works, with the same migrations, so that's how custom migrations should also (hopefully) work.
Thanks for the response. Sadly in v7.3.0 it doesn't work out of the box, unless I'm missing something.
I've been sitting on for a few weeks now. I've extracted the key bit of code and created a gist for you to see what I'm working with. I might create a repo, if you need it, instead as gists can be a little cumbersome for multiple file examples.
My scenario is I have code which was run pre-Migrations which has a PetaPoco object already on it. Also my web.config app setting will be set to 1.1.0. I'd hope that the code would run 1.0.0 before 1.1.0. I don't know how I'd make this happen though.
Also another eventuality is running this code with the web.config app setting would be the most recent version (1.1.0 or 1.2.0) and would hope the code would run the other bit of code too. Obviously in the clean environment setup the new property would get added in because they're part of the source controlled MyPoco.cs object.
So I guess, I'm really looking at that situation where the MyPoco.cs exists on an environment but the DB table isn't updated to wire up to new properties on the POCO. So in this scenario I'd want any missing migrations to run. If the latest version were 1.2.0 then I'd also want 1.1.0 to run too.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted