GetScriptUpgradingFrom() public method

public GetScriptUpgradingFrom ( int from ) : UpgradeScript
from int
return UpgradeScript
Example #1
0
        public bool CreateUpgradePath()
        {
            _upgradePath = new UpgradeScripts();

            int from = _application.Database.CurrentVersion;
            int to   = _application.Database.RequiredVersion;


            // Actually create the path.
            while (from != to)
            {
                UpgradeScript script = _upgradeScripts.GetScriptUpgradingFrom(from);

                if (script == null)
                {
                    MessageBox.Show("Upgrade path not found. Please contact support", "hMailServer");
                    return(false);
                }

                string fileName = GetScriptFileName(script);

                if (!File.Exists(fileName))
                {
                    MessageBox.Show("Required file for upgrade not found:" + Environment.NewLine + fileName, "hMailServer");
                    return(false);
                }

                _upgradePath.Add(script);

                from = script.To;
            }

            DisplayUpgradePath();

            return(true);
        }