コード例 #1
0
ファイル: RoundhousETask.cs プロジェクト: yonglehou/dropkick
        public DeploymentResult Execute()
        {
            var results           = new DeploymentResult();
            var scriptsPath       = Path.GetFullPath(_scriptsLocation);
            var useSimpleRecovery = _recoveryMode == DatabaseRecoveryMode.Simple ? true : false;

            try
            {
                var connectionString = _connectionInfo.BuildConnectionString();
                switch (_roundhouseMode)
                {
                case RoundhousEMode.Drop:
                    RoundhousEClientApi.Run(connectionString, scriptsPath, _environmentName, true, useSimpleRecovery, _repositoryPath, _versionFile, _versionXPath, _commandTimeout, _commandTimeoutAdmin, _functionsFolderName, _sprocsFolderName, _viewsFolderName, _upFolderName, _versionTable, _scriptsRunTable, _scriptsRunErrorTable, _warnOnOneTimeScriptChanges, _outputPath);
                    break;

                case RoundhousEMode.Restore:
                    RoundhousEClientApi.Run(connectionString, scriptsPath, _environmentName, false, useSimpleRecovery, _repositoryPath, _versionFile, _versionXPath, _commandTimeout, _commandTimeoutAdmin, true, _restorePath, _restoreTimeout, _restoreCustomOptions, _functionsFolderName, _sprocsFolderName, _viewsFolderName, _upFolderName, _versionTable, _scriptsRunTable, _scriptsRunErrorTable, _warnOnOneTimeScriptChanges, _outputPath);
                    break;

                case RoundhousEMode.DropCreate:
                    RoundhousEClientApi.Run(connectionString, @".\", _environmentName, true, useSimpleRecovery, _repositoryPath, _versionFile, _versionXPath, _commandTimeout, _commandTimeoutAdmin, _functionsFolderName, _sprocsFolderName, _viewsFolderName, _upFolderName, _versionTable, _scriptsRunTable, _scriptsRunErrorTable, _warnOnOneTimeScriptChanges, _outputPath);
                    goto case RoundhousEMode.Normal;

                case RoundhousEMode.Normal:
                    RoundhousEClientApi.Run(connectionString, scriptsPath, _environmentName, false, useSimpleRecovery, _repositoryPath, _versionFile, _versionXPath, _commandTimeout, _commandTimeoutAdmin, _functionsFolderName, _sprocsFolderName, _viewsFolderName, _upFolderName, _versionTable, _scriptsRunTable, _scriptsRunErrorTable, _warnOnOneTimeScriptChanges, _outputPath);
                    break;

                default:
                    goto case RoundhousEMode.Normal;
                }

                results.AddGood("[roundhouse] Deployed migrations changes successfully");
            }
            catch (Exception ex)
            {
                results.AddError("[roundhouse] An error occured during RoundhousE execution.", ex);
            }

            return(results);
        }
コード例 #2
0
ファイル: RoundhousETask.cs プロジェクト: oriacle/dropkick
        public DeploymentResult Execute()
        {
            var results = new DeploymentResult();

            var scriptsPath = Path.GetFullPath(_scriptsLocation);

            var log = new DeploymentLogger(results);

            try
            {
                if (_dropDatabase)
                {
                    RoundhousEClientApi.Run(log, _instanceName, _databaseType, _databaseName, true, scriptsPath, _environmentName, _useSimpleRecoveryMode);
                }
                RoundhousEClientApi.Run(log, _instanceName, _databaseType, _databaseName, false, scriptsPath, _environmentName, _useSimpleRecoveryMode);
            }
            catch (Exception ex)
            {
                results.AddError("An error occured during RoundhousE execution.", ex);
            }

            return(results);
        }