Changed to unmaintained
[portal/sdk.git] / ecomp-sdk / epsdk-app-os / db-scripts / EcompSdkMySql_Upgrade_1610.2_to_1707_OS.sql
1 -- ---------------------------------------------------------------------------------------------------------------
2 -- This script upgrades the OpenSource ECOMP SDK App database from version 1610.2 to 1707.
3 -- change size on 3 name columns from fn_user for the Opensource version
4 -- changed DS1 icon names to DS2 icon names
5 -- removed unnecessary fn_menu entries, updated fn_menu actions; changes the schema name from ecomp_sdk_os to ecomp_sdk
6 -- ---------------------------------------------------------------------------------------------------------------
7
8 SET FOREIGN_KEY_CHECKS=1; 
9 CREATE DATABASE IF NOT EXISTS ecomp_sdk;
10
11 rename table ecomp_sdk_os.cr_favorite_reports to ecomp_sdk.cr_favorite_reports;
12 rename table ecomp_sdk_os.cr_filehist_log to ecomp_sdk.cr_filehist_log;
13 rename table ecomp_sdk_os.cr_folder to ecomp_sdk.cr_folder;
14 rename table ecomp_sdk_os.cr_folder_access to ecomp_sdk.cr_folder_access;
15 rename table ecomp_sdk_os.cr_hist_user_map to ecomp_sdk.cr_hist_user_map;
16 rename table ecomp_sdk_os.cr_lu_file_type to ecomp_sdk.cr_lu_file_type;
17 rename table ecomp_sdk_os.cr_raptor_action_img to ecomp_sdk.cr_raptor_action_img;
18 rename table ecomp_sdk_os.cr_raptor_pdf_img to ecomp_sdk.cr_raptor_pdf_img;
19 rename table ecomp_sdk_os.cr_remote_schema_info to ecomp_sdk.cr_remote_schema_info;
20 rename table ecomp_sdk_os.cr_report to ecomp_sdk.cr_report;
21 rename table ecomp_sdk_os.cr_report_access to ecomp_sdk.cr_report_access;
22 rename table ecomp_sdk_os.cr_report_dwnld_log to ecomp_sdk.cr_report_dwnld_log;
23 rename table ecomp_sdk_os.cr_report_email_sent_log to ecomp_sdk.cr_report_email_sent_log;
24 rename table ecomp_sdk_os.cr_report_file_history to ecomp_sdk.cr_report_file_history;
25 rename table ecomp_sdk_os.cr_report_log to ecomp_sdk.cr_report_log;
26 rename table ecomp_sdk_os.cr_report_schedule to ecomp_sdk.cr_report_schedule;
27 rename table ecomp_sdk_os.cr_report_schedule_users to ecomp_sdk.cr_report_schedule_users;
28 rename table ecomp_sdk_os.cr_report_template_map to ecomp_sdk.cr_report_template_map;
29 rename table ecomp_sdk_os.cr_schedule_activity_log to ecomp_sdk.cr_schedule_activity_log;
30 rename table ecomp_sdk_os.cr_table_join to ecomp_sdk.cr_table_join;
31 rename table ecomp_sdk_os.cr_table_role to ecomp_sdk.cr_table_role;
32 rename table ecomp_sdk_os.cr_table_source to ecomp_sdk.cr_table_source;
33 rename table ecomp_sdk_os.fn_lu_timezone to ecomp_sdk.fn_lu_timezone;
34 rename table ecomp_sdk_os.fn_user to ecomp_sdk.fn_user;
35 rename table ecomp_sdk_os.fn_role to ecomp_sdk.fn_role;
36 rename table ecomp_sdk_os.fn_audit_action to ecomp_sdk.fn_audit_action;
37 rename table ecomp_sdk_os.fn_audit_action_log to ecomp_sdk.fn_audit_action_log;
38 rename table ecomp_sdk_os.fn_lu_activity to ecomp_sdk.fn_lu_activity;
39 rename table ecomp_sdk_os.fn_audit_log to ecomp_sdk.fn_audit_log;
40 rename table ecomp_sdk_os.fn_broadcast_message to ecomp_sdk.fn_broadcast_message;
41 rename table ecomp_sdk_os.fn_chat_logs to ecomp_sdk.fn_chat_logs;
42 rename table ecomp_sdk_os.fn_chat_room to ecomp_sdk.fn_chat_room;
43 rename table ecomp_sdk_os.fn_chat_users to ecomp_sdk.fn_chat_users;
44 rename table ecomp_sdk_os.fn_datasource to ecomp_sdk.fn_datasource;
45 rename table ecomp_sdk_os.fn_function to ecomp_sdk.fn_function;
46 rename table ecomp_sdk_os.fn_lu_alert_method to ecomp_sdk.fn_lu_alert_method;
47 rename table ecomp_sdk_os.fn_lu_broadcast_site to ecomp_sdk.fn_lu_broadcast_site;
48 rename table ecomp_sdk_os.fn_lu_menu_set to ecomp_sdk.fn_lu_menu_set;
49 rename table ecomp_sdk_os.fn_lu_priority to ecomp_sdk.fn_lu_priority;
50 rename table ecomp_sdk_os.fn_lu_role_type to ecomp_sdk.fn_lu_role_type;
51 rename table ecomp_sdk_os.fn_lu_tab_set to ecomp_sdk.fn_lu_tab_set;
52 rename table ecomp_sdk_os.fn_lu_message_location to ecomp_sdk.fn_lu_message_location;
53 rename table ecomp_sdk_os.fn_menu to ecomp_sdk.fn_menu;
54 rename table ecomp_sdk_os.fn_org to ecomp_sdk.fn_org;
55 rename table ecomp_sdk_os.fn_restricted_url to ecomp_sdk.fn_restricted_url;
56 rename table ecomp_sdk_os.fn_role_composite to ecomp_sdk.fn_role_composite;
57 rename table ecomp_sdk_os.fn_role_function to ecomp_sdk.fn_role_function;
58 rename table ecomp_sdk_os.fn_tab to ecomp_sdk.fn_tab;
59 rename table ecomp_sdk_os.fn_tab_selected to ecomp_sdk.fn_tab_selected;
60 rename table ecomp_sdk_os.fn_user_pseudo_role to ecomp_sdk.fn_user_pseudo_role;
61 rename table ecomp_sdk_os.fn_user_role to ecomp_sdk.fn_user_role;
62 rename table ecomp_sdk_os.schema_info to ecomp_sdk.schema_info;
63 rename table ecomp_sdk_os.fn_app to ecomp_sdk.fn_app;
64 rename table ecomp_sdk_os.fn_workflow to ecomp_sdk.fn_workflow;
65 rename table ecomp_sdk_os.fn_schedule_workflows to ecomp_sdk.fn_schedule_workflows;
66 rename table ecomp_sdk_os.demo_bar_chart to ecomp_sdk.demo_bar_chart;
67 rename table ecomp_sdk_os.demo_bar_chart_inter to ecomp_sdk.demo_bar_chart_inter;
68 rename table ecomp_sdk_os.demo_line_chart to ecomp_sdk.demo_line_chart;
69 rename table ecomp_sdk_os.demo_pie_chart to ecomp_sdk.demo_pie_chart;
70 rename table ecomp_sdk_os.demo_util_chart to ecomp_sdk.demo_util_chart;
71 rename table ecomp_sdk_os.demo_scatter_chart to ecomp_sdk.demo_scatter_chart;
72 rename table ecomp_sdk_os.demo_scatter_plot to ecomp_sdk.demo_scatter_plot;
73 rename table ecomp_sdk_os.fn_qz_job_details to ecomp_sdk.fn_qz_job_details;
74 rename table ecomp_sdk_os.fn_qz_triggers to ecomp_sdk.fn_qz_triggers;
75 rename table ecomp_sdk_os.fn_qz_simple_triggers to ecomp_sdk.fn_qz_simple_triggers;
76 rename table ecomp_sdk_os.fn_qz_cron_triggers to ecomp_sdk.fn_qz_cron_triggers;
77 rename table ecomp_sdk_os.fn_qz_simprop_triggers to ecomp_sdk.fn_qz_simprop_triggers;
78 rename table ecomp_sdk_os.fn_qz_blob_triggers to ecomp_sdk.fn_qz_blob_triggers;
79 rename table ecomp_sdk_os.fn_qz_calendars to ecomp_sdk.fn_qz_calendars;
80 rename table ecomp_sdk_os.fn_qz_paused_trigger_grps to ecomp_sdk.fn_qz_paused_trigger_grps;
81 rename table ecomp_sdk_os.fn_qz_fired_triggers to ecomp_sdk.fn_qz_fired_triggers;
82 rename table ecomp_sdk_os.fn_qz_scheduler_state to ecomp_sdk.fn_qz_scheduler_state;
83 rename table ecomp_sdk_os.fn_qz_locks to ecomp_sdk.fn_qz_locks;
84 rename table ecomp_sdk_os.rcloudinvocation to ecomp_sdk.rcloudinvocation;
85 rename table ecomp_sdk_os.rcloudnotebook to ecomp_sdk.rcloudnotebook;
86
87 USE ecomp_sdk;
88
89 --
90 -- NAME: V_URL_ACCESS; TYPE: VIEW
91 --
92 CREATE VIEW v_url_access AS
93  SELECT DISTINCT M.ACTION AS URL,
94     M.FUNCTION_CD
95    FROM FN_MENU M
96   WHERE (M.ACTION IS NOT NULL)
97 UNION
98  SELECT DISTINCT T.ACTION AS URL,
99     T.FUNCTION_CD
100    FROM FN_TAB T
101   WHERE (T.ACTION IS NOT NULL)
102 UNION
103  SELECT R.RESTRICTED_URL AS URL,
104     R.FUNCTION_CD
105    FROM FN_RESTRICTED_URL R;
106
107 update fn_menu
108 set image_src = 'icon-building-home'
109 where menu_id = 2 and  label = 'Home';
110
111 update fn_menu
112 set image_src = 'icon-documents-book'
113 where menu_id = 5000 and label = 'Sample Pages';
114
115 update fn_menu
116 set image_src = 'icon-misc-piechart'
117 where menu_id = 8 and  label = 'Reports';
118
119 update fn_menu
120 set image_src = 'icon-people-oneperson'
121 where menu_id = 9 and  label = 'Profile';
122
123 update fn_menu
124 set image_src = 'icon-content-star'
125 where menu_id = 10 and label = 'Admin';
126
127 update fn_menu
128 set action = 'samplePage#/collaborate_list'
129 where menu_id = 121 and label = 'Collaboration';
130
131 update fn_menu
132 set action = 'samplePage#/notebook'
133 where menu_id = 150038 and label = 'Notebook';
134
135 update fn_menu
136 set action = 'admin#/admin'
137 where menu_id = 101 and label = 'Roles';
138
139 update fn_menu 
140 set action ='report#/report_wizard' 
141 where menu_id = 87 and label = 'Create Reports';
142
143 delete from fn_menu 
144 where menu_id = 13 and label = 'Application Logout';
145
146 delete from fn_menu 
147 where menu_id = 92 and label = 'Import User';
148
149 delete from fn_menu 
150 where menu_id = 103 and label = 'Broadcast Messages';
151
152 alter table fn_user
153         CHANGE COLUMN FIRST_NAME FIRST_NAME VARCHAR(50) NULL DEFAULT NULL ,
154         CHANGE COLUMN MIDDLE_NAME MIDDLE_NAME VARCHAR(50) NULL DEFAULT NULL ,
155         CHANGE COLUMN LAST_NAME LAST_NAME VARCHAR(50) NULL DEFAULT NULL;
156     
157 INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (89, 'Import', 8, 140, 'report#/report_import', 'menu_reports', 'Y', null, null, null, null, 'APP', 'N', null); 
158 INSERT INTO fn_menu (MENU_ID, LABEL, PARENT_ID, SORT_ORDER, ACTION, FUNCTION_CD, ACTIVE_YN, SERVLET, QUERY_STRING, EXTERNAL_URL, TARGET, MENU_SET_CD, SEPARATOR_YN, IMAGE_SRC) VALUES (150022, 'Menus', 10, 60, 'admin#/admin_menu_edit', 'menu_admin', 'Y', NULL, NULL, NULL, NULL, 'APP', 'N', NULL);
159
160 drop schema ecomp_sdk_os;
161
162 commit;