public bool Execute() { try { var deployer = new DbDeployer(); deployer.Execute(this.config, Console.Out); return(true); } catch (UsageException ex) { Console.Error.WriteLine(ex.Message); this.PrintUsage(); } catch (DbDeployException ex) { Console.Error.WriteLine(ex.Message); } catch (Exception ex) { Console.Error.WriteLine("Failed to apply changes: " + ex.Message); Console.Error.WriteLine("Stack Trace:"); Console.Error.Write(ex.StackTrace); } return(false); }
protected override void ProcessRecord() { base.ProcessRecord(); if (string.IsNullOrEmpty(this.OutputFile)) { this.WriteError(new ErrorRecord(new PSInvalidOperationException( "Missing a file for output"), "NoOutputFile", ErrorCategory.MetadataError, null)); return; } var dbDeploy = new DbDeployer { InfoWriter = new LambdaTextWriter(WriteVerbose), Dbms = this.DatabaseType, ConnectionString = this.ConnectionString, ChangeLogTableName = this.TableName, ScriptDirectory = new DirectoryInfo(this.deltasDirectory), }; dbDeploy.OutputFile = new FileInfo(this.ToAbsolutePath(OutputFile)); if (!string.IsNullOrEmpty(this.UndoOutputFile)) { dbDeploy.OutputFile = new FileInfo(this.ToAbsolutePath(UndoOutputFile)); } dbDeploy.Go(); }
private void DatabaseUpdateCheck(string connectionStringArg) { var dbDeployer = new DbDeployer(connectionStringArg); var isSuccess = dbDeployer.Deploy(); if (!isSuccess) { throw new Exception("Database update check failed."); } }
protected override void ProcessRecord() { base.ProcessRecord(); var dbDeploy = new DbDeployer { InfoWriter = new LambdaTextWriter(WriteVerbose), Dbms = DatabaseType, ConnectionString = ConnectionString, ChangeLogTableName = TableName, ScriptDirectory = new DirectoryInfo(deltasDirectory), }; dbDeploy.Go(); }
protected override void ProcessRecord() { base.ProcessRecord(); var config = new DbDeployConfig { Dbms = DatabaseType, ConnectionString = ConnectionString, ChangeLogTableName = TableName, ScriptDirectory = Parser.ParseDirectory(deltasDirectory), }; var deployer = new DbDeployer(); deployer.Execute(config, new LambdaTextWriter(WriteVerbose)); }
protected override void ProcessRecord() { base.ProcessRecord(); if (string.IsNullOrEmpty(this.OutputFile)) { this.WriteError(new ErrorRecord(new PSInvalidOperationException( "Missing a file for output"), "NoOutputFile", ErrorCategory.MetadataError, null)); return; } var config = new DbDeployConfig { Dbms = this.DatabaseType, ConnectionString = this.ConnectionString, ChangeLogTableName = this.TableName, ScriptDirectory = new DirectoryInfo(this.deltasDirectory), AutoCreateChangeLogTable = this.AutoCreateChangeLogTable, ForceUpdate = this.ForceUpdate, UseSqlCmd = this.UseSqlCmd, OutputFile = new FileInfo(this.ToAbsolutePath(this.OutputFile)) }; if (!string.IsNullOrEmpty(this.UndoOutputFile)) { config.OutputFile = new FileInfo(this.ToAbsolutePath(UndoOutputFile)); } var deployer = new DbDeployer(); deployer.Execute(config, new LambdaTextWriter(WriteVerbose)); }
public static void AutoDeployDatabase(DbDeployer.InstallEventHandler onProcess, IEnumerable<string> tablePrefixs) { Stream dbStream = new MemoryStream(Encoding.UTF8.GetBytes(Install_Bin.scheme_xml)); string errorLog; DbDeployer.Update(Settings.Current.IConnectionString, dbStream, onProcess, tablePrefixs, out errorLog); if (!string.IsNullOrEmpty(errorLog)) CreateLog(errorLog); UpdateVersion(Settings.Versions[Settings.Versions.Length - 1]); }
public Dbdeploy() { this.dbDeploy = new DbDeployer(); this.dbDeploy.InfoWriter = Console.Out; }
public static void ClassInitialize(TestContext testContext) { DbDeployer.StartLocalDb(LocalDbInstance, testContext, typeof(ExampleDomainContext)); InitDb(); }