public DatabaseUpgradeResult Run(string[] args)
        {
            DatabaseUpgradeResult result = null;
            if (args.Any(a => "--scriptAllDefinitions".Equals(a, StringComparison.InvariantCultureIgnoreCase)))
            {
                result = ScriptAll();
            }
            else
            {
                var scriptsToExecute = m_engine.GetScriptsToExecute();

                if (args.Any(a => "--whatIf".Equals(a, StringComparison.InvariantCultureIgnoreCase)))
                {
                    result = new DatabaseUpgradeResult(null, true, null);

                    this.Log.WriteWarning("WHATIF Mode!");
                    this.Log.WriteWarning("The following scripts would have been executed:");
                    scriptsToExecute.ForEach(r => this.Log.WriteWarning(r.Name));
                }
                else
                {
                    result = m_engine.PerformUpgrade();

                    if (result.Successful
                        && args.Any(a => "--fromconsole".Equals(a, StringComparison.InvariantCultureIgnoreCase)))
                    {
                        this.Log.WriteInformation("Scripting changed database objects...");
                        var scripter = new DbObjectScripter(this.ConnectionString, m_options, this.Log);
                        var scriptorResult = scripter.ScriptMigrationTargets(scriptsToExecute);
                    }
                }
            }

            return result;
        }
        public DatabaseUpgradeResult ScriptAll()
        {
            this.Log.WriteInformation("Scripting all database object definitions...");

            if (this.ConnectionString == null)
            {
                return new DatabaseUpgradeResult(null, false, new Exception("connectionString could not be determined"));
            }

            var scripter = new DbObjectScripter(this.ConnectionString, m_options, this.Log);
            scripter.ScriptAll();

            return new DatabaseUpgradeResult(new List<SqlScript>(), true, null);
        }