-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateTables.sql
2725 lines (2579 loc) · 121 KB
/
CreateTables.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
----------############ Setup Job Scheduler FDW ---------
-- In database Scheduler:
CREATE OR REPLACE view scheduler.v_scheduler_history AS
select t.*
from (
select "ID" as id ,
"JOB_NAME" as job_name,
replace(upper("JOB_NAME"), 'ANCHORTO_', '') as job_type,
replace(substring("PARAMETERS" from '(TRANS[0-9]{10})'), 'TRANS', '') as trans_id,
replace(replace(substring(replace((xpath('//variable[@name="para1"]/@value',"PARAMETERS"::xml))[1]::text, '\"', '"')
from '("source_id":[0-9]+,)'),
'"source_id":', ''),
',', '') as source_id,
/*case when "ERROR_CODE" <> '0'--when "JOB_NAME" = 'anchorTO_CreateSource'
then replace((xpath('//variable[@name="para1"]/@value',"PARAMETERS"::xml))[1]::text, '\"', '"')::json->'source_id'
else null end as source_id, */
case when "JOB_NAME" = 'anchorTO_CreateSource' then upper(replace((xpath('//variable[@name="para1"]/@value',"PARAMETERS"::xml))[1]::text, '\', '')::json->>'user_id')
else ''
end as user_name,
"START_TIME" as start_time,
"END_TIME" as end_time,
case when "ERROR_CODE" <> '0' then 'FAILED' else 'SUCCESSFUL' end as status,
"EXIT_CODE" as exit_code,
"ERROR" as error,
"ERROR_CODE" as error_code,
"ERROR_TEXT" as error_text,
replace((xpath('//variable[@name="para1"]/@value',"PARAMETERS"::xml))[1]::text, '\"', '"') as info,
"PARAMETERS" as parameters
from scheduler.scheduler.scheduler_history sh
where "JOB_NAME" IN ('anchorTO_CreateSource', 'anchorTO_Post')
) t
where length(info) > 0;
ALTER view scheduler.v_scheduler_history
OWNER TO scheduler;
grant usage on schema scheduler to network;
grant select on scheduler.v_scheduler_history to network;
-- In database anchorTO / LBM:
-- Under admin account:
CREATE EXTENSION postgres_fdw;
CREATE SERVER server_scheduler FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'banff', port '5488', dbname 'scheduler');
ALTER SERVER server_scheduler OWNER TO network;
GRANT USAGE ON FOREIGN SERVER server_scheduler to network;
-- Under network account in a new window:
CREATE USER MAPPING FOR network SERVER server_scheduler OPTIONS (user 'network', password 'tsnine');
CREATE SCHEMA scheduler AUTHORIZATION network;
IMPORT FOREIGN SCHEMA scheduler LIMIT TO (v_scheduler_history) FROM SERVER server_scheduler INTO scheduler;
-- Test imported view:
SELECT * FROM scheduler.v_scheduler_history;
-- Create view in AnchorTO/LBM:
drop view if exists network.v_job_log;
create or replace view network.v_job_log as
select job_id,
job_type,
task_id,
user_name,
taken_by,
job_status,
start_time,
end_time,
error_text
from
(
select row_number() over (partition by job_id order by job_id) idx,
s.*
from
(
select s.id job_id,
s.job_type,
t.task_id,
t.username user_name,
t.taken_by,
s.status job_status,
s.start_time,
s.end_time,
s.error_text
from (
select *
from scheduler.v_scheduler_history
where job_type = 'POST'
) s
left join (
select t.trans_id,
t.task_id,
t.source_id,
t.username,
k.taken_by
from ige_transaction t
left join ige_task k on t.task_id = k.task_id
) t on s.trans_id::numeric = t.trans_id
UNION ALL
select s.id job_id,
s.job_type,
t.task_id,
coalesce(s.user_name, t.username) user_name,
t.taken_by,
s.status job_status,
s.start_time,
s.end_time,
s.error_text
from (
select *
from scheduler.v_scheduler_history
where job_type = 'CREATESOURCE'
) s
left join (
select t.trans_id,
t.task_id,
t.source_id,
t.username,
k.taken_by
from ige_transaction t
left join ige_task k on t.task_id = k.task_id
) t on s.source_id::numeric = t.source_id
) s
) ss
where idx = 1
;
----------############ Setup Oracle FDW -----------
-- ############ Run under admin user:
-- Create two servers: imaint_anchor for tables in anchor_ige schema; imaint_anchor2 for tables in ige schema in Oracle
CREATE SERVER imaint_anchor FOREIGN DATA WRAPPER oracle_fdw
OPTIONS (dbserver'//darlington.corp.toronto.ca:1521/IGEMA.CORP.TORONTO.CA'); -- QA Oracle
CREATE SERVER imaint_anchor2 FOREIGN DATA WRAPPER oracle_fdw
OPTIONS (dbserver'//darlington.corp.toronto.ca:1521/IGEMA.CORP.TORONTO.CA'); -- QA Oracle
GRANT USAGE ON FOREIGN SERVER imaint_anchor to network;
GRANT USAGE ON FOREIGN SERVER imaint_anchor2 to network;
CREATE USER MAPPING FOR network SERVER imaint_anchor
OPTIONS (user 'anchor_ige', password 'stage');
CREATE USER MAPPING FOR network SERVER imaint_anchor2
OPTIONS (user 'ige', password 'stage');
CREATE SCHEMA imaint_anchor AUTHORIZATION network;
-- Link tables from Oracle from both anchor_ige & ige schema
IMPORT FOREIGN SCHEMA "ANCHOR_IGE"
LIMIT TO (linear_name_evw)
FROM SERVER imaint_anchor INTO imaint_anchor;
IMPORT FOREIGN SCHEMA "ANCHOR_IGE"
LIMIT TO (linear_name_type_evw)
FROM SERVER imaint_anchor INTO imaint_anchor;
IMPORT FOREIGN SCHEMA "ANCHOR_IGE"
LIMIT TO (ige_source_evw)
FROM SERVER imaint_anchor INTO imaint_anchor;
IMPORT FOREIGN SCHEMA "IGE"
LIMIT TO (ige_control_task, ige_task, ige_transaction)
FROM SERVER imaint_anchor2 INTO imaint_anchor;
-- Test imported tables
SELECT * FROM imaint_anchor.linear_name;
SELECT * FROM imaint_anchor.ige_control_task limit 100;
SELECT * FROM imaint_anchor.ige_source limit 100;
SELECT * FROM imaint_anchor.ige_task limit 100;
SELECT * FROM imaint_anchor.ige_transaction limit 100;
--SELECT oracle_diag();
-------------############--------------------------
drop table if exists network.task_status_flow;
CREATE TABLE network.task_status_flow
(
flow_id serial,
status_from character varying(30) NOT NULL,
status_to character varying(30) NOT null,
ignored integer,
date_effective timestamp,
date_expiry timestamp
);
CREATE INDEX task_status_flow_status_from_to ON network.task_status_flow (upper(status_from), upper(status_to));
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('READY', 'TAKEN', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('READY', 'HOLD', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('HOLD', 'READY', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('TAKEN', 'POSTED', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('TAKEN', 'POSTING', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('TAKEN', 'POST FAILED', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('TAKEN', 'POST SYSERR', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('POSTING', 'POSTED', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('POSTING', 'POST FAILED', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('POSTING', 'POST SYSERR', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('POSTED', 'COMPLETED', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('POSTED', 'COMPLETE FAILED', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('POSTED', 'TAKEN', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective, ignored)
values ('POSTED', 'POSTED', current_timestamp,1);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('POSTED', 'POST FAILED', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('POSTED', 'POST SYSERR', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('POST FAILED', 'POSTED', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective, ignored)
values ('POST FAILED', 'POST FAILED', current_timestamp, 1);
insert into network.task_status_flow (status_from, status_to, date_effective)
values ('POST FAILED', 'POST SYSERR', current_timestamp);
insert into network.task_status_flow (status_from, status_to, date_effective, ignored)
values ('TAKEN', 'TAKEN', current_timestamp,1);
/*
update network.task_status_flow
set date_expiry = current_timestamp
where status_from = 'POSTING';
*/
update network.task_status_flow
set ignored = 1
where status_from = 'POSTED' and status_to = 'TAKEN';
commit;
select * from network.task_status_flow order by status_from;
----------------------------------------------
CREATE TABLE network.ige_control_task
(
CONTROL_TASK_ID numeric(12,0) NOT NULL,
SOURCE_ID numeric(12,0) NOT NULL,
CONTROL_TASK_STATUS character varying(30) NOT NULL,
CONTROL_TASK_COMMENTS character varying(255),
CONTROL_TASK_TYPE character varying(30) NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
CREATE UNIQUE INDEX ige_control_task_pk ON ige_control_task (control_task_id);
CREATE INDEX ige_control_task_source_id_trans_expire_idx ON ige_control_task (source_id, trans_id_expire);
CREATE INDEX ige_control_task_status_expire_idx ON ige_control_task(control_task_status, trans_id_expire);
GRANT ALL ON TABLE network.ige_control_task TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.ige_control_task TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.ige_task
(
TASK_ID numeric(12,0) PRIMARY KEY,
TASK_TYPE character varying(30) NOT NULL,
SOURCE_ID numeric(12,0),
ASSIGNED_TO character varying(30) NOT NULL,
TAKEN_BY character varying(32),
TASK_SEQUENCE numeric(4,1),
TASK_STATUS character varying(20) NOT NULL,
TASK_COMMENTS text,
CONTROL_TASK_ID numeric(12,0),
TASK_CATEGORY character varying(30),
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
GRANT ALL ON TABLE network.ige_task TO network;
CREATE INDEX ige_task_control_task_id_trans_expire_idx ON ige_task (control_task_id, trans_id_expire);
CREATE INDEX ige_task_task_type_idx ON ige_task (task_type);
CREATE INDEX ige_task_task_status_expire__taken_by_assigned_idx ON ige_task (task_status, trans_id_expire, taken_by, assigned_to);
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.ige_task TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.ige_transaction
(
TRANS_ID numeric(12,0) PRIMARY KEY,
TASK_ID numeric(12,0) NOT NULL,
SOURCE_ID numeric(12,0),
USERNAME character varying(15),
DATE_START TIMESTAMP,
DATE_END TIMESTAMP,
APPLICATION_CODE character varying(20),
TRANS_DESC character varying(500),
TRANS_NAME character varying(100),
TRANS_STATUS character varying(10)
);
GRANT ALL ON TABLE network.ige_transaction TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.ige_transaction TO sde;
CREATE INDEX ige_transaction_task_id_idx ON network.ige_transaction (task_id);
CREATE INDEX ige_transaction_task_trans_status_name_idx ON ige_transaction (trans_status,trans_name);
CREATE INDEX ige_transaction_task_trans_status_name_application_idx ON ige_transaction (trans_status,trans_name, application_code);
---------------------------------------------------------------------------------------------------------------------------
/*
CREATE TABLE network.linear_name
(
LINEAR_NAME_ID numeric(12,0),
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0),
RECORD_TYPE character varying(1),
NAME_PART character varying(60),
TYPE_PART character varying(15),
DIR_PART character varying(10),
DESCRIPTION character varying(20),
ACTIVATION_STATUS character varying(1),
APPROVAL_STATUS character varying(1),
DUPLICATION_STATUS character varying(1),
DUPLICATION_DESC character varying(30),
OBJECTID integer NOT NULL
);
CREATE INDEX network.linear_name_id ON network.linear_name (linear_name_id);
CREATE UNIQUE INDEX network.linear_name_objectid_uk ON network.linear_name (objectid);
*/
CREATE INDEX linear_name_type_up_i ON network.linear_name(upper(type_part));
CREATE INDEX linear_name_dir_up_i ON network.linear_name(upper(dir_part));
CREATE INDEX linear_name_full_name_i ON network.linear_name(trim(UPPER(name_part) || ' ' || coalesce(UPPER(type_part), '') || ' ' || coalesce(UPPER(dir_part), '')));
CREATE INDEX LINEAR_NAME_CREATE_ID_IDX ON network.LINEAR_NAME (TRANS_ID_CREATE);
CREATE INDEX LINEAR_NAME_EXPIRED_ID_IDX ON network.LINEAR_NAME (TRANS_ID_EXPIRE);
CREATE INDEX LINEAR_NAME_FULL_LINEAR_NAME_IDX ON network.LINEAR_NAME (REPLACE(UPPER(name_part) || ' ' || coalesce(UPPER(type_part), '') || ' ' || coalesce(UPPER(dir_part), ''), '"', ''''));
CREATE INDEX LINEAR_NAME_DUP_DESC_IDX ON network.LINEAR_NAME (UPPER(duplication_desc));
GRANT ALL ON TABLE network.linear_name TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.linear_name TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.linear_name_dm
(
LINEAR_NAME_ID numeric(12,0),
DATE_EFFECTIVE timestamp,
DATE_EXPIRY timestamp,
NAME_PART character varying(60),
TYPE_PART character varying(15),
DIR_PART character varying(10),
DESCRIPTION character varying(20),
ACTIVATION_STATUS character varying(1),
APPROVAL_STATUS character varying(1),
DUPLICATION_STATUS character varying(1),
DUPLICATION_DESC character varying(30),
LINEAR_NAME_FULL character varying(110),
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0),
OBJECTID integer NOT NULL -- Only when it's INTEGER type, it can be registered with GDB in ArcCatalog
);
--alter table network.linear_name_h add record_type character varying(1);
--alter table network.linear_name_h add use_by text;
--alter table network.linear_name_h drop record_type;
--alter table network.linear_name_h drop use_by;
CREATE INDEX linear_name_dm_id ON network.linear_name_dm (linear_name_id);
CREATE INDEX linear_name_dm_name_type_part ON network.linear_name_dm (name_part, type_part);
CREATE INDEX linear_name_dm_trans_id_create ON network.linear_name_dm (trans_id_create);
CREATE INDEX linear_name_dm_trans_id_expire ON network.linear_name_dm (trans_id_expire);
CREATE UNIQUE INDEX linear_name_dm_objectid_uk ON network.linear_name_dm (objectid);
CREATE INDEX linear_name_dm_name_type_dir_up_i ON network.linear_name_dm(upper(name_part), upper(type_part), upper(dir_part));
CREATE INDEX linear_name_dm_name_full_i ON network.linear_name_dm(linear_name_full);
CREATE INDEX linear_name_dm_name_full_up_i ON network.linear_name_dm(upper(linear_name_full));
CREATE INDEX linear_name_dm_name_up_i ON network.linear_name_dm(upper(name_part));
CREATE INDEX linear_name_dm_dir_up_i ON network.linear_name_dm(upper(dir_part));
GRANT ALL ON TABLE network.linear_name_dm TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.linear_name_dm TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.linear_name_h
(
LINEAR_NAME_ID numeric(12,0),
RECORD_ID numeric(12,0),
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0),
NAME_PART character varying(60),
TYPE_PART character varying(15),
DIR_PART character varying(10),
DESCRIPTION character varying(20),
ACTIVATION_STATUS character varying(1),
APPROVAL_STATUS character varying(1),
DUPLICATION_STATUS character varying(1),
DUPLICATION_DESC character varying(30),
OBJECTID integer NOT NULL -- Only when it's INTEGER type, it can be registered with GDB in ArcCatalog
);
--alter table network.linear_name_h add record_type character varying(1);
--alter table network.linear_name_h add use_by text;
--alter table network.linear_name_h add language_code text;
--alter table network.linear_name_h drop record_type;
--alter table network.linear_name_h drop use_by;
--alter table network.linear_name_h drop if exists record_id ;
--alter table network.linear_name_h drop language_code;
CREATE UNIQUE INDEX linear_name_h_objectid_uk ON network.linear_name_h (objectid);
CREATE INDEX linear_name_h_type_up_i ON network.linear_name_h(upper(type_part));
CREATE INDEX linear_name_h_dir_up_i ON network.linear_name_h(upper(dir_part));
GRANT ALL ON TABLE network.linear_name_h TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.linear_name_h TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.linear_name_type
(
linear_name_type_id numeric(12,0) PRIMARY KEY,
trans_id_create numeric(12,0),
trans_id_expire numeric(12,0),
type_part character varying(15) ,
type_part_code character varying(10) ,
objectid integer NOT NULL
);
CREATE UNIQUE INDEX linear_name_type_objectid_uk ON network.linear_name_type (objectid);
CREATE UNIQUE INDEX linear_name_type_pk ON network.linear_name_type (linear_name_type_id);
CREATE UNIQUE INDEX linear_name_type_type_uk ON network.linear_name_type (UPPER(type_part));
CREATE UNIQUE INDEX linear_name_type_type_code_uk ON network.linear_name_type (UPPER(type_part_code));
CREATE INDEX LINEAR_NAME_TYPE_CREATE_ID_IDX ON network.LINEAR_NAME_TYPE (TRANS_ID_CREATE);
CREATE INDEX LINEAR_NAME_TYPE_EXPIRED_ID_IDX ON network.LINEAR_NAME_TYPE (TRANS_ID_EXPIRE);
GRANT ALL ON TABLE network.linear_name_type TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.linear_name_type TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.linear_name_type_dm
(
LINEAR_NAME_TYPE_ID numeric(12,0),
DATE_EFFECTIVE timestamp,
DATE_EXPIRY timestamp,
TYPE_PART character varying(15),
TYPE_PART_CODE character varying(10),
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0),
OBJECTID integer NOT NULL -- Only when it's INTEGER type, it can be registered with GDB in ArcCatalog
);
--alter table network.linear_name_type_dm add record_type character varying(1);
--alter table network.linear_name_type_dm drop record_type;
CREATE UNIQUE INDEX linear_name_type_dm_objectid_uk ON network.linear_name_type_dm (objectid);
GRANT ALL ON TABLE network.linear_name_type_dm TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.linear_name_type_dm TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.linear_name_type_h
(
LINEAR_NAME_TYPE_ID numeric(12,0),
RECORD_ID numeric(12,0),
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0),
TYPE_PART character varying(15),
TYPE_PART_CODE character varying(10),
OBJECTID integer NOT NULL -- Only when it's INTEGER type, it can be registered with GDB in ArcCatalog
);
--alter table network.linear_name_type_h add record_type character varying(1);
--alter table network.linear_name_type_h drop record_type;
--alter table network.linear_name_type_h drop if exists record_id;
CREATE UNIQUE INDEX linear_name_type_h_objectid_uk ON network.linear_name_type_h (objectid);
GRANT ALL ON TABLE network.linear_name_type_h TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.linear_name_type_h TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.linear_name_direction_dm
(
linear_name_dir_id numeric(12,0),
DATE_EFFECTIVE timestamp,
DATE_EXPIRY timestamp,
trans_id_create numeric(12,0),
trans_id_expire numeric(12,0),
dir_part character varying(15) ,
dir_part_code character varying(10),
objectid integer NOT NULL -- Only when it's INTEGER type, it can be registered with GDB in ArcCatalog
);
--alter table network.linear_name_direction_dm add record_type character varying(1);
--alter table network.linear_name_direction_dm drop record_type;
CREATE UNIQUE INDEX linear_name_direction_dm_objectid_uk ON network.linear_name_direction_dm (objectid);
GRANT ALL ON TABLE network.linear_name_direction_dm TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.linear_name_direction_dm TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.linear_name_direction_h
(
linear_name_dir_id numeric(12,0),
RECORD_ID numeric(12,0),
trans_id_create numeric(12,0),
trans_id_expire numeric(12,0),
dir_part character varying(10) ,
dir_part_code character varying(2),
objectid integer NOT NULL -- Only when it's INTEGER type, it can be registered with GDB in ArcCatalog
);
--alter table network.linear_name_direction_h add record_type character varying(1);
--alter table network.linear_name_direction_h drop record_type;
--alter table network.linear_name_direction_h drop if exists record_id;
CREATE UNIQUE INDEX linear_name_direction_h_objectid_uk ON network.linear_name_direction_h (objectid);
GRANT ALL ON TABLE network.linear_name_direction_h TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.linear_name_direction_h TO sde;
---------------------------------------------------------------------------------------------------------------------------
/*CREATE TABLE network.AUTHORIZED_MUNICIPAL_ADDRESS
(
ADDRESS_STRING_ID numeric(12,0) NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0),
LINEAR_NAME_ID numeric(12,0),
LO_NUM numeric(6,0),
LO_NUM_SUF character varying(3),
HI_NUM numeric(6,0),
HI_NUM_SUF character varying(3),
OBJECTID integer NOT NULL -- Only when it's INTEGER type, it can be registered with GDB in ArcCatalog
);
--alter table network.AUTHORIZED_MUNICIPAL_ADDRESS add RECORD_ID numeric(12,0);
--alter table network.AUTHORIZED_MUNICIPAL_ADDRESS drop RECORD_ID;
GRANT ALL ON TABLE network.AUTHORIZED_MUNICIPAL_ADDRESS TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.AUTHORIZED_MUNICIPAL_ADDRESS TO sde;*/
select * from authorized_municipal_address limit 10;
--DROP record_id column in ArcCatalog -------------ALTER TABLE authorized_municipal_address DROP record_id CASCADE;
--Add column usage_status in ArcCatalog ----------------------ALTER TABLE authorized_municipal_address ADD COLUMN IF NOT EXISTS USAGE_STATUS VARCHAR(1);
--drop index AUTHORIZED_MUNICIPAL_ADDRESS_usage_status_u;
CREATE INDEX AUTHORIZED_MUNICIPAL_ADDRESS_usage_status_u ON network.AUTHORIZED_MUNICIPAL_ADDRESS (UPPER(usage_status));
CREATE INDEX AUTHORIZED_MUNICIPAL_ADDRESS_lo_num_i ON network.AUTHORIZED_MUNICIPAL_ADDRESS (lo_num);
CREATE INDEX AUTHORIZED_MUNICIPAL_ADDRESS_TYPE_CREATE_ID_IDX ON network.AUTHORIZED_MUNICIPAL_ADDRESS (TRANS_ID_CREATE);
CREATE INDEX AUTHORIZED_MUNICIPAL_ADDRESS_TYPE_EXPIRED_ID_IDX ON network.AUTHORIZED_MUNICIPAL_ADDRESS (TRANS_ID_EXPIRE);
CREATE INDEX AUTHORIZED_MUNICIPAL_ADDRESS_LO_NUM_IDX ON network.AUTHORIZED_MUNICIPAL_ADDRESS (lpad(lo_num::text,10,'0'));
CREATE INDEX AUTHORIZED_MUNICIPAL_ADDRESS_FULL_LO_NUM_IDX ON network.AUTHORIZED_MUNICIPAL_ADDRESS ((coalesce(lo_num::TEXT, '')|| coalesce(lo_num_suf, '')));
CREATE INDEX AUTHORIZED_MUNICIPAL_ADDRESS_address_string_id_i ON network.AUTHORIZED_MUNICIPAL_ADDRESS (address_string_id);
CREATE INDEX AUTHORIZED_MUNICIPAL_ADDRESS_linear_name_id_i ON network.AUTHORIZED_MUNICIPAL_ADDRESS (linear_name_id);
CREATE INDEX AUTHORIZED_MUNICIPAL_ADDRESS_name_LO_NUM_IDX ON network.AUTHORIZED_MUNICIPAL_ADDRESS (linear_name_id, lpad(lo_num::text,10,'0'));
CREATE UNIQUE INDEX AUTHORIZED_MUNICIPAL_ADDRESS_objectid_uk ON network.AUTHORIZED_MUNICIPAL_ADDRESS (objectid);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.ama_dm
(
ADDRESS_STRING_ID numeric(12,0) NOT NULL,
DATE_EFFECTIVE timestamp,
DATE_EXPIRY timestamp,
LINEAR_NAME_ID numeric(12,0),
LO_NUM numeric(6,0),
LO_NUM_SUF character varying(3),
HI_NUM numeric(6,0),
HI_NUM_SUF character varying(3),
LINEAR_NAME character varying(60),
LINEAR_NAME_TYPE character varying(10),
LINEAR_NAME_DIR character varying(2),
LINEAR_NAME_ACT_STATUS character varying(1),
LINEAR_NAME_APPR_STATUS character varying(1),
LINEAR_NAME_DUP_STATUS character varying(1),
LINEAR_NAME_DUP_DESC character varying(30),
ADDRESS_numeric character varying(20),
LINEAR_NAME_FULL character varying(110),
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0),
OBJECTID integer NOT NULL -- Only when it's INTEGER type, it can be registered with GDB in ArcCatalog
);
CREATE INDEX ama_dm_address_string_id_i ON network.ama_dm (address_string_id);
CREATE INDEX ama_dm_linear_name_id_i ON network.ama_dm (linear_name_id);
CREATE INDEX ama_dm_linear_name_type_i ON network.ama_dm (linear_name, linear_name_type);
CREATE INDEX ama_dm_linear_name_full_i ON network.ama_dm (linear_name_full);
CREATE INDEX ama_dm_trans_id_create_i ON network.ama_dm (trans_id_create);
CREATE INDEX ama_dm_trans_id_expire_i ON network.ama_dm (trans_id_expire);
CREATE INDEX ama_dm_linear_name_up_i ON network.ama_dm (upper(linear_name));
CREATE INDEX ama_dm_linear_name_full_up_i ON network.ama_dm (upper(linear_name_full));
CREATE UNIQUE INDEX ama_dm_objectid_uk ON network.ama_dm (objectid);
-- select count(*) from ama_dm;
GRANT ALL ON TABLE network.ama_dm TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.ama_dm TO sde;
ALTER TABLE ama_dm ADD COLUMN IF NOT EXISTS LINEAR_NAME_AUTHORIZED VARCHAR(1);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE ama_h
(
ADDRESS_STRING_ID numeric(12,0) NOT NULL,
RECORD_ID numeric(12,0),
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0),
LINEAR_NAME_ID numeric(12,0),
LO_NUM numeric(6,0),
LO_NUM_SUF character varying(3),
HI_NUM numeric(6,0),
HI_NUM_SUF character varying(3),
OBJECTID integer NOT NULL -- Only when it's INTEGER type, it can be registered with GDB in ArcCatalog
);
CREATE UNIQUE INDEX ama_h_objectid_uk ON network.ama_h (objectid);
--alter table network.ama_h drop if exists record_id;
GRANT ALL ON TABLE network.ama_h TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.ama_h TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.dmn_business_unit
(
BUSINESS_UNIT VARCHAR(20) PRIMARY KEY,
DESCRIPTION VARCHAR(500),
SORT_SEQUENCE numeric(12,2),
DATE_EFFECTIVE timestamp,
DATE_EXPIRY timestamp,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
GRANT ALL ON TABLE network.dmn_business_unit TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.dmn_business_unit TO sde;
CREATE INDEX dmn_business_unit_expire_idx ON dmn_business_unit(trans_id_expire);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_STEWARD_STATUS
(
STEWARD_STATUS VARCHAR(10) PRIMARY KEY,
DECRIPTION VARCHAR(500),
SORT_SEQUENCE numeric(12,2),
DATE_EFFECTIVE timestamp NOT NULL,
DATE_EXPIRY timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
GRANT ALL ON TABLE network.DMN_STEWARD_STATUS TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.DMN_STEWARD_STATUS TO sde;
CREATE INDEX dmn_steward_status_expire_idx ON dmn_steward_status (trans_id_expire);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_STEWARD_GROUP
(
STEWARD_GROUP VARCHAR(30) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
DATE_EFFECTIVE timestamp NOT NULL,
DATE_EXPIRY timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
CREATE UNIQUE INDEX DMN_STEWARD_GROUP_UK ON DMN_STEWARD_GROUP (UPPER(STEWARD_GROUP));
CREATE INDEX dmn_steward_group_expire_idx ON dmn_steward_group (trans_id_expire);
GRANT ALL ON TABLE network.DMN_STEWARD_GROUP TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.DMN_STEWARD_GROUP TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_BOOLEAN_VALUE
(
BOOLEAN_VALUE VARCHAR(1) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
DATE_EFFECTIVE timestamp NOT NULL,
DATE_EXPIRY timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
GRANT ALL ON TABLE network.DMN_BOOLEAN_VALUE TO network;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE network.DMN_BOOLEAN_VALUE TO sde;
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_SOURCE_CLASS
(
SOURCE_CLASS VARCHAR(50) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
CONTROL_TASK_TYPE VARCHAR(30), NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
CREATE INDEX dmn_source_class_trans_id_expire_idx ON dmn_source_class (trans_id_expire);
CREATE INDEX dmn_source_class_class_expire_up_idx ON dmn_source_class (UPPER(source_class),trans_id_expire);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_PLAN_TYPE
(
PLAN_TYPE VARCHAR(50) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SUBDIV_FABRIC VARCHAR(1) NOT NULL,
NAME_ABBREVIATION VARCHAR(15),
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
CREATE INDEX dmn_plan_type_expire_idx ON dmn_plan_type (trans_id_expire);
---------------------------------------------------------------------------------------------------------------------------
/*CREATE TABLE network.DMN_PLAN_TYPE_EXT
(
EXT_NAME VARCHAR(12) NOT NULL,
EXT_TYPE VARCHAR(6) NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
PLAN_TYPE VARCHAR(50) NOT NULL REFERENCES network.DMN_PLAN_TYPE(PLAN_TYPE),
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
-- run under admin: alter table network.dmn_plan_type_ext disable trigger all;
-- run under admin: alter table network.dmn_plan_type_ext enable trigger all;
*/
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_REPORT_TYPE
(
REPORT_TYPE VARCHAR(50) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
CREATE INDEX dmn_report_type_expire_idx ON dmn_report_type (trans_id_expire);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_PLAN_STATUS
(
PLAN_STATUS VARCHAR(30) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
CREATE INDEX dmn_plan_status_expire_idx ON dmn_plan_status (trans_id_expire);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_REPORT_STATUS
(
REPORT_STATUS VARCHAR(30) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
CREATE INDEX dmn_report_status_expire_idx ON dmn_report_status (trans_id_expire);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_PRESENTATION_TYPE
(
PRES_TYPE VARCHAR(30) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_TASK_TYPE
(
TASK_TYPE VARCHAR(30) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
CREATE INDEX dmn_task_type_type_idx ON dmn_task_type (task_type);
CREATE INDEX dmn_task_type_type_trans_id_expire_idx ON dmn_task_type (task_type, trans_id_expire);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_TASK_STATUS
(
TASK_STATUS VARCHAR(30) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
---------------------------------------------------------------------------------------------------------------------------
/*
CREATE TABLE network.DMN_CONTROL_TASK_TYPE
(
CONTROL_TASK_TYPE VARCHAR(30) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
*/
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_CONTROL_TASK_STATUS
(
CONTROL_TASK_STATUS VARCHAR(30) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0) NOT NULL
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.IGE_USER
(
USER_ID numeric(6,0) PRIMARY KEY NOT NULL,
USERNAME VARCHAR(15) NOT NULL,
--FIRST_NAME VARCHAR(30) NOT NULL,
--LAST_NAME VARCHAR(30) NOT NULL,
FULL_NAME VARCHAR(50) NOT NULL,
EMAIL VARCHAR(30) NOT NULL,
--PHONE VARCHAR(12),
BUSINESS_UNIT VARCHAR(200) NOT NULL,
STATUS VARCHAR(10) NOT NULL REFERENCES NETWORK.DMN_STEWARD_STATUS(STEWARD_STATUS),
STATUS_DATE timestamp NOT NULL
);
CREATE UNIQUE INDEX IGE_USER_NAME_UP_UK ON NETWORK.IGE_USER(UPPER(USERNAME));
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.IGE_USER_STEWARD
(
USER_ID numeric(6,0) NOT NULL REFERENCES NETWORK.IGE_USER(USER_ID),
STEWARD_GROUP VARCHAR(30) NOT NULL
--SUPERVISOR VARCHAR(1) NOT NULL,
--ENABLED VARCHAR(1) NOT NULL
);
CREATE UNIQUE INDEX IGE_USER_STEWARD_ID_GROUP_UK ON NETWORK.IGE_USER_STEWARD(USER_ID, STEWARD_GROUP);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_AMA_USAGE_STATUS
(
USAGE_STATUS VARCHAR(1) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500),
SORT_SEQUENCE numeric(12,2),
date_effective timestamp,
date_expiry timestamp,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_LN_USE_BY
(
USE_BY VARCHAR(1) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_LN_ACTIVATION_STATUS
(
ACTIVATION_STATUS VARCHAR(1) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_LN_APPROVAL_STATUS
(
APPROVAL_STATUS VARCHAR(1) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_LN_USAGE_STATUS
(
USAGE_STATUS VARCHAR(1) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_NUMERIC_OPERATOR
(
"operator" numeric(4,0) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_STRING_OPERATOR
(
"operator" numeric(4,0) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_CL_FEATURE_CODE
(
FEATURE_CODE numeric(6,0) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_CL_ONEWAY
(
ONEWAY_DIR_CODE numeric(1,0) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_INT_CLASSIFICATION
(
CLASSIFICATION VARCHAR(20) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_INT_ELEV_FEATURE_CODE
(
FEATURE_CODE VARCHAR(6) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0) NOT NULL,
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_INT_ELEVATION_LEVEL
(
ELEVATION_LEVEL numeric(2,0) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_INT_ELEVATION_UNIT
(
ELEVATION_UNIT VARCHAR(2) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_INT_HEIGHT_UNIT
(
HEIGHT_UNIT VARCHAR(2) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_OAR_MAINT_STAGE
(
MAINT_STAGE VARCHAR(10) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(5,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_OAR_CENTRELINE_SIDE
(
CENTRELINE_SIDE VARCHAR(1) PRIMARY KEY NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(5,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_OAR_GENERAL_USE
(
GENERAL_USE numeric(6,0) NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_OAR_CLASS_FLAG
(
ADDRESS_CLASS_FLAG numeric(5,0) NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
MAINT_STAGE VARCHAR(10) NOT NULL,
SORT_SEQUENCE numeric(5,2) NOT NULL,
ABBR_DESCRIPTION VARCHAR(20) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)
);
---------------------------------------------------------------------------------------------------------------------------
CREATE TABLE network.DMN_OAR_NAME_RECORD_TYPE
(
RECORD_TYPE VARCHAR(10) NOT NULL,
DESCRIPTION VARCHAR(500) NOT NULL,
SORT_SEQUENCE numeric(12,2) NOT NULL,
date_effective timestamp NOT NULL,
date_expiry timestamp NOT NULL,
TRANS_ID_CREATE numeric(12,0),
TRANS_ID_EXPIRE numeric(12,0)