nexus site path corrected
[portal.git] / ecomp-portal-BE / ecomp-portal-resources / sql scripts / EcompPortalDDLMySql_1610_Complete_OS.sql
1 -- ---------------------------------------------------------------------------------------------------------------
2 -- This is the 1610.2 Open Source Version of Ecomp Portal database called portal
3
4 -- note to : database admin,  set the mysql system variable called lower_case_table_names
5
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
19
20 set foreign_key_checks=1; 
21
22 create database portal;
23
24 use portal;
25 -- ------------------ create table section
26 --
27 -- name: cr_favorite_reports; type: table
28 --
29 create table cr_favorite_reports (
30     user_id integer not null,
31     rep_id integer not null
32 );
33 --
34 -- name: cr_filehist_log; type: table
35 --
36 create table cr_filehist_log (
37     schedule_id numeric(11,0) not null,
38     url character varying(4000),
39     notes character varying(3500),
40     run_time timestamp
41 --    run_time timestamp without time zone
42 );
43 --
44 -- name: cr_folder; type: table
45 --
46 create table cr_folder (
47     folder_id integer not null,
48     folder_name character varying(50) not null,
49     descr character varying(500),
50     create_id integer not null,
51     create_date timestamp not null,
52 --    create_date timestamp without time zone not null,
53     parent_folder_id integer,
54     public_yn character varying(1) default 'n' not null
55 --    public_yn character varying(1) default 'n'::character varying not null
56 );
57 --
58 -- name: cr_folder_access; type: table
59 --
60 create table cr_folder_access (
61     folder_access_id numeric(11,0) not null,
62     folder_id numeric(11,0) not null,
63     order_no numeric(11,0) not null,
64     role_id numeric(11,0),
65     user_id numeric(11,0),
66     read_only_yn character varying(1) default 'n' not null
67 --    read_only_yn character varying(1) default 'n'::character varying not null
68 );
69 --
70 -- name: cr_hist_user_map; type: table
71 --
72 create table cr_hist_user_map (
73     hist_id int(11) not null,
74     user_id int(11) not null
75 );
76 --
77 -- name: cr_lu_file_type; type: table
78 --
79 create table cr_lu_file_type (
80     lookup_id numeric(2,0) not null,
81     lookup_descr character varying(255) not null,
82     active_yn character(1) default 'y',
83 --    active_yn character(1) default 'y'::bpchar,
84     error_code numeric(11,0)
85 );
86 --
87 -- name: cr_raptor_action_img; type: table
88 --
89 create table cr_raptor_action_img (
90     image_id character varying(100) not null,
91     image_loc character varying(400)
92 );
93 --
94 -- name: cr_raptor_pdf_img; type: table
95 --
96 create table cr_raptor_pdf_img (
97     image_id character varying(100) not null,
98     image_loc character varying(400)
99 );
100 --
101 -- name: cr_remote_schema_info; type: table
102 --
103 create table cr_remote_schema_info (
104     schema_prefix character varying(5) not null,
105     schema_desc character varying(75) not null,
106     datasource_type character varying(100)
107 );
108 --
109 -- name: cr_report; type: table
110 --
111 create table cr_report (
112     rep_id numeric(11,0) not null,
113     title character varying(100) not null,
114     descr character varying(255),
115     public_yn character varying(1) default 'n' not null,
116 --    public_yn character varying(1) default 'n'::character varying not null,
117     report_xml text,
118     create_id numeric(11,0),
119     create_date timestamp default now(),
120 --    create_date timestamp without time zone,
121     maint_id numeric(11,0),
122     maint_date timestamp default now(), 
123 --    maint_date timestamp without time zone,
124     menu_id character varying(500),
125     menu_approved_yn character varying(1) default 'n' not null,
126 --    menu_approved_yn character varying(1) default 'n'::character varying not null,
127     owner_id numeric(11,0),
128     folder_id integer default 0,
129     dashboard_type_yn character varying(1) default 'n',
130 --    dashboard_type_yn character varying(1) default 'n'::character varying,
131     dashboard_yn character varying(1) default 'n'
132 --    dashboard_yn character varying(1) default 'n'::character varying
133 );
134 --
135 -- name: cr_report_access; type: table
136 --
137 create table cr_report_access (
138     rep_id numeric(11,0) not null,
139     order_no numeric(11,0) not null,
140     role_id numeric(11,0),
141     user_id numeric(11,0),
142     read_only_yn character varying(1) default 'n' not null
143 --    read_only_yn character varying(1) default 'n'::character varying not null
144 );
145 --
146 -- name: cr_report_dwnld_log; type: table
147 --
148 create table cr_report_dwnld_log (
149     user_id numeric(11,0) not null,
150     rep_id integer not null,
151     file_name character varying(100) not null,
152     dwnld_start_time timestamp default now() not null,
153 --    dwnld_start_time timestamp without time zone not null,
154     record_ready_time timestamp default now(),
155 --    record_ready_time timestamp without time zone,
156     filter_params character varying(2000)
157 );
158 --
159 -- name: cr_report_email_sent_log; type: table
160 --
161 create table cr_report_email_sent_log (
162     log_id integer not null,
163     schedule_id numeric(11,0),
164     gen_key character varying(25) not null,
165     rep_id numeric(11,0) not null,
166     user_id numeric(11,0),
167     sent_date timestamp default now(),
168 --    sent_date timestamp without time zone default now(),
169     access_flag character varying(1) default 'y' not null,
170 --    access_flag character varying(1) default 'y'::character varying not null,
171     touch_date timestamp default now()
172 --    touch_date timestamp without time zone
173 );
174 --
175 -- name: cr_report_file_history; type: table
176 --
177 create table cr_report_file_history (
178     hist_id int(11) not null,
179     sched_user_id numeric(11,0) not null,
180     schedule_id numeric(11,0) not null,
181     user_id numeric(11,0) not null,
182     rep_id numeric(11,0),
183     run_date timestamp,
184 --    run_date timestamp without time zone,
185     recurrence character varying(50),
186     file_type_id numeric(2,0),
187     file_name character varying(80),
188     file_blob blob,
189     file_size numeric(11,0),
190     raptor_url character varying(4000),
191     error_yn character(1) default 'n',
192 --    error_yn character(1) default 'n'::bpchar,
193     error_code numeric(11,0),
194     deleted_yn character(1) default 'n',
195 --    deleted_yn character(1) default 'n'::bpchar,
196     deleted_by numeric(38,0)
197 );
198 --
199 -- name: cr_report_log; type: table
200 --
201 create table cr_report_log (
202     rep_id numeric(11,0) not null,
203     log_time timestamp not null,
204 --    log_time timestamp without time zone not null,
205     user_id numeric(11,0) not null,
206     action character varying(2000) not null,
207     action_value character varying(50),
208     form_fields character varying(4000)
209 );
210 --
211 -- name: cr_report_schedule; type: table
212 --
213 create table cr_report_schedule (
214     schedule_id numeric(11,0) not null,
215     sched_user_id numeric(11,0) not null,
216     rep_id numeric(11,0) not null,
217     enabled_yn character varying(1) not null,
218     start_date timestamp default now(),
219 --    start_date timestamp without time zone,
220     end_date timestamp default now(),
221 --    end_date timestamp without time zone,
222     run_date timestamp default now(),
223 --    run_date timestamp without time zone,
224     recurrence character varying(50),
225     conditional_yn character varying(1) not null,
226     condition_sql character varying(4000),
227     notify_type integer default 0,
228     max_row integer default 1000,
229     initial_formfields character varying(3500),
230     processed_formfields character varying(3500),
231     formfields character varying(3500),
232     condition_large_sql text,
233     encrypt_yn character(1) default 'n',
234 --    encrypt_yn character(1) default 'n'::bpchar,
235     attachment_yn character(1) default 'y'
236 --    attachment_yn character(1) default 'y'::bpchar
237 );
238 --
239 -- name: cr_report_schedule_users; type: table
240 --
241 create table cr_report_schedule_users (
242     schedule_id numeric(11,0) not null,
243     rep_id numeric(11,0) not null,
244     user_id numeric(11,0) not null,
245     role_id numeric(11,0),
246     order_no numeric(11,0) not null
247 );
248 --
249 -- name: cr_report_template_map; type: table
250 --
251 create table cr_report_template_map (
252     report_id integer not null,
253     template_file character varying(200)
254 );
255 --
256 -- name: cr_schedule_activity_log; type: table
257 --
258 create table cr_schedule_activity_log (
259     schedule_id numeric(11,0) not null,
260     url character varying(4000),
261     notes character varying(2000),
262     run_time timestamp
263 --    run_time timestamp without time zone
264 );
265 --
266 -- name: cr_table_join; type: table
267 --
268 create table cr_table_join (
269     src_table_name character varying(30) not null,
270     dest_table_name character varying(30) not null,
271     join_expr character varying(500) not null
272 );
273 --
274 -- name: cr_table_role; type: table
275 --
276 create table cr_table_role (
277     table_name character varying(30) not null,
278     role_id numeric(11,0) not null
279 );
280 --
281 -- name: cr_table_source; type: table
282 --
283 create table cr_table_source (
284     table_name character varying(30) not null,
285     display_name character varying(30) not null,
286     pk_fields character varying(200),
287     web_view_action character varying(50),
288     large_data_source_yn character varying(1) default 'n' not null,
289 --    large_data_source_yn character varying(1) default 'n'::character varying not null,
290     filter_sql character varying(4000),
291     source_db character varying(50)
292 );
293 --
294 -- name: fn_lu_timezone; type: table
295 --
296 create table fn_lu_timezone (
297     timezone_id int(11) not null,
298     timezone_name character varying(100) not null,
299     timezone_value character varying(100) not null
300 );
301
302 create table fn_user (
303     user_id int(11) not null primary key  auto_increment,
304     org_id int(11),
305     manager_id int(11),
306     first_name character varying(25),
307     middle_name character varying(25),
308     last_name character varying(25),
309     phone character varying(25),
310     fax character varying(25),
311     cellular character varying(25),
312     email character varying(50),
313     address_id numeric(11,0),
314     alert_method_cd character varying(10),
315     hrid character varying(20),
316     org_user_id CHARACTER VARYING(20),
317     org_code character varying(30),
318     login_id character varying(25),
319     login_pwd character varying(100),
320     last_login_date timestamp,
321 --    last_login_date timestamp without time zone,
322     active_yn character varying(1) default 'y' not null,
323 --    active_yn character varying(1) default 'y'::character varying not null,
324     created_id int(11),
325     created_date timestamp default now(),
326 --    created_date timestamp without time zone default now(),
327     modified_id int(11),
328     modified_date timestamp default now(),
329 --    modified_date timestamp without time zone default now(),
330     is_internal_yn character(1) default 'n' not null,
331 --    is_internal_yn character(1) default 'n'::bpchar not null,
332     address_line_1 character varying(100),
333     address_line_2 character varying(100),
334     city character varying(50),
335     state_cd character varying(3),
336     zip_code character varying(11),
337     country_cd character varying(3),
338     location_clli character varying(8),
339     org_manager_userid CHARACTER VARYING(20),
340     company character varying(100),
341     department_name character varying(100),
342     job_title character varying(100),
343     timezone int(11),
344     department character varying(25),
345     business_unit character varying(25),
346     business_unit_name character varying(100),
347     cost_center character varying(25),
348     fin_loc_code character varying(10),
349     silo_status character varying(10)
350 );
351 --
352 -- name: fn_role; type: table
353 --
354 create table fn_role (
355     role_id int(11) not null primary key auto_increment,
356     role_name character varying(50) not null,
357     active_yn character varying(1) default 'y' not null,
358 --    active_yn character varying(1) default 'y'::character varying not null,
359     priority numeric(4,0),
360     app_id int(11) default null,
361     app_role_id int(11) default null
362
363 );
364 --
365 -- name: fn_audit_action; type: table
366 --
367 create table fn_audit_action (
368     audit_action_id integer not null,
369     class_name character varying(500) not null,
370     method_name character varying(50) not null,
371     audit_action_cd character varying(20) not null,
372     audit_action_desc character varying(200),
373     active_yn character varying(1)
374 );
375 --
376 -- name: fn_audit_action_log; type: table
377 --
378 create table fn_audit_action_log (
379     audit_log_id integer not null primary key  auto_increment,
380     audit_action_cd character varying(200),
381     action_time timestamp,
382 --    action_time timestamp without time zone,
383     user_id numeric(11,0),
384     class_name character varying(100),
385     method_name character varying(50),
386     success_msg character varying(20),
387     error_msg character varying(500)
388 );
389 --
390 -- name: fn_lu_activity; type: table
391 --
392 create table fn_lu_activity (
393     activity_cd character varying(50) not null primary key,
394     activity character varying(50) not null
395 );
396 --
397 -- name: fn_audit_log; type: table
398 --
399 create table fn_audit_log (
400     log_id int(11) not null primary key auto_increment,
401     user_id int(11) not null,
402     activity_cd character varying(50) not null,
403     audit_date timestamp default now() not null,
404 --    audit_date timestamp without time zone default now() not null,
405     comments character varying(1000),
406     affected_record_id_bk character varying(500),
407     affected_record_id character varying(4000),
408     constraint fk_fn_audit_ref_209_fn_user foreign key (user_id) references fn_user(user_id)
409 );
410 --
411 -- name: fn_broadcast_message; type: table
412 --
413 create table fn_broadcast_message (
414     message_id int(11) not null primary key auto_increment,
415     message_text character varying(1000) not null,
416     message_location_id numeric(11,0) not null,
417     broadcast_start_date timestamp not null  default now(),
418 --    broadcast_start_date timestamp without time zone not null,
419     broadcast_end_date timestamp not null default now(),
420 --    broadcast_end_date timestamp without time zone not null,
421     active_yn character(1) default 'y' not null,
422 --    active_yn character(1) default 'y'::bpchar not null,
423     sort_order numeric(4,0) not null,
424     broadcast_site_cd character varying(50)
425 );
426 --
427 -- name: fn_chat_logs; type: table
428 --
429 create table fn_chat_logs (
430     chat_log_id integer not null,
431     chat_room_id integer,
432     user_id integer,
433     message character varying(1000),
434     message_date_time timestamp
435 --    message_date_time timestamp without time zone
436 );
437 --
438 -- name: fn_chat_room; type: table
439 --
440 create table fn_chat_room (
441     chat_room_id integer not null,
442     name character varying(50) not null,
443     description character varying(500),
444     owner_id integer,
445     created_date timestamp default now(),
446 --    created_date timestamp without time zone,
447     updated_date timestamp default now()
448 --    updated_date timestamp without time zone
449 );
450 --
451 -- name: fn_chat_users; type: table
452 --
453 create table fn_chat_users (
454     chat_room_id integer,
455     user_id integer,
456     last_activity_date_time timestamp,
457 --    last_activity_date_time timestamp without time zone,
458     chat_status character varying(20),
459     id integer not null
460 );
461 --
462 -- name: fn_datasource; type: table
463 --
464 create table fn_datasource (
465     id integer not null primary key auto_increment,
466     name character varying(50),
467     driver_name character varying(256),
468     server character varying(256),
469     port integer,
470     user_name character varying(256),
471     password character varying(256),
472     url character varying(256),
473     min_pool_size integer,
474     max_pool_size integer,
475     adapter_id integer,
476     ds_type character varying(20)
477 );
478 --
479 -- name: fn_function; type: table
480 --
481 create table fn_function (
482     function_cd character varying(30) not null primary key,
483     function_name character varying(50) not null
484 );
485 --
486 -- name: fn_lu_alert_method; type: table
487 --
488 create table fn_lu_alert_method (
489     alert_method_cd character varying(10) not null,
490     alert_method character varying(50) not null
491 );
492 --
493 -- name: fn_lu_broadcast_site; type: table
494 --
495 create table fn_lu_broadcast_site (
496     broadcast_site_cd character varying(50) not null,
497     broadcast_site_descr character varying(100)
498 );
499 --
500 -- name: fn_lu_menu_set; type: table
501 --
502 create table fn_lu_menu_set (
503     menu_set_cd character varying(10) not null primary key,
504     menu_set_name character varying(50) not null
505 );
506 --
507 -- name: fn_lu_priority; type: table
508 --
509 create table fn_lu_priority (
510     priority_id numeric(11,0) not null,
511     priority character varying(50) not null,
512     active_yn character(1) not null,
513     sort_order numeric(5,0)
514 );
515 --
516 -- name: fn_lu_role_type; type: table
517 --
518 create table fn_lu_role_type (
519     role_type_id numeric(11,0) not null,
520     role_type character varying(50) not null
521 );
522 --
523 -- name: fn_lu_tab_set; type: table
524 --
525 create table fn_lu_tab_set (
526     tab_set_cd character varying(30) not null,
527     tab_set_name character varying(50) not null
528 );
529 --
530 -- name: fn_menu; type: table
531 --
532 create table fn_menu (
533     menu_id int(11) not null primary key auto_increment,
534     label character varying(100),
535     parent_id int(11),
536     sort_order numeric(4,0),
537     action character varying(200),
538     function_cd character varying(30),
539     active_yn character varying(1) default 'y' not null,
540 --    active_yn character varying(1) default 'y'::character varying not null,
541     servlet character varying(50),
542     query_string character varying(200),
543     external_url character varying(200),
544     target character varying(25),
545     menu_set_cd character varying(10) default 'app',
546 --    menu_set_cd character varying(10) default 'app'::character varying,
547     separator_yn character(1) default 'n',
548 --    separator_yn character(1) default 'n'::bpchar,
549     image_src character varying(100),
550     constraint fk_fn_menu_ref_196_fn_menu foreign key (parent_id) references fn_menu(menu_id),
551     constraint fk_fn_menu_menu_set_cd foreign key (menu_set_cd) references fn_lu_menu_set(menu_set_cd),
552     constraint fk_fn_menu_ref_223_fn_funct foreign key (function_cd) references fn_function(function_cd)
553 );
554 --
555 -- name: fn_org; type: table
556 --
557 create table fn_org (
558     org_id int(11) not null,
559     org_name character varying(50) not null,
560     access_cd character varying(10)
561 );
562 --
563 -- name: fn_restricted_url; type: table
564 --
565 create table fn_restricted_url (
566     restricted_url character varying(250) not null,
567     function_cd character varying(30) not null
568 );
569 --
570 -- name: fn_role_composite; type: table
571 --
572 create table fn_role_composite (
573     parent_role_id int(11) not null,
574     child_role_id int(11) not null,
575     constraint fk_fn_role_composite_child foreign key (child_role_id) references fn_role(role_id),
576     constraint fk_fn_role_composite_parent foreign key (parent_role_id) references fn_role(role_id)
577 );
578 --
579 -- name: fn_role_function; type: table
580 --
581 create table fn_role_function (
582     role_id int(11) not null,
583     function_cd character varying(30) not null,
584     constraint fk_fn_role__ref_198_fn_role foreign key (role_id) references fn_role(role_id)
585 );
586 --
587 -- name: fn_tab; type: table
588 --
589 create table fn_tab (
590     tab_cd character varying(30) not null,
591     tab_name character varying(50) not null,
592     tab_descr character varying(100),
593     action character varying(100) not null,
594     function_cd character varying(30) not null,
595     active_yn character(1) not null,
596     sort_order numeric(11,0) not null,
597     parent_tab_cd character varying(30),
598     tab_set_cd character varying(30)
599 );
600 --
601 -- name: fn_tab_selected; type: table
602 --
603 create table fn_tab_selected (
604     selected_tab_cd character varying(30) not null,
605     tab_uri character varying(40) not null
606 );
607 --
608 -- name: fn_user_pseudo_role; type: table
609 --
610 create table fn_user_pseudo_role (
611     pseudo_role_id int(11) not null,
612     user_id int(11) not null
613 );
614 --
615 -- name: fn_user_role; type: table
616 --
617 create table fn_user_role (
618     user_id int(10) not null,
619     role_id int(10) not null,
620     priority numeric(4,0),
621     app_id int(11) default 2,
622     constraint fk_fn_user__ref_172_fn_user foreign key (user_id) references fn_user(user_id),
623     constraint fk_fn_user__ref_175_fn_role foreign key (role_id) references fn_role(role_id)
624 );
625 --
626 -- name: schema_info; type: table
627 --
628 create table schema_info (
629     SCHEMA_ID CHARACTER VARYING(25) NOT NULL,
630     SCHEMA_DESC CHARACTER VARYING(75) NOT NULL,
631     DATASOURCE_TYPE CHARACTER VARYING(100),
632     CONNECTION_URL VARCHAR(200) NOT NULL,
633     USER_NAME VARCHAR(45) NOT NULL,
634     PASSWORD VARCHAR(45) NULL DEFAULT NULL,
635     DRIVER_CLASS VARCHAR(100) NOT NULL,
636     MIN_POOL_SIZE INT NOT NULL,
637     MAX_POOL_SIZE INT NOT NULL,
638     IDLE_CONNECTION_TEST_PERIOD INT NOT NULL
639
640 );
641 -- ----------------------------------------------------------
642 -- name: fn_app; type: table
643 -- ----------------------------------------------------------
644 create table fn_app (
645   app_id int(11) primary key not null auto_increment,
646   app_name varchar(100) not null default '?',
647   app_image_url varchar(256) default null,
648   app_description varchar(512) default null,
649   app_notes varchar(4096) default null,
650   app_url varchar(256) default null,
651   app_alternate_url varchar(256) default null,
652   app_rest_endpoint varchar(2000) default null,
653   ml_app_name varchar(50) not null default '?',
654   ml_app_admin_id varchar(7) not null default '?',
655   mots_id int(11) default null,
656   app_password varchar(256) not null default '?',
657   open char(1) default 'n',
658   enabled char(1) default 'y',
659   thumbnail mediumblob null default null,
660   app_username varchar(50),
661   ueb_key varchar(256) default null,
662   ueb_secret varchar(256) default null,
663   ueb_topic_name varchar(256) default null,
664   app_type int(11) not null default 1
665 );
666
667 create table fn_widget (
668   widget_id int(11) primary key not null auto_increment,
669   wdg_name varchar(100) not null default '?',
670   app_id int(11) not null,
671   wdg_width int(4) not null default '0',
672   wdg_height int(4) not null default '0',
673   wdg_url varchar(256) not null default '?',
674   key fk_fn_user__ref_201_fn_app_idx (app_id),
675   constraint fk_fn_user__ref_202_fn_app foreign key (app_id) references fn_app (app_id)
676 );
677 -- ------------------ functional menu tables -------------------
678 --
679 -- table structure for table fn_menu_functional
680 --
681 create table fn_menu_functional (
682   menu_id int(11) not null auto_increment,
683   column_num int(2) not null,
684   text varchar(100) not null,
685   parent_menu_id int(11) default null,
686   url varchar(128) not null default '',
687   active_yn varchar(1) not null default 'y',
688   image_src varchar(100) default null,
689   primary key (menu_id),
690   key fk_fn_menu_func_parent_menu_id_idx (parent_menu_id),
691   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
692 );
693 --
694 -- table structure for table fn_menu_functional_ancestors
695 --
696
697 create table fn_menu_functional_ancestors (
698   id int(11) not null auto_increment,
699   menu_id int(11) not null,
700   ancestor_menu_id int(11) not null,
701   depth int(2) not null,
702   primary key (id),
703   key fk_fn_menu_func_anc_menu_id_idx (menu_id),
704   key fk_fn_menu_func_anc_anc_menu_id_idx (ancestor_menu_id),
705   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,
706   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
707 );
708 --
709 -- table structure for table fn_menu_functional_roles
710 --
711 create table fn_menu_functional_roles (
712   id int(11) not null auto_increment,
713   menu_id int(11) not null,
714   app_id int(11) not null,
715   role_id int(10) not null,
716   primary key (id),
717   key fk_fn_menu_func_roles_menu_id_idx (menu_id),
718   key fk_fn_menu_func_roles_app_id_idx (app_id),
719   key fk_fn_menu_func_roles_role_id_idx (role_id),
720   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,
721   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,
722   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
723 );
724 -- ----------------------------------------------------------
725 -- NAME: FN_WORKFLOW; TYPE: TABLE
726 -- ----------------------------------------------------------
727 create table fn_workflow (
728   id mediumint(9) NOT NULL AUTO_INCREMENT,
729   name varchar(20) NOT NULL,
730   description varchar(500) DEFAULT NULL,
731   run_link varchar(300) DEFAULT NULL,
732   suspend_link varchar(300) DEFAULT NULL,
733   modified_link varchar(300) DEFAULT NULL,
734   active_yn varchar(300) DEFAULT NULL,
735   created varchar(300) DEFAULT NULL,
736   created_by int(11) DEFAULT NULL,
737   modified varchar(300) DEFAULT NULL,
738   modified_by int(11) DEFAULT NULL,
739   workflow_key varchar(50) DEFAULT NULL,
740   PRIMARY KEY (id),
741   UNIQUE KEY name (name)
742 );
743
744
745 -- ----------------------------------------------------------
746 -- NAME: FN_SCHEDULE_WORKFLOWS; TYPE: TABLE
747 -- ----------------------------------------------------------
748 create table fn_schedule_workflows (
749   id_schedule_workflows bigint(25) PRIMARY KEY NOT NULL AUTO_INCREMENT, 
750   workflow_server_url varchar(45) DEFAULT NULL,
751   workflow_key varchar(45) NOT NULL,
752   workflow_arguments varchar(45) DEFAULT NULL,
753   startDateTimeCron varchar(45) DEFAULT NULL,
754   endDateTime TIMESTAMP DEFAULT NOW(),
755   start_date_time TIMESTAMP DEFAULT NOW(),
756   recurrence varchar(45) DEFAULT NULL
757   );
758
759
760 -- ----------------------------------------------------------
761 -- NAME: FN_SHARED_CONTEXT; TYPE: TABLE
762 -- ----------------------------------------------------------  
763 create table fn_shared_context (
764     id int(11) not null auto_increment,
765     create_time timestamp not null,
766     context_id character varying(64) not null,
767     ckey character varying(128) not null,
768         cvalue character varying(1024),
769         primary key (id),
770         UNIQUE KEY session_key (context_id, ckey) );
771
772         
773 -- ----------------------------------------------------------
774 -- NAME: FN_QZ_JOB_DETAILS; TYPE: TABLE
775 -- ----------------------------------------------------------
776 create table fn_qz_job_details (
777 SCHED_NAME VARCHAR(120) NOT NULL,
778 JOB_NAME VARCHAR(200) NOT NULL,
779 JOB_GROUP VARCHAR(200) NOT NULL,
780 DESCRIPTION VARCHAR(250) NULL,
781 JOB_CLASS_NAME VARCHAR(250) NOT NULL,
782 IS_DURABLE VARCHAR(1) NOT NULL,
783 IS_NONCONCURRENT VARCHAR(1) NOT NULL,
784 IS_UPDATE_DATA VARCHAR(1) NOT NULL,
785 REQUESTS_RECOVERY VARCHAR(1) NOT NULL,
786 JOB_DATA BLOB NULL,
787 PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
788 );
789   
790 -- ----------------------------------------------------------
791 -- NAME: FN_QZ_TRIGGERS; TYPE: TABLE
792 -- ----------------------------------------------------------
793 create table fn_qz_triggers (
794 SCHED_NAME VARCHAR(120) NOT NULL,
795 TRIGGER_NAME VARCHAR(200) NOT NULL,
796 TRIGGER_GROUP VARCHAR(200) NOT NULL,
797 JOB_NAME VARCHAR(200) NOT NULL,
798 JOB_GROUP VARCHAR(200) NOT NULL,
799 DESCRIPTION VARCHAR(250) NULL,
800 NEXT_FIRE_TIME BIGINT(13) NULL,
801 PREV_FIRE_TIME BIGINT(13) NULL,
802 PRIORITY INTEGER NULL,
803 TRIGGER_STATE VARCHAR(16) NOT NULL,
804 TRIGGER_TYPE VARCHAR(8) NOT NULL,
805 START_TIME BIGINT(13) NOT NULL,
806 END_TIME BIGINT(13) NULL,
807 CALENDAR_NAME VARCHAR(200) NULL,
808 MISFIRE_INSTR SMALLINT(2) NULL,
809 JOB_DATA BLOB NULL,
810 PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
811 FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)
812 REFERENCES FN_QZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)
813 );
814   
815 -- ----------------------------------------------------------
816 -- NAME: FN_QZ_SIMPLE_TRIGGERS; TYPE: TABLE
817 -- ----------------------------------------------------------
818 create table fn_qz_simple_triggers (
819 SCHED_NAME VARCHAR(120) NOT NULL,
820 TRIGGER_NAME VARCHAR(200) NOT NULL,
821 TRIGGER_GROUP VARCHAR(200) NOT NULL,
822 REPEAT_COUNT BIGINT(7) NOT NULL,
823 REPEAT_INTERVAL BIGINT(12) NOT NULL,
824 TIMES_TRIGGERED BIGINT(10) NOT NULL,
825 PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
826 FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
827 REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
828 );
829   
830 -- ----------------------------------------------------------
831 -- NAME: FN_QZ_CRON_TRIGGERS; TYPE: TABLE
832 -- ----------------------------------------------------------
833 create table fn_qz_cron_triggers (
834 SCHED_NAME VARCHAR(120) NOT NULL,
835 TRIGGER_NAME VARCHAR(200) NOT NULL,
836 TRIGGER_GROUP VARCHAR(200) NOT NULL,
837 CRON_EXPRESSION VARCHAR(120) NOT NULL,
838 TIME_ZONE_ID VARCHAR(80),
839 PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
840 FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
841 REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
842 );
843   
844 -- ----------------------------------------------------------
845 -- NAME: FN_QZ_SIMPROP_TRIGGERS; TYPE: TABLE
846 -- ----------------------------------------------------------
847 create table fn_qz_simprop_triggers (          
848     SCHED_NAME VARCHAR(120) NOT NULL,
849     TRIGGER_NAME VARCHAR(200) NOT NULL,
850     TRIGGER_GROUP VARCHAR(200) NOT NULL,
851     STR_PROP_1 VARCHAR(512) NULL,
852     STR_PROP_2 VARCHAR(512) NULL,
853     STR_PROP_3 VARCHAR(512) NULL,
854     INT_PROP_1 INT NULL,
855     INT_PROP_2 INT NULL,
856     LONG_PROP_1 BIGINT NULL,
857     LONG_PROP_2 BIGINT NULL,
858     DEC_PROP_1 NUMERIC(13,4) NULL,
859     DEC_PROP_2 NUMERIC(13,4) NULL,
860     BOOL_PROP_1 VARCHAR(1) NULL,
861     BOOL_PROP_2 VARCHAR(1) NULL,
862     PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
863     FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) 
864     REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
865 );
866   
867 -- ----------------------------------------------------------
868 -- NAME: FN_QZ_BLOB_TRIGGERS; TYPE: TABLE
869 -- ----------------------------------------------------------
870 create table fn_qz_blob_triggers (
871 SCHED_NAME VARCHAR(120) NOT NULL,
872 TRIGGER_NAME VARCHAR(200) NOT NULL,
873 TRIGGER_GROUP VARCHAR(200) NOT NULL,
874 BLOB_DATA BLOB NULL,
875 PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
876 INDEX (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP),
877 FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
878 REFERENCES FN_QZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)
879 );
880   
881 -- ----------------------------------------------------------
882 -- NAME: FN_QZ_CALENDARS; TYPE: TABLE
883 -- ----------------------------------------------------------
884 create table fn_qz_calendars (
885 SCHED_NAME VARCHAR(120) NOT NULL,
886 CALENDAR_NAME VARCHAR(200) NOT NULL,
887 CALENDAR BLOB NOT NULL,
888 PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)
889 );
890
891
892 -- ----------------------------------------------------------
893 -- NAME: FN_QZ_PAUSED_TRIGGER_GRPS; TYPE: TABLE
894 -- ----------------------------------------------------------
895 create table fn_qz_paused_trigger_grps (
896 SCHED_NAME VARCHAR(120) NOT NULL,
897 TRIGGER_GROUP VARCHAR(200) NOT NULL,
898 PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)
899 );
900
901 -- ----------------------------------------------------------
902 -- NAME: FN_QZ_FIRED_TRIGGERS; TYPE: TABLE
903 -- ----------------------------------------------------------
904 create table fn_qz_fired_triggers (
905 SCHED_NAME VARCHAR(120) NOT NULL,
906 ENTRY_ID VARCHAR(95) NOT NULL,
907 TRIGGER_NAME VARCHAR(200) NOT NULL,
908 TRIGGER_GROUP VARCHAR(200) NOT NULL,
909 INSTANCE_NAME VARCHAR(200) NOT NULL,
910 FIRED_TIME BIGINT(13) NOT NULL,
911 SCHED_TIME BIGINT(13) NOT NULL,
912 PRIORITY INTEGER NOT NULL,
913 STATE VARCHAR(16) NOT NULL,
914 JOB_NAME VARCHAR(200) NULL,
915 JOB_GROUP VARCHAR(200) NULL,
916 IS_NONCONCURRENT VARCHAR(1) NULL,
917 REQUESTS_RECOVERY VARCHAR(1) NULL,
918 PRIMARY KEY (SCHED_NAME,ENTRY_ID)
919 );
920
921 -- ----------------------------------------------------------
922 -- NAME: FN_QZ_SCHEDULER_STATE; TYPE: TABLE
923 -- ----------------------------------------------------------
924 create table fn_qz_scheduler_state (
925 SCHED_NAME VARCHAR(120) NOT NULL,
926 INSTANCE_NAME VARCHAR(200) NOT NULL,
927 LAST_CHECKIN_TIME BIGINT(13) NOT NULL,
928 CHECKIN_INTERVAL BIGINT(13) NOT NULL,
929 PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)
930 );
931
932 -- ----------------------------------------------------------
933 -- NAME: FN_QZ_LOCKS; TYPE: TABLE
934 -- ----------------------------------------------------------
935 create table fn_qz_locks (
936 SCHED_NAME VARCHAR(120) NOT NULL,
937 LOCK_NAME VARCHAR(40) NOT NULL,
938 PRIMARY KEY (SCHED_NAME,LOCK_NAME)
939 );
940
941 -- ----------------------------------------------------------
942 -- NAME: FN_MENU_FAVORITES; TYPE: TABLE
943 -- ----------------------------------------------------------
944
945 create table fn_menu_favorites (
946   user_id int(11) NOT NULL,
947   menu_id int(11) NOT NULL,
948   PRIMARY KEY (user_id,menu_id)
949 );
950
951 --
952 -- NAME: KPI_API_STATS; TYPE: TABLE 
953 --
954 create table kpi_api_stats (
955     api_type varchar(64),
956     total_api int(11),
957     comment varchar(256)
958 );
959
960 --
961 -- NAME: KPI_SERVICE_SUPPORTED; TYPE: TABLE 
962 --
963 create table kpi_service_supported (
964     service_type varchar(100),
965     total_count int(11)
966 );
967
968 --
969 -- NAME: KPI_USER_STORY_STATS1; TYPE: TABLE 
970 --
971 create table kpi_user_story_stats1 (
972     release_key varchar(50),
973     delivered int(11),
974     in_progress int(11),
975     IST_progress_readiness varchar(50),
976         E2E_progress_readiness varchar(50),
977     Key_Highlights varchar(200)
978 );
979
980 --
981 -- NAME: KPI_DRVOLUMES; TYPE: TABLE 
982 --
983 create table kpi_drvolumes (
984     day date,
985     feedid int(11),
986     filespublished int(11),
987     bytespublished bigint(20),
988     filesdelivered int(11),
989     bytesdelivered bigint(20),
990         filesexpired int(11),
991     bytesexpired bigint(20),
992     PRIMARY KEY (day, feedid)
993 );
994
995 --
996 -- NAME: KPI_DRSUMM; TYPE: TABLE 
997 --
998 create table kpi_drsumm (
999     day date PRIMARY KEY,
1000     totalfeeds int(11),
1001     activefeeds int(11),
1002     activesubs int(11)
1003 );
1004
1005 --
1006 -- NAME: DEMO_KPI_SOURCECODE_STATS; TYPE: TABLE 
1007 --
1008 create table demo_kpi_sourcecode_stats (
1009     day date,
1010     repo_name varchar(75),
1011     category varchar(32),
1012     total_lines int(11),
1013     inserts int(11),
1014     deletes int(11),
1015     since date,
1016     category1 varchar(50)
1017 );
1018
1019 -- FACELIFT - Table for Events, News and Resources
1020
1021 create table fn_common_widget_data(
1022         id int auto_increment, 
1023         CATEGORY varchar(100), 
1024         HREF varchar(500), 
1025         TITLE varchar(200), 
1026         content varchar(10000), 
1027         event_date varchar(200), 
1028         SORT_ORDER int, 
1029         PRIMARY KEY (id)
1030 );
1031
1032 create table fn_app_contact_us (
1033   app_id int(11) NOT NULL,
1034   contact_name varchar(128) DEFAULT NULL,
1035   contact_email varchar(128) DEFAULT NULL,
1036   url varchar(256) DEFAULT NULL,
1037   active_yn varchar(2) DEFAULT NULL,
1038   description varchar(1024) DEFAULT NULL,
1039   PRIMARY KEY (app_id),
1040   constraint fk_fn_a_con__ref_202_fn_app foreign key (app_id) references fn_app (app_id)
1041 );
1042
1043 -- new 1610.2
1044 create table if not exists fn_pers_user_app_sel (
1045   id   int(11) NOT NULL auto_increment,
1046   user_id   int(11) NOT NULL,
1047   app_id    int(11) NOT NULL,
1048   status_cd char(1) NOT NULL,
1049   primary key(id),
1050   unique key uk_1_fn_pers_user_app_sel_user_app (user_id, app_id),
1051   constraint fk_1_fn_pers_user_app_sel_fn_user foreign key (user_id) references fn_user (user_id),
1052   constraint fk_2_fn_pers_user_app_sel_fn_app  foreign key (app_id)  references fn_app (app_id)
1053 );
1054
1055 -- end new 1610.2
1056
1057 -- ----------------------------------------------------------
1058 -- NAME: QUARTZ TYPE: INDEXES
1059 -- ----------------------------------------------------------
1060 create index idx_fn_qz_j_req_recovery on fn_qz_job_details(sched_name,requests_recovery);
1061 create index idx_fn_qz_j_grp on fn_qz_job_details(sched_name,job_group);
1062 create index idx_fn_qz_t_j on fn_qz_triggers(sched_name,job_name,job_group);
1063 create index idx_fn_qz_t_jg on fn_qz_triggers(sched_name,job_group);
1064 create index idx_fn_qz_t_c on fn_qz_triggers(sched_name,calendar_name);
1065 create index idx_fn_qz_t_g on fn_qz_triggers(sched_name,trigger_group);
1066 create index idx_fn_qz_t_state on fn_qz_triggers(sched_name,trigger_state);
1067 create index idx_fn_qz_t_n_state on fn_qz_triggers(sched_name,trigger_name,trigger_group,trigger_state);
1068 create index idx_fn_qz_t_n_g_state on fn_qz_triggers(sched_name,trigger_group,trigger_state);
1069 create index idx_fn_qz_t_next_fire_time on fn_qz_triggers(sched_name,next_fire_time);
1070 create index idx_fn_qz_t_nft_st on fn_qz_triggers(sched_name,trigger_state,next_fire_time);
1071 create index idx_fn_qz_t_nft_misfire on fn_qz_triggers(sched_name,misfire_instr,next_fire_time);
1072 create index idx_fn_qz_t_nft_st_misfire on fn_qz_triggers(sched_name,misfire_instr,next_fire_time,trigger_state);
1073 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);
1074 create index idx_fn_qz_ft_trig_inst_name on fn_qz_fired_triggers(sched_name,instance_name);
1075 create index idx_fn_qz_ft_inst_job_req_rcvry on fn_qz_fired_triggers(sched_name,instance_name,requests_recovery);
1076 create index idx_fn_qz_ft_j_g on fn_qz_fired_triggers(sched_name,job_name,job_group);
1077 create index idx_fn_qz_ft_jg on fn_qz_fired_triggers(sched_name,job_group);
1078 create index idx_fn_qz_ft_t_g on fn_qz_fired_triggers(sched_name,trigger_name,trigger_group);
1079 create index idx_fn_qz_ft_tg on fn_qz_fired_triggers(sched_name,trigger_group);
1080
1081
1082 -- ------------------ create view section
1083 --
1084 -- name: v_url_access; type: view
1085 --
1086 create view v_url_access as
1087  select distinct m.action as url,
1088     m.function_cd
1089    from fn_menu m
1090   where (m.action is not null)
1091 union
1092  select distinct t.action as url,
1093     t.function_cd
1094    from fn_tab t
1095   where (t.action is not null)
1096 union
1097  select r.restricted_url as url,
1098     r.function_cd
1099    from fn_restricted_url r;
1100 -- ------------------ alter table add constraint primary key section
1101 --
1102 -- name: cr_favorite_reports_user_idrep_id; type: constraint
1103 --
1104 alter table cr_favorite_reports 
1105     add constraint cr_favorite_reports_user_idrep_id primary key (user_id, rep_id);
1106 --
1107 -- name: cr_folder_folder_id; type: constraint
1108 --
1109 alter table cr_folder
1110     add constraint cr_folder_folder_id primary key (folder_id);
1111 --
1112 -- name: cr_folder_access_folder_access_id; type: constraint
1113 --
1114 alter table cr_folder_access
1115     add constraint cr_folder_access_folder_access_id primary key (folder_access_id);
1116 --
1117 -- name: cr_hist_user_map_hist_iduser_id; type: constraint
1118 --
1119 alter table cr_hist_user_map
1120     add constraint cr_hist_user_map_hist_iduser_id primary key (hist_id, user_id);
1121 --
1122 -- name: cr_lu_file_type_lookup_id; type: constraint
1123 --
1124 alter table cr_lu_file_type
1125     add constraint cr_lu_file_type_lookup_id primary key (lookup_id);
1126 --
1127 -- name: cr_raptor_action_img_image_id; type: constraint
1128 --
1129 alter table cr_raptor_action_img
1130     add constraint cr_raptor_action_img_image_id primary key (image_id);
1131 --
1132 -- name: cr_raptor_pdf_img_image_id; type: constraint
1133 --
1134 alter table cr_raptor_pdf_img
1135     add constraint cr_raptor_pdf_img_image_id primary key (image_id);
1136 --
1137 -- name: cr_remote_schema_info_schema_prefix; type: constraint
1138 --
1139 alter table cr_remote_schema_info
1140     add constraint cr_remote_schema_info_schema_prefix primary key (schema_prefix);
1141 --
1142 -- name: cr_report_rep_id; type: constraint
1143 --
1144 alter table cr_report
1145     add constraint cr_report_rep_id primary key (rep_id);
1146 --
1147 -- name: cr_report_access_rep_idorder_no; type: constraint
1148 --
1149 alter table cr_report_access
1150     add constraint cr_report_access_rep_idorder_no primary key (rep_id, order_no);
1151 --
1152 -- name: cr_report_email_sent_log_log_id; type: constraint
1153 --
1154 alter table cr_report_email_sent_log
1155     add constraint cr_report_email_sent_log_log_id primary key (log_id);
1156 --
1157 -- name: cr_report_file_history_hist_id; type: constraint
1158 --
1159 alter table cr_report_file_history
1160     add constraint cr_report_file_history_hist_id primary key (hist_id);
1161 --
1162 -- name: cr_report_schedule_schedule_id; type: constraint
1163 --
1164 alter table cr_report_schedule
1165     add constraint cr_report_schedule_schedule_id primary key (schedule_id);
1166 --
1167 -- name: cr_report_schedule_users_schedule_idrep_iduser_idorder_no; type: constraint
1168 --
1169 alter table cr_report_schedule_users
1170     add constraint cr_report_schedule_users_schedule_idrep_iduser_idorder_no primary key (schedule_id, rep_id, user_id, order_no);
1171 --
1172 -- name: cr_report_template_map_report_id; type: constraint
1173 --
1174 alter table cr_report_template_map
1175     add constraint cr_report_template_map_report_id primary key (report_id);
1176 --
1177 -- name: cr_table_role_table_namerole_id; type: constraint
1178 --
1179 alter table cr_table_role
1180     add constraint cr_table_role_table_namerole_id primary key (table_name, role_id);
1181 --
1182 -- name: cr_table_source_table_name; type: constraint
1183 --
1184 alter table cr_table_source
1185     add constraint cr_table_source_table_name primary key (table_name);
1186 --
1187 -- name: fn_audit_action_audit_action_id; type: constraint
1188 --
1189 alter table fn_audit_action
1190     add constraint fn_audit_action_audit_action_id primary key (audit_action_id);  
1191 --
1192 --
1193 -- name: fk_fn_audit_ref_205_fn_lu_ac; type: constraint
1194 --
1195 alter table fn_audit_log
1196         add constraint fk_fn_audit_ref_205_fn_lu_ac foreign key (activity_cd) references fn_lu_activity(activity_cd);
1197 --
1198 -- name: fk_fn_role__ref_201_fn_funct; type: constraint
1199 --    
1200 alter table fn_role_function
1201         add constraint fk_fn_role__ref_201_fn_funct foreign key (function_cd) references fn_function(function_cd);
1202 --
1203 -- name: fn_chat_logs_chat_log_id; type: constraint
1204 --
1205 alter table fn_chat_logs
1206     add constraint fn_chat_logs_chat_log_id primary key (chat_log_id);
1207 --
1208 -- name: fn_chat_room_chat_room_id; type: constraint
1209 --
1210 alter table fn_chat_room
1211     add constraint fn_chat_room_chat_room_id primary key (chat_room_id);
1212 --
1213 -- name: fn_chat_users_id; type: constraint
1214 --
1215 alter table fn_chat_users  
1216     add constraint fn_chat_users_id primary key (id);
1217 --
1218 -- name: fn_lu_alert_method_alert_method_cd; type: constraint
1219 --
1220 alter table fn_lu_alert_method
1221     add constraint fn_lu_alert_method_alert_method_cd primary key (alert_method_cd);
1222 --
1223 -- name: fn_lu_broadcast_site_broadcast_site_cd; type: constraint
1224 --
1225 alter table fn_lu_broadcast_site
1226     add constraint fn_lu_broadcast_site_broadcast_site_cd primary key (broadcast_site_cd);
1227 --
1228 -- name: fn_lu_priority_priority_id; type: constraint
1229 --
1230 alter table fn_lu_priority
1231     add constraint fn_lu_priority_priority_id primary key (priority_id);
1232 --
1233 -- name: fn_lu_role_type_role_type_id; type: constraint
1234 --
1235 alter table fn_lu_role_type
1236     add constraint fn_lu_role_type_role_type_id primary key (role_type_id);
1237 --
1238 -- name: fn_lu_tab_set_tab_set_cd; type: constraint
1239 --
1240 alter table fn_lu_tab_set
1241     add constraint fn_lu_tab_set_tab_set_cd primary key (tab_set_cd);
1242 --
1243 -- name: fn_lu_timezone_timezone_id; type: constraint
1244 --
1245 alter table fn_lu_timezone
1246     add constraint fn_lu_timezone_timezone_id primary key (timezone_id);
1247 --
1248 -- name: fn_org_org_id; type: constraint
1249 --
1250 alter table fn_org
1251     add constraint fn_org_org_id primary key (org_id);
1252 --
1253 -- name: fn_restricted_url_restricted_urlfunction_cd; type: constraint
1254 --
1255 alter table fn_restricted_url
1256     add constraint fn_restricted_url_restricted_urlfunction_cd primary key (restricted_url, function_cd);
1257 --
1258 -- name: fn_role_composite_parent_role_idchild_role_id; type: constraint
1259 --
1260 alter table fn_role_composite
1261     add constraint fn_role_composite_parent_role_idchild_role_id primary key (parent_role_id, child_role_id);
1262 --
1263 -- name: fn_role_function_role_idfunction_cd; type: constraint
1264 --
1265 alter table fn_role_function
1266     add constraint fn_role_function_role_idfunction_cd primary key (role_id, function_cd);
1267 --
1268 -- name: fn_tab_tab_cd; type: constraint
1269 --
1270 alter table fn_tab
1271     add constraint fn_tab_tab_cd primary key (tab_cd);
1272 --
1273 -- name: fn_tab_selected_selected_tab_cdtab_uri; type: constraint
1274 --
1275 alter table fn_tab_selected
1276     add constraint fn_tab_selected_selected_tab_cdtab_uri primary key (selected_tab_cd, tab_uri);
1277 --
1278 -- name: fn_user_pseudo_role_pseudo_role_iduser_id; type: constraint
1279 --
1280 alter table fn_user_pseudo_role
1281     add constraint fn_user_pseudo_role_pseudo_role_iduser_id primary key (pseudo_role_id, user_id);
1282 --
1283 -- name: fn_user_role_user_idrole_id; type: constraint
1284 --
1285 alter table fn_user_role
1286     add constraint fn_user_role_user_idrole_id primary key (user_id, role_id, app_id);
1287 -- ------------------ create index section
1288 --
1289 -- name: cr_report_create_idpublic_yntitle; type: index
1290 --
1291 create index cr_report_create_idpublic_yntitle using btree on cr_report (create_id, public_yn, title);
1292 --
1293 -- name: cr_table_join_dest_table_name; type: index
1294 --
1295 create index cr_table_join_dest_table_name using btree on cr_table_join (dest_table_name);
1296 --
1297 -- name: cr_table_join_src_table_name; type: index
1298 --
1299 create index cr_table_join_src_table_name using btree on cr_table_join (src_table_name);
1300 --
1301 -- name: fn_audit_log_activity_cd; type: index
1302 --
1303 create index fn_audit_log_activity_cd using btree on fn_audit_log (activity_cd);
1304 --
1305 -- name: fn_audit_log_user_id; type: index
1306 --
1307 create index fn_audit_log_user_id using btree on fn_audit_log (user_id);
1308 --
1309 -- name: fn_menu_function_cd; type: index
1310 --
1311 create index fn_menu_function_cd using btree on fn_menu (function_cd);
1312 --
1313 -- name: fn_org_access_cd; type: index
1314 --
1315 create index fn_org_access_cd using btree on fn_org (access_cd);
1316 --
1317 -- name: fn_role_function_function_cd; type: index
1318 --
1319 create index fn_role_function_function_cd using btree on fn_role_function (function_cd);
1320 --
1321 -- name: fn_role_function_role_id; type: index
1322 --
1323 create index fn_role_function_role_id using btree on fn_role_function (role_id);
1324 --
1325 -- name: fn_user_address_id; type: index
1326 --
1327 create index fn_user_address_id using btree on fn_user (address_id); 
1328 --
1329 -- name: fn_user_alert_method_cd; type: index
1330 --
1331 create index fn_user_alert_method_cd using btree on fn_user (alert_method_cd); 
1332 --
1333 -- name: fn_user_hrid; type: index
1334 --
1335 create unique index fn_user_hrid using btree on fn_user (hrid); 
1336 --
1337 -- name: fn_user_login_id; type: index
1338 --
1339 create unique index fn_user_login_id using btree on fn_user (login_id); 
1340 --
1341 -- name: fn_user_org_id; type: index
1342 --
1343 create index fn_user_org_id using btree on fn_user (org_id); 
1344 --
1345 -- name: fn_user_role_role_id; type: index
1346 --
1347 create index fn_user_role_role_id using btree on fn_user_role (role_id);
1348 --
1349 -- name: fn_user_role_user_id; type: index
1350 --
1351 create index fn_user_role_user_id using btree on fn_user_role (user_id);
1352 --
1353 -- name: fk_fn_user__ref_178_fn_app_idx; type: index
1354 --
1355 create index fk_fn_user__ref_178_fn_app_idx on fn_user_role (app_id);
1356 -- ------------------ alter table add constraint foreign key section
1357 --
1358 -- name: fk_fn_user__ref_178_fn_app; type: fk constraint
1359 --
1360 alter table fn_user_role
1361         add constraint fk_fn_user__ref_178_fn_app foreign key (app_id) references fn_app(app_id);
1362 --
1363 -- name: fk_cr_repor_ref_14707_cr_repor; type: fk constraint
1364 --
1365 alter table cr_report_schedule
1366     add constraint fk_cr_repor_ref_14707_cr_repor foreign key (rep_id) references cr_report(rep_id);
1367 --
1368 -- name: fk_cr_repor_ref_14716_cr_repor; type: fk constraint
1369 --
1370 alter table cr_report_schedule_users
1371     add constraint fk_cr_repor_ref_14716_cr_repor foreign key (schedule_id) references cr_report_schedule(schedule_id);
1372 --
1373 -- name: fk_cr_repor_ref_17645_cr_repor; type: fk constraint
1374 --
1375 alter table cr_report_log
1376     add constraint fk_cr_repor_ref_17645_cr_repor foreign key (rep_id) references cr_report(rep_id);
1377 --
1378 -- name: fk_cr_repor_ref_8550_cr_repor; type: fk constraint
1379 --
1380 alter table cr_report_access
1381     add constraint fk_cr_repor_ref_8550_cr_repor foreign key (rep_id) references cr_report(rep_id);
1382 --
1383 -- name: fk_cr_report_rep_id; type: fk constraint
1384 --
1385 alter table cr_report_email_sent_log
1386     add constraint fk_cr_report_rep_id foreign key (rep_id) references cr_report(rep_id);
1387 --
1388 -- name: fk_cr_table_ref_311_cr_tab; type: fk constraint
1389 --
1390 alter table cr_table_join
1391     add constraint fk_cr_table_ref_311_cr_tab foreign key (src_table_name) references cr_table_source(table_name);
1392 --
1393 -- name: fk_cr_table_ref_315_cr_tab; type: fk constraint
1394 --
1395 alter table cr_table_join
1396     add constraint fk_cr_table_ref_315_cr_tab foreign key (dest_table_name) references cr_table_source(table_name);
1397 --
1398 -- name: fk_cr_table_ref_32384_cr_table; type: fk constraint
1399 --
1400 alter table cr_table_role
1401     add constraint fk_cr_table_ref_32384_cr_table foreign key (table_name) references cr_table_source(table_name);
1402 --
1403 -- name: fk_fn_tab_function_cd; type: fk constraint
1404 --
1405 alter table fn_tab
1406     add constraint fk_fn_tab_function_cd foreign key (function_cd) references fn_function(function_cd);
1407 --
1408 -- name: fk_fn_tab_selected_tab_cd; type: fk constraint
1409 --
1410 alter table fn_tab_selected
1411     add constraint fk_fn_tab_selected_tab_cd foreign key (selected_tab_cd) references fn_tab(tab_cd);
1412 --
1413 -- name: fk_fn_tab_set_cd; type: fk constraint
1414 --
1415 alter table fn_tab
1416     add constraint fk_fn_tab_set_cd foreign key (tab_set_cd) references fn_lu_tab_set(tab_set_cd);
1417 --
1418 -- name: fk_fn_user_ref_110_fn_org; type: fk constraint
1419 -- 
1420 alter table fn_user
1421     add constraint fk_fn_user_ref_110_fn_org foreign key (org_id) references fn_org(org_id); 
1422 --
1423 -- name: fk_fn_user_ref_123_fn_lu_al; type: fk constraint
1424 --
1425 alter table fn_user
1426     add constraint fk_fn_user_ref_123_fn_lu_al foreign key (alert_method_cd) references fn_lu_alert_method(alert_method_cd); 
1427 --
1428 -- name: fk_fn_user_ref_197_fn_user; type: fk constraint
1429 --
1430  alter table fn_user
1431     add constraint fk_fn_user_ref_197_fn_user foreign key (manager_id) references fn_user(user_id); 
1432 --
1433 -- name: fk_fn_user_ref_198_fn_user; type: fk constraint
1434 --
1435 alter table fn_user  
1436     add constraint fk_fn_user_ref_198_fn_user foreign key (created_id) references fn_user(user_id); 
1437 --
1438 -- name: fk_fn_user_ref_199_fn_user; type: fk constraint
1439 --
1440 alter table fn_user  
1441     add constraint fk_fn_user_ref_199_fn_user foreign key (modified_id) references fn_user(user_id); 
1442 --
1443 -- name: fk_parent_key_cr_folder; type: fk constraint
1444 --
1445 alter table cr_folder
1446     add constraint fk_parent_key_cr_folder foreign key (parent_folder_id) references cr_folder(folder_id);
1447 --
1448 -- name: fk_pseudo_role_pseudo_role_id; type: fk constraint
1449 --
1450 alter table fn_user_pseudo_role 
1451     add constraint fk_pseudo_role_pseudo_role_id foreign key (pseudo_role_id) references fn_role(role_id);
1452 --
1453 -- name: fk_pseudo_role_user_id; type: fk constraint
1454 --
1455 alter table fn_user_pseudo_role 
1456     add constraint fk_pseudo_role_user_id foreign key (user_id) references fn_user(user_id);
1457 --
1458 -- name: fk_restricted_url_function_cd; type: fk constraint
1459 --
1460 alter table fn_restricted_url
1461     add constraint fk_restricted_url_function_cd foreign key (function_cd) references fn_function(function_cd);
1462 --
1463 -- name: fk_timezone; type: fk constraint
1464 --
1465 alter table fn_user
1466     add constraint fk_timezone foreign key (timezone) references fn_lu_timezone(timezone_id); 
1467 --
1468 -- name: sys_c0014614; type: fk constraint
1469 --
1470 alter table cr_report_file_history
1471     add constraint sys_c0014614 foreign key (file_type_id) references cr_lu_file_type(lookup_id);
1472 --
1473 -- name: sys_c0014615; type: fk constraint
1474 --
1475 alter table cr_report_file_history
1476     add constraint sys_c0014615 foreign key (rep_id) references cr_report(rep_id);
1477 --
1478 -- name: sys_c0014616; type: fk constraint
1479 --
1480 alter table cr_hist_user_map  
1481     add constraint sys_c0014616 foreign key (hist_id) references cr_report_file_history(hist_id);
1482 --
1483 -- name: sys_c0014617; type: fk constraint
1484 --
1485 alter table cr_hist_user_map  
1486     add constraint sys_c0014617 foreign key (user_id) references fn_user(user_id);
1487 --
1488 -- name: sys_c0014618; type: fk constraint
1489 --
1490 alter table fn_menu_favorites
1491 add constraint sys_c0014618 foreign key (user_id) references fn_user(user_id);  
1492     
1493 --
1494 -- name: sys_c0014619; type: fk constraint
1495 --
1496 alter table fn_menu_favorites
1497 add constraint sys_c0014619 foreign key (menu_id) references fn_menu_functional(menu_id);
1498
1499 commit;