U4-8545 - Refactor MigrationRunner to accept a MigrationContext along with all Migrations to be created with IoC

Created by Shannon Deminick 31 May 2016, 20:49:57 Updated by Stephan 02 Jun 2016, 12:38:18

Tags: Unscheduled

Subtask of: U4-5482

We need to be able to pass in the runtime MigrationContext instance to create all of the migrations, we also need to update the MigrationRunner to use the MigrationContext instead of all of it's parts.


Shannon Deminick 31 May 2016, 22:44:56

I have refactored the runner, etc...

  • df9160b3cd85db632af938032ed977f570acf9a3

Changes MigrationBase and all sub-classes to have an IMigrationContext as a ctor param. Updates the MigrationResolver to resolve Migration instances with the passed in IMigrationContext value. Simplifies MigrationBase since now we know we have a context to work with, there's no need to GetUp/GetDown Expression methods. Updates the MigrationRunner to use the MigrationContext instead of creating one itself.

  • 11552da6ecc42bd43b35b3b8fd75f2d92ffb9ae1

reverts change made to remove the 'child container' - this actually works well and doesn't interfere with the main container's scope manager - but uses the built in IServiceContainer.Clone() method instead of our own extension to do that. Ignores the one failing test, need to ask Stephan

The failing test is: Issue8370Test which is set to ignore. I cannot figure out the error so hoping @zpqrtbnk can.

I have tested running all migrations by forcing an upgrade (i.e. change web config to 7.2), all other tests pass and the migration classes, base classes and runners are much simpler.

Stephan 02 Jun 2016, 10:21:01

code review looks good + it's working = fixed

Stephan 02 Jun 2016, 10:21:50

looking into the test that fails

Stephan 02 Jun 2016, 12:38:08

The failing test is caused by an NPoco issue.

Have reported: https://github.com/schotime/NPoco/issues/282 Have submitted a PR that fixes the issue, waiting for it to be merged.

Marking this issue as fixed, will take care of re-enabling the test when we upgrade NPoco.

Priority: Normal

Type: Task

State: Fixed


Difficulty: Normal


Backwards Compatible: False

Fix Submitted:

Affected versions:

Due in version: 8.0.0

Sprint: Sprint 16

Story Points: