MigratorDotNet for Plugins Architecture

196 views Asked by At

We're starting to use Migrator.NET for managing our database migrations, its fantastic but we have an additional requirement that plug-ins written for our software which require their own custom fields added (depending on the plug in of course).

So basically we have a our core database tables, and our plugin specific tables.

I was hoping that in Migrator.NET I would see some sort of additional attribute like this

[Migration(1, "Core")
public class Migration1 : Migration
{
}

so that I'd be able to then plug in developers would then be able to do something like

[Migration(1, "PluginName")
public class Migration1 : Migration
{
}

Unfortunately this parameter doesn't exist, and the version table doesn't seem to have any place to store a tag/plugin name

CREATE TABLE [dbo].[VersionInfo](
    [Version] [bigint] NOT NULL,
    [AppliedOn] [datetime] NULL
) ON [PRIMARY]

Does anybody have any ideas how I would go about doing this?

I've seen that Ruby/Redmine support this sort of architecture as they allow plugins to include their own db migrations, however would love to be able to do this in MigratorDotNet.

1

There are 1 answers

0
Castrohenge On

You mentioned you're tagging, and you can filter migrations based on Tags, like so:

[Tags("DK", "NL", "UK")]
[Tags("Staging", "Production")]
[Migration(1)]
public class DoSomeStuffToEuropeanStagingAndProdDbs() { }

See the following wiki page for more details:

https://github.com/schambers/fluentmigrator/wiki/Filter-migrations-run-based-on-Tags