Beispiel #1
0
        protected override int Run()
        {
            _loggingFeature.Configure();

            if (!(Require(_databaseFeature.Host, "host") && Require(_databaseFeature.Database, "database") &&
                  Require("username", _usernamePasswordFeature.Username) && Require("password", _usernamePasswordFeature.Password) &&
                  Require(_scriptRoot, "script root directory")))
            {
                return(-1);
            }

            try
            {
                UpdateSession.ApplyChangeScripts(
                    _databaseFeature.Host, _databaseFeature.Database, _usernamePasswordFeature.Username, _usernamePasswordFeature.Password,
                    _createIfMissing, _scriptRoot, _defineVariablesFeature.Variables);

                return(0);
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Could not apply change scripts");
                return(-1);
            }
        }
Beispiel #2
0
        protected override int Run()
        {
            _loggingFeature.Configure();

            try
            {
                UpdateSession.ApplyChangeScripts(
                    _databaseFeature.Host, _databaseFeature.Database, _usernamePasswordFeature.Username, _usernamePasswordFeature.Password,
                    _createIfMissing, _scriptRootFeature.ScriptRoot, _defineVariablesFeature.Variables);

                return(0);
            }
            catch (PostgresException ex)
            {
                Log.Fatal("Could not apply change scripts: {Message} ({SqlState})", ex.MessageText, ex.SqlState);
                return(-1);
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Could not apply change scripts");
                return(-1);
            }
        }