Skip to main content
Solved

How to delete base model related stuff


Forum|alt.badge.img+6

Hi, 

In the past, we included the base model for the Exchange connector into our work project. But we stopped with that and now we use the ms_graph functionality.

But there are several ‘exh_**’ domains and tables auto generated by the base model, but these can't be deleted from the SF user interface.
Even not after unlinking the base model from the project and generating the definitions.

Is there an option to get them safely deleted from the model?

Thanks in advance!

Best answer by Mark Jongeling

Hi HJ, as a final blow you can execute the task_delete_tab via SSMS. Fill in three parameters: Model, Branch, and Table

Then the task will clean up all the tables and underlaying data. That should definitely fix it. 

1exec task_delete_tab 'Model', 'Branch', 'exh_log'
2exec task_delete_tab 'Model', 'Branch', 'exh_A'
3exec task_delete_tab 'Model', 'Branch', 'exh_B'
4-- ....

 

View original
Did this topic help you find an answer to your question?
This topic has been closed for replies.

8 replies

Mark Jongeling
Administrator
Forum|alt.badge.img+23

Hi HJ,

From 2023.2 the deletion of generated objects from base models has changed, the deletion of these objects happens only if they are not in use by other objects.

So the domains will be cleaned up if there are no columns using these. The deletion will happen bottom up so once the lowest level is unused, the rest will be cleaned up when running a Generate definition. You should be able to see the Usage of the domains in the Domains screen in the detail tab Usage:

SF > Data model > Domains > Usage

For the Tables, they could be in use by Process actions for example, or in a Menu. Navigate through the details availabke in Subjects. The important screens here are the Links and the Applied to.

Hope this helps out cleaning it up!


Forum|alt.badge.img+6

Hi, 

I already checked the menu's and process flows and functionality.
But these tables are not used in this branch any more.

But still the tables can't be deleted or are getting deleted by Generate definitions:
 

And due to this, 41 exh_ domains are not deleted as they are used in the tables above.

 

I only see that the translations are still there…


We are using the 2023.2.12 version
 


Mark Jongeling
Administrator
Forum|alt.badge.img+23

Can you check the Generated by control procedure value for these tables? In 2023.2, they should be Copied from base model. (See Form > Trace info)

If the value is Copied from base project. then that is most likely the cause of this problem. Fixing that is a little challenging as all related object should be updated as well. If this is the problem, you can try the following and the regenerate the definitions:

1-- Replace with Model and Branch of your choice
2declare @model_id model_id = '{MODEL}', @branch_id branch_id = '{}'
3
4update t1
5set t1.generated_by_control_proc_id = 'Copied from base model'
6from dom t1
7where t1.generated_by_control_proc_id = 'Copied from base project'
8 and t1.model_id = @model_id
9 and t1.branch_id = @branch_id
10
11update t1
12set t1.generated_by_control_proc_id = 'Copied from base model'
13from screen_component_property t1
14where t1.generated_by_control_proc_id = 'Copied from base project'
15 and t1.model_id = @model_id
16 and t1.branch_id = @branch_id
17
18update t1
19set t1.generated_by_control_proc_id = 'Copied from base model'
20from screen_component t1
21where t1.generated_by_control_proc_id = 'Copied from base project'
22 and t1.model_id = @model_id
23 and t1.branch_id = @branch_id
24
25update t1
26set t1.generated_by_control_proc_id = 'Copied from base model'
27from screen_type t1
28where t1.generated_by_control_proc_id = 'Copied from base project'
29 and t1.model_id = @model_id
30 and t1.branch_id = @branch_id
31
32update t1
33set t1.generated_by_control_proc_id = 'Copied from base model'
34from col t1
35where t1.generated_by_control_proc_id = 'Copied from base project'
36 and t1.model_id = @model_id
37 and t1.branch_id = @branch_id
38
39update t1
40set t1.generated_by_control_proc_id = 'Copied from base model'
41from tab t1
42where t1.generated_by_control_proc_id = 'Copied from base project'
43 and t1.model_id = @model_id
44 and t1.branch_id = @branch_id

If for the given model and branch it gives the desired result, you could opt to run it for all models and branches inside your Software Factory.

In 2023.2, Copied from base project should have been replaced entirely by Copied from base model. This is done during the upgrade to 2023.1.


Forum|alt.badge.img+6

I've checked, but these are already properly updated with the upgrade.
There are no results in the SF database for the generated_by_control_proc_id = 'Copied from base project'

 


Mark Jongeling
Administrator
Forum|alt.badge.img+23

Hmm, then we need to be looking even deeper, we need to find where the table is used. The code looks through the following tables to see the table (tab_id) is in use:-

  • linked_model (not present in any other base model) - This could be the most likely cause

Query to check:

1declare @model_id model_id = '{MODEL}', @branch_id branch_id = '{BRANCH}'
2
3select t1.tab_id, l.base_model_id, l.base_branch_id
4from tab t1
5join linked_model l
6 on l.work_model_id = t1.model_id
7 and l.work_branch_id = t1.branch_id
8where t1.model_id = @model_id
9 and t1.branch_id = @branch_id
10 and t1.generated_by_control_proc_id = 'Copied from base model'
11 and exists (select 1
12 from tab b
13 where b.model_id = l.base_model_id
14 and b.branch_id = l.base_branch_id
15 and b.tab_id = t1.tab_id)

If this returns a Base model and branch, it means that table is still present in a Base model that is linked to your work model. That's why the table is not removed.

or else:

Show content
  • automl_model
  • automl_model_fitted
  • automl_model_predictor
  • automl_model_target
  • col (either as tab_id or view_tab_id)
  • col_data_sensitivity
  • conditional_layout
  • cube
  • data_set_tab
  • drag_drop
  • indx
  • list_bar_item map
  • map_base_layer
  • module_item
  • process_action
  • process_action_col_input_parmtr
  • process_action_output_parmtr
  • process_action_start_tab
  • process_action_start_tab_variant
  • process_action_tab_prefilter_input_parmtr
  • ref (either source_tab_id or target_tab_id)
  • role_tab scheduler
  • scheduler_view
  • tab_check_constraint
  • tab_prefilter
  • tab_prefilter_grp
  • tab_prefilter_tag
  • tab_report
  • tab_report_grp
  • tab_tab_drag_drop (either drag_tab_id or drop_tab_id)
  • tab_tab_variant_drag_drop (either drag_tab_id or drop_tab_id) tab_tag
  • tab_task tab_task_grp
  • tab_variant
  • tab_variant_map_overlay
  • tab_variant_tab_drag_drop (either drag_tab_id or drop_tab_id)
  • tab_variant_tab_variant_drag_drop (either drag_tab_id or drop_tab_id)
  • test_case
  • tile

 

Handy query to check thanks to ChatGPT:

1DECLARE @tab_id VARCHAR(50) = 'ext'; -- Replace 'your_tab_id_here' with the tab_id you want to check
2declare @model_id model_id = '{model}', @branch_id branch_id = '{branch}'
3
4IF EXISTS (
5 SELECT 1 FROM (
6 SELECT 'automl_model' AS table_name, tab_id FROM automl_model WHERE model_id = @model_id and branch_id = @branch_id
7 UNION ALL SELECT 'automl_model_fitted', tab_id FROM automl_model_fitted WHERE model_id = @model_id and branch_id = @branch_id
8 UNION ALL SELECT 'automl_model_predictor', tab_id FROM automl_model_predictor WHERE model_id = @model_id and branch_id = @branch_id
9 UNION ALL SELECT 'automl_model_target', tab_id FROM automl_model_target WHERE model_id = @model_id and branch_id = @branch_id
10 UNION ALL SELECT 'col', tab_id FROM col WHERE (tab_id = @tab_id OR view_tab_id = @tab_id) and model_id = @model_id and branch_id = @branch_id
11 UNION ALL SELECT 'col_data_sensitivity', tab_id FROM col_data_sensitivity WHERE model_id = @model_id and branch_id = @branch_id
12 UNION ALL SELECT 'conditional_layout', tab_id FROM conditional_layout WHERE model_id = @model_id and branch_id = @branch_id
13 UNION ALL SELECT 'cube', cube_id FROM cube WHERE model_id = @model_id and branch_id = @branch_id
14 UNION ALL SELECT 'data_set_tab', tab_id FROM data_set_tab WHERE model_id = @model_id and branch_id = @branch_id
15 UNION ALL SELECT 'drag_drop', drag_tab_id FROM drag_drop WHERE model_id = @model_id and branch_id = @branch_id
16 UNION ALL SELECT 'drag_drop', drop_tab_id FROM drag_drop WHERE model_id = @model_id and branch_id = @branch_id
17 UNION ALL SELECT 'indx', tab_id FROM indx WHERE model_id = @model_id and branch_id = @branch_id
18 UNION ALL SELECT 'list_bar_item', tab_id FROM list_bar_item WHERE model_id = @model_id and branch_id = @branch_id
19 UNION ALL SELECT 'map_base_layer', tab_id FROM map_base_layer WHERE model_id = @model_id and branch_id = @branch_id
20 UNION ALL SELECT 'module_item', tab_id FROM module_item WHERE model_id = @model_id and branch_id = @branch_id
21 UNION ALL SELECT 'process_action', tab_id FROM process_action WHERE model_id = @model_id and branch_id = @branch_id
22 UNION ALL SELECT 'process_action_col_input_parmtr', tab_id FROM process_action_col_input_parmtr WHERE model_id = @model_id and branch_id = @branch_id
23 UNION ALL SELECT 'process_action_output_parmtr', tab_id FROM process_action_output_parmtr WHERE model_id = @model_id and branch_id = @branch_id
24 UNION ALL SELECT 'process_action_start_tab', tab_id FROM process_action_start_tab WHERE model_id = @model_id and branch_id = @branch_id
25 UNION ALL SELECT 'process_action_start_tab_variant', tab_id FROM process_action_start_tab_variant WHERE model_id = @model_id and branch_id = @branch_id
26 UNION ALL SELECT 'process_action_tab_prefilter_input_parmtr', tab_id FROM process_action_tab_prefilter_input_parmtr WHERE model_id = @model_id and branch_id = @branch_id
27 UNION ALL SELECT 'ref', source_tab_id AS tab_id FROM ref WHERE source_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
28 UNION ALL SELECT 'ref', target_tab_id AS tab_id FROM ref WHERE target_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
29 UNION ALL SELECT 'role_tab', tab_id FROM role_tab WHERE model_id = @model_id and branch_id = @branch_id
30 UNION ALL SELECT 'scheduler', tab_id FROM scheduler WHERE model_id = @model_id and branch_id = @branch_id
31 UNION ALL SELECT 'scheduler_view', tab_id FROM scheduler_view WHERE model_id = @model_id and branch_id = @branch_id
32 UNION ALL SELECT 'tab_check_constraint', tab_id FROM tab_check_constraint WHERE model_id = @model_id and branch_id = @branch_id
33 UNION ALL SELECT 'tab_prefilter', tab_id FROM tab_prefilter WHERE model_id = @model_id and branch_id = @branch_id
34 UNION ALL SELECT 'tab_prefilter_grp', tab_id FROM tab_prefilter_grp WHERE model_id = @model_id and branch_id = @branch_id
35 UNION ALL SELECT 'tab_prefilter_tag', tab_id FROM tab_prefilter_tag WHERE model_id = @model_id and branch_id = @branch_id
36 UNION ALL SELECT 'tab_report', tab_id FROM tab_report WHERE model_id = @model_id and branch_id = @branch_id
37 UNION ALL SELECT 'tab_report_grp', tab_id FROM tab_report_grp WHERE model_id = @model_id and branch_id = @branch_id
38 UNION ALL SELECT 'tab_tab_drag_drop', drag_tab_id FROM tab_tab_drag_drop WHERE drag_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
39 UNION ALL SELECT 'tab_tab_drag_drop', drop_tab_id FROM tab_tab_drag_drop WHERE drop_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
40 UNION ALL SELECT 'tab_tab_variant_drag_drop', drag_tab_id FROM tab_tab_variant_drag_drop WHERE drag_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
41 UNION ALL SELECT 'tab_tab_variant_drag_drop', drop_tab_id FROM tab_tab_variant_drag_drop WHERE drop_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
42 UNION ALL SELECT 'tab_tag', tab_id FROM tab_tag WHERE model_id = @model_id and branch_id = @branch_id
43 UNION ALL SELECT 'tab_task', tab_id FROM tab_task WHERE model_id = @model_id and branch_id = @branch_id
44 UNION ALL SELECT 'tab_task_grp', tab_id FROM tab_task_grp WHERE model_id = @model_id and branch_id = @branch_id
45 UNION ALL SELECT 'tab_variant', tab_id FROM tab_variant WHERE model_id = @model_id and branch_id = @branch_id
46 UNION ALL SELECT 'tab_variant_map_overlay', tab_id FROM tab_variant_map_overlay WHERE model_id = @model_id and branch_id = @branch_id
47 UNION ALL SELECT 'tab_variant_tab_drag_drop', drag_tab_id FROM tab_variant_tab_drag_drop WHERE drag_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
48 UNION ALL SELECT 'tab_variant_tab_drag_drop', drop_tab_id FROM tab_variant_tab_drag_drop WHERE drop_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
49 UNION ALL SELECT 'tab_variant_tab_variant_drag_drop', drag_tab_id FROM tab_variant_tab_variant_drag_drop WHERE drag_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
50 UNION ALL SELECT 'tab_variant_tab_variant_drag_drop', drop_tab_id FROM tab_variant_tab_variant_drag_drop WHERE drop_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
51 UNION ALL SELECT 'test_case', tab_id FROM test_case WHERE model_id = @model_id and branch_id = @branch_id
52 UNION ALL SELECT 'tile', tab_id FROM tile WHERE model_id = @model_id and branch_id = @branch_id
53 ) AS all_tabs
54 WHERE tab_id = @tab_id
55)
56BEGIN
57 SELECT 'The tab_id is in use in table: ' + table_name
58 FROM (
59 SELECT 'automl_model' AS table_name, tab_id FROM automl_model WHERE model_id = @model_id and branch_id = @branch_id
60 UNION ALL SELECT 'automl_model_fitted', tab_id FROM automl_model_fitted WHERE model_id = @model_id and branch_id = @branch_id
61 UNION ALL SELECT 'automl_model_predictor', tab_id FROM automl_model_predictor WHERE model_id = @model_id and branch_id = @branch_id
62 UNION ALL SELECT 'automl_model_target', tab_id FROM automl_model_target WHERE model_id = @model_id and branch_id = @branch_id
63 UNION ALL SELECT 'col', tab_id FROM col WHERE (tab_id = @tab_id OR view_tab_id = @tab_id) and model_id = @model_id and branch_id = @branch_id
64 UNION ALL SELECT 'col_data_sensitivity', tab_id FROM col_data_sensitivity WHERE model_id = @model_id and branch_id = @branch_id
65 UNION ALL SELECT 'conditional_layout', tab_id FROM conditional_layout WHERE model_id = @model_id and branch_id = @branch_id
66 UNION ALL SELECT 'cube', cube_id FROM cube WHERE model_id = @model_id and branch_id = @branch_id
67 UNION ALL SELECT 'data_set_tab', tab_id FROM data_set_tab WHERE model_id = @model_id and branch_id = @branch_id
68 UNION ALL SELECT 'drag_drop', drag_tab_id FROM drag_drop WHERE model_id = @model_id and branch_id = @branch_id
69 UNION ALL SELECT 'drag_drop', drop_tab_id FROM drag_drop WHERE model_id = @model_id and branch_id = @branch_id
70 UNION ALL SELECT 'indx', tab_id FROM indx WHERE model_id = @model_id and branch_id = @branch_id
71 UNION ALL SELECT 'list_bar_item', tab_id FROM list_bar_item WHERE model_id = @model_id and branch_id = @branch_id
72 UNION ALL SELECT 'map_base_layer', tab_id FROM map_base_layer WHERE model_id = @model_id and branch_id = @branch_id
73 UNION ALL SELECT 'module_item', tab_id FROM module_item WHERE model_id = @model_id and branch_id = @branch_id
74 UNION ALL SELECT 'process_action', tab_id FROM process_action WHERE model_id = @model_id and branch_id = @branch_id
75 UNION ALL SELECT 'process_action_col_input_parmtr', tab_id FROM process_action_col_input_parmtr WHERE model_id = @model_id and branch_id = @branch_id
76 UNION ALL SELECT 'process_action_output_parmtr', tab_id FROM process_action_output_parmtr WHERE model_id = @model_id and branch_id = @branch_id
77 UNION ALL SELECT 'process_action_start_tab', tab_id FROM process_action_start_tab WHERE model_id = @model_id and branch_id = @branch_id
78 UNION ALL SELECT 'process_action_start_tab_variant', tab_id FROM process_action_start_tab_variant WHERE model_id = @model_id and branch_id = @branch_id
79 UNION ALL SELECT 'process_action_tab_prefilter_input_parmtr', tab_id FROM process_action_tab_prefilter_input_parmtr WHERE model_id = @model_id and branch_id = @branch_id
80 UNION ALL SELECT 'ref', source_tab_id AS tab_id FROM ref WHERE source_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
81 UNION ALL SELECT 'ref', target_tab_id AS tab_id FROM ref WHERE target_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
82 UNION ALL SELECT 'role_tab', tab_id FROM role_tab WHERE model_id = @model_id and branch_id = @branch_id
83 UNION ALL SELECT 'scheduler', tab_id FROM scheduler WHERE model_id = @model_id and branch_id = @branch_id
84 UNION ALL SELECT 'scheduler_view', tab_id FROM scheduler_view WHERE model_id = @model_id and branch_id = @branch_id
85 UNION ALL SELECT 'tab_check_constraint', tab_id FROM tab_check_constraint WHERE model_id = @model_id and branch_id = @branch_id
86 UNION ALL SELECT 'tab_prefilter', tab_id FROM tab_prefilter WHERE model_id = @model_id and branch_id = @branch_id
87 UNION ALL SELECT 'tab_prefilter_grp', tab_id FROM tab_prefilter_grp WHERE model_id = @model_id and branch_id = @branch_id
88 UNION ALL SELECT 'tab_prefilter_tag', tab_id FROM tab_prefilter_tag WHERE model_id = @model_id and branch_id = @branch_id
89 UNION ALL SELECT 'tab_report', tab_id FROM tab_report WHERE model_id = @model_id and branch_id = @branch_id
90 UNION ALL SELECT 'tab_report_grp', tab_id FROM tab_report_grp WHERE model_id = @model_id and branch_id = @branch_id
91 UNION ALL SELECT 'tab_tab_drag_drop', drag_tab_id FROM tab_tab_drag_drop WHERE drag_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
92 UNION ALL SELECT 'tab_tab_drag_drop', drop_tab_id FROM tab_tab_drag_drop WHERE drop_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
93 UNION ALL SELECT 'tab_tab_variant_drag_drop', drag_tab_id FROM tab_tab_variant_drag_drop WHERE drag_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
94 UNION ALL SELECT 'tab_tab_variant_drag_drop', drop_tab_id FROM tab_tab_variant_drag_drop WHERE drop_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
95 UNION ALL SELECT 'tab_tag', tab_id FROM tab_tag WHERE model_id = @model_id and branch_id = @branch_id
96 UNION ALL SELECT 'tab_task', tab_id FROM tab_task WHERE model_id = @model_id and branch_id = @branch_id
97 UNION ALL SELECT 'tab_task_grp', tab_id FROM tab_task_grp WHERE model_id = @model_id and branch_id = @branch_id
98 UNION ALL SELECT 'tab_variant', tab_id FROM tab_variant WHERE model_id = @model_id and branch_id = @branch_id
99 UNION ALL SELECT 'tab_variant_map_overlay', tab_id FROM tab_variant_map_overlay WHERE model_id = @model_id and branch_id = @branch_id
100 UNION ALL SELECT 'tab_variant_tab_drag_drop', drag_tab_id FROM tab_variant_tab_drag_drop WHERE drag_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
101 UNION ALL SELECT 'tab_variant_tab_drag_drop', drop_tab_id FROM tab_variant_tab_drag_drop WHERE drop_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
102 UNION ALL SELECT 'tab_variant_tab_variant_drag_drop', drag_tab_id FROM tab_variant_tab_variant_drag_drop WHERE drag_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
103 UNION ALL SELECT 'tab_variant_tab_variant_drag_drop', drop_tab_id FROM tab_variant_tab_variant_drag_drop WHERE drop_tab_id = @tab_id and model_id = @model_id and branch_id = @branch_id
104 UNION ALL SELECT 'test_case', tab_id FROM test_case WHERE model_id = @model_id and branch_id = @branch_id
105 UNION ALL SELECT 'tile', tab_id FROM tile WHERE model_id = @model_id and branch_id = @branch_id
106 ) AS used_table
107 WHERE tab_id = @tab_id
108END
109ELSE
110BEGIN
111 PRINT 'The tab_id is not in use.';
112END
113

 

 


Forum|alt.badge.img+6

The first query gives no results in the branch where I deleted the base model from 
(DEV), but for TEST it still gives results.

The other query to check for results initially resulted in some roles still having the rights for some of the tables and some data sensitivity setup.
These I could remove.

Now only result is returned that it is in use for the table ‘col’ , but that is logical as it still has columns, (but these cannot be deleted via SF).
 

 


Mark Jongeling
Administrator
Forum|alt.badge.img+23
  • Administrator
  • 4034 replies
  • Answer
  • April 12, 2024

Hi HJ, as a final blow you can execute the task_delete_tab via SSMS. Fill in three parameters: Model, Branch, and Table

Then the task will clean up all the tables and underlaying data. That should definitely fix it. 

1exec task_delete_tab 'Model', 'Branch', 'exh_log'
2exec task_delete_tab 'Model', 'Branch', 'exh_A'
3exec task_delete_tab 'Model', 'Branch', 'exh_B'
4-- ....

 


Forum|alt.badge.img+6

The tables with the domains are deleted now from the branch.

Thanks!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings