//https://github.com/commandlineparser/commandline //https://github.com/dotnet/command-line-api public static int Main(string[] args) { var environmentService = new EnvironmentService(); var traceService = new FileTraceService(); var localVersionService = new LocalVersionService(traceService); var migrationServiceFactory = new CLI.MigrationServiceFactory(traceService); var commandLineService = new CommandLineService(migrationServiceFactory, localVersionService, environmentService, traceService); var resultCode = Parser.Default.ParseArguments < InitOption, RunOption, ListOption, NextVersionOption, VerifyOption, EraseOption, BaselineOption, RebaseOption>(args) .MapResult( (InitOption opts) => Dispatch(commandLineService.RunInitOption, opts, traceService), (RunOption opts) => Dispatch(commandLineService.RunMigration, opts, traceService), (NextVersionOption opts) => Dispatch(commandLineService.IncrementVersion, opts, traceService), (ListOption opts) => Dispatch(commandLineService.RunListOption, opts, traceService), (VerifyOption opts) => Dispatch(commandLineService.RunVerify, opts, traceService), (EraseOption opts) => Dispatch(commandLineService.RunEraseOption, opts, traceService), (BaselineOption opts) => Dispatch(commandLineService.RunBaselineOption, opts, traceService), (RebaseOption opts) => Dispatch(commandLineService.RunRebaseOption, opts, traceService), (ArchiveOption opts) => Dispatch(commandLineService.RunArchiveOption, opts, traceService), errs => 1); return(resultCode); }
public ITestDataService Create(string platform) { var traceService = new FileTraceService { IsDebugEnabled = true }; var tokenReplacementService = new TokenReplacementService(traceService); switch (platform.ToLower()) { case SUPPORTED_DATABASES.SQLSERVER: { return(new SqlServerTestDataService(new SqlServerDataService(traceService), tokenReplacementService)); } case SUPPORTED_DATABASES.POSTGRESQL: { return(new PostgreSqlTestDataService(new PostgreSqlDataService(traceService), tokenReplacementService)); } case SUPPORTED_DATABASES.MYSQL: { return(new MySqlTestDataService(new MySqlDataService(traceService), tokenReplacementService)); } default: throw new NotSupportedException($"The target database platform {platform} is not supported or plugins location was not correctly configured. " + $"See WIKI for supported database platforms and usage guide."); } }
//https://github.com/commandlineparser/commandline //https://github.com/dotnet/command-line-api public static int Main(string[] args) { var directoryService = new DirectoryService(); var traceService = new FileTraceService(directoryService); var fileService = new FileService(); var workspaceService = new WorkspaceService(traceService, directoryService, fileService); var environmentService = new EnvironmentService(); var configurationService = new ConfigurationService(environmentService, workspaceService, traceService); var dataServiceFactory = new DataServiceFactory(traceService); var manifestFactory = new ManifestFactory(traceService); var migrationServiceFactory = new MigrationServiceFactory(traceService); var commandLineService = new CommandLineService( migrationServiceFactory, dataServiceFactory, manifestFactory, workspaceService, environmentService, traceService, configurationService); var resultCode = Parser.Default .ParseArguments < CheckOption, InitOption, VerifyOption, RunOption, ApplyOption, ListOption, NextVersionOption, EraseOption, DestroyOption, PlatformsOption, BaselineOption, RebaseOption //ArchiveOption, >(args).MapResult( (CheckOption opts) => Dispatch(commandLineService.RunCheckOption, opts, traceService), (InitOption opts) => Dispatch(commandLineService.RunInitOption, opts, traceService), (VerifyOption opts) => Dispatch(commandLineService.RunVerifyOption, opts, traceService), (RunOption opts) => Dispatch(commandLineService.RunRunOption, opts, traceService), (ApplyOption opts) => Dispatch(commandLineService.RunApplyOption, opts, traceService), (ListOption opts) => Dispatch(commandLineService.RunListOption, opts, traceService), (NextVersionOption opts) => Dispatch(commandLineService.RunNextVersionOption, opts, traceService), (EraseOption opts) => Dispatch(commandLineService.RunEraseOption, opts, traceService), (DestroyOption opts) => Dispatch(commandLineService.RunDestroyOption, opts, traceService), (PlatformsOption opts) => Dispatch(commandLineService.RunPlatformsOption, opts, traceService), (BaselineOption opts) => Dispatch(commandLineService.RunBaselineOption, opts, traceService), (RebaseOption opts) => Dispatch(commandLineService.RunRebaseOption, opts, traceService), //(ArchiveOption opts) => Dispatch(commandLineService.RunArchiveOption, opts, traceService) errs => 1); return(resultCode); }
/// <summary> /// Runs database migrations with Yuniql. This uses default trace service FileTraceService. /// </summary> /// <param name="builder"></param> /// <param name="configuration">Desired configuration when yuniql runs. Set your workspace location, connection string, target version and other parameters.</param> /// <returns></returns> public static IWebHostBuilder UseYuniql( this IWebHostBuilder builder, Configuration configuration ) { var traceService = new FileTraceService { IsDebugEnabled = configuration.DebugTraceMode }; return(builder.UseYuniql(traceService, configuration)); }
/// <summary> /// Runs database migrations with Yuniql. This uses default trace service FileTraceService. /// </summary> /// <param name="builder"></param> /// <param name="configuration">Desired configuration when yuniql runs. Set your workspace location, connection string, target version and other parameters.</param> /// <returns></returns> public static IApplicationBuilder UseYuniql( this IApplicationBuilder builder, Configuration configuration ) { var traceService = new FileTraceService { IsDebugEnabled = configuration.IsDebug }; return(builder.UseYuniql(traceService, configuration)); }
public void Setup() { var directoryService = new DirectoryService(); var traceService = new FileTraceService(directoryService); var environmentService = new EnvironmentService(); var fileService = new FileService(); var workspaceService = new WorkspaceService(traceService, directoryService, fileService); var configurationService = new ConfigurationService(environmentService, workspaceService, traceService); configurationService.Reset(); }
public Configuration GetFreshConfiguration() { var directoryService = new DirectoryService(); var traceService = new FileTraceService(directoryService); var environmentService = new EnvironmentService(); var fileService = new FileService(); var workspaceService = new WorkspaceService(traceService, directoryService, fileService); var configurationService = new ConfigurationService(environmentService, workspaceService, traceService); configurationService.Reset(); var configuration = Configuration.Instance; configuration.Workspace = WorkspacePath; configuration.Platform = Platform; configuration.ConnectionString = ConnectionString; configuration.IsAutoCreateDatabase = true; return(configuration); }
//https://github.com/commandlineparser/commandline //https://github.com/dotnet/command-line-api public static void Main(string[] args) { var environmentService = new EnvironmentService(); var traceService = new FileTraceService(); var localVersionService = new LocalVersionService(traceService); var migrationServiceFactory = new CLI.MigrationServiceFactory(traceService); var commandLineService = new CommandLineService(migrationServiceFactory, localVersionService, environmentService, traceService); Parser.Default.ParseArguments < InitOption, RunOption, NextVersionOption, InfoOption, VerifyOption, EraseOption, BaselineOption, RebaseOption>(args) .MapResult( (InitOption opts) => { traceService.IsDebugEnabled = opts.Debug; return(commandLineService.RunInitOption(opts)); }, (RunOption opts) => { traceService.IsDebugEnabled = opts.Debug; return(commandLineService.RunMigration(opts)); }, (NextVersionOption opts) => { traceService.IsDebugEnabled = opts.Debug; return(commandLineService.IncrementVersion(opts)); }, (InfoOption opts) => { traceService.IsDebugEnabled = opts.Debug; return(commandLineService.RunInfoOption(opts)); }, (VerifyOption opts) => { traceService.IsDebugEnabled = opts.Debug; return(commandLineService.RunVerify(opts)); }, (EraseOption opts) => { traceService.IsDebugEnabled = opts.Debug; return(commandLineService.RunEraseOption(opts)); }, (BaselineOption opts) => { traceService.IsDebugEnabled = opts.Debug; return(commandLineService.RunBaselineOption(opts)); }, (RebaseOption opts) => { traceService.IsDebugEnabled = opts.Debug; return(commandLineService.RunRebaseOption(opts)); }, (ArchiveOption opts) => { traceService.IsDebugEnabled = opts.Debug; return(commandLineService.RunArchiveOption(opts)); }, errs => 1); }