Skip to Main Content
Feature Request FR-4319
Product Area Application Builder
Status ROADMAP

11 Voters

Preserve working copy/master relationship with export/import

dan2 Public
· Mar 6 2025

Idea Summary
Give the option, both in the UI and CLI, when exporting an application to also export the working copies and maintain the relationship between them upon importing.

Use Case
If I need to rebuild my development environment or move to a different platform, I have to merge all working copies back into master before exporting. This is a bad developer experience.

Preferred Solution (Optional)
How would you implement this idea? If you are not sure, please delete this section.

This is planned for a future APEX release.

Comments

Comments

  • ld.diaz OP 1.1 years ago

    This concept is crucial for adhering to the Feature-Driven Development cycle. The ability to deploy a working copy in each environment facilitates merging and comparisons, independent of remote deployments.

    Feature Driven Development | Baeldung on Computer Science

  • jayson hanes Admin OP 1.1 years ago

    Per the Working Copy feature developer lead, Matt Nolan, he came up with this work around:

    Step 1:

    Query the following information for your working copies in the original environment:

    select id, 
           security_group_id, 
           import_orig_app_id, 
           import_orig_owner, 
           import_id_offset
      from wwv_flows
     where working_copy_name is not null
    order by id
    

    Step 2

    Edit your working copy export files and add the following code after the “wwv_flow_imp.import_begin” api call in the first begin/end block. Taking note to replace the values below with the values obtained from the above query, the export file that you edit corresponds to the ID value from the first column.

    wwv_imp_workspace.set_original_app_values(
    	p_original_security_group_id => 8707788597408233,
    	p_original_application_id    => 23000,
    	p_original_owner             => 'WORKING_COPY_TEST',
    	p_original_id_offset         => 9330320211679924 );
    

    Step 3

    Install the file from the SQLcl command line

    In Summary

    Please test this on one working copy first and confirm that it is working before proceeding with the others. Also be careful that you copy the correct values into the correct export files.

  • ld.diaz OP 1.1 years ago

    Excellent, thank you for the recommendation. We deployed using Remote Deployment and cannot modify the import scripts since they are generated online during deployment. However, we implemented a workaround as part of this update in the application upgrade scripts.

    UPDATE wwv_flows dest
    SET (working_copy_created_on, 
         working_copy_created_by, 
         working_copy_name, 
         working_copy_description, 
         import_orig_app_id, 
         import_id_offset) = 
        (SELECT working_copy_created_on, 
                working_copy_created_by, 
                working_copy_name, 
                working_copy_description, 
                import_orig_app_id, 
                import_id_offset
         FROM wwv_flows src
         WHERE src.working_copy_name IS NOT NULL
           AND src.id = v('APP_ID')
         ORDER BY src.id
         FETCH FIRST 1 ROW ONLY)
    WHERE dest.id = v('APP_ID')
    
  • phillip.grimshaw OP 1.1 years ago

    we migrated envs recently and this was a real world problem

  • dan2 OP 1.1 years ago

    The workaround suggested by Jayson Haynes did not work for me. My exports were done via CLI (sqlcl). Not sure if that makes a difference.

    apex export -workspaceid <wkspid> -dir "$base_dir"/apps -expSupportingObjects I;
    
  • matt.nolan2 APEX Team OP 1 years ago

    @dan2  **Please Note**  In order for the workaround to work, you need to ensure that your workspace on your destination server was created with the exact same ID, either from a workspace export/import or by specifically defining the ID at the time of creation that matches your original environment workspace ID.

  • ian OP 11 months ago

    APEX 24.1.7.
    I've been trying to solve this issue as well. The above jayson hanes method worked but no  “View changes in other copies” warnings were displayed.
    I then hit upon the following.

    • Created Working Copy
    • Made changes
    • Exported Working Copy: Original Ids: On, Audit Information: Names and Dates

    I then deleted the Working Copy and Imported the export.

    Working Copy was recreated correctly (i.e. with correct relationship to Main). In addition the “View changes in other copies” button also correctly appears in all Working Copies to indicate changes made in other Working Copies.

    If you exclude Audit information then “View changes in other copies” doesn't work after import.