1

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?

1 Answer 1

2

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).

Sign up to request clarification or add additional context in comments.

1 Comment

I ended up keeping the test data separate in a sql-file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.