Testimonial

"SEO Checker ensures that our websites meet best practice standards and ensures that new content doesn’t cause unexpected SEO headaches! We won’t be building another site without it!"

Jeavon Leopold, Crumpled Dog

 

Package Migrations tester

April 23, 2018

When you develop Umbraco packages that need to modify config files, create database tables etc you can use Package Actions. These actions get called by the Umbraco when the installer is installing your package. Downside is that these actions don't get called when you install a package via NuGet. Also updates are not handled very well by Package Actions

Migrations

Migrations is the new option to use when you create an installer. Umbraco itself is using migrations to install or update an Umbraco version. Basically a migration is a class that you decorate with an migration attribute that holds product and version info. The installer will use this during install. I am not going into details about migrations itself. A few years back Sebastiaan wrote this excellent blogpost about how to use migrations best to read that.

A pain to test

When you release a  package that does a lot during install such as installing db tables, adding dashboards, http modules etc it's very time consuming to test these installer actions if you use the Umbraco installer, you need to modify source, update package file, restore previous state of your Umbraco environment etc.. Years ago I've released a tool to test package actions. Today I've released a new package to test Package Migrations. When you install this package and open the developer section again You will see the Package Migrations tester tab.

Select Package

When you click on this tab you will see an overview where you can select a package. This will show an overview with all available migrations and the option to execute the up/down methods. Add a debugger to your code and debugging migrations is a lot easier now.

Oh if you don't like the Umbraco Package installer you can also use NuGet

PM> Install-Package PackageMigrationTester

 Hope this will save you some time as well.