Null check for ClientResponse in PolicyUril.java
[portal.git] / ecomp-portal-DB-common / EcompPortalDDLMySql_1710_Common.sql
1 -- ---------------------------------------------------------------------------------------------------------------
2 -- This is the 1710 Open Source Version of Ecomp Portal database called portal
3 -- based on 1707 Open Source Version and  Ecomp Portal database called portal 
4
5 -- note to : database admin,  set the mysql system variable called lower_case_table_names
6 --              it can be set 3 different ways: 
7 --                      command-line options (cmd-line), 
8 --                      options valid in configuration files (option file), or 
9 --                      server system variables (system var). 
10
11 -- it needs to be set to 1, then table names are stored in lowercase on disk and comparisons are not case sensitive. 
12 --                          MySql/MariaDB Version compatibility information
13 -- bash-4.2$ mysql --version  – cluster version
14 -- mysql  Ver 15.1 Distrib 10.1.17-MariaDB, for Linux (x86_64) using readline 5.1
15
16 -- All versions newer or older than these DO NOT necessarily mean they are compatible.
17 -- -----------------------------------------------------------------------------------------------------------------
18 set foreign_key_checks=1; 
19
20 create database portal;
21
22 use portal;
23
24 -- ------------------ create table section
25 --
26 -- name: cr_favorite_reports; type: table
27 --
28 create table cr_favorite_reports (
29     user_id integer not null,
30     rep_id integer not null
31 );
32 --
33 -- name: cr_filehist_log; type: table
34 --
35 create table cr_filehist_log (
36     schedule_id numeric(11,0) not null,
37     url character varying(4000),
38     notes character varying(3500),
39     run_time timestamp
40 );
41 --
42 -- name: cr_folder; type: table
43 --
44 create table cr_folder (
45     folder_id integer not null,
46     folder_name character varying(50) not null,
47     descr character varying(500),
48     create_id integer not null,
49     create_date timestamp not null,
50     parent_folder_id integer,
51     public_yn character varying(1) default 'n' not null
52 );
53 --
54 -- name: cr_folder_access; type: table
55 --
56 create table cr_folder_access (
57     folder_access_id numeric(11,0) not null,
58     folder_id numeric(11,0) not null,
59     order_no numeric(11,0) not null,
60     role_id numeric(11,0),
61     user_id numeric(11,0),
62     read_only_yn character varying(1) default 'n' not null
63 );
64 --
65 -- name: cr_hist_user_map; type: table
66 --
67 create table cr_hist_user_map (
68     hist_id int(11) not null,
69     user_id int(11) not null
70 );
71 --
72 -- name: cr_lu_file_type; type: table
73 --
74 create table cr_lu_file_type (
75     lookup_id numeric(2,0) not null,
76     lookup_descr character varying(255) not null,
77     active_yn character(1) default 'y',
78     error_code numeric(11,0)
79 );
80 --
81 -- name: cr_raptor_action_img; type: table
82 --
83 create table cr_raptor_action_img (
84     image_id character varying(100) not null,
85     image_loc character varying(400)
86 );
87 --
88 -- name: cr_raptor_pdf_img; type: table
89 --
90 create table cr_raptor_pdf_img (
91     image_id character varying(100) not null,
92     image_loc character varying(400)
93 );
94 --
95 -- name: cr_remote_schema_info; type: table
96 --
97 create table cr_remote_schema_info (
98     schema_prefix character varying(5) not null,
99     schema_desc character varying(75) not null,
100     datasource_type character varying(100)
101 );
102 --
103 -- name: cr_report; type: table
104 --
105 create table cr_report (
106     rep_id numeric(11,0) not null,
107     title character varying(100) not null,
108     descr character varying(255),
109     public_yn character varying(1) default 'n' not null,
110     report_xml text,
111     create_id numeric(11,0),
112     create_date timestamp default now(),
113     maint_id numeric(11,0),
114     maint_date timestamp default now(), 
115     menu_id character varying(500),
116     menu_approved_yn character varying(1) default 'n' not null,
117     owner_id numeric(11,0),
118     folder_id integer default 0,
119     dashboard_type_yn character varying(1) default 'n',
120     dashboard_yn character varying(1) default 'n'
121 );
122 --
123 -- name: cr_report_access; type: table
124 --
125 create table cr_report_access (
126     rep_id numeric(11,0) not null,
127     order_no numeric(11,0) not null,
128     role_id numeric(11,0),
129     user_id numeric(11,0),
130     read_only_yn character varying(1) default 'n' not null
131 );
132 --
133 -- name: cr_report_dwnld_log; type: table
134 --
135 create table cr_report_dwnld_log (
136     user_id numeric(11,0) not null,
137     rep_id integer not null,
138     file_name character varying(100) not null,
139     dwnld_start_time timestamp default now() not null,
140     record_ready_time timestamp default now(),
141     filter_params character varying(2000)
142 );
143 --
144 -- name: cr_report_email_sent_log; type: table
145 --
146 create table cr_report_email_sent_log (
147     log_id integer not null,
148     schedule_id numeric(11,0),
149     gen_key character varying(25) not null,
150     rep_id numeric(11,0) not null,
151     user_id numeric(11,0),
152     sent_date timestamp default now(),
153     access_flag character varying(1) default 'y' not null,
154     touch_date timestamp default now()
155 );
156 --
157 -- name: cr_report_file_history; type: table
158 --
159 create table cr_report_file_history (
160     hist_id int(11) not null,
161     sched_user_id numeric(11,0) not null,
162     schedule_id numeric(11,0) not null,
163     user_id numeric(11,0) not null,
164     rep_id numeric(11,0),
165     run_date timestamp,
166     recurrence character varying(50),
167     file_type_id numeric(2,0),
168     file_name character varying(80),
169     file_blob blob,
170     file_size numeric(11,0),
171     raptor_url character varying(4000),
172     error_yn character(1) default 'n',
173     error_code numeric(11,0),
174     deleted_yn character(1) default 'n',
175     deleted_by numeric(38,0)
176 );
177 --
178 -- name: cr_report_log; type: table
179 --
180 create table cr_report_log (
181     rep_id numeric(11,0) not null,
182     log_time timestamp not null,
183     user_id numeric(11,0) not null,
184     action character varying(2000) not null,
185     action_value character varying(50),
186     form_fields character varying(4000)
187 );
188 --
189 -- name: cr_report_schedule; type: table
190 --
191 create table cr_report_schedule (
192     schedule_id numeric(11,0) not null,
193     sched_user_id numeric(11,0) not null,
194     rep_id numeric(11,0) not null,
195     enabled_yn character varying(1) not null,
196     start_date timestamp default now(),
197     end_date timestamp default now(),
198     run_date timestamp default now(),
199     recurrence character varying(50),
200     conditional_yn character varying(1) not null,
201     condition_sql character varying(4000),
202     notify_type integer default 0,
203     max_row integer default 1000,
204     initial_formfields character varying(3500),
205     processed_formfields character varying(3500),
206     formfields character varying(3500),
207     condition_large_sql text,
208     encrypt_yn character(1) default 'n',
209     attachment_yn character(1) default 'y'
210 );
211 --
212 -- name: cr_report_schedule_users; type: table
213 --
214 create table cr_report_schedule_users (
215     schedule_id numeric(11,0) not null,
216     rep_id numeric(11,0) not null,
217     user_id numeric(11,0) not null,
218     role_id numeric(11,0),
219     order_no numeric(11,0) not null
220 );
221 --
222 -- name: cr_report_template_map; type: table
223 --
224 create table cr_report_template_map (
225     report_id integer not null,
226     template_file character varying(200)
227 );
228 --
229 -- name: cr_schedule_activity_log; type: table
230 --
231 create table cr_schedule_activity_log (
232     schedule_id numeric(11,0) not null,
233     url character varying(4000),
234     notes character varying(2000),
235     run_time timestamp
236 );
237 --
238 -- name: cr_table_join; type: table
239 --
240 create table cr_table_join (
241     src_table_name character varying(30) not null,
242     dest_table_name character varying(30) not null,
243     join_expr character varying(500) not null
244 );
245 --
246 -- name: cr_table_role; type: table
247 --
248 create table cr_table_role (
249     table_name character varying(30) not null,
250     role_id numeric(11,0) not null
251 );
252 --
253 -- name: cr_table_source; type: table
254 --
255 create table cr_table_source (
256     table_name character varying(30) not null,
257     display_name character varying(30) not null,
258     pk_fields character varying(200),
259     web_view_action character varying(50),
260     large_data_source_yn character varying(1) default 'n' not null,
261     filter_sql character varying(4000),
262     source_db character varying(50)
263 );
264 --
265 -- name: fn_lu_timezone; type: table
266 --
267 create table fn_lu_timezone (
268     timezone_id int(11) not null,
269     timezone_name character varying(100) not null,
270     timezone_value character varying(100) not null
271 );
272
273 create table fn_user (
274     user_id int(11) not null primary key  auto_increment,
275     org_id int(11),
276     manager_id int(11),
277     first_name character varying(50),
278     middle_name character varying(50),
279     last_name character varying(50),
280     phone character varying(25),
281     fax character varying(25),
282     cellular character varying(25),
283     email character varying(50),
284     address_id numeric(11,0),
285     alert_method_cd character varying(10),
286     hrid character varying(20),
287     org_user_id CHARACTER VARYING(20),
288     org_code character varying(30),
289     login_id character varying(25),
290     login_pwd character varying(100),
291     last_login_date timestamp,
292     active_yn character varying(1) default 'y' not null,
293     created_id int(11),
294     created_date timestamp default now(),
295     modified_id int(11),
296     modified_date timestamp default now(),
297     is_internal_yn character(1) default 'n' not null,
298     address_line_1 character varying(100),
299     address_line_2 character varying(100),
300     city character varying(50),
301     state_cd character varying(3),
302     zip_code character varying(11),
303     country_cd character varying(3),
304     location_clli character varying(8),
305     org_manager_userid CHARACTER VARYING(20),
306     company character varying(100),
307     department_name character varying(100),
308     job_title character varying(100),
309     timezone int(11),
310     department character varying(25),
311     business_unit character varying(25),
312     business_unit_name character varying(100),
313     cost_center character varying(25),
314     fin_loc_code character varying(10),
315     silo_status character varying(10)
316 );
317 --
318 -- name: fn_role; type: table
319 --
320 create table fn_role (
321     role_id int(11) not null primary key auto_increment,
322     role_name character varying(300) not null,
323     active_yn character varying(1) default 'y' not null,
324     priority numeric(4,0),
325     app_id int(11) default null,
326     app_role_id int(11) default null
327
328 );
329 --
330 -- name: fn_audit_action; type: table
331 --
332 create table fn_audit_action (
333     audit_action_id integer not null,
334     class_name character varying(500) not null,
335     method_name character varying(50) not null,
336     audit_action_cd character varying(20) not null,
337     audit_action_desc character varying(200),
338     active_yn character varying(1)
339 );
340 --
341 -- name: fn_audit_action_log; type: table
342 --
343 create table fn_audit_action_log (
344     audit_log_id integer not null primary key  auto_increment,
345     audit_action_cd character varying(200),
346     action_time timestamp,
347     user_id numeric(11,0),
348     class_name character varying(100),
349     method_name character varying(50),
350     success_msg character varying(20),
351     error_msg character varying(500)
352 );
353 --
354 -- name: fn_lu_activity; type: table
355 --
356 create table fn_lu_activity (
357     activity_cd character varying(50) not null primary key,
358     activity character varying(50) not null
359 );
360 --
361 -- name: fn_audit_log; type: table
362 --
363 create table fn_audit_log (
364     log_id int(11) not null primary key auto_increment,
365     user_id int(11) not null,
366     activity_cd character varying(50) not null,
367     audit_date timestamp default now() not null,
368     comments character varying(1000),
369     affected_record_id_bk character varying(500),
370     affected_record_id character varying(4000),
371     constraint fk_fn_audit_ref_209_fn_user foreign key (user_id) references fn_user(user_id)
372 );
373 --
374 -- name: fn_broadcast_message; type: table
375 --
376 create table fn_broadcast_message (
377     message_id int(11) not null primary key auto_increment,
378     message_text character varying(1000) not null,
379     message_location_id numeric(11,0) not null,
380     broadcast_start_date timestamp not null  default now(),
381     broadcast_end_date timestamp not null default now(),
382     active_yn character(1) default 'y' not null,
383     sort_order numeric(4,0) not null,
384     broadcast_site_cd character varying(50)
385 );
386 --
387 -- name: fn_chat_logs; type: table
388 --
389 create table fn_chat_logs (
390     chat_log_id integer not null,
391     chat_room_id integer,
392     user_id integer,
393     message character varying(1000),
394     message_date_time timestamp
395 );
396 --
397 -- name: fn_chat_room; type: table
398 --
399 create table fn_chat_room (
400     chat_room_id integer not null,
401     name character varying(50) not null,
402     description character varying(500),
403     owner_id integer,
404     created_date timestamp default now(),
405     updated_date timestamp default now()
406 );
407 --
408 -- name: fn_chat_users; type: table
409 --
410 create table fn_chat_users (
411     chat_room_id integer,
412     user_id integer,
413     last_activity_date_time timestamp,
414     chat_status character varying(20),
415     id integer not null
416 );
417 --
418 -- name: fn_datasource; type: table
419 --
420 create table fn_datasource (
421     id integer not null primary key auto_increment,
422     name character varying(50),
423     driver_name character varying(256),
424     server character varying(256),
425     port integer,
426     user_name character varying(256),
427     password character varying(256),
428     url character varying(256),
429     min_pool_size integer,
430     max_pool_size integer,
431     adapter_id integer,
432     ds_type character varying(20)
433 );
434 --
435 -- name: fn_function; type: table
436 --
437 create table fn_function (
438     function_cd character varying(30) not null primary key,
439     function_name character varying(50) not null
440 );
441 --
442 -- name: fn_lu_alert_method; type: table
443 --
444 create table fn_lu_alert_method (
445     alert_method_cd character varying(10) not null,
446     alert_method character varying(50) not null
447 );
448 --
449 -- name: fn_lu_broadcast_site; type: table
450 --
451 create table fn_lu_broadcast_site (
452     broadcast_site_cd character varying(50) not null,
453     broadcast_site_descr character varying(100)
454 );
455 --
456 -- name: fn_lu_menu_set; type: table
457 --
458 create table fn_lu_menu_set (
459     menu_set_cd character varying(10) not null primary key,
460     menu_set_name character varying(50) not null
461 );
462 --
463 -- name: fn_lu_priority; type: table
464 --
465 create table fn_lu_priority (
466     priority_id numeric(11,0) not null,
467     priority character varying(50) not null,
468     active_yn character(1) not null,
469     sort_order numeric(5,0)
470 );
471 --
472 -- name: fn_lu_role_type; type: table
473 --
474 create table fn_lu_role_type (
475     role_type_id numeric(11,0) not null,
476     role_type character varying(50) not null
477 );
478 --
479 -- name: fn_lu_tab_set; type: table
480 --
481 create table fn_lu_tab_set (
482     tab_set_cd character varying(30) not null,
483     tab_set_name character varying(50) not null
484 );
485 --
486 -- name: fn_menu; type: table
487 --
488 create table fn_menu (
489     menu_id int(11) not null primary key auto_increment,
490     label character varying(100),
491     parent_id int(11),
492     sort_order numeric(4,0),
493     action character varying(200),
494     function_cd character varying(30),
495     active_yn character varying(1) default 'y' not null,
496     servlet character varying(50),
497     query_string character varying(200),
498     external_url character varying(200),
499     target character varying(25),
500     menu_set_cd character varying(10) default 'app',
501     separator_yn character(1) default 'n',
502     image_src character varying(100),
503     constraint fk_fn_menu_ref_196_fn_menu foreign key (parent_id) references fn_menu(menu_id),
504     constraint fk_fn_menu_menu_set_cd foreign key (menu_set_cd) references fn_lu_menu_set(menu_set_cd),
505     constraint fk_fn_menu_ref_223_fn_funct foreign key (function_cd) references fn_function(function_cd)
506 );
507 --
508 -- name: fn_org; type: table
509 --
510 create table fn_org (
511     org_id int(11) not null,
512     org_name character varying(50) not null,
513     access_cd character varying(10)
514 );
515 --
516 -- name: fn_restricted_url; type: table
517 --
518 create table fn_restricted_url (
519     restricted_url character varying(250) not null,
520     function_cd character varying(30) not null
521 );
522 --
523 -- name: fn_role_composite; type: table
524 --
525 create table fn_role_composite (
526     parent_role_id int(11) not null,
527     child_role_id int(11) not null,
528     constraint fk_fn_role_composite_child foreign key (child_role_id) references fn_role(role_id),
529     constraint fk_fn_role_composite_parent foreign key (parent_role_id) references fn_role(role_id)
530 );
531 --
532 -- name: fn_role_function; type: table
533 --
534 create table fn_role_function (
535     role_id int(11) not null,
536     function_cd character varying(30) not null,
537     constraint fk_fn_role__ref_198_fn_role foreign key (role_id) references fn_role(role_id)
538 );
539 --
540 -- name: fn_tab; type: table
541 --
542 create table fn_tab (
543     tab_cd character varying(30) not null,
544     tab_name character varying(50) not null,
545     tab_descr character varying(100),
546     action character varying(100) not null,
547     function_cd character varying(30) not null,
548     active_yn character(1) not null,
549     sort_order numeric(11,0) not null,
550     parent_tab_cd character varying(30),
551     tab_set_cd character varying(30)
552 );
553 --
554 -- name: fn_tab_selected; type: table
555 --
556 create table fn_tab_selected (
557     selected_tab_cd character varying(30) not null,
558     tab_uri character varying(40) not null
559 );
560 --
561 -- name: fn_user_pseudo_role; type: table
562 --
563 create table fn_user_pseudo_role (
564     pseudo_role_id int(11) not null,
565     user_id int(11) not null
566 );
567 --
568 -- name: fn_user_role; type: table
569 --
570 create table fn_user_role (
571     user_id int(10) not null,
572     role_id int(10) not null,
573     priority numeric(4,0),
574     app_id int(11) default 2,
575     constraint fk_fn_user__ref_172_fn_user foreign key (user_id) references fn_user(user_id),
576     constraint fk_fn_user__ref_175_fn_role foreign key (role_id) references fn_role(role_id)
577 );
578 --
579 -- name: schema_info; type: table
580 --
581 create table schema_info (
582     SCHEMA_ID CHARACTER VARYING(25) not null,
583     SCHEMA_DESC CHARACTER VARYING(75) not null,
584     DATASOURCE_TYPE CHARACTER VARYING(100),
585     CONNECTION_URL VARCHAR(200) not null,
586     USER_NAME VARCHAR(45) not null,
587     PASSWORD VARCHAR(45) null default null,
588     DRIVER_CLASS VARCHAR(100) not null,
589     MIN_POOL_SIZE INT not null,
590     MAX_POOL_SIZE INT not null,
591     IDLE_CONNECTION_TEST_PERIOD INT not null
592
593 );
594 -- ----------------------------------------------------------
595 -- name: fn_app; type: table
596 -- ----------------------------------------------------------
597 create table fn_app (
598   app_id int(11) primary key not null auto_increment,
599   app_name varchar(100) not null default '?',
600   app_image_url varchar(256) default null,
601   app_description varchar(512) default null,
602   app_notes varchar(4096) default null,
603   app_url varchar(256) default null,
604   app_alternate_url varchar(256) default null,
605   app_rest_endpoint varchar(2000) default null,
606   ml_app_name varchar(50) not null default '?',
607   ml_app_admin_id varchar(7) not null default '?',
608   mots_id int(11) default null,
609   app_password varchar(256) not null default '?',
610   open char(1) default 'N',
611   enabled char(1) default 'Y',
612   thumbnail mediumblob null default null,
613   app_username varchar(50),
614   ueb_key varchar(256) default null,
615   ueb_secret varchar(256) default null,
616   ueb_topic_name varchar(256) default null,
617   app_type int(11) not null default 1,
618   auth_central char(1) not null default 'N',
619   auth_namespace varchar(100) null default null
620 );
621
622 -- ------------------ functional menu tables -------------------
623 --
624 -- table structure for table fn_menu_functional
625 --
626 create table fn_menu_functional (
627   menu_id int(11) not null auto_increment,
628   column_num int(2) not null,
629   text varchar(100) not null,
630   parent_menu_id int(11) default null,
631   url varchar(128) not null default '',
632   active_yn varchar(1) not null default 'y',
633   image_src varchar(100) default null,
634   primary key (menu_id),
635   key fk_fn_menu_func_parent_menu_id_idx (parent_menu_id),
636   constraint fk_fn_menu_func_parent_menu_id foreign key (parent_menu_id) references fn_menu_functional (menu_id) on delete no action on update no action
637 );
638 --
639 -- table structure for table fn_menu_functional_ancestors
640 --
641
642 create table fn_menu_functional_ancestors (
643   id int(11) not null auto_increment,
644   menu_id int(11) not null,
645   ancestor_menu_id int(11) not null,
646   depth int(2) not null,
647   primary key (id),
648   key fk_fn_menu_func_anc_menu_id_idx (menu_id),
649   key fk_fn_menu_func_anc_anc_menu_id_idx (ancestor_menu_id),
650   constraint fk_fn_menu_func_anc_anc_menu_id foreign key (ancestor_menu_id) references fn_menu_functional (menu_id) on delete no action on update no action,
651   constraint fk_fn_menu_func_anc_menu_id foreign key (menu_id) references fn_menu_functional (menu_id) on delete no action on update no action
652 );
653 --
654 -- table structure for table fn_menu_functional_roles
655 --
656 create table fn_menu_functional_roles (
657   id int(11) not null auto_increment,
658   menu_id int(11) not null,
659   app_id int(11) not null,
660   role_id int(10) not null,
661   primary key (id),
662   key fk_fn_menu_func_roles_menu_id_idx (menu_id),
663   key fk_fn_menu_func_roles_app_id_idx (app_id),
664   key fk_fn_menu_func_roles_role_id_idx (role_id),
665   constraint fk_fn_menu_func_roles_app_id foreign key (app_id) references fn_app (app_id) on delete no action on update no action,
666   constraint fk_fn_menu_func_roles_menu_id foreign key (menu_id) references fn_menu_functional (menu_id) on delete no action on update no action,
667   constraint fk_fn_menu_func_roles_role_id foreign key (role_id) references fn_role (role_id) on delete no action on update no action
668 );
669 -- ----------------------------------------------------------
670 -- NAME: FN_WORKFLOW; TYPE: TABLE
671 -- ----------------------------------------------------------
672 create table fn_workflow (
673   id mediumint(9) not null auto_increment,
674   name varchar(20) not null,
675   description varchar(500) default null,
676   run_link varchar(300) default null,
677   suspend_link varchar(300) default null,
678   modified_link varchar(300) default null,
679   active_yn varchar(300) default null,
680   created varchar(300) default null,
681   created_by int(11) default null,
682   modified varchar(300) default null,
683   modified_by int(11) default null,
684   workflow_key varchar(50) default null,
685   primary key (id),
686   UNIQUE KEY name (name)
687 );
688
689
690 -- ----------------------------------------------------------
691 -- NAME: FN_SCHEDULE_WORKFLOWS; TYPE: TABLE
692 -- ----------------------------------------------------------
693 create table fn_schedule_workflows (
694   id_schedule_workflows bigint(25) primary key not null auto_increment, 
695   workflow_server_url varchar(45) default null,
696   workflow_key varchar(45) not null,
697   workflow_arguments varchar(45) default null,
698   startDateTimeCron varchar(45) default null,
699   endDateTime TIMESTAMP default NOW(),
700   start_date_time TIMESTAMP default NOW(),
701   recurrence varchar(45) default null
702   );
703
704
705 -- ----------------------------------------------------------
706 -- NAME: FN_SHARED_CONTEXT; TYPE: TABLE
707 -- ----------------------------------------------------------  
708 create table fn_shared_context (
709     id int(11) not null auto_increment,
710     create_time timestamp not null,
711     context_id character varying(64) not null,
712     ckey character varying(128) not null,
713         cvalue character varying(1024),
714         primary key (id),
715         UNIQUE KEY session_key (context_id, ckey) );
716
717         
718 -- ----------------------------------------------------------
719 -- NAME: FN_QZ_JOB_DETAILS; TYPE: TABLE
720 -- ----------------------------------------------------------
721 create table fn_qz_job_details (
722 SCHED_NAME VARCHAR(120) not null,
723 JOB_NAME VARCHAR(200) not null,
724 JOB_GROUP VARCHAR(200) not null,
725 DESCRIPTION VARCHAR(250) null,
726 JOB_CLASS_NAME VARCHAR(250) not null,
727 IS_DURABLE VARCHAR(1) not null,
728 IS_NONCONCURRENT VARCHAR(1) not null,
729 IS_UPDATE_DATA VARCHAR(1) not null,
730 REQUESTS_RECOVERY VARCHAR(1) not null,
731 JOB_DATA BLOB null,
732 primary key (SCHED_NAME,JOB_NAME,JOB_GROUP)
733 );
734   
735 -- ----------------------------------------------------------
736 -- NAME: FN_QZ_TRIGGERS; TYPE: TABLE
737 -- ----------------------------------------------------------
738 create table fn_qz_triggers (
739 SCHED_NAME VARCHAR(120) not null,
740 TRIGGER_NAME VARCHAR(200) not null,
741 TRIGGER_GROUP VARCHAR(200) not null,
742 JOB_NAME VARCHAR(200) not null,
743 JOB_GROUP VARCHAR(200) not null,
744 DESCRIPTION VARCHAR(250) null,
745 NEXT_FIRE_TIME BIGINT(13) null,
746 PREV_FIRE_TIME BIGINT(13) null,
747 PRIORITY INTEGER null,
748 TRIGGER_STATE VARCHAR(16) not null,
749 TRIGGER_TYPE VARCHAR(8) not null,
750 START_TIME BIGINT(13) not null,
751 END_TIME BIGINT(13) null,
752 CALENDAR_NAME VARCHAR(200) null,
753 MISFIRE_INSTR SMALLINT(2) null,
754 JOB_DATA BLOB null,
755 primary key (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
756 FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
757 REFERENCES FN_QZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
758 );
759   
760 -- ----------------------------------------------------------
761 -- NAME: FN_QZ_SIMPLE_TRIGGERS; TYPE: TABLE
762 -- ----------------------------------------------------------
763 create table fn_qz_simple_triggers (
764 SCHED_NAME VARCHAR(120) not null,
765 TRIGGER_NAME VARCHAR(200) not null,
766 TRIGGER_GROUP VARCHAR(200) not null,
767 REPEAT_COUNT BIGINT(7) not null,
768 REPEAT_INTERVAL BIGINT(12) not null,
769 TIMES_TRIGGERED BIGINT(10) not null,
770 primary key (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
771 FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
772 REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
773 );
774   
775 -- ----------------------------------------------------------
776 -- NAME: FN_QZ_CRON_TRIGGERS; TYPE: TABLE
777 -- ----------------------------------------------------------
778 create table fn_qz_cron_triggers (
779 SCHED_NAME VARCHAR(120) not null,
780 TRIGGER_NAME VARCHAR(200) not null,
781 TRIGGER_GROUP VARCHAR(200) not null,
782 CRON_EXPRESSION VARCHAR(120) not null,
783 TIME_ZONE_ID VARCHAR(80),
784 primary key (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
785 FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
786 REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
787 );
788   
789 -- ----------------------------------------------------------
790 -- NAME: FN_QZ_SIMPROP_TRIGGERS; TYPE: TABLE
791 -- ----------------------------------------------------------
792 create table fn_qz_simprop_triggers (          
793     SCHED_NAME VARCHAR(120) not null,
794     TRIGGER_NAME VARCHAR(200) not null,
795     TRIGGER_GROUP VARCHAR(200) not null,
796     STR_PROP_1 VARCHAR(512) null,
797     STR_PROP_2 VARCHAR(512) null,
798     STR_PROP_3 VARCHAR(512) null,
799     INT_PROP_1 INT null,
800     INT_PROP_2 INT null,
801     LONG_PROP_1 BIGINT null,
802     LONG_PROP_2 BIGINT null,
803     DEC_PROP_1 NUMERIC(13,4) null,
804     DEC_PROP_2 NUMERIC(13,4) null,
805     BOOL_PROP_1 VARCHAR(1) null,
806     BOOL_PROP_2 VARCHAR(1) null,
807     primary key (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
808     FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) 
809     REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
810 );
811   
812 -- ----------------------------------------------------------
813 -- NAME: FN_QZ_BLOB_TRIGGERS; TYPE: TABLE
814 -- ----------------------------------------------------------
815 create table fn_qz_blob_triggers (
816 SCHED_NAME VARCHAR(120) not null,
817 TRIGGER_NAME VARCHAR(200) not null,
818 TRIGGER_GROUP VARCHAR(200) not null,
819 BLOB_DATA BLOB null,
820 primary key (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
821 INDEX (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP),
822 FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
823 REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
824 );
825   
826 -- ----------------------------------------------------------
827 -- NAME: FN_QZ_CALENDARS; TYPE: TABLE
828 -- ----------------------------------------------------------
829 create table fn_qz_calendars (
830 SCHED_NAME VARCHAR(120) not null,
831 CALENDAR_NAME VARCHAR(200) not null,
832 CALENDAR BLOB not null,
833 primary key (SCHED_NAME,CALENDAR_NAME)
834 );
835
836
837 -- ----------------------------------------------------------
838 -- NAME: FN_QZ_PAUSED_TRIGGER_GRPS; TYPE: TABLE
839 -- ----------------------------------------------------------
840 create table fn_qz_paused_trigger_grps (
841 SCHED_NAME VARCHAR(120) not null,
842 TRIGGER_GROUP VARCHAR(200) not null,
843 primary key (SCHED_NAME,TRIGGER_GROUP)
844 );
845
846 -- ----------------------------------------------------------
847 -- NAME: FN_QZ_FIRED_TRIGGERS; TYPE: TABLE
848 -- ----------------------------------------------------------
849 create table fn_qz_fired_triggers (
850 SCHED_NAME VARCHAR(120) not null,
851 ENTRY_ID VARCHAR(95) not null,
852 TRIGGER_NAME VARCHAR(200) not null,
853 TRIGGER_GROUP VARCHAR(200) not null,
854 INSTANCE_NAME VARCHAR(200) not null,
855 FIRED_TIME BIGINT(13) not null,
856 SCHED_TIME BIGINT(13) not null,
857 PRIORITY INTEGER not null,
858 STATE VARCHAR(16) not null,
859 JOB_NAME VARCHAR(200) null,
860 JOB_GROUP VARCHAR(200) null,
861 IS_NONCONCURRENT VARCHAR(1) null,
862 REQUESTS_RECOVERY VARCHAR(1) null,
863 primary key (SCHED_NAME,ENTRY_ID)
864 );
865
866 -- ----------------------------------------------------------
867 -- NAME: FN_QZ_SCHEDULER_STATE; TYPE: TABLE
868 -- ----------------------------------------------------------
869 create table fn_qz_scheduler_state (
870 SCHED_NAME VARCHAR(120) not null,
871 INSTANCE_NAME VARCHAR(200) not null,
872 LAST_CHECKIN_TIME BIGINT(13) not null,
873 CHECKIN_INTERVAL BIGINT(13) not null,
874 primary key (SCHED_NAME,INSTANCE_NAME)
875 );
876
877 -- ----------------------------------------------------------
878 -- NAME: FN_QZ_LOCKS; TYPE: TABLE
879 -- ----------------------------------------------------------
880 create table fn_qz_locks (
881 SCHED_NAME VARCHAR(120) not null,
882 LOCK_NAME VARCHAR(40) not null,
883 primary key (SCHED_NAME,LOCK_NAME)
884 );
885
886 -- ----------------------------------------------------------
887 -- NAME: FN_MENU_FAVORITES; TYPE: TABLE
888 -- ----------------------------------------------------------
889
890 create table fn_menu_favorites (
891   user_id int(11) not null,
892   menu_id int(11) not null,
893   primary key (user_id,menu_id)
894 );
895
896 -- FACELIFT - Table for Events, News and Resources
897
898 create table fn_common_widget_data(
899         id int auto_increment, 
900         category varchar(32), 
901         href varchar(512), 
902         title varchar(256), 
903         content varchar(4096), 
904         event_date varchar(10), -- YYYY-MM-DD 
905         sort_order int, 
906         primary key (id)
907 );
908
909 create table fn_app_contact_us (
910   app_id int(11) not null,
911   contact_name varchar(128) default null,
912   contact_email varchar(128) default null,
913   url varchar(256) default null,
914   active_yn varchar(2) default null,
915   description varchar(1024) default null,
916   primary key (app_id),
917   constraint fk_fn_a_con__ref_202_fn_app foreign key (app_id) references fn_app (app_id)
918 );
919
920 -- new 1610.2
921 create table fn_pers_user_app_sel (
922   id   int(11) not null auto_increment,
923   user_id   int(11) not null,
924   app_id    int(11) not null,
925   status_cd char(1) not null,
926   primary key(id),
927   constraint fk_1_fn_pers_user_app_sel_fn_user foreign key (user_id) references fn_user (user_id),
928   constraint fk_2_fn_pers_user_app_sel_fn_app  foreign key (app_id)  references fn_app (app_id)
929 );
930
931 -- end new 1610.2
932
933 -- new 1702 tables/views
934  -- 1702 Additions for User Notifications
935  -- ----------------------------------------------------------
936  -- NAME: ep_notification; TYPE: TABLE
937  -- ----------------------------------------------------------
938  create table ep_notification (
939     notification_ID     int(11) primary key not null auto_increment,
940     is_for_online_users char(1) default 'N',
941     is_for_all_roles    char(1) default 'N',
942     active_YN           char(1) default 'Y',
943     msg_header          varchar(100),
944     msg_description     varchar(2000),
945     msg_source          varchar(50) default 'EP',
946     start_time          timestamp default now(),
947     end_time            timestamp null,
948     priority            int(11),
949     creator_ID          int(11) null default null,
950     created_date        timestamp null default null,
951     notification_hyperlink varchar(512) null default null  -- new column for 1710
952    );
953
954  -- ----------------------------------------------------------
955  -- NAME: ep_role_notification; TYPE: TABLE
956  -- ----------------------------------------------------------
957  create table ep_role_notification (
958    ID                  int(11) primary key not null auto_increment,
959    notification_ID     int(11),
960    role_ID             int(11),
961    recv_user_id        int(11) null,
962    constraint fk_ep_role_notif_fn_role foreign key (role_ID) references fn_role(role_id),
963    constraint fk_ep_role_notif_fn_notif foreign key (notification_ID) references ep_notification(notification_ID)
964    );
965    
966  -- ----------------------------------------------------------
967  -- NAME: ep_user_notification; TYPE: TABLE
968  -- ----------------------------------------------------------
969  create table ep_user_notification (
970     ID                  int(11) primary key not null auto_increment,
971     User_ID             int(11),
972     notification_ID     int(11),
973     is_viewed           char(1) default 'N',
974     updated_time        timestamp default now(),
975     constraint fk_ep_urole_notif_fn_user foreign key (User_ID) references fn_user(user_id),
976     constraint fk_ep_urole_notif_fn_notif foreign key (notification_ID) references ep_notification(notification_ID)
977    );
978
979  -- ----------------------------------------------------------
980  -- NAME: ep_pers_user_app_sort; TYPE: Table
981  -- ----------------------------------------------------------
982
983  CREATE TABLE ep_pers_user_app_sort (
984    id        int(11) not null primary key auto_increment,
985    user_id   int(11) not null,
986    sort_pref char(1) not null,
987    unique key uk_1_ep_pers_user_app_sort (user_id),
988    constraint fk_ep_pers_user_app_sort_fn_user foreign key (user_id) references fn_user(user_id)
989  );
990  -- ----------------------------------------------------------
991  -- NAME: ep_pers_user_app_man_sort; TYPE: Table
992  -- ----------------------------------------------------------
993
994  CREATE TABLE ep_pers_user_app_man_sort (
995    id         int(11) not null primary key auto_increment,
996    user_id    int(11) not null,
997    app_id     int(11) not null,
998    sort_order int(11) not null,
999    unique key uk_1_ep_pers_user_app_man_sort (user_id, app_id),
1000    constraint fk_ep_pers_app_man_sort_fn_user foreign key (user_id) references fn_user(user_id),
1001    constraint fk_ep_pers_app_man_sort_fn_app foreign key (app_id) references fn_app(app_id)
1002  );
1003
1004  -- ----------------------------------------------------------
1005  -- NAME: ep_widget_catalog; TYPE: Table
1006  -- ----------------------------------------------------------
1007
1008  CREATE TABLE ep_widget_catalog (
1009    widget_id int(11) not null auto_increment,
1010    wdg_name varchar(100) not null default '?',
1011    service_id int(11) default null,
1012    wdg_desc varchar(200) default null,
1013    wdg_file_loc varchar(256) not null default '?',
1014    all_user_flag char(1) not null default 'N',
1015    primary key (widget_id)
1016  );
1017  
1018  -- ----------------------------------------------------------
1019  -- NAME: ep_widget_catalog_role; TYPE: Table
1020  -- ----------------------------------------------------------
1021  create table ep_widget_catalog_role (
1022    widget_id    int(10) not null,
1023    app_id               int(11) default '1',
1024    role_id              int(10) not null,
1025    key fk_ep_widget_catalog_role_fn_widget (widget_id),
1026    key fk_ep_widget_catalog_role_ref_fn_role (role_id),
1027    key fk_ep_widget_catalog_role_app_id  (app_id),
1028    constraint fk_ep_widget_catalog_role_fn_widget foreign key (widget_id) references ep_widget_catalog (widget_id),
1029    constraint fk_ep_widget_catalog_role_ref_fn_role foreign key (role_id) references fn_role (role_id),
1030    constraint fk_ep_widget_catalog_role_app_id foreign key (app_id) references fn_app (app_id)
1031  );
1032
1033  -- ----------------------------------------------------------
1034  -- NAME: ep_pers_user_widget_placement; TYPE: Table
1035  -- ----------------------------------------------------------
1036  CREATE TABLE ep_pers_user_widget_placement (
1037    id        int(11) not null primary key auto_increment,
1038    user_id   int(11) not null,
1039    widget_id int(11) not null,
1040    x         int(11) not null,
1041    y         int(11),
1042    height    int(11),
1043    width     int(11),
1044    unique key uk_1_ep_pers_user_widg_place (user_id, widget_id),
1045    constraint fk_ep_pers_user_widg_place_fn_user foreign key (user_id) references fn_user(user_id),
1046    constraint fk_ep_pers_user_widg_place_ep_widg foreign key (widget_id) references ep_widget_catalog(widget_id)
1047  );
1048
1049  -- ----------------------------------------------------------
1050  -- NAME: ep_pers_user_widget_sel; TYPE: TABLE
1051  -- ----------------------------------------------------------
1052  CREATE TABLE ep_pers_user_widget_sel (
1053    id        int(11) not null primary key auto_increment,
1054    user_id   int(11) not null,
1055    widget_id int(11) not null,
1056    status_cd char(1) not null,
1057    unique key uk_1_ep_pers_user_widg_sel_user_widg (user_id, widget_id),
1058    CONSTRAINT fk_1_ep_pers_user_wid_sel_fn_user FOREIGN KEY (user_id) REFERENCES fn_user (user_id),
1059    CONSTRAINT fk_2_ep_pers_user_wid_sel_ep_wid FOREIGN KEY (widget_id) REFERENCES ep_widget_catalog (widget_id)
1060  );
1061
1062  -- ----------------------------------------------------------
1063  -- NAME: ep_widget_catalog_files; TYPE: TABLE
1064  -- ----------------------------------------------------------
1065  CREATE TABLE ep_widget_catalog_files (
1066         file_id                 int(11) not null primary key auto_increment,
1067         widget_id               int(11),
1068                 widget_name             VARCHAR(100) NOT NULL,
1069                 framework_js            LONGBLOB NULL,
1070                 controller_js           LONGBLOB NULL,
1071                 markup_html             LONGBLOB NULL,
1072                 widget_css                      LONGBLOB NULL
1073  );
1074
1075  -- ----------------------------------------------------------
1076  -- NAME: fn_role_v; TYPE: VIEW
1077  -- All roles without an APP_ID are Portal only.
1078  -- ----------------------------------------------------------
1079  create view fn_role_v as
1080   select fn_role.role_id as role_id,
1081          fn_role.role_name as role_name,
1082                 fn_role.active_yn as active_yn,
1083          fn_role.priority as priority,
1084          fn_role.app_id as app_id,
1085          fn_role.app_role_id as app_role_id
1086  from fn_role where isnull(fn_role.app_id);
1087
1088 -- end new 1702 tables/views
1089
1090 -- new 1707 tables/views
1091
1092  -- ----------------------------------------------------------
1093  -- NAME: ep_user_roles_request; TYPE: TABLE
1094  -- ----------------------------------------------------------
1095
1096 create table ep_user_roles_request (
1097     req_id int(11) not null primary key auto_increment,
1098     user_id int(11) not null,
1099     app_id int(11) not null,
1100         created_date timestamp default now(),
1101         updated_date timestamp default now(),
1102     request_status character varying(50) not null,
1103         constraint fk_user_roles_req_fn_user foreign key (user_id) references fn_user(user_id),
1104         constraint fk_user_roles_req_fn_app foreign key (app_id) references fn_app(app_id)
1105     );
1106   
1107   
1108  -- ----------------------------------------------------------
1109  -- NAME: ep_user_roles_request_det; TYPE: TABLE
1110  -- ----------------------------------------------------------
1111 create table ep_user_roles_request_det (
1112     id int(11) not null primary key auto_increment,
1113     req_id int(11) default null,
1114         requested_role_id int(10) not null,
1115     request_type character varying(10) not null,
1116     constraint fk_user_roles_req_fn_req_id foreign key (req_id) references ep_user_roles_request(req_id),
1117     constraint fk_user_roles_req_fn_role_id foreign key (requested_role_id) references fn_role(role_id)
1118     );
1119         
1120  -- ----------------------------------------------------------
1121  -- NAME: ep_microservice; TYPE: TABLE
1122  -- ----------------------------------------------------------
1123
1124 CREATE TABLE ep_microservice (
1125         id INT(11) NOT NULL AUTO_INCREMENT,
1126         name VARCHAR(50) NULL DEFAULT NULL,
1127         description VARCHAR(50) NULL DEFAULT NULL,
1128         appId INT(11) NULL DEFAULT NULL,
1129         endpoint_url VARCHAR(200) NULL DEFAULT NULL,
1130         security_type VARCHAR(50) NULL DEFAULT NULL,
1131         username VARCHAR(50) NULL DEFAULT NULL,
1132         password VARCHAR(50) NULL DEFAULT NULL,
1133         active CHAR(1) NOT NULL DEFAULT 'Y',
1134         PRIMARY KEY (id),
1135         CONSTRAINT FK_FN_APP_EP_MICROSERVICE FOREIGN KEY (appId) REFERENCES fn_app (app_id)
1136 );
1137
1138  -- ----------------------------------------------------------
1139  -- NAME: ep_microservice_parameter; TYPE: TABLE
1140  -- ----------------------------------------------------------
1141  
1142 CREATE TABLE ep_microservice_parameter (
1143         id INT(11) NOT NULL AUTO_INCREMENT,
1144         service_id INT(11) NULL DEFAULT NULL,
1145         para_key VARCHAR(50) NULL DEFAULT NULL,
1146         para_value VARCHAR(50) NULL DEFAULT NULL,
1147         PRIMARY KEY (id),
1148         CONSTRAINT FK_EP_MICROSERIVCE_EP_MICROSERVICE_PARAMETER FOREIGN KEY (service_id) REFERENCES ep_microservice (id)
1149 );
1150
1151
1152  -- ----------------------------------------------------------
1153  -- NAME: ep_widget_preview_files; TYPE: TABLE
1154  -- ----------------------------------------------------------
1155  
1156 CREATE TABLE ep_widget_preview_files (
1157         preview_id INT(11) NOT NULL AUTO_INCREMENT,
1158         html_file LONGBLOB NULL,
1159         css_file LONGBLOB NULL,
1160         javascript_file LONGBLOB NULL,
1161         framework_file LONGBLOB NULL,
1162         PRIMARY KEY (preview_id)
1163 );
1164
1165  -- ----------------------------------------------------------
1166  -- NAME: ep_widget_microservice; TYPE: TABLE
1167  -- ----------------------------------------------------------
1168
1169 CREATE TABLE ep_widget_microservice (
1170         id INT(11) NOT NULL AUTO_INCREMENT,
1171         widget_id INT(11) NOT NULL DEFAULT '0',
1172         microservice_id INT(11) NOT NULL DEFAULT '0',
1173         PRIMARY KEY (id),
1174         CONSTRAINT FK_EP_WIDGET_MICROSERVICE_EP_MICROSERVICE FOREIGN KEY (microservice_id) REFERENCES ep_microservice (id),
1175         CONSTRAINT FK_EP_WIDGET_MICROSERVICE_EP_WIDGET FOREIGN KEY (widget_id) REFERENCES ep_widget_catalog (widget_id)
1176 );
1177
1178  -- ----------------------------------------------------------
1179  -- NAME: ep_basic_auth_account; TYPE: TABLE
1180  -- ----------------------------------------------------------
1181  
1182 create table ep_basic_auth_account (
1183         id INT(11) NOT NULL AUTO_INCREMENT,
1184         ext_app_name VARCHAR(50) NOT NULL,
1185         username VARCHAR(50) NOT NULL,
1186         password VARCHAR(50) NOT NULL,
1187     active_yn char(1) NOT NULL default 'Y',
1188         PRIMARY KEY (id)
1189 );
1190
1191  -- ----------------------------------------------------------
1192  -- NAME: ep_widget_catalog_parameter; TYPE: TABLE
1193  -- ----------------------------------------------------------
1194  
1195 create table  ep_widget_catalog_parameter (
1196         id INT(11) NOT NULL AUTO_INCREMENT,
1197         widget_id INT(11) NOT NULL,
1198         user_id INT(11) NOT NULL,
1199         param_id INT(11) NOT NULL,
1200     user_value VARCHAR(50) NULL,
1201         PRIMARY KEY (id),
1202         CONSTRAINT EP_FN_USER_WIDGET_PARAMETER_FK FOREIGN KEY (user_id) REFERENCES fn_user (user_id),
1203         CONSTRAINT EP_WIDGET_CATALOG_WIDGET_PARAMETER_FK FOREIGN KEY (widget_id) REFERENCES ep_widget_catalog (widget_id),
1204         CONSTRAINT EP_PARAMETER_ID_WIDGET_PARAMETER_FK FOREIGN KEY (param_id) REFERENCES ep_microservice_parameter (id)
1205 );
1206
1207  -- ----------------------------------------------------------
1208  -- NAME: ep_web_analytics_source; TYPE: TABLE
1209  -- ----------------------------------------------------------
1210  
1211 create table ep_web_analytics_source(
1212         resource_id int(11) NOT NULL auto_increment,
1213         app_id int(11) NOT NULL,
1214     report_source varchar(500),
1215     report_name  varchar(500),
1216     PRIMARY KEY (resource_id),
1217         FOREIGN KEY (app_id) REFERENCES fn_app(app_id)
1218 ); 
1219
1220  -- Machine Learning Tables
1221  -- ----------------------------------------------------------
1222  -- NAME: ep_ml_model; TYPE: TABLE
1223  -- ----------------------------------------------------------
1224  
1225 create table ep_ml_model(
1226   time_stamp timestamp default now(),
1227   group_id int(11) NOT NULL,
1228   model longblob,
1229   PRIMARY KEY (time_stamp,group_id)
1230 );
1231  -- ----------------------------------------------------------
1232  -- NAME: ep_ml_rec; TYPE: TABLE
1233  -- ----------------------------------------------------------
1234  
1235 create table ep_ml_rec(
1236   time_stamp timestamp default now(),
1237   org_user_id varchar(20) NOT NULL,
1238   rec varchar(4000) DEFAULT NULL,
1239   PRIMARY KEY (time_stamp,org_user_id)
1240 );
1241
1242  -- ----------------------------------------------------------
1243  -- NAME: ep_ml_user; TYPE: TABLE
1244  -- ----------------------------------------------------------
1245  
1246 create table ep_ml_user(
1247   time_stamp timestamp default now(),
1248   org_user_id varchar(20) NOT NULL,
1249   group_id int(11) NOT NULL,
1250   PRIMARY KEY (time_stamp,org_user_id)
1251 );
1252
1253  -- ----------------------------------------------------------
1254  -- NAME: ep_endpoints; TYPE: TABLE
1255  -- ----------------------------------------------------------
1256  
1257 create table  ep_endpoints (
1258         id INT(11) NOT NULL AUTO_INCREMENT,
1259     url VARCHAR(50) NOT NULL,
1260         PRIMARY KEY (id)
1261 );
1262
1263  -- ----------------------------------------------------------
1264  -- NAME: ep_endpoints_basic_auth_account; TYPE: TABLE
1265  -- ----------------------------------------------------------
1266
1267 create table  ep_endpoints_basic_auth_account (
1268         id INT(11) NOT NULL AUTO_INCREMENT,
1269         ep_id INT(11) DEFAULT NULL,
1270         account_id INT(11) DEFAULT NULL,
1271         PRIMARY KEY (id),
1272         CONSTRAINT ep_endpoints_basic_auth_account_account_id_fk FOREIGN KEY (account_id) REFERENCES ep_basic_auth_account (id),
1273         CONSTRAINT ep_endpoints_basic_auth_account_ep_id_fk FOREIGN KEY (ep_id) REFERENCES ep_endpoints (id)
1274
1275 );
1276
1277 -- end new 1707 tables/views
1278
1279 -- new 1710 tables/views
1280
1281  -- ----------------------------------------------------------
1282  -- NAME: ep_app_function; TYPE: TABLE
1283  -- ----------------------------------------------------------
1284
1285 CREATE TABLE ep_app_function (
1286 app_id INT(11) NOT NULL,
1287 function_cd VARCHAR(250) NOT NULL,
1288 function_name VARCHAR(50) NOT NULL,
1289 PRIMARY KEY (function_cd, app_id),
1290 INDEX fk_ep_app_function_app_id (app_id),
1291 CONSTRAINT fk_ep_app_function_app_id FOREIGN KEY (app_id) REFERENCES fn_app (app_id)
1292 );
1293
1294  -- ----------------------------------------------------------
1295  -- NAME: ep_app_role_function; TYPE: TABLE
1296  -- ----------------------------------------------------------
1297
1298 CREATE TABLE `ep_app_role_function` (
1299 `id` INT(11) NOT NULL AUTO_INCREMENT,
1300 `app_id` INT(11) NOT NULL,
1301 `role_id` INT(11) NOT NULL,
1302 `function_cd` VARCHAR(250) NOT NULL,
1303 PRIMARY KEY (`id`),
1304 UNIQUE INDEX `UNIQUE KEY` (`app_id`, `role_id`, `function_cd`),
1305 CONSTRAINT `fk_ep_app_role_function_app_id` FOREIGN KEY (`app_id`) REFERENCES `fn_app` (`app_id`),
1306 CONSTRAINT `fk_ep_app_role_function_ep_app_func` FOREIGN KEY (`app_id`, `function_cd`) REFERENCES `ep_app_function` (`app_id`, `function_cd`),
1307 CONSTRAINT `fk_ep_app_role_function_role_id` FOREIGN KEY (`role_id`) REFERENCES `fn_role` (`role_id`)
1308 );
1309
1310 -- end new 1710 tables/views
1311
1312 -- ----------------------------------------------------------
1313 -- NAME: QUARTZ TYPE: INDEXES
1314 -- ----------------------------------------------------------
1315 create index idx_fn_qz_j_req_recovery on fn_qz_job_details(sched_name,requests_recovery);
1316 create index idx_fn_qz_j_grp on fn_qz_job_details(sched_name,job_group);
1317 create index idx_fn_qz_t_j on fn_qz_triggers(sched_name,job_name,job_group);
1318 create index idx_fn_qz_t_jg on fn_qz_triggers(sched_name,job_group);
1319 create index idx_fn_qz_t_c on fn_qz_triggers(sched_name,calendar_name);
1320 create index idx_fn_qz_t_g on fn_qz_triggers(sched_name,trigger_group);
1321 create index idx_fn_qz_t_state on fn_qz_triggers(sched_name,trigger_state);
1322 create index idx_fn_qz_t_n_state on fn_qz_triggers(sched_name,trigger_name,trigger_group,trigger_state);
1323 create index idx_fn_qz_t_n_g_state on fn_qz_triggers(sched_name,trigger_group,trigger_state);
1324 create index idx_fn_qz_t_next_fire_time on fn_qz_triggers(sched_name,next_fire_time);
1325 create index idx_fn_qz_t_nft_st on fn_qz_triggers(sched_name,trigger_state,next_fire_time);
1326 create index idx_fn_qz_t_nft_misfire on fn_qz_triggers(sched_name,misfire_instr,next_fire_time);
1327 create index idx_fn_qz_t_nft_st_misfire on fn_qz_triggers(sched_name,misfire_instr,next_fire_time,trigger_state);
1328 create index idx_fn_qz_t_nft_st_misfire_grp on fn_qz_triggers(sched_name,misfire_instr,next_fire_time,trigger_group,trigger_state);
1329 create index idx_fn_qz_ft_trig_inst_name on fn_qz_fired_triggers(sched_name,instance_name);
1330 create index idx_fn_qz_ft_inst_job_req_rcvry on fn_qz_fired_triggers(sched_name,instance_name,requests_recovery);
1331 create index idx_fn_qz_ft_j_g on fn_qz_fired_triggers(sched_name,job_name,job_group);
1332 create index idx_fn_qz_ft_jg on fn_qz_fired_triggers(sched_name,job_group);
1333 create index idx_fn_qz_ft_t_g on fn_qz_fired_triggers(sched_name,trigger_name,trigger_group);
1334 create index idx_fn_qz_ft_tg on fn_qz_fired_triggers(sched_name,trigger_group);
1335
1336
1337 -- ------------------ create view section
1338 --
1339 -- name: v_url_access; type: view
1340 --
1341 create view v_url_access as
1342  select distinct m.action as url,
1343     m.function_cd
1344    from fn_menu m
1345   where (m.action is not null)
1346 union
1347  select distinct t.action as url,
1348     t.function_cd
1349    from fn_tab t
1350   where (t.action is not null)
1351 union
1352  select r.restricted_url as url,
1353     r.function_cd
1354    from fn_restricted_url r;
1355    
1356 -- ------------------ alter table add constraint primary key section
1357 --
1358 -- name: cr_favorite_reports_user_idrep_id; type: constraint
1359 --
1360 alter table cr_favorite_reports 
1361     add constraint cr_favorite_reports_user_idrep_id primary key (user_id, rep_id);
1362 --
1363 -- name: cr_folder_folder_id; type: constraint
1364 --
1365 alter table cr_folder
1366     add constraint cr_folder_folder_id primary key (folder_id);
1367 --
1368 -- name: cr_folder_access_folder_access_id; type: constraint
1369 --
1370 alter table cr_folder_access
1371     add constraint cr_folder_access_folder_access_id primary key (folder_access_id);
1372 --
1373 -- name: cr_hist_user_map_hist_iduser_id; type: constraint
1374 --
1375 alter table cr_hist_user_map
1376     add constraint cr_hist_user_map_hist_iduser_id primary key (hist_id, user_id);
1377 --
1378 -- name: cr_lu_file_type_lookup_id; type: constraint
1379 --
1380 alter table cr_lu_file_type
1381     add constraint cr_lu_file_type_lookup_id primary key (lookup_id);
1382 --
1383 -- name: cr_raptor_action_img_image_id; type: constraint
1384 --
1385 alter table cr_raptor_action_img
1386     add constraint cr_raptor_action_img_image_id primary key (image_id);
1387 --
1388 -- name: cr_raptor_pdf_img_image_id; type: constraint
1389 --
1390 alter table cr_raptor_pdf_img
1391     add constraint cr_raptor_pdf_img_image_id primary key (image_id);
1392 --
1393 -- name: cr_remote_schema_info_schema_prefix; type: constraint
1394 --
1395 alter table cr_remote_schema_info
1396     add constraint cr_remote_schema_info_schema_prefix primary key (schema_prefix);
1397 --
1398 -- name: cr_report_rep_id; type: constraint
1399 --
1400 alter table cr_report
1401     add constraint cr_report_rep_id primary key (rep_id);
1402 --
1403 -- name: cr_report_access_rep_idorder_no; type: constraint
1404 --
1405 alter table cr_report_access
1406     add constraint cr_report_access_rep_idorder_no primary key (rep_id, order_no);
1407 --
1408 -- name: cr_report_email_sent_log_log_id; type: constraint
1409 --
1410 alter table cr_report_email_sent_log
1411     add constraint cr_report_email_sent_log_log_id primary key (log_id);
1412 --
1413 -- name: cr_report_file_history_hist_id; type: constraint
1414 --
1415 alter table cr_report_file_history
1416     add constraint cr_report_file_history_hist_id primary key (hist_id);
1417 --
1418 -- name: cr_report_schedule_schedule_id; type: constraint
1419 --
1420 alter table cr_report_schedule
1421     add constraint cr_report_schedule_schedule_id primary key (schedule_id);
1422 --
1423 -- name: cr_report_schedule_users_schedule_idrep_iduser_idorder_no; type: constraint
1424 --
1425 alter table cr_report_schedule_users
1426     add constraint cr_report_schedule_users_schedule_idrep_iduser_idorder_no primary key (schedule_id, rep_id, user_id, order_no);
1427 --
1428 -- name: cr_report_template_map_report_id; type: constraint
1429 --
1430 alter table cr_report_template_map
1431     add constraint cr_report_template_map_report_id primary key (report_id);
1432 --
1433 -- name: cr_table_role_table_namerole_id; type: constraint
1434 --
1435 alter table cr_table_role
1436     add constraint cr_table_role_table_namerole_id primary key (table_name, role_id);
1437 --
1438 -- name: cr_table_source_table_name; type: constraint
1439 --
1440 alter table cr_table_source
1441     add constraint cr_table_source_table_name primary key (table_name);
1442 --
1443 -- name: fn_audit_action_audit_action_id; type: constraint
1444 --
1445 alter table fn_audit_action
1446     add constraint fn_audit_action_audit_action_id primary key (audit_action_id);  
1447 --
1448 --
1449 -- name: fk_fn_audit_ref_205_fn_lu_ac; type: constraint
1450 --
1451 alter table fn_audit_log
1452         add constraint fk_fn_audit_ref_205_fn_lu_ac foreign key (activity_cd) references fn_lu_activity(activity_cd);
1453 --
1454 -- name: fk_fn_role__ref_201_fn_funct; type: constraint
1455 --    
1456 alter table fn_role_function
1457         add constraint fk_fn_role__ref_201_fn_funct foreign key (function_cd) references fn_function(function_cd);
1458 --
1459 -- name: fn_chat_logs_chat_log_id; type: constraint
1460 --
1461 alter table fn_chat_logs
1462     add constraint fn_chat_logs_chat_log_id primary key (chat_log_id);
1463 --
1464 -- name: fn_chat_room_chat_room_id; type: constraint
1465 --
1466 alter table fn_chat_room
1467     add constraint fn_chat_room_chat_room_id primary key (chat_room_id);
1468 --
1469 -- name: fn_chat_users_id; type: constraint
1470 --
1471 alter table fn_chat_users  
1472     add constraint fn_chat_users_id primary key (id);
1473 --
1474 -- name: fn_lu_alert_method_alert_method_cd; type: constraint
1475 --
1476 alter table fn_lu_alert_method
1477     add constraint fn_lu_alert_method_alert_method_cd primary key (alert_method_cd);
1478 --
1479 -- name: fn_lu_broadcast_site_broadcast_site_cd; type: constraint
1480 --
1481 alter table fn_lu_broadcast_site
1482     add constraint fn_lu_broadcast_site_broadcast_site_cd primary key (broadcast_site_cd);
1483 --
1484 -- name: fn_lu_priority_priority_id; type: constraint
1485 --
1486 alter table fn_lu_priority
1487     add constraint fn_lu_priority_priority_id primary key (priority_id);
1488 --
1489 -- name: fn_lu_role_type_role_type_id; type: constraint
1490 --
1491 alter table fn_lu_role_type
1492     add constraint fn_lu_role_type_role_type_id primary key (role_type_id);
1493 --
1494 -- name: fn_lu_tab_set_tab_set_cd; type: constraint
1495 --
1496 alter table fn_lu_tab_set
1497     add constraint fn_lu_tab_set_tab_set_cd primary key (tab_set_cd);
1498 --
1499 -- name: fn_lu_timezone_timezone_id; type: constraint
1500 --
1501 alter table fn_lu_timezone
1502     add constraint fn_lu_timezone_timezone_id primary key (timezone_id);
1503 --
1504 -- name: fn_org_org_id; type: constraint
1505 --
1506 alter table fn_org
1507     add constraint fn_org_org_id primary key (org_id);
1508 --
1509 -- name: fn_restricted_url_restricted_urlfunction_cd; type: constraint
1510 --
1511 alter table fn_restricted_url
1512     add constraint fn_restricted_url_restricted_urlfunction_cd primary key (restricted_url, function_cd);
1513 --
1514 -- name: fn_role_composite_parent_role_idchild_role_id; type: constraint
1515 --
1516 alter table fn_role_composite
1517     add constraint fn_role_composite_parent_role_idchild_role_id primary key (parent_role_id, child_role_id);
1518 --
1519 -- name: fn_role_function_role_idfunction_cd; type: constraint
1520 --
1521 alter table fn_role_function
1522     add constraint fn_role_function_role_idfunction_cd primary key (role_id, function_cd);
1523 --
1524 -- name: fn_tab_tab_cd; type: constraint
1525 --
1526 alter table fn_tab
1527     add constraint fn_tab_tab_cd primary key (tab_cd);
1528 --
1529 -- name: fn_tab_selected_selected_tab_cdtab_uri; type: constraint
1530 --
1531 alter table fn_tab_selected
1532     add constraint fn_tab_selected_selected_tab_cdtab_uri primary key (selected_tab_cd, tab_uri);
1533 --
1534 -- name: fn_user_pseudo_role_pseudo_role_iduser_id; type: constraint
1535 --
1536 alter table fn_user_pseudo_role
1537     add constraint fn_user_pseudo_role_pseudo_role_iduser_id primary key (pseudo_role_id, user_id);
1538 --
1539 -- name: fn_user_role_user_idrole_id; type: constraint
1540 --
1541 alter table fn_user_role
1542     add constraint fn_user_role_user_idrole_id primary key (user_id, role_id, app_id);
1543 -- ------------------ create index section
1544 --
1545 -- name: cr_report_create_idpublic_yntitle; type: index
1546 --
1547 create index cr_report_create_idpublic_yntitle using btree on cr_report (create_id, public_yn, title);
1548 --
1549 -- name: cr_table_join_dest_table_name; type: index
1550 --
1551 create index cr_table_join_dest_table_name using btree on cr_table_join (dest_table_name);
1552 --
1553 -- name: cr_table_join_src_table_name; type: index
1554 --
1555 create index cr_table_join_src_table_name using btree on cr_table_join (src_table_name);
1556 --
1557 -- name: fn_audit_log_activity_cd; type: index
1558 --
1559 create index fn_audit_log_activity_cd using btree on fn_audit_log (activity_cd);
1560 --
1561 -- name: fn_audit_log_user_id; type: index
1562 --
1563 create index fn_audit_log_user_id using btree on fn_audit_log (user_id);
1564 --
1565 -- name: fn_menu_function_cd; type: index
1566 --
1567 create index fn_menu_function_cd using btree on fn_menu (function_cd);
1568 --
1569 -- name: fn_org_access_cd; type: index
1570 --
1571 create index fn_org_access_cd using btree on fn_org (access_cd);
1572 --
1573 -- name: fn_role_function_function_cd; type: index
1574 --
1575 create index fn_role_function_function_cd using btree on fn_role_function (function_cd);
1576 --
1577 -- name: fn_role_function_role_id; type: index
1578 --
1579 create index fn_role_function_role_id using btree on fn_role_function (role_id);
1580 --
1581 -- name: fn_user_address_id; type: index
1582 --
1583 create index fn_user_address_id using btree on fn_user (address_id); 
1584 --
1585 -- name: fn_user_alert_method_cd; type: index
1586 --
1587 create index fn_user_alert_method_cd using btree on fn_user (alert_method_cd); 
1588 --
1589 -- name: fn_user_hrid; type: index
1590 --
1591 create unique index fn_user_hrid using btree on fn_user (hrid); 
1592 --
1593 -- name: fn_user_login_id; type: index
1594 --
1595 create unique index fn_user_login_id using btree on fn_user (login_id); 
1596 --
1597 -- name: fn_user_org_id; type: index
1598 --
1599 create index fn_user_org_id using btree on fn_user (org_id); 
1600 --
1601 -- name: fn_user_role_role_id; type: index
1602 --
1603 create index fn_user_role_role_id using btree on fn_user_role (role_id);
1604 --
1605 -- name: fn_user_role_user_id; type: index
1606 --
1607 create index fn_user_role_user_id using btree on fn_user_role (user_id);
1608 --
1609 -- name: fk_fn_user__ref_178_fn_app_idx; type: index
1610 --
1611 create index fk_fn_user__ref_178_fn_app_idx on fn_user_role (app_id);
1612  --
1613  -- name: fn_role_name_app_id_idx; type: index
1614  --
1615  create unique index fn_role_name_app_id_idx using btree on fn_role (role_name,app_id);
1616  
1617 -- new for 1707
1618  
1619 create index ep_notif_recv_user_id_idx using btree on ep_role_notification (recv_user_id);
1620   
1621 -- end new for 1707
1622
1623 -- ------------------ alter table add constraint foreign key section
1624 --
1625 -- name: fk_fn_user__ref_178_fn_app; type: fk constraint
1626 --
1627 alter table fn_user_role
1628         add constraint fk_fn_user__ref_178_fn_app foreign key (app_id) references fn_app(app_id);
1629 --
1630 -- name: fk_cr_repor_ref_14707_cr_repor; type: fk constraint
1631 --
1632 alter table cr_report_schedule
1633     add constraint fk_cr_repor_ref_14707_cr_repor foreign key (rep_id) references cr_report(rep_id);
1634 --
1635 -- name: fk_cr_repor_ref_14716_cr_repor; type: fk constraint
1636 --
1637 alter table cr_report_schedule_users
1638     add constraint fk_cr_repor_ref_14716_cr_repor foreign key (schedule_id) references cr_report_schedule(schedule_id);
1639 --
1640 -- name: fk_cr_repor_ref_17645_cr_repor; type: fk constraint
1641 --
1642 alter table cr_report_log
1643     add constraint fk_cr_repor_ref_17645_cr_repor foreign key (rep_id) references cr_report(rep_id);
1644 --
1645 -- name: fk_cr_repor_ref_8550_cr_repor; type: fk constraint
1646 --
1647 alter table cr_report_access
1648     add constraint fk_cr_repor_ref_8550_cr_repor foreign key (rep_id) references cr_report(rep_id);
1649 --
1650 -- name: fk_cr_report_rep_id; type: fk constraint
1651 --
1652 alter table cr_report_email_sent_log
1653     add constraint fk_cr_report_rep_id foreign key (rep_id) references cr_report(rep_id);
1654 --
1655 -- name: fk_cr_table_ref_311_cr_tab; type: fk constraint
1656 --
1657 alter table cr_table_join
1658     add constraint fk_cr_table_ref_311_cr_tab foreign key (src_table_name) references cr_table_source(table_name);
1659 --
1660 -- name: fk_cr_table_ref_315_cr_tab; type: fk constraint
1661 --
1662 alter table cr_table_join
1663     add constraint fk_cr_table_ref_315_cr_tab foreign key (dest_table_name) references cr_table_source(table_name);
1664 --
1665 -- name: fk_cr_table_ref_32384_cr_table; type: fk constraint
1666 --
1667 alter table cr_table_role
1668     add constraint fk_cr_table_ref_32384_cr_table foreign key (table_name) references cr_table_source(table_name);
1669 --
1670 -- name: fk_fn_tab_function_cd; type: fk constraint
1671 --
1672 alter table fn_tab
1673     add constraint fk_fn_tab_function_cd foreign key (function_cd) references fn_function(function_cd);
1674 --
1675 -- name: fk_fn_tab_selected_tab_cd; type: fk constraint
1676 --
1677 alter table fn_tab_selected
1678     add constraint fk_fn_tab_selected_tab_cd foreign key (selected_tab_cd) references fn_tab(tab_cd);
1679 --
1680 -- name: fk_fn_tab_set_cd; type: fk constraint
1681 --
1682 alter table fn_tab
1683     add constraint fk_fn_tab_set_cd foreign key (tab_set_cd) references fn_lu_tab_set(tab_set_cd);
1684 --
1685 -- name: fk_fn_user_ref_110_fn_org; type: fk constraint
1686 -- 
1687 alter table fn_user
1688     add constraint fk_fn_user_ref_110_fn_org foreign key (org_id) references fn_org(org_id); 
1689 --
1690 -- name: fk_fn_user_ref_123_fn_lu_al; type: fk constraint
1691 --
1692 alter table fn_user
1693     add constraint fk_fn_user_ref_123_fn_lu_al foreign key (alert_method_cd) references fn_lu_alert_method(alert_method_cd); 
1694 --
1695 -- name: fk_fn_user_ref_197_fn_user; type: fk constraint
1696 --
1697  alter table fn_user
1698     add constraint fk_fn_user_ref_197_fn_user foreign key (manager_id) references fn_user(user_id); 
1699 --
1700 -- name: fk_fn_user_ref_198_fn_user; type: fk constraint
1701 --
1702 alter table fn_user  
1703     add constraint fk_fn_user_ref_198_fn_user foreign key (created_id) references fn_user(user_id); 
1704 --
1705 -- name: fk_fn_user_ref_199_fn_user; type: fk constraint
1706 --
1707 alter table fn_user  
1708     add constraint fk_fn_user_ref_199_fn_user foreign key (modified_id) references fn_user(user_id); 
1709 --
1710 -- name: fk_parent_key_cr_folder; type: fk constraint
1711 --
1712 alter table cr_folder
1713     add constraint fk_parent_key_cr_folder foreign key (parent_folder_id) references cr_folder(folder_id);
1714 --
1715 -- name: fk_pseudo_role_pseudo_role_id; type: fk constraint
1716 --
1717 alter table fn_user_pseudo_role 
1718     add constraint fk_pseudo_role_pseudo_role_id foreign key (pseudo_role_id) references fn_role(role_id);
1719 --
1720 -- name: fk_pseudo_role_user_id; type: fk constraint
1721 --
1722 alter table fn_user_pseudo_role 
1723     add constraint fk_pseudo_role_user_id foreign key (user_id) references fn_user(user_id);
1724 --
1725 -- name: fk_restricted_url_function_cd; type: fk constraint
1726 --
1727 alter table fn_restricted_url
1728     add constraint fk_restricted_url_function_cd foreign key (function_cd) references fn_function(function_cd);
1729 --
1730 -- name: fk_timezone; type: fk constraint
1731 --
1732 alter table fn_user
1733     add constraint fk_timezone foreign key (timezone) references fn_lu_timezone(timezone_id); 
1734 --
1735 -- name: sys_c0014614; type: fk constraint
1736 --
1737 alter table cr_report_file_history
1738     add constraint sys_c0014614 foreign key (file_type_id) references cr_lu_file_type(lookup_id);
1739 --
1740 -- name: sys_c0014615; type: fk constraint
1741 --
1742 alter table cr_report_file_history
1743     add constraint sys_c0014615 foreign key (rep_id) references cr_report(rep_id);
1744 --
1745 -- name: sys_c0014616; type: fk constraint
1746 --
1747 alter table cr_hist_user_map  
1748     add constraint sys_c0014616 foreign key (hist_id) references cr_report_file_history(hist_id);
1749 --
1750 -- name: sys_c0014617; type: fk constraint
1751 --
1752 alter table cr_hist_user_map  
1753     add constraint sys_c0014617 foreign key (user_id) references fn_user(user_id);
1754 --
1755 -- name: sys_c0014618; type: fk constraint
1756 --
1757 alter table fn_menu_favorites
1758 add constraint sys_c0014618 foreign key (user_id) references fn_user(user_id);  
1759     
1760 --
1761 -- name: sys_c0014619; type: fk constraint
1762 --
1763 alter table fn_menu_favorites
1764 add constraint sys_c0014619 foreign key (menu_id) references fn_menu_functional(menu_id);
1765
1766 commit;