apm_data_model_scripts_find (public)

 apm_data_model_scripts_find \
    [ -upgrade_from_version_name upgrade_from_version_name ] \
    [ -upgrade_to_version_name upgrade_to_version_name ] \
    [ -package_path package_path ] package_key

Defined in packages/acs-tcl/tcl/apm-install-procs.tcl

Switches:
-upgrade_from_version_name (optional)
From which version do we want the files
-upgrade_to_version_name (optional)
To what version do we want the files
-package_path (optional)
The package path
Parameters:
package_key (required)
The package key
Returns:
A list of files and file types of form [list [list "foo.sql" "data_model_upgrade"] ...]

Partial Call Graph (max 5 caller/called nodes):
%3 apm_package_install_data_model apm_package_install_data_model (private) apm_data_model_scripts_find apm_data_model_scripts_find apm_package_install_data_model->apm_data_model_scripts_find packages/acs-admin/www/apm/packages-install-3.tcl packages/acs-admin/ www/apm/packages-install-3.tcl packages/acs-admin/www/apm/packages-install-3.tcl->apm_data_model_scripts_find packages/acs-admin/www/install/install-3.tcl packages/acs-admin/ www/install/install-3.tcl packages/acs-admin/www/install/install-3.tcl->apm_data_model_scripts_find apm_get_package_files apm_get_package_files (public) apm_data_model_scripts_find->apm_get_package_files apm_guess_db_type apm_guess_db_type (public) apm_data_model_scripts_find->apm_guess_db_type apm_guess_file_type apm_guess_file_type (public) apm_data_model_scripts_find->apm_guess_file_type apm_log apm_log (public) apm_data_model_scripts_find->apm_log apm_order_upgrade_scripts apm_order_upgrade_scripts (private) apm_data_model_scripts_find->apm_order_upgrade_scripts

Testcases:
No testcase defined.
Source code:
    set types_to_retrieve [list "sqlj_code"]
    if {$upgrade_from_version_name eq ""} {
        lappend types_to_retrieve "data_model_create"
        # Assuming here that ctl_file files are not upgrade scripts
        # TODO: Make it possible to determine which ctl files are upgrade scripts and which aren't
        lappend types_to_retrieve "ctl_file"
    } else {
        lappend types_to_retrieve "data_model_upgrade"
    }

    if {[apm_package_installed_p $package_key] && ![apm_package_enabled_p $package_key]} {
        ns_log notice "apm_data_model_scripts_find: ignore upgrade attempt for disabled package $package_key"
        return ""
    }
    set data_model_list [list]
    set upgrade_file_list [list]
    set ctl_file_list [list]
    set file_list [apm_get_package_files -include_data_model_files  -file_types $types_to_retrieve  -package_path $package_path  -package_key $package_key]

    foreach path $file_list {
        set file_type [apm_guess_file_type $package_key $path]
        set file_db_type [apm_guess_db_type $package_key $path]
        apm_log APMDebug "apm_data_model_scripts_find: Checking \"$path\" of type \"$file_type\" and db_type \"$file_db_type\"."

        if {$file_type in $types_to_retrieve} {
            set list_item [list $path $file_type $package_key]
            if {$file_type eq "data_model_upgrade"} {
                # Upgrade script
                if {[apm_upgrade_for_version_p $path $upgrade_from_version_name  $upgrade_to_version_name]} {
                    # Its a valid upgrade script.
                    ns_log Debug "apm_data_model_scripts_find: Adding $path to the list of upgrade files."
                    lappend upgrade_file_list $list_item
                }
            } elseif {$file_type eq "ctl_file"} {
                lappend ctl_file_list $list_item
            } else {
                # Install script
                apm_log APMDebug "apm_data_model_scripts_find: Adding $path to the list of data model files."
                lappend data_model_list $list_item
            }
        }
    }
    # ctl files need to be loaded after the sql create scripts
    set file_list [concat [apm_order_upgrade_scripts $upgrade_file_list]  $data_model_list  $ctl_file_list]
    apm_log APMDebug "apm_data_model_scripts_find: Data model scripts for $package_key: $file_list"

    return $file_list
Generic XQL file:
packages/acs-tcl/tcl/apm-install-procs.xql

PostgreSQL XQL file:
packages/acs-tcl/tcl/apm-install-procs-postgresql.xql

Oracle XQL file:
packages/acs-tcl/tcl/apm-install-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: