def __init__(self, module):
        """
        Constructor
        """
        ActionBundle.__init__(self, module)

        unzippedPackagePath = module.executionContext["unzippedPackagePath"]
        versionInfo = module.executionContext["versionInfo"]
        revisionInfo = module.executionContext["revisionInfo"]
        guid = module.executionContext["guid"]

        # Compose Oracle DB Connection String
        oracleConnectionString = "%s/%s@%s" % (
            extractOracleDatabaseCredentials(
                module.name,
                lib.OptParser.options.envprops,
                "VNA_CRM_USERNAMEBASE",
                "VNA_CRM_PASSWORDBASE",
                "DBConnectionString",
            )
        )

        # Run DB init script(s)
        for dbInitScript in module.relativeDatabaseInitFiles:
            appendRequiredStringsToOracleSQLFile(unzippedPackagePath + scriptGlobals.osDirSeparator + dbInitScript)
            RunOracleScriptFromFile(
                unzippedPackagePath + scriptGlobals.osDirSeparator + dbInitScript, oracleConnectionString
            )

        # Add LOG table
        RunOracleScriptFromFile(scriptGlobals.oracleLogTemplateFile, oracleConnectionString)

        # Log DB init script(s)
        for dbInitScript in module.relativeDatabaseInitFiles:
            logOracleScriptInDBLog(
                dbInitScript,
                guid,
                lib.OptParser.options.action,
                module.name,
                versionInfo,
                revisionInfo,
                oracleConnectionString,
            )

        # Already existing upgrade scripts must be logged because in the upcoming upgrade we need to run from there on
        log.info(
            "Existing SQL patches will be logged in the log table so that the script will not run them again if you decise to update this version to latest"
        )
        ls = os.listdir(unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeDatabaseUpgradeFilePath)
        ls.sort()
        for patch in ls:
            logOracleScriptInDBLog(
                patch,
                guid,
                lib.OptParser.options.action,
                module.name,
                versionInfo,
                revisionInfo,
                oracleConnectionString,
            )
    def __init__(self, module):
        """
        Constructor
        """
        ActionBundle.__init__(self, module)

        unzippedPackagePath = module.executionContext["unzippedPackagePath"]
        versionInfo = module.executionContext["versionInfo"]
        revisionInfo = module.executionContext["revisionInfo"]
        majorVersionInfo = module.executionContext["majorVersionInfo"]
        guid = module.executionContext["guid"]

        # Compose Oracle DB Connection String
        oracleConnectionString = "%s/%s@%s" % (
            extractOracleDatabaseCredentials(
                module.name,
                lib.OptParser.options.envprops,
                "VNA_CRM_USERNAMEBASE",
                "VNA_CRM_PASSWORDBASE",
                "DBConnectionString",
            )
        )

        # Determine last executed script
        result = getLatestExecutedScript(versionInfo, majorVersionInfo, oracleConnectionString)
        lastExecutedPath, lastExecutedFilename = os.path.split(result.strip())

        if "no rows selected" in lastExecutedFilename:
            answer = getAnswerFromUser(
                "Unable to determine last executed script on '"
                + oracleConnectionString
                + "'. There is a possibility that the scripts in the log table are of an older major version than '"
                + majorVersionInfo
                + "'. (In this case you may want to run all the scripts in your upgrade folder '"
                + unzippedPackagePath
                + scriptGlobals.osDirSeparator
                + module.relativeDatabaseUpgradeFilePath
                + "'). \n\nSelect your actions: \n(E) Execute all scripts in the upgrade folder in alphabetical order \n(<any other key>) Don't run any scripts and continue installation: "
            )
            if (re.compile("^e$", re.I)).match(answer):
                log.info(
                    "Running ALL scripts contained in '"
                    + unzippedPackagePath
                    + scriptGlobals.osDirSeparator
                    + module.relativeDatabaseUpgradeFilePath
                    + "' in alphabetical order."
                )

                # Run scripts on DB
                ls = os.listdir(
                    unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeDatabaseUpgradeFilePath
                )
                ls.sort()
                for patch in ls:
                    appendRequiredStringsToOracleSQLFile(
                        unzippedPackagePath
                        + scriptGlobals.osDirSeparator
                        + module.relativeDatabaseUpgradeFilePath
                        + scriptGlobals.osDirSeparator
                        + patch
                    )
                    RunOracleScriptFromFile(
                        unzippedPackagePath
                        + scriptGlobals.osDirSeparator
                        + module.relativeDatabaseUpgradeFilePath
                        + scriptGlobals.osDirSeparator
                        + patch,
                        oracleConnectionString,
                    )
                    # Log executed scripts
                    logOracleScriptInDBLog(
                        patch,
                        guid,
                        lib.OptParser.options.action,
                        module.name,
                        versionInfo,
                        revisionInfo,
                        oracleConnectionString,
                    )

        else:
            log.info(
                "According to log table, the last script executed on '"
                + oracleConnectionString
                + "' was '"
                + lastExecutedFilename
                + "'"
            )

            # Run scripts on DB
            ls = os.listdir(unzippedPackagePath + scriptGlobals.osDirSeparator + module.relativeDatabaseUpgradeFilePath)
            ls.sort()
            found = False
            for patch in ls:
                if found:
                    appendRequiredStringsToOracleSQLFile(
                        unzippedPackagePath
                        + scriptGlobals.osDirSeparator
                        + module.relativeDatabaseUpgradeFilePath
                        + scriptGlobals.osDirSeparator
                        + patch
                    )
                    RunOracleScriptFromFile(
                        unzippedPackagePath
                        + scriptGlobals.osDirSeparator
                        + module.relativeDatabaseUpgradeFilePath
                        + scriptGlobals.osDirSeparator
                        + patch,
                        oracleConnectionString,
                    )
                    # Log executed scripts
                    logOracleScriptInDBLog(
                        patch,
                        guid,
                        lib.OptParser.options.action,
                        module.name,
                        versionInfo,
                        revisionInfo,
                        oracleConnectionString,
                    )
                if patch == lastExecutedFilename:
                    found = True