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