Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Options #3

Closed
bretcope opened this issue Jan 23, 2017 · 3 comments
Closed

Refactor Options #3

bretcope opened this issue Jan 23, 2017 · 3 comments

Comments

@bretcope
Copy link
Owner

Right now setup options are being conflated with command options. For example, "UseGlobalTransaction" is not relevant if you're only looking to get a count of outstanding migrations. It's specific to the command you're running. Whereas "MigrationsTable" is relevant to any command, so it's more of a setup option.

I'd like to rework Mayflower such that the Options object only contains setup properties. These are:

  • ConnectionString
  • Database
  • Server
  • Directory
  • MigrationsTable
  • Output
  • AutoRunPrefixes
  • Provider (not actually settable currently)
  • Verbosity (planned feature)

The Output option is a bit ambiguous as to whether it's a setup or a command option. I'm leaning more towards setup, for simplicity.

Current properties which would be removed from the Options class:

  • CommandTimeout
  • IsPreview
  • UseGlobalTransaction
  • Force

The Migrator object would be refactored to allow it to be constructed directly using an Options argument, then you could run as many commands on it as you want. Each command would correspond to an instance method on Migrator, and would accept parameters as the command options, rather than having a dedicated Options class for each command.

Furthermore, the CLI would be refactored to better support adding commands in the future. Each command will accept any of the setup arguments, but may also have its own arguments which are specific to that command. The first argument must always be a command, such as "migrate" or "status".

@bretcope
Copy link
Owner Author

It's possible that the Options class is entirely redundant, and could be replaced with parameters on the Migrator constructor.

@bretcope
Copy link
Owner Author

bretcope commented Feb 6, 2017

After giving it a little bit more thought, I'm going to move the connection options out of the Migrator constructor as well. The basic idea is that I'd like you to be able to construct the migrator, and then run various commands with one or more databases.

@bretcope
Copy link
Owner Author

bretcope commented Feb 7, 2017

This is more or less done in the redesign branch.

@bretcope bretcope closed this as completed Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant