Migration with tag always runs with no tags input to runner

470 views
Skip to first unread message

Quentin Starin

unread,
Apr 19, 2013, 3:14:28 PM4/19/13
to fluentmigrato...@googlegroups.com
I created a migration with a tag like so:

using System;
using System.Collections.Generic;
using System.Linq;
using FluentMigrator;

[Tags("Pages")]
[Migration(201304161452)]
public class PagesMigration : Migration {
   public override void Up() { /*...*/ }
   public override void Down() { /*...*/ }
}

When I run my migrations, both through the MSBuild runner and the command line runner, the runner always tries to run this migration, whether I provide no tags or a different tag to the runner. I'm very confused because this seems like a simple, straightforward feature. 

I also tried running a migration up from the command line with the --version switch like so

migrate.exe -a migrations.dll -db SqlServer2008 -c "server=localhost;database=mydb;integrated security=true;" -- version 201304161452

And again the runner tries to run every migration, not just the ones up to that version number. I've tried moving the position of the version parameter around, with equals and without, different versions - it always runs all the outstanding migrations, ones with tags and ones with higher versions. The version parameter works fine from the MSBuild runner, but not from the command line runner. The tags don't seem to work in either.

I'm on the 1.0.6.0 NuGet package, 


Daniel Lee

unread,
Apr 26, 2013, 6:07:34 PM4/26/13
to fluentmigrato...@googlegroups.com
Sounds like a bug. I saw that you reported it as an issue on Github. I'll try and have a look at it over the next few days. It sounds very strange that there would be a difference between the command line runner and the MSBuild task.

//Daniel

cupito

unread,
Jul 24, 2013, 8:23:01 AM7/24/13
to fluentmigrato...@googlegroups.com
I got the same problem. Currently i have 2 migrations. 

If i choose the version tag for migration 1, everythings runs fine. Only the first one will used. 
If i choose the version tag for migration 2, the 1st and 2nd migration runs. But i only want to get the changes from the second one.

i am running the 1.1.1.0 package

Kieranmaine

unread,
Jul 25, 2013, 8:23:05 AM7/25/13
to fluentmigrato...@googlegroups.com
I think your issue might be related to this bug:

https://github.com/schambers/fluentmigrator/issues/403

cupito

unread,
Jul 25, 2013, 8:40:09 AM7/25/13
to fluentmigrato...@googlegroups.com
Thanks, but i do not think so. Cause it should be fixed and i am using the version tag. maybe i understand the migration in a different way.
if i have 2 migration versions i expect during creating the scripts i can create a script for each version

cmd: migrate --assembly .... --version=1 => script 1 including version 1
cmd: migrate --assembly .... --version=2 => script 2 including version 2 

but i got

cmd: migrate --assembly .... --version=1 => script 1 including version 1
cmd: migrate --assembly .... --version=2 => script 2 including version 1+2 

Kieranmaine

unread,
Jul 25, 2013, 8:47:24 AM7/25/13
to fluentmigrato...@googlegroups.com
The --version option is different to the --tag option.

--version specifies up to which version you want the migrations to run.

For example if you have 3 versions numbers 1, 2, and 3 and you enter

--version 2

at the command line migrations 1 and 2 will be executed. if you enter

--version 3

versions 1, 2 and 3 will all be executed.

See the following page for instructions on how to use tags:

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

cupito

unread,
Jul 25, 2013, 8:48:58 AM7/25/13
to fluentmigrato...@googlegroups.com
than the behaviour makes sense
ok i will change the version tag to the tag tag

thanks for your quickly reply
Reply all
Reply to author
Forward
0 new messages