Example #1
0
        public override void Execute(DBVersionsProcessContext processContext)
        {
            processContext.ThrowIfNull(nameof(processContext));


            using (ArtifactExtractor _currentArtifactExtractor = _artifactExtractorFactory.Create(processContext.ProjectConfig))
            {
                List <ActionStepBase> internalSteps = new List <ActionStepBase>();

                using (var dbCommands = _dbCommandsFactory.CreateDBCommand(processContext.ProjectConfig.DBConnectionInfo))
                {
                    ScriptFileTypeBase       incrementalFileType = ScriptFileTypeBase.Create <IncrementalScriptFileType>();
                    ExecuteScriptsByTypeStep incrementalExecuteScriptsByTypeStep = _executeScriptsByTypeStepFactory.Create(incrementalFileType.FileTypeCode, dbCommands);
                    internalSteps.Add(incrementalExecuteScriptsByTypeStep);


                    string lastIncStriptFilename = GetLastIncFilename(processContext);

                    TargetScripts targetScripts = null;
                    if (processContext.ProcessArgs != null)
                    {
                        targetScripts = (processContext.ProcessArgs as DBVersionsProcessArgs).TargetScripts;
                    }

                    //Comment: We run the repeatable files and ddd files, onlyif we have all the schema on the DB. mean, only if we executed all incremiental files.
                    if (targetScripts.IncScriptFileName.Trim().ToUpperInvariant() == lastIncStriptFilename.Trim().ToUpperInvariant() ||
                        targetScripts.IncScriptFileName.Trim().ToUpperInvariant() == RuntimeScriptFile.TargetLastScriptFileName.Trim().ToUpperInvariant())
                    {
                        ScriptFileTypeBase       repeatableFileType = ScriptFileTypeBase.Create <RepeatableScriptFileType>();
                        ExecuteScriptsByTypeStep repeatableFileTypeExecuteScriptsByTypeStep = _executeScriptsByTypeStepFactory.Create(repeatableFileType.FileTypeCode, dbCommands);
                        internalSteps.Add(repeatableFileTypeExecuteScriptsByTypeStep);


                        if (processContext.ScriptFilesState.DevDummyDataScriptFilesComparer != null)
                        {
                            ScriptFileTypeBase       devDummyDataFileType = ScriptFileTypeBase.Create <DevDummyDataScriptFileType>();
                            ExecuteScriptsByTypeStep devDummyDataFileTypeExecuteScriptsByTypeStep = _executeScriptsByTypeStepFactory.Create(devDummyDataFileType.FileTypeCode, dbCommands);
                            internalSteps.Add(devDummyDataFileTypeExecuteScriptsByTypeStep);
                        }
                    }


                    ExecuteInternalSteps(internalSteps, false);
                }
            }
        }
        public override void Execute(DBVersionsProcessContext processContext)
        {
            processContext.ThrowIfNull(nameof(processContext));


            if (processContext.ScriptFilesState.DevDummyDataScriptFilesComparer != null)
            {
                using (var dbCommands = _dbCommandsFactory.CreateDBCommand(processContext.ProjectConfig.DBConnectionInfo))
                {
                    List <ActionStepBase> internalSteps = new List <ActionStepBase>();

                    (processContext.ProcessDefinition as DBVersionsProcessDefinition).IsVirtualExecution = true;

                    ScriptFileTypeBase       devDummyDataFileType = ScriptFileTypeBase.Create <DevDummyDataScriptFileType>();
                    ExecuteScriptsByTypeStep devDummyDataFileTypeExecuteScriptsByTypeStep = _executeScriptsByTypeStepFactory.Create(devDummyDataFileType.FileTypeCode, dbCommands);
                    internalSteps.Add(devDummyDataFileTypeExecuteScriptsByTypeStep);

                    ExecuteInternalSteps(internalSteps, false);
                }
            }
        }