Question

I want to separate the test data (can differ per environment) from the actual database creation.
I know you can use profiles for that purpose, but the way I understand it, you call them once at the end of the other migrations.

What I want, is to have them based on migration versions, so:

  • Migration X creates table 'Users'
  • Test data is inserted into 'Users' separately

How would I go about doing that?

Was it helpful?

Solution

There are two new features that might help you. Have you looked at tags (https://github.com/schambers/fluentmigrator/wiki/Filter-migrations-run-based-on-Tags)?

And the other option is not merged in yet but should be shortly: Passing a parameter via the runner (console, nant, msbuild) that you can use to have logic in migrations.

See here: https://github.com/schambers/fluentmigrator/wiki/ApplicationContext:-Passing-parameters-to-Migrations

Personally, I have always just used an sql script for setting testdata and run it from my build script (not via FluentMigrator).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top