Replies: 1 comment 1 reply
-
This might be where I could help, not sure. But unifying all ways of producing SQL scripts would be ideal. I wonder if you could use a plug-in type of system like MEF to achieve this. Instead of including all runners, the end user just has a plug-in directory with the runner in it. I'm new to all of this though so I could just be saying a bunch of nonsense. Instead of pointing to an assembly, it just takes whatever's in a directory and does it's thing. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The idea here is to introduce a new way to encapsulate various Tasks that are used by the three FluentMigrator "Task Runners".
Currently, FluentMigrator not only has three Task Runners, but each one has a different API for the tasks themselves, which increases overall code complexity:
FluentMigrator.Console primarily exists to support legacy .NET Framework. The other use case it supports is fully bundled dependencies, such that the nupkg file contains a zip of all libraries it needs, without needing to download them from a nuget package server.
FluentMigrator.DotNet.Cli exists to support .NET Core users. It does not support fully bundled dependencies, but we could always create a FluentMigrator.DotNet.Cli.Bundled re-packaging of FluentMigrator.DotNet.Cli.
FluentMigrator.MSBuild exists to provide "red blood" in the Windows Terminal so that when a migration fails, the error message is highlighted in red ink. MSBuild users can use FluentMigrator.DotNet.Cli to run their migrations, but they lose the error stream and red link that the FluentMigrator.MSBuild task provides.
Long-term, it would be nice to encapsulate each Task as a Micro-Service, and have FluentMigrator.MSBuild and FluentMigrator.DotNet.Cli use the same micro-services under the hood.
Goals
FluentMigrator.Abstractions.ITaskDefinition<T> where T : FluentMigrator.Abstractions.ITask
ContinueWith
another FluentMigrator task.Rough Sketch of API
Thoughts on Rough Sketch API
Why F-Bounded Polymorphism?
F-Bounded Polymorphism is a useful trick to allow important interface changes in derived types. In the case of FluentMigrator, each task has a unique set of parameters (inputs) and a unique set of return values/outputs.
The main reason not to use F-Bounded Tasks is if all the Tasks have the same homogeneous structure, and there is no scenario where one task may want to take its outputs and map them into the inputs of another task. Given FluentMigrator's current architecture, one could argue this is over-engineering. But what if we took all the existing tasks in FluentMigrator and broke them down into smaller pieces. For example,
migrate:up
task is really a composition of many other tasks:migrate:up range=1,4 --profile ProfileName --tags Dev,Alpha,Beta,Production --preview-only
is actually four tasks in one, at minimum:migrate:up range=1,4
suggests to look at the VersionInfo table to determine what range of migrations need applying--profile ProfileName
suggests to look at the ProfileSource dependency to determine what profiles to run and when to run them--tags Dev,Alpha,Beta,Production
suggests to take the output from task one and apply an additional filter on the migrations by requiring they have these tags.--preview-only
suggests to construct a "unit of work" where the persistent store is a text fileHowever, so far, FluentMigrator's internal APIs reflect how the consumers most typically use the task runners. This limits degrees of freedom, as there are no micro-tasks to easily create linear combinations of logic/features.
YAGNI - Why Not Just use .NET Task API?
There are some reasons why we shouldn't use the .NET Task API:
Beta Was this translation helpful? Give feedback.
All reactions