root/rita/doc/master-schema-from-aaron.sql

Revision 1230, 200.6 KB (checked in by gcc, 7 weeks ago)

Update to schema 1.44.

Change RequestDao?.listRequests() to take just a Viewpoint.Code instead of a Viewpoint,
because the query is decided entirely by the viewpoint code now.

Line 
1-- sed -i.orig -e '/^-- TOC entry/d' -e '/^-- Dependencies:/d' -e '/^SET /d'
2-- svn diff --diff-cmd=diff -x "-u -F TABLE"
3
4--
5-- PostgreSQL database dump
6--
7
8-- Started on 2010-07-14 14:25:34
9
10
11
12--
13-- Name: list_valid_actions(character varying, character varying, integer, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres
14--
15
16CREATE FUNCTION list_valid_actions("ScreenCode" character varying, "SelectedViewpoint" character varying, "ActiveUser" integer, "ActiveProject" integer, "ShowHiddenActions" integer, OUT action_code character varying, OUT description character varying, OUT is_hidden integer, OUT seqno integer) RETURNS SETOF record
17    LANGUAGE sql
18    AS $_$select distinct LA.screen_code || '_' || LA.list_action_code As action_code
19     , LA.description
20     , 1 - LA.is_displayed as is_hidden
21     , LA.seqno
22
23-- Source (Note: All tables must be included the query, to ensure all deleted rows are excluded)
24  from viewpoints             as VP
25     , list_action_viewpoints as LV
26     
27     , list_action            as LA
28     
29     , list_action_roles      as LR
30     , user_roles             as UR
31     , users                  as US
32
33     , project                as PR
34
35-- Changeable criteria
36 where VP.screen_code      = upper($1)
37   and VP.viewpoint_code   = upper($2)
38   and UR.user_id          = $3
39   and (   UR.role_code In ('ADM', 'CEN', 'RPA')
40        Or UR.project_id   = $4)
41
42-- Joins
43   and VP.screen_code      = LV.screen_code
44   and VP.viewpoint_code   = LV.viewpoint_code
45   
46   and LV.screen_code      = LA.screen_code
47   and LV.list_action_code = LA.list_action_code
48   
49   and LA.screen_code      = LR.screen_code
50   and LA.list_action_code = LR.list_action_code
51   
52   and LR.role_code        = UR.role_code
53   and UR.user_id          = US.id
54
55   and PR.id               = $4
56
57-- Exclude hidden records
58   and ($5 = 1 Or ($5 = 0 and LA.is_displayed     = 1))
59
60-- Exclude deleted records
61   and VP.is_deleted       = 0
62   and LV.is_deleted       = 0
63   and LA.is_deleted       = 0   
64   and LR.is_deleted       = 0
65   and UR.is_deleted       = 0   
66   and US.is_deleted       = 0
67
68-- Exclude expired records
69   and (US.expiry_date Is Null or US.expiry_date > Now())
70   and (UR.expiry_date Is Null or UR.expiry_date > Now())
71
72-- Exclude selected actions if the project is closed
73   and (   (LA.is_allowed_if_proj_closed = 1)
74        or (LA.is_allowed_if_proj_closed = 0 And PR.end_date Is Null)
75        or (LA.is_allowed_if_proj_closed = 0 And PR.end_date > Now()))
76
77order by LA.seqno$_$;
78
79
80ALTER FUNCTION public.list_valid_actions("ScreenCode" character varying, "SelectedViewpoint" character varying, "ActiveUser" integer, "ActiveProject" integer, "ShowHiddenActions" integer, OUT action_code character varying, OUT description character varying, OUT is_hidden integer, OUT seqno integer) OWNER TO postgres;
81
82--
83-- Name: list_valid_projects(character varying, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres
84--
85
86CREATE FUNCTION list_valid_projects("SelectedViewpoint" character varying, "ActiveUser" integer, "ShowClosedProjects" integer, OUT project_id integer, OUT project_name character varying, OUT project_description character varying, OUT project_is_closed integer) RETURNS SETOF record
87    LANGUAGE sql
88    AS $_$
89
90select distinct PR.id
91     , PR.name
92     , PR.description
93     , case when (PR.end_date Is Null or PR.end_date > Now()) then 0 else 1 end as is_project_closed
94
95-- Source (Note: All tables are required to ensure all deleted rows are excluded)
96  from viewpoints             as VP
97     , list_action_viewpoints as LV
98     
99     , list_action            as LA
100     
101     , list_action_roles      as LR
102
103     , users                  as US
104     , user_roles             as UR
105
106-- Project table is not directly linked to any other table in the query     
107     , project                as PR
108
109-- This query is only applicable for ScreenCode ‘MM’
110 where VP.screen_code      = 'MM'
111
112-- Changeable criteria
113   and VP.viewpoint_code   = upper($1)
114   and UR.user_id          = $2
115
116-- Joins
117   and VP.screen_code      = LV.screen_code
118   and VP.viewpoint_code   = LV.viewpoint_code
119   
120   and LV.screen_code      = LA.screen_code
121   and LV.list_action_code = LA.list_action_code
122   
123   and LA.screen_code      = LR.screen_code
124   and LA.list_action_code = LR.list_action_code
125   
126   and LR.role_code        = UR.role_code
127   and UR.user_id          = US.id
128
129-- Exclude deleted records
130   and VP.is_deleted       = 0
131   and LV.is_deleted       = 0
132   and LA.is_deleted       = 0   
133   and LR.is_deleted       = 0
134   and UR.is_deleted       = 0   
135   and US.is_deleted       = 0
136   and PR.is_deleted       = 0 
137
138-- Exclude expired users
139   and (US.expiry_date Is Null or US.expiry_date > Now())
140   and (UR.expiry_date Is Null or UR.expiry_date > Now())
141
142-- Exclude closed projects (if required)
143   and ($3 > 0 Or ($3 = 0 And (PR.end_date Is Null or PR.end_date > Now())))
144   
145-- If this is a GLOBAL Role, display all current Projects,
146-- Otherwise, display only those projects that are referenced
147-- in the User_Role table for the selected user
148   and (   (UR.project_id Is Null)
149        or (UR.project_id =PR.id )) 
150
151 order by PR.name
152
153
154$_$;
155
156
157ALTER FUNCTION public.list_valid_projects("SelectedViewpoint" character varying, "ActiveUser" integer, "ShowClosedProjects" integer, OUT project_id integer, OUT project_name character varying, OUT project_description character varying, OUT project_is_closed integer) OWNER TO postgres;
158
159--
160-- Name: list_valid_viewpoints(character varying, integer, integer); Type: FUNCTION; Schema: public; Owner: postgres
161--
162
163CREATE FUNCTION list_valid_viewpoints("ScreenCode" character varying, "ActiveUser" integer, "ActiveProject" integer, OUT viewpoint_code character, OUT description character varying, OUT viewpoint_site_desc character varying, OUT seqno integer, OUT is_default smallint) RETURNS SETOF record
164    LANGUAGE sql
165    AS $_$select distinct VP.viewpoint_code
166     , VP.description
167     , VP.viewpoint_site_name
168     , VP.seqno
169     , VP.is_default
170
171-- Source (Note: All tables must be included the query, to ensure all deleted rows are excluded)
172  from viewpoints             as VP
173     , list_action_viewpoints as LV
174     
175     , list_action            as LA
176     
177     , list_action_roles      as LR
178     , user_roles             as UR
179     , users                  as US
180
181     , project                as PR
182
183-- Changeable criteria
184 where VP.screen_code      = upper($1)
185   and UR.user_id          = $2
186   and (   UR.role_code In ('ADM', 'CEN', 'RPA')
187        Or UR.project_id   = $3)
188
189-- Joins
190   and VP.screen_code      = LV.screen_code
191   and VP.viewpoint_code   = LV.viewpoint_code
192   
193   and LV.screen_code      = LA.screen_code
194   and LV.list_action_code = LA.list_action_code
195   
196   and LA.screen_code      = LR.screen_code
197   and LA.list_action_code = LR.list_action_code
198   
199   and LR.role_code        = UR.role_code
200   and UR.user_id          = US.id
201
202   and PR.id               = $3
203
204-- Exclude hidden records
205--   and LA.is_displayed     = 1
206
207-- Exclude deleted records
208   and VP.is_deleted       = 0
209   and LV.is_deleted       = 0
210   and LA.is_deleted       = 0   
211   and LR.is_deleted       = 0
212   and UR.is_deleted       = 0   
213   and US.is_deleted       = 0
214
215-- Exclude expired records
216   and (US.expiry_date Is Null or US.expiry_date > Now())
217   and (UR.expiry_date Is Null or UR.expiry_date > Now())
218
219-- Exclude selected actions if the project is closed
220   and (   (VP.is_allowed_if_proj_closed = 1)
221        or (VP.is_allowed_if_proj_closed = 0 And PR.end_date Is Null)
222        or (VP.is_allowed_if_proj_closed = 0 And PR.end_date > Now()))
223
224order by VP.seqno$_$;
225
226
227ALTER FUNCTION public.list_valid_viewpoints("ScreenCode" character varying, "ActiveUser" integer, "ActiveProject" integer, OUT viewpoint_code character, OUT description character varying, OUT viewpoint_site_desc character varying, OUT seqno integer, OUT is_default smallint) OWNER TO postgres;
228
229--
230-- Name: validate_user_action(character varying, character varying, integer, integer, character varying); Type: FUNCTION; Schema: public; Owner: postgres
231--
232
233CREATE FUNCTION validate_user_action("ScreenCode" character varying, "SelectedViewpoint" character varying, "ActiveUser" integer, "ActiveProject" integer, "RequestedAction" character varying) RETURNS bigint
234    LANGUAGE sql
235    AS $_$select count(*)
236
237-- Source (Note: All tables must be included the query, to ensure all deleted rows are excluded)
238  from viewpoints             as VP
239     , list_action_viewpoints as LV
240     
241     , list_action            as LA
242     
243     , list_action_roles      as LR
244     , user_roles             as UR
245     , users                  as US
246
247     , project                as PR
248
249-- Changeable criteria
250 where VP.screen_code      = upper($1)
251   and VP.viewpoint_code   = upper($2)
252   and UR.user_id          = $3
253   and (   UR.Role_code In ('ADM', 'CEN', 'RPA')
254        Or UR.Project_ID   = $4)
255       
256   and PR.id               = $4
257   
258   and LA.list_action_code = upper($5)
259
260
261-- Joins
262   and VP.screen_code      = LV.screen_code
263   and VP.viewpoint_code   = LV.viewpoint_code
264   
265   and LV.screen_code      = LA.screen_code
266   and LV.list_action_code = LA.list_action_code
267   
268   and LA.screen_code      = LR.screen_code
269   and LA.list_action_code = LR.list_action_code
270   
271   and LR.role_code        = UR.role_code
272   and UR.user_id          = US.id
273
274-- Exclude deleted records
275   and VP.is_deleted       = 0
276   and LV.is_deleted       = 0
277   and LA.is_deleted       = 0   
278   and LR.is_deleted       = 0
279   and UR.is_deleted       = 0   
280   and US.is_deleted       = 0
281
282-- Exclude expired records
283   and (US.expiry_date Is Null or US.expiry_date > Now())
284   and (UR.expiry_date Is Null or UR.expiry_date > Now())
285
286-- Exclude selected actions if the project is closed
287   and (   (LA.is_allowed_if_proj_closed = 1)
288        or (LA.is_allowed_if_proj_closed = 0 And PR.end_date Is Null)
289        or (LA.is_allowed_if_proj_closed = 0 And PR.end_date > Now()))
290
291
292   $_$;
293
294
295ALTER FUNCTION public.validate_user_action("ScreenCode" character varying, "SelectedViewpoint" character varying, "ActiveUser" integer, "ActiveProject" integer, "RequestedAction" character varying) OWNER TO postgres;
296
297
298
299--
300-- Name: arrival_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
301--
302
303CREATE TABLE arrival_type (
304    code character(1) NOT NULL,
305    description character varying(40) NOT NULL,
306    record_version bigint NOT NULL,
307    is_deleted smallint NOT NULL
308);
309
310
311ALTER TABLE public.arrival_type OWNER TO postgres;
312
313--
314-- Name: COLUMN arrival_type.code; Type: COMMENT; Schema: public; Owner: postgres
315--
316
317COMMENT ON COLUMN arrival_type.code IS 'Code of the screen using the viewpoint';
318
319
320--
321-- Name: COLUMN arrival_type.description; Type: COMMENT; Schema: public; Owner: postgres
322--
323
324COMMENT ON COLUMN arrival_type.description IS 'Description';
325
326
327--
328-- Name: COLUMN arrival_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
329--
330
331COMMENT ON COLUMN arrival_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
332
333
334--
335-- Name: COLUMN arrival_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
336--
337
338COMMENT ON COLUMN arrival_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
339
340
341--
342-- Name: building_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
343--
344
345CREATE TABLE building_type (
346    id integer NOT NULL,
347    description character varying(255) NOT NULL,
348    record_version bigint NOT NULL,
349    is_deleted smallint NOT NULL
350);
351
352
353ALTER TABLE public.building_type OWNER TO postgres;
354
355--
356-- Name: COLUMN building_type.id; Type: COMMENT; Schema: public; Owner: postgres
357--
358
359COMMENT ON COLUMN building_type.id IS 'Site Building Type Code';
360
361
362--
363-- Name: COLUMN building_type.description; Type: COMMENT; Schema: public; Owner: postgres
364--
365
366COMMENT ON COLUMN building_type.description IS 'English language description';
367
368
369--
370-- Name: COLUMN building_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
371--
372
373COMMENT ON COLUMN building_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
374
375
376--
377-- Name: COLUMN building_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
378--
379
380COMMENT ON COLUMN building_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
381
382
383--
384-- Name: bundle; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
385--
386
387CREATE TABLE bundle (
388    bundle_site_id integer NOT NULL,
389    id integer NOT NULL,
390    bundle_type_id integer NOT NULL,
391    bundle_qty integer NOT NULL,
392    bundle_idnf character varying(40),
393    is_new_bundle_provided smallint NOT NULL,
394    record_version bigint NOT NULL,
395    is_deleted smallint NOT NULL,
396    CONSTRAINT ckc_bundle_qty_bundle CHECK ((bundle_qty >= 0))
397);
398
399
400ALTER TABLE public.bundle OWNER TO postgres;
401
402--
403-- Name: COLUMN bundle.bundle_site_id; Type: COMMENT; Schema: public; Owner: postgres
404--
405
406COMMENT ON COLUMN bundle.bundle_site_id IS 'Site that owns the bundle record, and normally (except for goods arriving from CUST, or where the bundle was reconfigured upon arrival) the site at the origin of the movement';
407
408
409--
410-- Name: COLUMN bundle.id; Type: COMMENT; Schema: public; Owner: postgres
411--
412
413COMMENT ON COLUMN bundle.id IS 'Internally generated unique identifier';
414
415
416--
417-- Name: COLUMN bundle.bundle_type_id; Type: COMMENT; Schema: public; Owner: postgres
418--
419
420COMMENT ON COLUMN bundle.bundle_type_id IS 'Container Type';
421
422
423--
424-- Name: COLUMN bundle.bundle_qty; Type: COMMENT; Schema: public; Owner: postgres
425--
426
427COMMENT ON COLUMN bundle.bundle_qty IS 'Number of containers';
428
429
430--
431-- Name: COLUMN bundle.bundle_idnf; Type: COMMENT; Schema: public; Owner: postgres
432--
433
434COMMENT ON COLUMN bundle.bundle_idnf IS 'Container identifier (either NULL or unique within a journey)';
435
436
437--
438-- Name: COLUMN bundle.is_new_bundle_provided; Type: COMMENT; Schema: public; Owner: postgres
439--
440
441COMMENT ON COLUMN bundle.is_new_bundle_provided IS 'Were new pallets (containers) provided? Multiply cost per container x ContainerQty';
442
443
444--
445-- Name: COLUMN bundle.record_version; Type: COMMENT; Schema: public; Owner: postgres
446--
447
448COMMENT ON COLUMN bundle.record_version IS 'Audit field: Lastest (local) change version number of the data';
449
450
451--
452-- Name: COLUMN bundle.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
453--
454
455COMMENT ON COLUMN bundle.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
456
457
458--
459-- Name: bundle_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
460--
461
462CREATE TABLE bundle_type (
463    id integer NOT NULL,
464    description character varying(255) NOT NULL,
465    group_id integer NOT NULL,
466    enclosure_type_code character(2) NOT NULL,
467    bundle_weight numeric(12,6) NOT NULL,
468    bundle_volume numeric(12,6) NOT NULL,
469    max_cap_weight numeric(12,6) NOT NULL,
470    max_cap_volume numeric(12,6) NOT NULL,
471    is_valid_for_land smallint NOT NULL,
472    is_valid_for_water smallint NOT NULL,
473    is_valid_for_air smallint NOT NULL,
474    record_version bigint NOT NULL,
475    is_deleted smallint NOT NULL,
476    CONSTRAINT ckc_max_cap_volume_bundle_t CHECK ((max_cap_volume >= (0)::numeric)),
477    CONSTRAINT ckc_max_cap_weight_bundle_t CHECK ((max_cap_weight >= (0)::numeric))
478);
479
480
481ALTER TABLE public.bundle_type OWNER TO postgres;
482
483--
484-- Name: COLUMN bundle_type.id; Type: COMMENT; Schema: public; Owner: postgres
485--
486
487COMMENT ON COLUMN bundle_type.id IS 'Internally generated unique identifier';
488
489
490--
491-- Name: COLUMN bundle_type.description; Type: COMMENT; Schema: public; Owner: postgres
492--
493
494COMMENT ON COLUMN bundle_type.description IS 'English language description';
495
496
497--
498-- Name: COLUMN bundle_type.group_id; Type: COMMENT; Schema: public; Owner: postgres
499--
500
501COMMENT ON COLUMN bundle_type.group_id IS 'Bundle Group';
502
503
504--
505-- Name: COLUMN bundle_type.enclosure_type_code; Type: COMMENT; Schema: public; Owner: postgres
506--
507
508COMMENT ON COLUMN bundle_type.enclosure_type_code IS 'Bundle Enclosure Type (Base Only; Fully Enclosed; Top Open)';
509
510
511--
512-- Name: COLUMN bundle_type.bundle_weight; Type: COMMENT; Schema: public; Owner: postgres
513--
514
515COMMENT ON COLUMN bundle_type.bundle_weight IS 'Weight (kg) of the empty bundle';
516
517
518--
519-- Name: COLUMN bundle_type.bundle_volume; Type: COMMENT; Schema: public; Owner: postgres
520--
521
522COMMENT ON COLUMN bundle_type.bundle_volume IS 'Volume (m3) of the empty bundle';
523
524
525--
526-- Name: COLUMN bundle_type.max_cap_weight; Type: COMMENT; Schema: public; Owner: postgres
527--
528
529COMMENT ON COLUMN bundle_type.max_cap_weight IS 'Maximum capacity (weight) of the bundle, excluding own weight (0=No maximum capacity)';
530
531
532--
533-- Name: COLUMN bundle_type.max_cap_volume; Type: COMMENT; Schema: public; Owner: postgres
534--
535
536COMMENT ON COLUMN bundle_type.max_cap_volume IS 'Maximum capacity (volume) of the bundle, excluding own volume (0=No maximum capacity)';
537
538
539--
540-- Name: COLUMN bundle_type.is_valid_for_land; Type: COMMENT; Schema: public; Owner: postgres
541--
542
543COMMENT ON COLUMN bundle_type.is_valid_for_land IS 'Is a valid bundle type for LAND journeys';
544
545
546--
547-- Name: COLUMN bundle_type.is_valid_for_water; Type: COMMENT; Schema: public; Owner: postgres
548--
549
550COMMENT ON COLUMN bundle_type.is_valid_for_water IS 'Is a valid bundle type for WATER journeys';
551
552
553--
554-- Name: COLUMN bundle_type.is_valid_for_air; Type: COMMENT; Schema: public; Owner: postgres
555--
556
557COMMENT ON COLUMN bundle_type.is_valid_for_air IS 'Is a valid bundle type for AIR journeys';
558
559
560--
561-- Name: COLUMN bundle_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
562--
563
564COMMENT ON COLUMN bundle_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
565
566
567--
568-- Name: COLUMN bundle_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
569--
570
571COMMENT ON COLUMN bundle_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
572
573
574--
575-- Name: bundle_type_group; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
576--
577
578CREATE TABLE bundle_type_group (
579    id integer NOT NULL,
580    description character varying(255) NOT NULL,
581    is_qty_allowed smallint NOT NULL,
582    record_version bigint NOT NULL,
583    is_deleted smallint NOT NULL
584);
585
586
587ALTER TABLE public.bundle_type_group OWNER TO postgres;
588
589--
590-- Name: COLUMN bundle_type_group.id; Type: COMMENT; Schema: public; Owner: postgres
591--
592
593COMMENT ON COLUMN bundle_type_group.id IS 'Internally generated unique identifier';
594
595
596--
597-- Name: COLUMN bundle_type_group.description; Type: COMMENT; Schema: public; Owner: postgres
598--
599
600COMMENT ON COLUMN bundle_type_group.description IS 'English language description';
601
602
603--
604-- Name: COLUMN bundle_type_group.is_qty_allowed; Type: COMMENT; Schema: public; Owner: postgres
605--
606
607COMMENT ON COLUMN bundle_type_group.is_qty_allowed IS 'Allow the user to enter bundle quantity for this group - NOT used for "loose" items';
608
609
610--
611-- Name: COLUMN bundle_type_group.record_version; Type: COMMENT; Schema: public; Owner: postgres
612--
613
614COMMENT ON COLUMN bundle_type_group.record_version IS 'Audit field: Lastest (local) change version number of the data';
615
616
617--
618-- Name: COLUMN bundle_type_group.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
619--
620
621COMMENT ON COLUMN bundle_type_group.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
622
623
624--
625-- Name: change_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
626--
627
628CREATE TABLE change_type (
629    code character(1) NOT NULL,
630    description character varying(255) NOT NULL,
631    record_version bigint NOT NULL,
632    is_deleted smallint NOT NULL
633);
634
635
636ALTER TABLE public.change_type OWNER TO postgres;
637
638--
639-- Name: COLUMN change_type.code; Type: COMMENT; Schema: public; Owner: postgres
640--
641
642COMMENT ON COLUMN change_type.code IS 'Static Change Type Code (S=Status Change; P=Priority Change; C=Comment)';
643
644
645--
646-- Name: COLUMN change_type.description; Type: COMMENT; Schema: public; Owner: postgres
647--
648
649COMMENT ON COLUMN change_type.description IS 'English language description';
650
651
652--
653-- Name: COLUMN change_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
654--
655
656COMMENT ON COLUMN change_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
657
658
659--
660-- Name: COLUMN change_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
661--
662
663COMMENT ON COLUMN change_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
664
665
666--
667-- Name: contact; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
668--
669
670CREATE TABLE contact (
671    owner_site_id integer NOT NULL,
672    id integer NOT NULL,
673    project_id integer NOT NULL,
674    org_id integer NOT NULL,
675    title character varying(40),
676    name character varying(255) NOT NULL,
677    job_title character varying(255),
678    address character varying(255),
679    country_id integer,
680    email1 character varying(100),
681    email2 character varying(100),
682    email3 character varying(100),
683    phone1 character varying(40),
684    phone2 character varying(40),
685    phone3 character varying(40),
686    record_version bigint NOT NULL,
687    is_deleted smallint NOT NULL
688);
689
690
691ALTER TABLE public.contact OWNER TO postgres;
692
693--
694-- Name: COLUMN contact.owner_site_id; Type: COMMENT; Schema: public; Owner: postgres
695--
696
697COMMENT ON COLUMN contact.owner_site_id IS 'Site that created/owns the record';
698
699
700--
701-- Name: COLUMN contact.id; Type: COMMENT; Schema: public; Owner: postgres
702--
703
704COMMENT ON COLUMN contact.id IS 'Internally generated identifier, unique within Owner_Site_ID';
705
706
707--
708-- Name: COLUMN contact.project_id; Type: COMMENT; Schema: public; Owner: postgres
709--
710
711COMMENT ON COLUMN contact.project_id IS 'Contact is active for which project';
712
713
714--
715-- Name: COLUMN contact.org_id; Type: COMMENT; Schema: public; Owner: postgres
716--
717
718COMMENT ON COLUMN contact.org_id IS 'Contact belongs to which organisation';
719
720
721--
722-- Name: COLUMN contact.title; Type: COMMENT; Schema: public; Owner: postgres
723--
724
725COMMENT ON COLUMN contact.title IS 'Contact"s title';
726
727
728--
729-- Name: COLUMN contact.name; Type: COMMENT; Schema: public; Owner: postgres
730--
731
732COMMENT ON COLUMN contact.name IS 'Contact"s name';
733
734
735--
736-- Name: COLUMN contact.job_title; Type: COMMENT; Schema: public; Owner: postgres
737--
738
739COMMENT ON COLUMN contact.job_title IS 'Contact"s position';
740
741
742--
743-- Name: COLUMN contact.address; Type: COMMENT; Schema: public; Owner: postgres
744--
745
746COMMENT ON COLUMN contact.address IS 'Contact"s physical address';
747
748
749--
750-- Name: COLUMN contact.country_id; Type: COMMENT; Schema: public; Owner: postgres
751--
752
753COMMENT ON COLUMN contact.country_id IS 'Contact"s address country';
754
755
756--
757-- Name: COLUMN contact.email1; Type: COMMENT; Schema: public; Owner: postgres
758--
759
760COMMENT ON COLUMN contact.email1 IS 'Contact"s email address (used when confirming dispatch/delivery)';
761
762
763--
764-- Name: COLUMN contact.email2; Type: COMMENT; Schema: public; Owner: postgres
765--
766
767COMMENT ON COLUMN contact.email2 IS 'Contact"s email address (used when confirming dispatch/delivery)';
768
769
770--
771-- Name: COLUMN contact.email3; Type: COMMENT; Schema: public; Owner: postgres
772--
773
774COMMENT ON COLUMN contact.email3 IS 'Contact"s email address (used when confirming dispatch/delivery)';
775
776
777--
778-- Name: COLUMN contact.phone1; Type: COMMENT; Schema: public; Owner: postgres
779--
780
781COMMENT ON COLUMN contact.phone1 IS 'Contact"s phone number';
782
783
784--
785-- Name: COLUMN contact.phone2; Type: COMMENT; Schema: public; Owner: postgres
786--
787
788COMMENT ON COLUMN contact.phone2 IS 'Contact"s phone number';
789
790
791--
792-- Name: COLUMN contact.phone3; Type: COMMENT; Schema: public; Owner: postgres
793--
794
795COMMENT ON COLUMN contact.phone3 IS 'Contact"s phone number';
796
797
798--
799-- Name: COLUMN contact.record_version; Type: COMMENT; Schema: public; Owner: postgres
800--
801
802COMMENT ON COLUMN contact.record_version IS 'Audit field: Lastest (local) change version number of the data';
803
804
805--
806-- Name: COLUMN contact.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
807--
808
809COMMENT ON COLUMN contact.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
810
811
812--
813-- Name: country; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
814--
815
816CREATE TABLE country (
817    id integer NOT NULL,
818    subregion_id integer NOT NULL,
819    name character varying(40) NOT NULL,
820    official_name character varying(40) NOT NULL,
821    alternate_name character varying(255),
822    country_type_code character(1) NOT NULL,
823    currency_id integer NOT NULL,
824    iso2_idnf character(2) NOT NULL,
825    iso3_idnf character(3) NOT NULL,
826    isonumb_idnf integer NOT NULL,
827    latitude numeric(8,5),
828    longitude numeric(8,5),
829    timezone numeric(3,1) NOT NULL,
830    capital_city character varying(40),
831    record_version bigint NOT NULL,
832    is_deleted smallint NOT NULL
833);
834
835
836ALTER TABLE public.country OWNER TO postgres;
837
838--
839-- Name: COLUMN country.id; Type: COMMENT; Schema: public; Owner: postgres
840--
841
842COMMENT ON COLUMN country.id IS 'Internally generated unique identifier';
843
844
845--
846-- Name: COLUMN country.subregion_id; Type: COMMENT; Schema: public; Owner: postgres
847--
848
849COMMENT ON COLUMN country.subregion_id IS 'Sub-Region';
850
851
852--
853-- Name: COLUMN country.name; Type: COMMENT; Schema: public; Owner: postgres
854--
855
856COMMENT ON COLUMN country.name IS 'Country name, as known to public';
857
858
859--
860-- Name: COLUMN country.official_name; Type: COMMENT; Schema: public; Owner: postgres
861--
862
863COMMENT ON COLUMN country.official_name IS 'Official Name to be printed on reports, invoices, etc';
864
865
866--
867-- Name: COLUMN country.alternate_name; Type: COMMENT; Schema: public; Owner: postgres
868--
869
870COMMENT ON COLUMN country.alternate_name IS 'Alternative Country Name';
871
872
873--
874-- Name: COLUMN country.country_type_code; Type: COMMENT; Schema: public; Owner: postgres
875--
876
877COMMENT ON COLUMN country.country_type_code IS 'Country Type (UN Classification)';
878
879
880--
881-- Name: COLUMN country.currency_id; Type: COMMENT; Schema: public; Owner: postgres
882--
883
884COMMENT ON COLUMN country.currency_id IS 'Official Currency';
885
886
887--
888-- Name: COLUMN country.iso2_idnf; Type: COMMENT; Schema: public; Owner: postgres
889--
890
891COMMENT ON COLUMN country.iso2_idnf IS '2-Character ISO Code (Internet suffix)';
892
893
894--
895-- Name: COLUMN country.iso3_idnf; Type: COMMENT; Schema: public; Owner: postgres
896--
897
898COMMENT ON COLUMN country.iso3_idnf IS '3-Character ISO Code';
899
900
901--
902-- Name: COLUMN country.isonumb_idnf; Type: COMMENT; Schema: public; Owner: postgres
903--
904
905COMMENT ON COLUMN country.isonumb_idnf IS 'Numeric ISO code';
906
907
908--
909-- Name: COLUMN country.latitude; Type: COMMENT; Schema: public; Owner: postgres
910--
911
912COMMENT ON COLUMN country.latitude IS 'Latitude of country (centre)';
913
914
915--
916-- Name: COLUMN country.longitude; Type: COMMENT; Schema: public; Owner: postgres
917--
918
919COMMENT ON COLUMN country.longitude IS 'Longitude of country (centre)';
920
921
922--
923-- Name: COLUMN country.timezone; Type: COMMENT; Schema: public; Owner: postgres
924--
925
926COMMENT ON COLUMN country.timezone IS 'Timezone of Capital City (disregards daylights saving)';
927
928
929--
930-- Name: COLUMN country.capital_city; Type: COMMENT; Schema: public; Owner: postgres
931--
932
933COMMENT ON COLUMN country.capital_city IS 'Name of capital city';
934
935
936--
937-- Name: COLUMN country.record_version; Type: COMMENT; Schema: public; Owner: postgres
938--
939
940COMMENT ON COLUMN country.record_version IS 'Audit field: Lastest (local) change version number of the data';
941
942
943--
944-- Name: COLUMN country.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
945--
946
947COMMENT ON COLUMN country.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
948
949
950--
951-- Name: country_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
952--
953
954CREATE TABLE country_type (
955    code character(1) NOT NULL,
956    description character varying(255) NOT NULL,
957    record_version bigint NOT NULL,
958    is_deleted smallint NOT NULL
959);
960
961
962ALTER TABLE public.country_type OWNER TO postgres;
963
964--
965-- Name: COLUMN country_type.code; Type: COMMENT; Schema: public; Owner: postgres
966--
967
968COMMENT ON COLUMN country_type.code IS 'Country Type Code: C, T';
969
970
971--
972-- Name: COLUMN country_type.description; Type: COMMENT; Schema: public; Owner: postgres
973--
974
975COMMENT ON COLUMN country_type.description IS 'English language description';
976
977
978--
979-- Name: COLUMN country_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
980--
981
982COMMENT ON COLUMN country_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
983
984
985--
986-- Name: COLUMN country_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
987--
988
989COMMENT ON COLUMN country_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
990
991
992--
993-- Name: currency; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
994--
995
996CREATE TABLE currency (
997    id integer NOT NULL,
998    iso3_idnf character(3) NOT NULL,
999    name character varying(40) NOT NULL,
1000    decimal_places smallint,
1001    record_version bigint NOT NULL,
1002    is_deleted smallint NOT NULL,
1003    CONSTRAINT ckc_decimal_places_currency CHECK (((decimal_places IS NULL) OR (decimal_places >= 0)))
1004);
1005
1006
1007ALTER TABLE public.currency OWNER TO postgres;
1008
1009--
1010-- Name: COLUMN currency.id; Type: COMMENT; Schema: public; Owner: postgres
1011--
1012
1013COMMENT ON COLUMN currency.id IS 'Internally generated unique identifier';
1014
1015
1016--
1017-- Name: COLUMN currency.iso3_idnf; Type: COMMENT; Schema: public; Owner: postgres
1018--
1019
1020COMMENT ON COLUMN currency.iso3_idnf IS '3-character ISO currency code';
1021
1022
1023--
1024-- Name: COLUMN currency.name; Type: COMMENT; Schema: public; Owner: postgres
1025--
1026
1027COMMENT ON COLUMN currency.name IS 'Currency Name';
1028
1029
1030--
1031-- Name: COLUMN currency.decimal_places; Type: COMMENT; Schema: public; Owner: postgres
1032--
1033
1034COMMENT ON COLUMN currency.decimal_places IS 'Currency Precision (Digits after decimal point)';
1035
1036
1037--
1038-- Name: COLUMN currency.record_version; Type: COMMENT; Schema: public; Owner: postgres
1039--
1040
1041COMMENT ON COLUMN currency.record_version IS 'Audit field: Lastest (local) change version number of the data';
1042
1043
1044--
1045-- Name: COLUMN currency.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
1046--
1047
1048COMMENT ON COLUMN currency.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
1049
1050
1051--
1052-- Name: cust_order; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
1053--
1054
1055CREATE TABLE cust_order (
1056    id integer NOT NULL,
1057    project_id integer NOT NULL,
1058    request_site_id integer NOT NULL,
1059    owners_ref character varying(40),
1060    arrival_type_code character(1) NOT NULL,
1061    arrival_location_site_id integer,
1062    arrival_location_id integer,
1063    arrival_instructions character varying(255),
1064    arrival_contact character varying(255),
1065    service_type_code character(1) NOT NULL,
1066    exit_location_site_id integer,
1067    exit_location_id integer,
1068    final_instructions character varying(255),
1069    storage_duration smallint,
1070    status_code character(2) NOT NULL,
1071    sender_site_id integer NOT NULL,
1072    sender_contact_id integer NOT NULL,
1073    receiver_site_id integer NOT NULL,
1074    receiver_contact_id integer NOT NULL,
1075    invoice_site_id integer,
1076    invoice_contact_id integer,
1077    on_behalf_of character varying(255),
1078    description character varying(255),
1079    product_id integer,
1080    est_dispatch_time timestamp without time zone,
1081    est_deliver_time timestamp without time zone,
1082    followup_date date,
1083    shipment_docm_idnf character varying(40),
1084    created_by_logon character varying(40) NOT NULL,
1085    created_time timestamp without time zone NOT NULL,
1086    record_version bigint NOT NULL,
1087    is_deleted smallint NOT NULL,
1088    CONSTRAINT ckc_storage_duration_cust_ord CHECK (((storage_duration IS NULL) OR (storage_duration >= 0)))
1089);
1090
1091
1092ALTER TABLE public.cust_order OWNER TO postgres;
1093
1094--
1095-- Name: COLUMN cust_order.id; Type: COMMENT; Schema: public; Owner: postgres
1096--
1097
1098COMMENT ON COLUMN cust_order.id IS '--> Request.Cust_Order_ID: Internally generated unique identifier';
1099
1100
1101--
1102-- Name: COLUMN cust_order.project_id; Type: COMMENT; Schema: public; Owner: postgres
1103--
1104
1105COMMENT ON COLUMN cust_order.project_id IS '--> Request.Project ID';
1106
1107
1108--
1109-- Name: COLUMN cust_order.request_site_id; Type: COMMENT; Schema: public; Owner: postgres
1110--
1111
1112COMMENT ON COLUMN cust_order.request_site_id IS '--> Request.Request_Site_ID: Start site';
1113
1114
1115--
1116-- Name: COLUMN cust_order.owners_ref; Type: COMMENT; Schema: public; Owner: postgres
1117--
1118
1119COMMENT ON COLUMN cust_order.owners_ref IS 'Owner''s Reference';
1120
1121
1122--
1123-- Name: COLUMN cust_order.arrival_type_code; Type: COMMENT; Schema: public; Owner: postgres
1124--
1125
1126COMMENT ON COLUMN cust_order.arrival_type_code IS 'Identifies the way in which the cargo will enter the tracking system (D=Direct Delivery by Client; P=Pickup from Client Site; X=Transshipment; I=Internal)';
1127
1128
1129--
1130-- Name: COLUMN cust_order.arrival_location_site_id; Type: COMMENT; Schema: public; Owner: postgres
1131--
1132
1133COMMENT ON COLUMN cust_order.arrival_location_site_id IS 'Point where goods will initially enter the system';
1134
1135
1136--
1137-- Name: COLUMN cust_order.arrival_location_id; Type: COMMENT; Schema: public; Owner: postgres
1138--
1139
1140COMMENT ON COLUMN cust_order.arrival_location_id IS 'Point where goods will initially enter the system';
1141
1142
1143--
1144-- Name: COLUMN cust_order.arrival_instructions; Type: COMMENT; Schema: public; Owner: postgres
1145--
1146
1147COMMENT ON COLUMN cust_order.arrival_instructions IS 'Additional instructions for the arrival of goods';
1148
1149
1150--
1151-- Name: COLUMN cust_order.arrival_contact; Type: COMMENT; Schema: public; Owner: postgres
1152--
1153
1154COMMENT ON COLUMN cust_order.arrival_contact IS 'Additional contact details (eg. name & tel. of supplier)';
1155
1156
1157--
1158-- Name: COLUMN cust_order.service_type_code; Type: COMMENT; Schema: public; Owner: postgres
1159--
1160
1161COMMENT ON COLUMN cust_order.service_type_code IS '--> Request.Type_Code: Static Request-Type Code';
1162
1163
1164--
1165-- Name: COLUMN cust_order.exit_location_site_id; Type: COMMENT; Schema: public; Owner: postgres
1166--
1167
1168COMMENT ON COLUMN cust_order.exit_location_site_id IS 'Destination Point';
1169
1170
1171--
1172-- Name: COLUMN cust_order.exit_location_id; Type: COMMENT; Schema: public; Owner: postgres
1173--
1174
1175COMMENT ON COLUMN cust_order.exit_location_id IS 'Destination Point';
1176
1177
1178--
1179-- Name: COLUMN cust_order.final_instructions; Type: COMMENT; Schema: public; Owner: postgres
1180--
1181
1182COMMENT ON COLUMN cust_order.final_instructions IS 'Addtional handling instruictions for the final delivery (if appropriate) of the goods';
1183
1184
1185--
1186-- Name: COLUMN cust_order.storage_duration; Type: COMMENT; Schema: public; Owner: postgres
1187--
1188
1189COMMENT ON COLUMN cust_order.storage_duration IS 'Length of time goods will be stored in the warehouse';
1190
1191
1192--
1193-- Name: COLUMN cust_order.status_code; Type: COMMENT; Schema: public; Owner: postgres
1194--
1195
1196COMMENT ON COLUMN cust_order.status_code IS '<Field is *NOT* copied to Request> Current request Status';
1197
1198
1199--
1200-- Name: COLUMN cust_order.sender_site_id; Type: COMMENT; Schema: public; Owner: postgres
1201--
1202
1203COMMENT ON COLUMN cust_order.sender_site_id IS '--> Request.Sender_Site_ID: Site owning the Sender''s Contact ID';
1204
1205
1206--
1207-- Name: COLUMN cust_order.sender_contact_id; Type: COMMENT; Schema: public; Owner: postgres
1208--
1209
1210COMMENT ON COLUMN cust_order.sender_contact_id IS '--> Request.Sender_Contact_ID: Sender Organisation Contact (within Sender_Site_ID)';
1211
1212
1213--
1214-- Name: COLUMN cust_order.receiver_site_id; Type: COMMENT; Schema: public; Owner: postgres
1215--
1216
1217COMMENT ON COLUMN cust_order.receiver_site_id IS '--> Request.Receiver_Site_ID: Site owning the Receiver''s Contact ID';
1218
1219
1220--
1221-- Name: COLUMN cust_order.receiver_contact_id; Type: COMMENT; Schema: public; Owner: postgres
1222--
1223
1224COMMENT ON COLUMN cust_order.receiver_contact_id IS '--> Request.Receiver_Contact_ID: Receiving Organisation Contact (within Receiver_Site_ID)';
1225
1226
1227--
1228-- Name: COLUMN cust_order.invoice_site_id; Type: COMMENT; Schema: public; Owner: postgres
1229--
1230
1231COMMENT ON COLUMN cust_order.invoice_site_id IS '--> Request.Invoice_Site_ID: Site owning the Billable Contact ID';
1232
1233
1234--
1235-- Name: COLUMN cust_order.invoice_contact_id; Type: COMMENT; Schema: public; Owner: postgres
1236--
1237
1238COMMENT ON COLUMN cust_order.invoice_contact_id IS '--> Request.Invoice_Contact_ID: Billable Organisation Contact (within Invoice_Site_ID)';
1239
1240
1241--
1242-- Name: COLUMN cust_order.on_behalf_of; Type: COMMENT; Schema: public; Owner: postgres
1243--
1244
1245COMMENT ON COLUMN cust_order.on_behalf_of IS '--> Request.On_Behalf_Of: Additional information, in the event that the cargo will be fowarded on by the Consignee';
1246
1247
1248--
1249-- Name: COLUMN cust_order.description; Type: COMMENT; Schema: public; Owner: postgres
1250--
1251
1252COMMENT ON COLUMN cust_order.description IS '--> Request_History.Remarks: Customer entered description';
1253
1254
1255--
1256-- Name: COLUMN cust_order.product_id; Type: COMMENT; Schema: public; Owner: postgres
1257--
1258
1259COMMENT ON COLUMN cust_order.product_id IS '--> Request.Product_ID: High-level sector being covered by the CMR (Null if none)';
1260
1261
1262--
1263-- Name: COLUMN cust_order.est_dispatch_time; Type: COMMENT; Schema: public; Owner: postgres
1264--
1265
1266COMMENT ON COLUMN cust_order.est_dispatch_time IS '--> Journey.Est_Dispatch_Time: Estimated (Sheduled) Date/Time of Dispatch';
1267
1268
1269--
1270-- Name: COLUMN cust_order.est_deliver_time; Type: COMMENT; Schema: public; Owner: postgres
1271--
1272
1273COMMENT ON COLUMN cust_order.est_deliver_time IS '--> Journey.Est_Deliver_Time: Estimated (Sheduled) Date/Time of Delivery';
1274
1275
1276--
1277-- Name: COLUMN cust_order.followup_date; Type: COMMENT; Schema: public; Owner: postgres
1278--
1279
1280COMMENT ON COLUMN cust_order.followup_date IS '<Field is *NOT* copied to Request> Set a date for followup (when Cust Order is placed on HOLD)';
1281
1282
1283--
1284-- Name: COLUMN cust_order.shipment_docm_idnf; Type: COMMENT; Schema: public; Owner: postgres
1285--
1286
1287COMMENT ON COLUMN cust_order.shipment_docm_idnf IS '--> Shipment.Shipment_Docm_Idnf: Document Number';
1288
1289
1290--
1291-- Name: COLUMN cust_order.created_by_logon; Type: COMMENT; Schema: public; Owner: postgres
1292--
1293
1294COMMENT ON COLUMN cust_order.created_by_logon IS '<Field is *NOT* copied to Request> User who created the request';
1295
1296
1297--
1298-- Name: COLUMN cust_order.created_time; Type: COMMENT; Schema: public; Owner: postgres
1299--
1300
1301COMMENT ON COLUMN cust_order.created_time IS '<Field is *NOT* copied to Request> Date the request was created';
1302
1303
1304--
1305-- Name: COLUMN cust_order.record_version; Type: COMMENT; Schema: public; Owner: postgres
1306--
1307
1308COMMENT ON COLUMN cust_order.record_version IS 'Audit field: Lastest (local) change version number of the data';
1309
1310
1311--
1312-- Name: COLUMN cust_order.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
1313--
1314
1315COMMENT ON COLUMN cust_order.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
1316
1317
1318--
1319-- Name: cust_order_history; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
1320--
1321
1322CREATE TABLE cust_order_history (
1323    commenting_site_id integer NOT NULL,
1324    cust_order_id integer NOT NULL,
1325    change_time timestamp without time zone NOT NULL,
1326    change_type_code character(1) NOT NULL,
1327    new_status_code character(2),
1328    remarks character varying(255) NOT NULL,
1329    created_by_logon character varying(40) NOT NULL,
1330    record_version bigint NOT NULL,
1331    is_deleted smallint NOT NULL
1332);
1333
1334
1335ALTER TABLE public.cust_order_history OWNER TO postgres;
1336
1337--
1338-- Name: COLUMN cust_order_history.commenting_site_id; Type: COMMENT; Schema: public; Owner: postgres
1339--
1340
1341COMMENT ON COLUMN cust_order_history.commenting_site_id IS 'Site owning this comment';
1342
1343
1344--
1345-- Name: COLUMN cust_order_history.cust_order_id; Type: COMMENT; Schema: public; Owner: postgres
1346--
1347
1348COMMENT ON COLUMN cust_order_history.cust_order_id IS 'Customer order ID';
1349
1350
1351--
1352-- Name: COLUMN cust_order_history.change_time; Type: COMMENT; Schema: public; Owner: postgres
1353--
1354
1355COMMENT ON COLUMN cust_order_history.change_time IS 'Date/Time of status change';
1356
1357
1358--
1359-- Name: COLUMN cust_order_history.change_type_code; Type: COMMENT; Schema: public; Owner: postgres
1360--
1361
1362COMMENT ON COLUMN cust_order_history.change_type_code IS '(S=Status Change; P=Priority Change; C=Comment)';
1363
1364
1365--
1366-- Name: COLUMN cust_order_history.new_status_code; Type: COMMENT; Schema: public; Owner: postgres
1367--
1368
1369COMMENT ON COLUMN cust_order_history.new_status_code IS 'If ChangeTypeCode="S": New request status; Otherwise NULL';
1370
1371
1372--
1373-- Name: COLUMN cust_order_history.remarks; Type: COMMENT; Schema: public; Owner: postgres
1374--
1375
1376COMMENT ON COLUMN cust_order_history.remarks IS 'If ChangeTypeCode="S", "C": User comment';
1377
1378
1379--
1380-- Name: COLUMN cust_order_history.created_by_logon; Type: COMMENT; Schema: public; Owner: postgres
1381--
1382
1383COMMENT ON COLUMN cust_order_history.created_by_logon IS 'User who created the request';
1384
1385
1386--
1387-- Name: COLUMN cust_order_history.record_version; Type: COMMENT; Schema: public; Owner: postgres
1388--
1389
1390COMMENT ON COLUMN cust_order_history.record_version IS 'Audit field: Lastest (local) change version number of the data';
1391
1392
1393--
1394-- Name: COLUMN cust_order_history.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
1395--
1396
1397COMMENT ON COLUMN cust_order_history.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
1398
1399
1400--
1401-- Name: cust_order_line; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
1402--
1403
1404CREATE TABLE cust_order_line (
1405    id integer NOT NULL,
1406    cust_order_id integer NOT NULL,
1407    seqno integer NOT NULL,
1408    kit_type_code character(1) NOT NULL,
1409    parent_line_id integer,
1410    ownr_item_desc character varying(255) NOT NULL,
1411    ownr_item_idnf character varying(40),
1412    product_id integer,
1413    is_cold_storage smallint NOT NULL,
1414    cold_min_temp numeric(4,1),
1415    cold_max_temp numeric(4,1),
1416    is_dangerous smallint NOT NULL,
1417    is_regulated smallint NOT NULL,
1418    is_fragile smallint NOT NULL,
1419    handling_instructions character varying(255),
1420    is_on_packing_list smallint NOT NULL,
1421    sku_id integer,
1422    sku_qty smallint,
1423    ltu_id integer NOT NULL,
1424    ltu_qty integer NOT NULL,
1425    ltu_weight numeric(12,6) NOT NULL,
1426    ltu_volume numeric(12,6) NOT NULL,
1427    bundle_type_id integer NOT NULL,
1428    bundle_qty smallint NOT NULL,
1429    record_version bigint NOT NULL,
1430    is_deleted smallint NOT NULL,
1431    CONSTRAINT ckc_bundle_qty_cust_ord CHECK ((bundle_qty >= 0)),
1432    CONSTRAINT ckc_ltu_qty_cust_ord CHECK ((ltu_qty >= 0)),
1433    CONSTRAINT ckc_ltu_volume_cust_ord CHECK ((ltu_volume >= (0)::numeric)),
1434    CONSTRAINT ckc_ltu_weight_cust_ord CHECK ((ltu_weight >= (0)::numeric)),
1435    CONSTRAINT ckc_sku_qty_cust_ord CHECK (((sku_qty IS NULL) OR (sku_qty >= 0)))
1436);
1437
1438
1439ALTER TABLE public.cust_order_line OWNER TO postgres;
1440
1441--
1442-- Name: COLUMN cust_order_line.id; Type: COMMENT; Schema: public; Owner: postgres
1443--
1444
1445COMMENT ON COLUMN cust_order_line.id IS 'Internally generated unique identifier';
1446
1447
1448--
1449-- Name: COLUMN cust_order_line.cust_order_id; Type: COMMENT; Schema: public; Owner: postgres
1450--
1451
1452COMMENT ON COLUMN cust_order_line.cust_order_id IS 'Project ID';
1453
1454
1455--
1456-- Name: COLUMN cust_order_line.seqno; Type: COMMENT; Schema: public; Owner: postgres
1457--
1458
1459COMMENT ON COLUMN cust_order_line.seqno IS 'Sequential Number within CMR';
1460
1461
1462--
1463-- Name: COLUMN cust_order_line.kit_type_code; Type: COMMENT; Schema: public; Owner: postgres
1464--
1465
1466COMMENT ON COLUMN cust_order_line.kit_type_code IS 'Kit Type: "N" = Normal (One or more items per single LTU); "S" = Splittable kit / "U" = Unsplittable Kit (multiple LTUs (boxes) make up one kit)';
1467
1468
1469--
1470-- Name: COLUMN cust_order_line.parent_line_id; Type: COMMENT; Schema: public; Owner: postgres
1471--
1472
1473COMMENT ON COLUMN cust_order_line.parent_line_id IS 'ProdSkuType = "S" or "U" only: Link back to the parent item in the multi-box kit';
1474
1475
1476--
1477-- Name: COLUMN cust_order_line.ownr_item_desc; Type: COMMENT; Schema: public; Owner: postgres
1478--
1479
1480COMMENT ON COLUMN cust_order_line.ownr_item_desc IS 'Item description as known to the owner (copy master item description if none supplied by customer)';
1481
1482
1483--
1484-- Name: COLUMN cust_order_line.ownr_item_idnf; Type: COMMENT; Schema: public; Owner: postgres
1485--
1486
1487COMMENT ON COLUMN cust_order_line.ownr_item_idnf IS 'Item code as known to the owner';
1488
1489
1490--
1491-- Name: COLUMN cust_order_line.product_id; Type: COMMENT; Schema: public; Owner: postgres
1492--
1493
1494COMMENT ON COLUMN cust_order_line.product_id IS 'Product Identifier';
1495
1496
1497--
1498-- Name: COLUMN cust_order_line.is_cold_storage; Type: COMMENT; Schema: public; Owner: postgres
1499--
1500
1501COMMENT ON COLUMN cust_order_line.is_cold_storage IS 'Does the item requires cold storage?';
1502
1503
1504--
1505-- Name: COLUMN cust_order_line.cold_min_temp; Type: COMMENT; Schema: public; Owner: postgres
1506--
1507
1508COMMENT ON COLUMN cust_order_line.cold_min_temp IS 'Cold storage minimum temperature (NULL indicates no minimum)';
1509
1510
1511--
1512-- Name: COLUMN cust_order_line.cold_max_temp; Type: COMMENT; Schema: public; Owner: postgres
1513--
1514
1515COMMENT ON COLUMN cust_order_line.cold_max_temp IS 'Cold storage maximum temperature (NULL indicates no maximum (only when IsColdStorage = "N"))';
1516
1517
1518--
1519-- Name: COLUMN cust_order_line.is_dangerous; Type: COMMENT; Schema: public; Owner: postgres
1520--
1521
1522COMMENT ON COLUMN cust_order_line.is_dangerous IS 'Does the item require dangerous goods documentation?';
1523
1524
1525--
1526-- Name: COLUMN cust_order_line.is_regulated; Type: COMMENT; Schema: public; Owner: postgres
1527--
1528
1529COMMENT ON COLUMN cust_order_line.is_regulated IS 'Requires other special documentation (psychotropic drugs, etc)';
1530
1531
1532--
1533-- Name: COLUMN cust_order_line.is_fragile; Type: COMMENT; Schema: public; Owner: postgres
1534--
1535
1536COMMENT ON COLUMN cust_order_line.is_fragile IS 'Requires special handling';
1537
1538
1539--
1540-- Name: COLUMN cust_order_line.handling_instructions; Type: COMMENT; Schema: public; Owner: postgres
1541--
1542
1543COMMENT ON COLUMN cust_order_line.handling_instructions IS 'Handling instructions - made available whenever Is_Dangerous, Is_Regulated or Is_Fragile is set to TRUE';
1544
1545
1546--
1547-- Name: COLUMN cust_order_line.is_on_packing_list; Type: COMMENT; Schema: public; Owner: postgres
1548--
1549
1550COMMENT ON COLUMN cust_order_line.is_on_packing_list IS 'Determines whether Handling instructions are to be printed on the packing list or not';
1551
1552
1553--
1554-- Name: COLUMN cust_order_line.sku_id; Type: COMMENT; Schema: public; Owner: postgres
1555--
1556
1557COMMENT ON COLUMN cust_order_line.sku_id IS 'Kit_Type = "N" only: Accounting Unit Quantity per LTU';
1558
1559
1560--
1561-- Name: COLUMN cust_order_line.sku_qty; Type: COMMENT; Schema: public; Owner: postgres
1562--
1563
1564COMMENT ON COLUMN cust_order_line.sku_qty IS 'Kit_Type = "N" only: Accounting Unit Quantity per LTU';
1565
1566
1567--
1568-- Name: COLUMN cust_order_line.ltu_id; Type: COMMENT; Schema: public; Owner: postgres
1569--
1570
1571COMMENT ON COLUMN cust_order_line.ltu_id IS 'Selected Unit of Measurement';
1572
1573
1574--
1575-- Name: COLUMN cust_order_line.ltu_qty; Type: COMMENT; Schema: public; Owner: postgres
1576--
1577
1578COMMENT ON COLUMN cust_order_line.ltu_qty IS 'Quantity of goods (at Lowest Transportable Unit) being transported';
1579
1580
1581--
1582-- Name: COLUMN cust_order_line.ltu_weight; Type: COMMENT; Schema: public; Owner: postgres
1583--
1584
1585COMMENT ON COLUMN cust_order_line.ltu_weight IS 'Weight (kg) of each individual item (Lowest Transportable Unit)';
1586
1587
1588--
1589-- Name: COLUMN cust_order_line.ltu_volume; Type: COMMENT; Schema: public; Owner: postgres
1590--
1591
1592COMMENT ON COLUMN cust_order_line.ltu_volume IS 'Volume (m3) of each individual item (Lowest Transportable Unit)';
1593
1594
1595--
1596-- Name: COLUMN cust_order_line.bundle_type_id; Type: COMMENT; Schema: public; Owner: postgres
1597--
1598
1599COMMENT ON COLUMN cust_order_line.bundle_type_id IS 'Container Type';
1600
1601
1602--
1603-- Name: COLUMN cust_order_line.bundle_qty; Type: COMMENT; Schema: public; Owner: postgres
1604--
1605
1606COMMENT ON COLUMN cust_order_line.bundle_qty IS 'Number of containers';
1607
1608
1609--
1610-- Name: COLUMN cust_order_line.record_version; Type: COMMENT; Schema: public; Owner: postgres
1611--
1612
1613COMMENT ON COLUMN cust_order_line.record_version IS 'Audit field: Lastest (local) change version number of the data';
1614
1615
1616--
1617-- Name: COLUMN cust_order_line.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
1618--
1619
1620COMMENT ON COLUMN cust_order_line.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
1621
1622
1623--
1624-- Name: dispatch_priority; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
1625--
1626
1627CREATE TABLE dispatch_priority (
1628    id integer NOT NULL,
1629    description character varying(255) NOT NULL,
1630    seqno integer NOT NULL,
1631    is_default smallint NOT NULL,
1632    name character varying(40) NOT NULL,
1633    record_version bigint NOT NULL,
1634    is_deleted smallint NOT NULL
1635);
1636
1637
1638ALTER TABLE public.dispatch_priority OWNER TO postgres;
1639
1640--
1641-- Name: COLUMN dispatch_priority.id; Type: COMMENT; Schema: public; Owner: postgres
1642--
1643
1644COMMENT ON COLUMN dispatch_priority.id IS 'Internally generated unique identifier';
1645
1646
1647--
1648-- Name: COLUMN dispatch_priority.description; Type: COMMENT; Schema: public; Owner: postgres
1649--
1650
1651COMMENT ON COLUMN dispatch_priority.description IS 'English language description';
1652
1653
1654--
1655-- Name: COLUMN dispatch_priority.seqno; Type: COMMENT; Schema: public; Owner: postgres
1656--
1657
1658COMMENT ON COLUMN dispatch_priority.seqno IS 'Priority Sort Sequency Number';
1659
1660
1661--
1662-- Name: COLUMN dispatch_priority.is_default; Type: COMMENT; Schema: public; Owner: postgres
1663--
1664
1665COMMENT ON COLUMN dispatch_priority.is_default IS 'Is this the default selection';
1666
1667
1668--
1669-- Name: COLUMN dispatch_priority.name; Type: COMMENT; Schema: public; Owner: postgres
1670--
1671
1672COMMENT ON COLUMN dispatch_priority.name IS 'Short name of the priority';
1673
1674
1675--
1676-- Name: COLUMN dispatch_priority.record_version; Type: COMMENT; Schema: public; Owner: postgres
1677--
1678
1679COMMENT ON COLUMN dispatch_priority.record_version IS 'Audit field: Lastest (local) change version number of the data';
1680
1681
1682--
1683-- Name: COLUMN dispatch_priority.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
1684--
1685
1686COMMENT ON COLUMN dispatch_priority.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
1687
1688
1689--
1690-- Name: distribution_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
1691--
1692
1693CREATE TABLE distribution_type (
1694    id integer NOT NULL,
1695    description character varying(255) NOT NULL,
1696    record_version bigint NOT NULL,
1697    is_deleted smallint NOT NULL
1698);
1699
1700
1701ALTER TABLE public.distribution_type OWNER TO postgres;
1702
1703--
1704-- Name: COLUMN distribution_type.id; Type: COMMENT; Schema: public; Owner: postgres
1705--
1706
1707COMMENT ON COLUMN distribution_type.id IS 'Site Distribution Type Code';
1708
1709
1710--
1711-- Name: COLUMN distribution_type.description; Type: COMMENT; Schema: public; Owner: postgres
1712--
1713
1714COMMENT ON COLUMN distribution_type.description IS 'English language description';
1715
1716
1717--
1718-- Name: COLUMN distribution_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
1719--
1720
1721COMMENT ON COLUMN distribution_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
1722
1723
1724--
1725-- Name: COLUMN distribution_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
1726--
1727
1728COMMENT ON COLUMN distribution_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
1729
1730
1731--
1732-- Name: enclosure_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
1733--
1734
1735CREATE TABLE enclosure_type (
1736    code character(2) NOT NULL,
1737    description character varying(255) NOT NULL,
1738    record_version bigint NOT NULL,
1739    is_deleted smallint NOT NULL
1740);
1741
1742
1743ALTER TABLE public.enclosure_type OWNER TO postgres;
1744
1745--
1746-- Name: COLUMN enclosure_type.code; Type: COMMENT; Schema: public; Owner: postgres
1747--
1748
1749COMMENT ON COLUMN enclosure_type.code IS 'Enclosure Type Code';
1750
1751
1752--
1753-- Name: COLUMN enclosure_type.description; Type: COMMENT; Schema: public; Owner: postgres
1754--
1755
1756COMMENT ON COLUMN enclosure_type.description IS 'English language description';
1757
1758
1759--
1760-- Name: COLUMN enclosure_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
1761--
1762
1763COMMENT ON COLUMN enclosure_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
1764
1765
1766--
1767-- Name: COLUMN enclosure_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
1768--
1769
1770COMMENT ON COLUMN enclosure_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
1771
1772
1773--
1774-- Name: exchange_rate; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
1775--
1776
1777CREATE TABLE exchange_rate (
1778    currency_id integer NOT NULL,
1779    take_effect_date date NOT NULL,
1780    exch_rate_usd numeric(10,4),
1781    record_version bigint NOT NULL,
1782    is_deleted smallint NOT NULL
1783);
1784
1785
1786ALTER TABLE public.exchange_rate OWNER TO postgres;
1787
1788--
1789-- Name: COLUMN exchange_rate.take_effect_date; Type: COMMENT; Schema: public; Owner: postgres
1790--
1791
1792COMMENT ON COLUMN exchange_rate.take_effect_date IS 'Effective Date';
1793
1794
1795--
1796-- Name: COLUMN exchange_rate.exch_rate_usd; Type: COMMENT; Schema: public; Owner: postgres
1797--
1798
1799COMMENT ON COLUMN exchange_rate.exch_rate_usd IS 'Exchange rate against USD1 (accurate to 4 decimal places)';
1800
1801
1802--
1803-- Name: COLUMN exchange_rate.record_version; Type: COMMENT; Schema: public; Owner: postgres
1804--
1805
1806COMMENT ON COLUMN exchange_rate.record_version IS 'Audit field: Lastest (local) change version number of the data';
1807
1808
1809--
1810-- Name: COLUMN exchange_rate.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
1811--
1812
1813COMMENT ON COLUMN exchange_rate.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
1814
1815
1816--
1817-- Name: journey; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
1818--
1819
1820CREATE TABLE journey (
1821    journey_site_id integer NOT NULL,
1822    id integer NOT NULL,
1823    project_id integer NOT NULL,
1824    journey_type_code character(1) NOT NULL,
1825    is_dispatched smallint NOT NULL,
1826    est_dispatch_time timestamp without time zone NOT NULL,
1827    actual_dispatch_time timestamp without time zone,
1828    transport_company character varying(40),
1829    vehicle_category_id integer,
1830    vehicle_type character varying(40),
1831    vehicle_idnf character varying(40),
1832    driver_name character varying(255),
1833    driver_idnf character varying(255),
1834    driver_contact character varying(255),
1835    load_port_address character varying(255),
1836    remarks_journey character varying(255),
1837    record_version bigint NOT NULL,
1838    is_deleted smallint NOT NULL
1839);
1840
1841
1842ALTER TABLE public.journey OWNER TO postgres;
1843
1844--
1845-- Name: COLUMN journey.journey_site_id; Type: COMMENT; Schema: public; Owner: postgres
1846--
1847
1848COMMENT ON COLUMN journey.journey_site_id IS 'Site that owns the record - normally the same as Origin_Site_ID, except where goods originat from the special CUST Site';
1849
1850
1851--
1852-- Name: COLUMN journey.id; Type: COMMENT; Schema: public; Owner: postgres
1853--
1854
1855COMMENT ON COLUMN journey.id IS 'Internally generated unique identifier';
1856
1857
1858--
1859-- Name: COLUMN journey.project_id; Type: COMMENT; Schema: public; Owner: postgres
1860--
1861
1862COMMENT ON COLUMN journey.project_id IS 'Project - Included in this table, even though it can be derived via Movement & Request), as when a Journey is initially defined, it has no Movement and no Request records. When multiple projects use the same site, this field is needed to separate unused Journey records by project';
1863
1864
1865--
1866-- Name: COLUMN journey.journey_type_code; Type: COMMENT; Schema: public; Owner: postgres
1867--
1868
1869COMMENT ON COLUMN journey.journey_type_code IS 'I=Initial (Record customer promise); T=Transfer (Physical movement of cargo); R=Release (Cargo surrendered to customer without a movement); A=Adjustment (Change to stock levels within a site)';
1870
1871
1872--
1873-- Name: COLUMN journey.is_dispatched; Type: COMMENT; Schema: public; Owner: postgres
1874--
1875
1876COMMENT ON COLUMN journey.is_dispatched IS 'FALSE = Journey still in planning stages; TRUE = Journey has been dispatched';
1877
1878
1879--
1880-- Name: COLUMN journey.est_dispatch_time; Type: COMMENT; Schema: public; Owner: postgres
1881--
1882
1883COMMENT ON COLUMN journey.est_dispatch_time IS 'Estimated (Sheduled) Date/Time of Dispatch';
1884
1885
1886--
1887-- Name: COLUMN journey.actual_dispatch_time; Type: COMMENT; Schema: public; Owner: postgres
1888--
1889
1890COMMENT ON COLUMN journey.actual_dispatch_time IS 'Actual Date/Time of Dispatch';
1891
1892
1893--
1894-- Name: COLUMN journey.transport_company; Type: COMMENT; Schema: public; Owner: postgres
1895--
1896
1897COMMENT ON COLUMN journey.transport_company IS 'Name of the company providing the vehicle';
1898
1899
1900--
1901-- Name: COLUMN journey.vehicle_category_id; Type: COMMENT; Schema: public; Owner: postgres
1902--
1903
1904COMMENT ON COLUMN journey.vehicle_category_id IS 'Vehicle Category';
1905
1906
1907--
1908-- Name: COLUMN journey.vehicle_type; Type: COMMENT; Schema: public; Owner: postgres
1909--
1910
1911COMMENT ON COLUMN journey.vehicle_type IS 'Make/model of the vehicle';
1912
1913
1914--
1915-- Name: COLUMN journey.vehicle_idnf; Type: COMMENT; Schema: public; Owner: postgres
1916--
1917
1918COMMENT ON COLUMN journey.vehicle_idnf IS 'Licence plate/call sign of the vehicle';
1919
1920
1921--
1922-- Name: COLUMN journey.driver_name; Type: COMMENT; Schema: public; Owner: postgres
1923--
1924
1925COMMENT ON COLUMN journey.driver_name IS 'Driver"s name';
1926
1927
1928--
1929-- Name: COLUMN journey.driver_idnf; Type: COMMENT; Schema: public; Owner: postgres
1930--
1931
1932COMMENT ON COLUMN journey.driver_idnf IS 'Driver"s Identification';
1933
1934
1935--
1936-- Name: COLUMN journey.driver_contact; Type: COMMENT; Schema: public; Owner: postgres
1937--
1938
1939COMMENT ON COLUMN journey.driver_contact IS 'Driver"s contact details';
1940
1941
1942--
1943-- Name: COLUMN journey.load_port_address; Type: COMMENT; Schema: public; Owner: postgres
1944--
1945
1946COMMENT ON COLUMN journey.load_port_address IS 'Loading Port Name (Free text, optional)';
1947
1948
1949--
1950-- Name: COLUMN journey.remarks_journey; Type: COMMENT; Schema: public; Owner: postgres
1951--
1952
1953COMMENT ON COLUMN journey.remarks_journey IS 'Additional remarks about the Journey (pickup sequence, etc)';
1954
1955
1956--
1957-- Name: COLUMN journey.record_version; Type: COMMENT; Schema: public; Owner: postgres
1958--
1959
1960COMMENT ON COLUMN journey.record_version IS 'Audit field: Lastest (local) change version number of the data';
1961
1962
1963--
1964-- Name: COLUMN journey.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
1965--
1966
1967COMMENT ON COLUMN journey.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
1968
1969
1970--
1971-- Name: journey_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
1972--
1973
1974CREATE TABLE journey_type (
1975    code character(1) NOT NULL,
1976    description character varying(255) NOT NULL,
1977    record_version bigint NOT NULL,
1978    is_deleted smallint NOT NULL
1979);
1980
1981
1982ALTER TABLE public.journey_type OWNER TO postgres;
1983
1984--
1985-- Name: COLUMN journey_type.code; Type: COMMENT; Schema: public; Owner: postgres
1986--
1987
1988COMMENT ON COLUMN journey_type.code IS 'Journey Type Code';
1989
1990
1991--
1992-- Name: COLUMN journey_type.description; Type: COMMENT; Schema: public; Owner: postgres
1993--
1994
1995COMMENT ON COLUMN journey_type.description IS 'English language description';
1996
1997
1998--
1999-- Name: COLUMN journey_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
2000--
2001
2002COMMENT ON COLUMN journey_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
2003
2004
2005--
2006-- Name: COLUMN journey_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2007--
2008
2009COMMENT ON COLUMN journey_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2010
2011
2012--
2013-- Name: kit_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2014--
2015
2016CREATE TABLE kit_type (
2017    code character(1) NOT NULL,
2018    description character varying(255) NOT NULL,
2019    record_version bigint NOT NULL,
2020    is_deleted smallint NOT NULL
2021);
2022
2023
2024ALTER TABLE public.kit_type OWNER TO postgres;
2025
2026--
2027-- Name: COLUMN kit_type.code; Type: COMMENT; Schema: public; Owner: postgres
2028--
2029
2030COMMENT ON COLUMN kit_type.code IS 'Kit Type: "N" = Normal (One or more items per single LTU); "S" / "U" = Splittable / Unsplittable kit (multiple LTUs (boxes) make up one kit)';
2031
2032
2033--
2034-- Name: COLUMN kit_type.description; Type: COMMENT; Schema: public; Owner: postgres
2035--
2036
2037COMMENT ON COLUMN kit_type.description IS 'English language description';
2038
2039
2040--
2041-- Name: COLUMN kit_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
2042--
2043
2044COMMENT ON COLUMN kit_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
2045
2046
2047--
2048-- Name: COLUMN kit_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2049--
2050
2051COMMENT ON COLUMN kit_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2052
2053
2054--
2055-- Name: languages; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2056--
2057
2058CREATE TABLE languages (
2059    iso2_idnf character(2) NOT NULL,
2060    locale_idnf character(6) NOT NULL,
2061    english_desc character varying(255) NOT NULL,
2062    original_desc character varying(255) NOT NULL,
2063    record_version bigint NOT NULL,
2064    is_deleted smallint NOT NULL
2065);
2066
2067
2068ALTER TABLE public.languages OWNER TO postgres;
2069
2070--
2071-- Name: COLUMN languages.iso2_idnf; Type: COMMENT; Schema: public; Owner: postgres
2072--
2073
2074COMMENT ON COLUMN languages.iso2_idnf IS 'ISO639-1 language code';
2075
2076
2077--
2078-- Name: COLUMN languages.locale_idnf; Type: COMMENT; Schema: public; Owner: postgres
2079--
2080
2081COMMENT ON COLUMN languages.locale_idnf IS 'Java Locale Code';
2082
2083
2084--
2085-- Name: COLUMN languages.english_desc; Type: COMMENT; Schema: public; Owner: postgres
2086--
2087
2088COMMENT ON COLUMN languages.english_desc IS 'Language name in English';
2089
2090
2091--
2092-- Name: COLUMN languages.original_desc; Type: COMMENT; Schema: public; Owner: postgres
2093--
2094
2095COMMENT ON COLUMN languages.original_desc IS 'Language name in that language';
2096
2097
2098--
2099-- Name: COLUMN languages.record_version; Type: COMMENT; Schema: public; Owner: postgres
2100--
2101
2102COMMENT ON COLUMN languages.record_version IS 'Audit field: Lastest (local) change version number of the data';
2103
2104
2105--
2106-- Name: COLUMN languages.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2107--
2108
2109COMMENT ON COLUMN languages.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2110
2111
2112--
2113-- Name: list_action; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2114--
2115
2116CREATE TABLE list_action (
2117    screen_code character(2) NOT NULL,
2118    list_action_code character(3) NOT NULL,
2119    description character varying(255) NOT NULL,
2120    seqno integer NOT NULL,
2121    is_displayed smallint NOT NULL,
2122    is_allowed_if_proj_closed smallint NOT NULL,
2123    record_version bigint NOT NULL,
2124    is_deleted smallint NOT NULL
2125);
2126
2127
2128ALTER TABLE public.list_action OWNER TO postgres;
2129
2130--
2131-- Name: COLUMN list_action.screen_code; Type: COMMENT; Schema: public; Owner: postgres
2132--
2133
2134COMMENT ON COLUMN list_action.screen_code IS 'Code of the screen using the action';
2135
2136
2137--
2138-- Name: COLUMN list_action.list_action_code; Type: COMMENT; Schema: public; Owner: postgres
2139--
2140
2141COMMENT ON COLUMN list_action.list_action_code IS 'Code of the action';
2142
2143
2144--
2145-- Name: COLUMN list_action.description; Type: COMMENT; Schema: public; Owner: postgres
2146--
2147
2148COMMENT ON COLUMN list_action.description IS 'English language description';
2149
2150
2151--
2152-- Name: COLUMN list_action.seqno; Type: COMMENT; Schema: public; Owner: postgres
2153--
2154
2155COMMENT ON COLUMN list_action.seqno IS 'Sequence Number within the list. Lowest SeqNo will be the double-click default';
2156
2157
2158--
2159-- Name: COLUMN list_action.is_displayed; Type: COMMENT; Schema: public; Owner: postgres
2160--
2161
2162COMMENT ON COLUMN list_action.is_displayed IS 'Is the action to be displayed in the Action list.';
2163
2164
2165--
2166-- Name: COLUMN list_action.is_allowed_if_proj_closed; Type: COMMENT; Schema: public; Owner: postgres
2167--
2168
2169COMMENT ON COLUMN list_action.is_allowed_if_proj_closed IS 'Is the viewpoint allowed/valid if the project is closed';
2170
2171
2172--
2173-- Name: COLUMN list_action.record_version; Type: COMMENT; Schema: public; Owner: postgres
2174--
2175
2176COMMENT ON COLUMN list_action.record_version IS 'Audit field: Lastest (local) change version number of the data';
2177
2178
2179--
2180-- Name: COLUMN list_action.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2181--
2182
2183COMMENT ON COLUMN list_action.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2184
2185
2186--
2187-- Name: list_action_roles; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2188--
2189
2190CREATE TABLE list_action_roles (
2191    screen_code character(2) NOT NULL,
2192    list_action_code character(3) NOT NULL,
2193    role_code character(3) NOT NULL,
2194    record_version bigint NOT NULL,
2195    is_deleted smallint NOT NULL
2196);
2197
2198
2199ALTER TABLE public.list_action_roles OWNER TO postgres;
2200
2201--
2202-- Name: COLUMN list_action_roles.screen_code; Type: COMMENT; Schema: public; Owner: postgres
2203--
2204
2205COMMENT ON COLUMN list_action_roles.screen_code IS 'Code of the screen using the viewpoint';
2206
2207
2208--
2209-- Name: COLUMN list_action_roles.list_action_code; Type: COMMENT; Schema: public; Owner: postgres
2210--
2211
2212COMMENT ON COLUMN list_action_roles.list_action_code IS 'List Action being taken';
2213
2214
2215--
2216-- Name: COLUMN list_action_roles.role_code; Type: COMMENT; Schema: public; Owner: postgres
2217--
2218
2219COMMENT ON COLUMN list_action_roles.role_code IS 'Role';
2220
2221
2222--
2223-- Name: COLUMN list_action_roles.record_version; Type: COMMENT; Schema: public; Owner: postgres
2224--
2225
2226COMMENT ON COLUMN list_action_roles.record_version IS 'Audit field: Lastest (local) change version number of the data';
2227
2228
2229--
2230-- Name: COLUMN list_action_roles.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2231--
2232
2233COMMENT ON COLUMN list_action_roles.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2234
2235
2236--
2237-- Name: list_action_viewpoints; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2238--
2239
2240CREATE TABLE list_action_viewpoints (
2241    screen_code character(2) NOT NULL,
2242    viewpoint_code character(3) NOT NULL,
2243    list_action_code character(3) NOT NULL,
2244    record_version bigint NOT NULL,
2245    is_deleted smallint NOT NULL
2246);
2247
2248
2249ALTER TABLE public.list_action_viewpoints OWNER TO postgres;
2250
2251--
2252-- Name: COLUMN list_action_viewpoints.screen_code; Type: COMMENT; Schema: public; Owner: postgres
2253--
2254
2255COMMENT ON COLUMN list_action_viewpoints.screen_code IS 'Code of the screen using the viewpoint';
2256
2257
2258--
2259-- Name: COLUMN list_action_viewpoints.viewpoint_code; Type: COMMENT; Schema: public; Owner: postgres
2260--
2261
2262COMMENT ON COLUMN list_action_viewpoints.viewpoint_code IS 'Viewpoint';
2263
2264
2265--
2266-- Name: COLUMN list_action_viewpoints.list_action_code; Type: COMMENT; Schema: public; Owner: postgres
2267--
2268
2269COMMENT ON COLUMN list_action_viewpoints.list_action_code IS 'List Action being taken';
2270
2271
2272--
2273-- Name: COLUMN list_action_viewpoints.record_version; Type: COMMENT; Schema: public; Owner: postgres
2274--
2275
2276COMMENT ON COLUMN list_action_viewpoints.record_version IS 'Audit field: Lastest (local) change version number of the data';
2277
2278
2279--
2280-- Name: COLUMN list_action_viewpoints.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2281--
2282
2283COMMENT ON COLUMN list_action_viewpoints.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2284
2285
2286--
2287-- Name: location; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2288--
2289
2290CREATE TABLE location (
2291    location_site_id integer NOT NULL,
2292    id integer NOT NULL,
2293    location_type_code character(1) NOT NULL,
2294    project_id integer NOT NULL,
2295    parent_site_id integer NOT NULL,
2296    name character varying(40) NOT NULL,
2297    latitude numeric(8,5),
2298    longitude numeric(8,5),
2299    address1 character varying(255),
2300    address2 character varying(255),
2301    country_id integer NOT NULL,
2302    email character varying(100),
2303    phone character varying(40),
2304    fax character varying(40),
2305    warehouse_cap_area numeric(9,3),
2306    warehouse_cap_volume numeric(12,6),
2307    warehouse_cap_weight numeric(12,6),
2308    remarks character varying(255),
2309    port_iso_code character(4),
2310    port_type_id integer,
2311    port_consignee_detail text,
2312    port_is_active smallint NOT NULL,
2313    record_version bigint NOT NULL,
2314    is_deleted smallint NOT NULL,
2315    CONSTRAINT ckc_warehouse_cap_are_location CHECK (((warehouse_cap_area IS NULL) OR (warehouse_cap_area >= (0)::numeric))),
2316    CONSTRAINT ckc_warehouse_cap_vol_location CHECK (((warehouse_cap_volume IS NULL) OR (warehouse_cap_volume >= (0)::numeric))),
2317    CONSTRAINT ckc_warehouse_cap_wei_location CHECK (((warehouse_cap_weight IS NULL) OR (warehouse_cap_weight >= (0)::numeric)))
2318);
2319
2320
2321ALTER TABLE public.location OWNER TO postgres;
2322
2323--
2324-- Name: COLUMN location.location_site_id; Type: COMMENT; Schema: public; Owner: postgres
2325--
2326
2327COMMENT ON COLUMN location.location_site_id IS 'Site that created/owns the record';
2328
2329
2330--
2331-- Name: COLUMN location.id; Type: COMMENT; Schema: public; Owner: postgres
2332--
2333
2334COMMENT ON COLUMN location.id IS 'Internally generated identifier. Unique within Owner_Site_ID';
2335
2336
2337--
2338-- Name: COLUMN location.location_type_code; Type: COMMENT; Schema: public; Owner: postgres
2339--
2340
2341COMMENT ON COLUMN location.location_type_code IS 'W=Warehouse (destinations limited to this for transfers) - GPS mandatory; P=Port (additional fields available) - GPS Optional; C=Customer Address - GPS optional';
2342
2343
2344--
2345-- Name: COLUMN location.project_id; Type: COMMENT; Schema: public; Owner: postgres
2346--
2347
2348COMMENT ON COLUMN location.project_id IS 'Project ID';
2349
2350
2351--
2352-- Name: COLUMN location.parent_site_id; Type: COMMENT; Schema: public; Owner: postgres
2353--
2354
2355COMMENT ON COLUMN location.parent_site_id IS 'Site closest to, or responsible for the Location (usually but not necessarily the same as the owener Site ID)';
2356
2357
2358--
2359-- Name: COLUMN location.name; Type: COMMENT; Schema: public; Owner: postgres
2360--
2361
2362COMMENT ON COLUMN location.name IS 'Location''s short name';
2363
2364
2365--
2366-- Name: COLUMN location.latitude; Type: COMMENT; Schema: public; Owner: postgres
2367--
2368
2369COMMENT ON COLUMN location.latitude IS 'Latitude';
2370
2371
2372--
2373-- Name: COLUMN location.longitude; Type: COMMENT; Schema: public; Owner: postgres
2374--
2375
2376COMMENT ON COLUMN location.longitude IS 'Longitude';
2377
2378
2379--
2380-- Name: COLUMN location.address1; Type: COMMENT; Schema: public; Owner: postgres
2381--
2382
2383COMMENT ON COLUMN location.address1 IS 'Site Address';
2384
2385
2386--
2387-- Name: COLUMN location.address2; Type: COMMENT; Schema: public; Owner: postgres
2388--
2389
2390COMMENT ON COLUMN location.address2 IS 'Site Address';
2391
2392
2393--
2394-- Name: COLUMN location.country_id; Type: COMMENT; Schema: public; Owner: postgres
2395--
2396
2397COMMENT ON COLUMN location.country_id IS 'Country ID';
2398
2399
2400--
2401-- Name: COLUMN location.email; Type: COMMENT; Schema: public; Owner: postgres
2402--
2403
2404COMMENT ON COLUMN location.email IS 'Primary email of the site';
2405
2406
2407--
2408-- Name: COLUMN location.phone; Type: COMMENT; Schema: public; Owner: postgres
2409--
2410
2411COMMENT ON COLUMN location.phone IS 'Site Phone';
2412
2413
2414--
2415-- Name: COLUMN location.fax; Type: COMMENT; Schema: public; Owner: postgres
2416--
2417
2418COMMENT ON COLUMN location.fax IS 'Site Fax';
2419
2420
2421--
2422-- Name: COLUMN location.warehouse_cap_area; Type: COMMENT; Schema: public; Owner: postgres
2423--
2424
2425COMMENT ON COLUMN location.warehouse_cap_area IS 'Site Capacity - Floor Area (m2)';
2426
2427
2428--
2429-- Name: COLUMN location.warehouse_cap_volume; Type: COMMENT; Schema: public; Owner: postgres
2430--
2431
2432COMMENT ON COLUMN location.warehouse_cap_volume IS 'Site Capacity - Volume (m3)';
2433
2434
2435--
2436-- Name: COLUMN location.warehouse_cap_weight; Type: COMMENT; Schema: public; Owner: postgres
2437--
2438
2439COMMENT ON COLUMN location.warehouse_cap_weight IS 'Site Capacity - Weight (kg)';
2440
2441
2442--
2443-- Name: COLUMN location.remarks; Type: COMMENT; Schema: public; Owner: postgres
2444--
2445
2446COMMENT ON COLUMN location.remarks IS 'Additional comments';
2447
2448
2449--
2450-- Name: COLUMN location.port_iso_code; Type: COMMENT; Schema: public; Owner: postgres
2451--
2452
2453COMMENT ON COLUMN location.port_iso_code IS 'Location_Type_Code=''P'': 3-4 Character ISO code for the port';
2454
2455
2456--
2457-- Name: COLUMN location.port_type_id; Type: COMMENT; Schema: public; Owner: postgres
2458--
2459
2460COMMENT ON COLUMN location.port_type_id IS 'Location_Type_Code=''P'': Airport, Seaport, etc';
2461
2462
2463--
2464-- Name: COLUMN location.port_consignee_detail; Type: COMMENT; Schema: public; Owner: postgres
2465--
2466
2467COMMENT ON COLUMN location.port_consignee_detail IS 'Location_Type_Code=''P'': Sample consignee text required for all incoming waybills';
2468
2469
2470--
2471-- Name: COLUMN location.port_is_active; Type: COMMENT; Schema: public; Owner: postgres
2472--
2473
2474COMMENT ON COLUMN location.port_is_active IS 'Location_Type_Code=''P'': Flag indicating transhipment port is available for clients to select';
2475
2476
2477--
2478-- Name: COLUMN location.record_version; Type: COMMENT; Schema: public; Owner: postgres
2479--
2480
2481COMMENT ON COLUMN location.record_version IS 'Audit field: Lastest (local) change version number of the data';
2482
2483
2484--
2485-- Name: COLUMN location.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2486--
2487
2488COMMENT ON COLUMN location.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2489
2490
2491--
2492-- Name: location_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2493--
2494
2495CREATE TABLE location_type (
2496    code character(1) NOT NULL,
2497    description character varying(255) NOT NULL,
2498    record_version bigint NOT NULL,
2499    is_deleted smallint NOT NULL
2500);
2501
2502
2503ALTER TABLE public.location_type OWNER TO postgres;
2504
2505--
2506-- Name: COLUMN location_type.code; Type: COMMENT; Schema: public; Owner: postgres
2507--
2508
2509COMMENT ON COLUMN location_type.code IS 'Location Type Code: W, P, C';
2510
2511
2512--
2513-- Name: COLUMN location_type.description; Type: COMMENT; Schema: public; Owner: postgres
2514--
2515
2516COMMENT ON COLUMN location_type.description IS 'English language description';
2517
2518
2519--
2520-- Name: COLUMN location_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
2521--
2522
2523COMMENT ON COLUMN location_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
2524
2525
2526--
2527-- Name: COLUMN location_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2528--
2529
2530COMMENT ON COLUMN location_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2531
2532
2533--
2534-- Name: movement; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2535--
2536
2537CREATE TABLE movement (
2538    move_site_id integer NOT NULL,
2539    id integer NOT NULL,
2540    affected_location_site_id integer NOT NULL,
2541    affected_location_id integer NOT NULL,
2542    shipment_site_id integer NOT NULL,
2543    shipment_id integer NOT NULL,
2544    bundle_site_id integer NOT NULL,
2545    bundle_id integer NOT NULL,
2546    request_site_id integer NOT NULL,
2547    request_line_id integer NOT NULL,
2548    movement_ledger_code character(1) NOT NULL,
2549    ltu_qty integer NOT NULL,
2550    ltu_weight numeric(12,6) NOT NULL,
2551    ltu_volume numeric(12,6) NOT NULL,
2552    record_version bigint NOT NULL,
2553    is_deleted smallint NOT NULL,
2554    CONSTRAINT ckc_ltu_volume_movement CHECK ((ltu_volume >= (0)::numeric)),
2555    CONSTRAINT ckc_ltu_weight_movement CHECK ((ltu_weight >= (0)::numeric))
2556);
2557
2558
2559ALTER TABLE public.movement OWNER TO postgres;
2560
2561--
2562-- Name: COLUMN movement.move_site_id; Type: COMMENT; Schema: public; Owner: postgres
2563--
2564
2565COMMENT ON COLUMN movement.move_site_id IS 'Site that created and owns the movement record';
2566
2567
2568--
2569-- Name: COLUMN movement.id; Type: COMMENT; Schema: public; Owner: postgres
2570--
2571
2572COMMENT ON COLUMN movement.id IS 'Internally generated identifier, Unique within Move_Site_ID';
2573
2574
2575--
2576-- Name: COLUMN movement.affected_location_site_id; Type: COMMENT; Schema: public; Owner: postgres
2577--
2578
2579COMMENT ON COLUMN movement.affected_location_site_id IS 'Site whose stock will be affected by this record';
2580
2581
2582--
2583-- Name: COLUMN movement.affected_location_id; Type: COMMENT; Schema: public; Owner: postgres
2584--
2585
2586COMMENT ON COLUMN movement.affected_location_id IS 'Location whose stock will be affected by this record';
2587
2588
2589--
2590-- Name: COLUMN movement.shipment_site_id; Type: COMMENT; Schema: public; Owner: postgres
2591--
2592
2593COMMENT ON COLUMN movement.shipment_site_id IS 'Site that owns the Journey and Shipment record, and normally (except for goods arriving from CUST) the site at the origin of the movement';
2594
2595
2596--
2597-- Name: COLUMN movement.shipment_id; Type: COMMENT; Schema: public; Owner: postgres
2598--
2599
2600COMMENT ON COLUMN movement.shipment_id IS 'Journey identifier';
2601
2602
2603--
2604-- Name: COLUMN movement.bundle_site_id; Type: COMMENT; Schema: public; Owner: postgres
2605--
2606
2607COMMENT ON COLUMN movement.bundle_site_id IS 'Owning site of the bundle record (may be the same or different between ''O'' and ''D'' records, depending whether the bundle config in the w/house is the same as the bundle config sent)';
2608
2609
2610--
2611-- Name: COLUMN movement.bundle_id; Type: COMMENT; Schema: public; Owner: postgres
2612--
2613
2614COMMENT ON COLUMN movement.bundle_id IS 'Bundle ID, unique within Bundle_Site_ID';
2615
2616
2617--
2618-- Name: COLUMN movement.request_site_id; Type: COMMENT; Schema: public; Owner: postgres
2619--
2620
2621COMMENT ON COLUMN movement.request_site_id IS 'Site that originally raised the request - not necessarily the same as the Site originating the currernt movement';
2622
2623
2624--
2625-- Name: COLUMN movement.request_line_id; Type: COMMENT; Schema: public; Owner: postgres
2626--
2627
2628COMMENT ON COLUMN movement.request_line_id IS 'Request Detail';
2629
2630
2631--
2632-- Name: COLUMN movement.movement_ledger_code; Type: COMMENT; Schema: public; Owner: postgres
2633--
2634
2635COMMENT ON COLUMN movement.movement_ledger_code IS 'E: Expected (Goods in transit); S (in-Stock); D (Damaged); L (Lost); P: (Planning -not yet dispatched)';
2636
2637
2638--
2639-- Name: COLUMN movement.ltu_qty; Type: COMMENT; Schema: public; Owner: postgres
2640--
2641
2642COMMENT ON COLUMN movement.ltu_qty IS 'Quantity of goods (at Lowest Transportable Unit) being transported';
2643
2644
2645--
2646-- Name: COLUMN movement.ltu_weight; Type: COMMENT; Schema: public; Owner: postgres
2647--
2648
2649COMMENT ON COLUMN movement.ltu_weight IS 'Weight (kg) of each individual item (Lowest Transportable Unit)';
2650
2651
2652--
2653-- Name: COLUMN movement.ltu_volume; Type: COMMENT; Schema: public; Owner: postgres
2654--
2655
2656COMMENT ON COLUMN movement.ltu_volume IS 'Volume (m3) of each individual item (Lowest Transportable Unit)';
2657
2658
2659--
2660-- Name: COLUMN movement.record_version; Type: COMMENT; Schema: public; Owner: postgres
2661--
2662
2663COMMENT ON COLUMN movement.record_version IS 'Audit field: Lastest (local) change version number of the data';
2664
2665
2666--
2667-- Name: COLUMN movement.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2668--
2669
2670COMMENT ON COLUMN movement.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2671
2672
2673--
2674-- Name: movement_comment; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2675--
2676
2677CREATE TABLE movement_comment (
2678    move_site_id integer NOT NULL,
2679    id integer NOT NULL,
2680    remarks character varying(255),
2681    record_version bigint NOT NULL,
2682    is_deleted smallint NOT NULL
2683);
2684
2685
2686ALTER TABLE public.movement_comment OWNER TO postgres;
2687
2688--
2689-- Name: COLUMN movement_comment.move_site_id; Type: COMMENT; Schema: public; Owner: postgres
2690--
2691
2692COMMENT ON COLUMN movement_comment.move_site_id IS 'Site originating this cargo movement';
2693
2694
2695--
2696-- Name: COLUMN movement_comment.id; Type: COMMENT; Schema: public; Owner: postgres
2697--
2698
2699COMMENT ON COLUMN movement_comment.id IS 'Internally generated unique identifier';
2700
2701
2702--
2703-- Name: COLUMN movement_comment.remarks; Type: COMMENT; Schema: public; Owner: postgres
2704--
2705
2706COMMENT ON COLUMN movement_comment.remarks IS 'Comments around a movement. Normally optional, this becomes mandatory when moving goods to the special Site ID "DAMAGED';
2707
2708
2709--
2710-- Name: COLUMN movement_comment.record_version; Type: COMMENT; Schema: public; Owner: postgres
2711--
2712
2713COMMENT ON COLUMN movement_comment.record_version IS 'Audit field: Lastest (local) change version number of the data';
2714
2715
2716--
2717-- Name: COLUMN movement_comment.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2718--
2719
2720COMMENT ON COLUMN movement_comment.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2721
2722
2723--
2724-- Name: org; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2725--
2726
2727CREATE TABLE org (
2728    id integer NOT NULL,
2729    name character varying(100) NOT NULL,
2730    abrv character varying(40),
2731    org_type_code character(3) NOT NULL,
2732    is_intl smallint NOT NULL,
2733    is_donor smallint NOT NULL,
2734    country_id integer,
2735    website character varying(255),
2736    wings_idnf character varying(40),
2737    compas_idnf character varying(40),
2738    dacota_idnf integer,
2739    record_version bigint NOT NULL,
2740    is_deleted smallint NOT NULL
2741);
2742
2743
2744ALTER TABLE public.org OWNER TO postgres;
2745
2746--
2747-- Name: COLUMN org.id; Type: COMMENT; Schema: public; Owner: postgres
2748--
2749
2750COMMENT ON COLUMN org.id IS 'Internally generated unique identifier';
2751
2752
2753--
2754-- Name: COLUMN org.name; Type: COMMENT; Schema: public; Owner: postgres
2755--
2756
2757COMMENT ON COLUMN org.name IS 'Organisation"s full name';
2758
2759
2760--
2761-- Name: COLUMN org.abrv; Type: COMMENT; Schema: public; Owner: postgres
2762--
2763
2764COMMENT ON COLUMN org.abrv IS 'Abbreviation';
2765
2766
2767--
2768-- Name: COLUMN org.org_type_code; Type: COMMENT; Schema: public; Owner: postgres
2769--
2770
2771COMMENT ON COLUMN org.org_type_code IS 'Organisation type code';
2772
2773
2774--
2775-- Name: COLUMN org.is_intl; Type: COMMENT; Schema: public; Owner: postgres
2776--
2777
2778COMMENT ON COLUMN org.is_intl IS 'Non-country specific organisation? If "Yes", Country field is unavailable and set to NULL. If "No", Country field is mandatory';
2779
2780
2781--
2782-- Name: COLUMN org.is_donor; Type: COMMENT; Schema: public; Owner: postgres
2783--
2784
2785COMMENT ON COLUMN org.is_donor IS 'Is this organisation a donor?';
2786
2787
2788--
2789-- Name: COLUMN org.country_id; Type: COMMENT; Schema: public; Owner: postgres
2790--
2791
2792COMMENT ON COLUMN org.country_id IS 'Country where this organisation operates';
2793
2794
2795--
2796-- Name: COLUMN org.website; Type: COMMENT; Schema: public; Owner: postgres
2797--
2798
2799COMMENT ON COLUMN org.website IS 'Organisation"s Webpage address';
2800
2801
2802--
2803-- Name: COLUMN org.wings_idnf; Type: COMMENT; Schema: public; Owner: postgres
2804--
2805
2806COMMENT ON COLUMN org.wings_idnf IS 'Organisation Identifier as known to WINGS';
2807
2808
2809--
2810-- Name: COLUMN org.compas_idnf; Type: COMMENT; Schema: public; Owner: postgres
2811--
2812
2813COMMENT ON COLUMN org.compas_idnf IS 'Organisation Identifier as known to COMPAS';
2814
2815
2816--
2817-- Name: COLUMN org.dacota_idnf; Type: COMMENT; Schema: public; Owner: postgres
2818--
2819
2820COMMENT ON COLUMN org.dacota_idnf IS 'Organisation Identifier as known to DACOTA';
2821
2822
2823--
2824-- Name: COLUMN org.record_version; Type: COMMENT; Schema: public; Owner: postgres
2825--
2826
2827COMMENT ON COLUMN org.record_version IS 'Audit field: Lastest (local) change version number of the data';
2828
2829
2830--
2831-- Name: COLUMN org.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2832--
2833
2834COMMENT ON COLUMN org.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2835
2836
2837--
2838-- Name: org_address; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2839--
2840
2841CREATE TABLE org_address (
2842    id integer NOT NULL,
2843    org_id integer NOT NULL,
2844    address_line1 character varying(255) NOT NULL,
2845    address_line2 character varying(255),
2846    address_line3 character varying(255),
2847    address_postcode character varying(255),
2848    address_country_id integer NOT NULL,
2849    is_billing_address smallint NOT NULL,
2850    is_mailing_address smallint NOT NULL,
2851    is_default smallint NOT NULL,
2852    is_valid smallint NOT NULL,
2853    record_version bigint NOT NULL,
2854    is_deleted smallint NOT NULL
2855);
2856
2857
2858ALTER TABLE public.org_address OWNER TO postgres;
2859
2860--
2861-- Name: COLUMN org_address.id; Type: COMMENT; Schema: public; Owner: postgres
2862--
2863
2864COMMENT ON COLUMN org_address.id IS 'Internally generated unique identifier';
2865
2866
2867--
2868-- Name: COLUMN org_address.org_id; Type: COMMENT; Schema: public; Owner: postgres
2869--
2870
2871COMMENT ON COLUMN org_address.org_id IS 'Unique Organisation Identifier';
2872
2873
2874--
2875-- Name: COLUMN org_address.address_line1; Type: COMMENT; Schema: public; Owner: postgres
2876--
2877
2878COMMENT ON COLUMN org_address.address_line1 IS 'Mailing Address - Line 1';
2879
2880
2881--
2882-- Name: COLUMN org_address.address_line2; Type: COMMENT; Schema: public; Owner: postgres
2883--
2884
2885COMMENT ON COLUMN org_address.address_line2 IS 'Mailing Address - Line 2';
2886
2887
2888--
2889-- Name: COLUMN org_address.address_line3; Type: COMMENT; Schema: public; Owner: postgres
2890--
2891
2892COMMENT ON COLUMN org_address.address_line3 IS 'Mailing Address - Line 3';
2893
2894
2895--
2896-- Name: COLUMN org_address.address_postcode; Type: COMMENT; Schema: public; Owner: postgres
2897--
2898
2899COMMENT ON COLUMN org_address.address_postcode IS 'Mailing Address - Postcode';
2900
2901
2902--
2903-- Name: COLUMN org_address.address_country_id; Type: COMMENT; Schema: public; Owner: postgres
2904--
2905
2906COMMENT ON COLUMN org_address.address_country_id IS 'Mailing Address - Country';
2907
2908
2909--
2910-- Name: COLUMN org_address.is_billing_address; Type: COMMENT; Schema: public; Owner: postgres
2911--
2912
2913COMMENT ON COLUMN org_address.is_billing_address IS 'Is this a billing address?';
2914
2915
2916--
2917-- Name: COLUMN org_address.is_mailing_address; Type: COMMENT; Schema: public; Owner: postgres
2918--
2919
2920COMMENT ON COLUMN org_address.is_mailing_address IS 'Is this a mailing address?';
2921
2922
2923--
2924-- Name: COLUMN org_address.is_default; Type: COMMENT; Schema: public; Owner: postgres
2925--
2926
2927COMMENT ON COLUMN org_address.is_default IS 'Is the default address for the organisation?';
2928
2929
2930--
2931-- Name: COLUMN org_address.is_valid; Type: COMMENT; Schema: public; Owner: postgres
2932--
2933
2934COMMENT ON COLUMN org_address.is_valid IS 'Is the address still valid?';
2935
2936
2937--
2938-- Name: COLUMN org_address.record_version; Type: COMMENT; Schema: public; Owner: postgres
2939--
2940
2941COMMENT ON COLUMN org_address.record_version IS 'Audit field: Lastest (local) change version number of the data';
2942
2943
2944--
2945-- Name: COLUMN org_address.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2946--
2947
2948COMMENT ON COLUMN org_address.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2949
2950
2951--
2952-- Name: org_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
2953--
2954
2955CREATE TABLE org_type (
2956    code character(3) NOT NULL,
2957    description character varying(255) NOT NULL,
2958    is_system smallint NOT NULL,
2959    record_version bigint NOT NULL,
2960    is_deleted smallint NOT NULL
2961);
2962
2963
2964ALTER TABLE public.org_type OWNER TO postgres;
2965
2966--
2967-- Name: COLUMN org_type.code; Type: COMMENT; Schema: public; Owner: postgres
2968--
2969
2970COMMENT ON COLUMN org_type.code IS 'Organisation type code, as extracted from COMPAS';
2971
2972
2973--
2974-- Name: COLUMN org_type.description; Type: COMMENT; Schema: public; Owner: postgres
2975--
2976
2977COMMENT ON COLUMN org_type.description IS 'English language description';
2978
2979
2980--
2981-- Name: COLUMN org_type.is_system; Type: COMMENT; Schema: public; Owner: postgres
2982--
2983
2984COMMENT ON COLUMN org_type.is_system IS 'Identifies special rows needed for system purposes';
2985
2986
2987--
2988-- Name: COLUMN org_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
2989--
2990
2991COMMENT ON COLUMN org_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
2992
2993
2994--
2995-- Name: COLUMN org_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
2996--
2997
2998COMMENT ON COLUMN org_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
2999
3000
3001--
3002-- Name: port_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
3003--
3004
3005CREATE TABLE port_type (
3006    id integer NOT NULL,
3007    description character varying(255) NOT NULL,
3008    record_version bigint NOT NULL,
3009    is_deleted smallint NOT NULL
3010);
3011
3012
3013ALTER TABLE public.port_type OWNER TO postgres;
3014
3015--
3016-- Name: COLUMN port_type.id; Type: COMMENT; Schema: public; Owner: postgres
3017--
3018
3019COMMENT ON COLUMN port_type.id IS 'Site Port Type Code';
3020
3021
3022--
3023-- Name: COLUMN port_type.description; Type: COMMENT; Schema: public; Owner: postgres
3024--
3025
3026COMMENT ON COLUMN port_type.description IS 'English language description';
3027
3028
3029--
3030-- Name: COLUMN port_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
3031--
3032
3033COMMENT ON COLUMN port_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
3034
3035
3036--
3037-- Name: COLUMN port_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
3038--
3039
3040COMMENT ON COLUMN port_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
3041
3042
3043--
3044-- Name: product; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
3045--
3046
3047CREATE TABLE product (
3048    id integer NOT NULL,
3049    product_idnf character(18) NOT NULL,
3050    description character varying(255) NOT NULL,
3051    level integer,
3052    parent_id integer,
3053    dflt_ltu_id integer,
3054    dflt_sku_id integer,
3055    est_weight_volume_ratio numeric(12,6),
3056    is_cold_storage smallint NOT NULL,
3057    cold_min_temp numeric(4,1),
3058    cold_max_temp numeric(4,1),
3059    is_dangerous smallint NOT NULL,
3060    is_regulated smallint NOT NULL,
3061    is_fragile smallint NOT NULL,
3062    record_version bigint NOT NULL,
3063    is_deleted smallint NOT NULL,
3064    CONSTRAINT ckc_est_weight_volume_product CHECK (((est_weight_volume_ratio IS NULL) OR (est_weight_volume_ratio >= (0)::numeric)))
3065);
3066
3067
3068ALTER TABLE public.product OWNER TO postgres;
3069
3070--
3071-- Name: COLUMN product.id; Type: COMMENT; Schema: public; Owner: postgres
3072--
3073
3074COMMENT ON COLUMN product.id IS 'Internally generated unique identifier';
3075
3076
3077--
3078-- Name: COLUMN product.product_idnf; Type: COMMENT; Schema: public; Owner: postgres
3079--
3080
3081COMMENT ON COLUMN product.product_idnf IS 'Product Code';
3082
3083
3084--
3085-- Name: COLUMN product.description; Type: COMMENT; Schema: public; Owner: postgres
3086--
3087
3088COMMENT ON COLUMN product.description IS 'English language description';
3089
3090
3091--
3092-- Name: COLUMN product.level; Type: COMMENT; Schema: public; Owner: postgres
3093--
3094
3095COMMENT ON COLUMN product.level IS 'Product level within the hierarchy';
3096
3097
3098--
3099-- Name: COLUMN product.parent_id; Type: COMMENT; Schema: public; Owner: postgres
3100--
3101
3102COMMENT ON COLUMN product.parent_id IS 'Internally generated unique identifier';
3103
3104
3105--
3106-- Name: COLUMN product.dflt_ltu_id; Type: COMMENT; Schema: public; Owner: postgres
3107--
3108
3109COMMENT ON COLUMN product.dflt_ltu_id IS 'Default Lowest Transportable Unit Type';
3110
3111
3112--
3113-- Name: COLUMN product.dflt_sku_id; Type: COMMENT; Schema: public; Owner: postgres
3114--
3115
3116COMMENT ON COLUMN product.dflt_sku_id IS 'Default Accounting Unit Type';
3117
3118
3119--
3120-- Name: COLUMN product.est_weight_volume_ratio; Type: COMMENT; Schema: public; Owner: postgres
3121--
3122
3123COMMENT ON COLUMN product.est_weight_volume_ratio IS 'Stores the approximate weight-to-volume ratio for the product category';
3124
3125
3126--
3127-- Name: COLUMN product.is_cold_storage; Type: COMMENT; Schema: public; Owner: postgres
3128--
3129
3130COMMENT ON COLUMN product.is_cold_storage IS 'Requires refirdgeration?';
3131
3132
3133--
3134-- Name: COLUMN product.cold_min_temp; Type: COMMENT; Schema: public; Owner: postgres
3135--
3136
3137COMMENT ON COLUMN product.cold_min_temp IS 'Cold storage minimum temperature (NULL indicates no minimum)';
3138
3139
3140--
3141-- Name: COLUMN product.cold_max_temp; Type: COMMENT; Schema: public; Owner: postgres
3142--
3143
3144COMMENT ON COLUMN product.cold_max_temp IS 'Cold storage maximum temperature (NULL indicates no maximum (only when IsColdStorage = "N"))';
3145
3146
3147--
3148-- Name: COLUMN product.is_dangerous; Type: COMMENT; Schema: public; Owner: postgres
3149--
3150
3151COMMENT ON COLUMN product.is_dangerous IS 'Requires Dangerous Goods documentation (flammable liquids, etc)';
3152
3153
3154--
3155-- Name: COLUMN product.is_regulated; Type: COMMENT; Schema: public; Owner: postgres
3156--
3157
3158COMMENT ON COLUMN product.is_regulated IS 'Requires other special documentation (psychotropic drugs, etc)';
3159
3160
3161--
3162-- Name: COLUMN product.is_fragile; Type: COMMENT; Schema: public; Owner: postgres
3163--
3164
3165COMMENT ON COLUMN product.is_fragile IS 'Requires special handling';
3166
3167
3168--
3169-- Name: COLUMN product.record_version; Type: COMMENT; Schema: public; Owner: postgres
3170--
3171
3172COMMENT ON COLUMN product.record_version IS 'Audit field: Lastest (local) change version number of the data';
3173
3174
3175--
3176-- Name: COLUMN product.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
3177--
3178
3179COMMENT ON COLUMN product.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
3180
3181
3182--
3183-- Name: product_ltu; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
3184--
3185
3186CREATE TABLE product_ltu (
3187    id integer NOT NULL,
3188    description character varying(255) NOT NULL,
3189    record_version bigint NOT NULL,
3190    is_deleted smallint NOT NULL
3191);
3192
3193
3194ALTER TABLE public.product_ltu OWNER TO postgres;
3195
3196--
3197-- Name: COLUMN product_ltu.id; Type: COMMENT; Schema: public; Owner: postgres
3198--
3199
3200COMMENT ON COLUMN product_ltu.id IS 'Internally generated unique identifier';
3201
3202
3203--
3204-- Name: COLUMN product_ltu.description; Type: COMMENT; Schema: public; Owner: postgres
3205--
3206
3207COMMENT ON COLUMN product_ltu.description IS 'English language description';
3208
3209
3210--
3211-- Name: COLUMN product_ltu.record_version; Type: COMMENT; Schema: public; Owner: postgres
3212--
3213
3214COMMENT ON COLUMN product_ltu.record_version IS 'Audit field: Lastest (local) change version number of the data';
3215
3216
3217--
3218-- Name: COLUMN product_ltu.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
3219--
3220
3221COMMENT ON COLUMN product_ltu.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
3222
3223
3224--
3225-- Name: product_sku; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
3226--
3227
3228CREATE TABLE product_sku (
3229    id integer NOT NULL,
3230    description character varying(255) NOT NULL,
3231    record_version bigint NOT NULL,
3232    is_deleted smallint NOT NULL
3233);
3234
3235
3236ALTER TABLE public.product_sku OWNER TO postgres;
3237
3238--
3239-- Name: COLUMN product_sku.id; Type: COMMENT; Schema: public; Owner: postgres
3240--
3241
3242COMMENT ON COLUMN product_sku.id IS 'Internally generated unique identifier';
3243
3244
3245--
3246-- Name: COLUMN product_sku.description; Type: COMMENT; Schema: public; Owner: postgres
3247--
3248
3249COMMENT ON COLUMN product_sku.description IS 'English language description';
3250
3251
3252--
3253-- Name: COLUMN product_sku.record_version; Type: COMMENT; Schema: public; Owner: postgres
3254--
3255
3256COMMENT ON COLUMN product_sku.record_version IS 'Audit field: Lastest (local) change version number of the data';
3257
3258
3259--
3260-- Name: COLUMN product_sku.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
3261--
3262
3263COMMENT ON COLUMN product_sku.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
3264
3265
3266--
3267-- Name: project; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
3268--
3269
3270CREATE TABLE project (
3271    id integer NOT NULL,
3272    project_idnf character(10) NOT NULL,
3273    name character varying(40) NOT NULL,
3274    description character varying(255) NOT NULL,
3275    org_id integer NOT NULL,
3276    region_id integer NOT NULL,
3277    subregion_id integer,
3278    country_id integer,
3279    purpose_id integer NOT NULL,
3280    is_logcluster smallint NOT NULL,
3281    approval_date date NOT NULL,
3282    end_date date,
3283    close_date date,
3284    storage_duration smallint,
3285    external_idnf character(15),
3286    budget_idnf character(15),
3287    subsidy_pct numeric(6,3) DEFAULT 0 NOT NULL,
3288    email_address character varying(100),
3289    web_address character varying(255),
3290    sop_address character varying(255),
3291    record_version bigint NOT NULL,
3292    is_deleted smallint NOT NULL,
3293    CONSTRAINT ckc_storage_duration_project CHECK (((storage_duration IS NULL) OR (storage_duration >= 0))),
3294    CONSTRAINT ckc_subsidy_pct_project CHECK (((subsidy_pct >= (0)::numeric) AND (subsidy_pct <= (100)::numeric)))
3295);
3296
3297
3298ALTER TABLE public.project OWNER TO postgres;
3299
3300--
3301-- Name: COLUMN project.id; Type: COMMENT; Schema: public; Owner: postgres
3302--
3303
3304COMMENT ON COLUMN project.id IS 'Internally generated unique identifier';
3305
3306
3307--
3308-- Name: COLUMN project.project_idnf; Type: COMMENT; Schema: public; Owner: postgres
3309--
3310
3311COMMENT ON COLUMN project.project_idnf IS 'Internal Project identifier';
3312
3313
3314--
3315-- Name: COLUMN project.name; Type: COMMENT; Schema: public; Owner: postgres
3316--
3317
3318COMMENT ON COLUMN project.name IS 'Project name';
3319
3320
3321--
3322-- Name: COLUMN project.description; Type: COMMENT; Schema: public; Owner: postgres
3323--
3324
3325COMMENT ON COLUMN project.description IS 'Project detailed description';
3326
3327
3328--
3329-- Name: COLUMN project.org_id; Type: COMMENT; Schema: public; Owner: postgres
3330--
3331
3332COMMENT ON COLUMN project.org_id IS 'Organisation responsible for/running the project';
3333
3334
3335--
3336-- Name: COLUMN project.region_id; Type: COMMENT; Schema: public; Owner: postgres
3337--
3338
3339COMMENT ON COLUMN project.region_id IS 'Main Region of operation';
3340
3341
3342--
3343-- Name: COLUMN project.subregion_id; Type: COMMENT; Schema: public; Owner: postgres
3344--
3345
3346COMMENT ON COLUMN project.subregion_id IS 'Main Sub-Region of operation';
3347
3348
3349--
3350-- Name: COLUMN project.country_id; Type: COMMENT; Schema: public; Owner: postgres
3351--
3352
3353COMMENT ON COLUMN project.country_id IS 'Main country of operation';
3354
3355
3356--
3357-- Name: COLUMN project.purpose_id; Type: COMMENT; Schema: public; Owner: postgres
3358--
3359
3360COMMENT ON COLUMN project.purpose_id IS 'Project type';
3361
3362
3363--
3364-- Name: COLUMN project.is_logcluster; Type: COMMENT; Schema: public; Owner: postgres
3365--
3366
3367COMMENT ON COLUMN project.is_logcluster IS 'Is this a Log Cluster project? (Yes will enforce use of product nomenclature in Requests)';
3368
3369
3370--
3371-- Name: COLUMN project.approval_date; Type: COMMENT; Schema: public; Owner: postgres
3372--
3373
3374COMMENT ON COLUMN project.approval_date IS 'Date the project was approved (start date) - No cargo movement dates allowed before this date';
3375
3376
3377--
3378-- Name: COLUMN project.end_date; Type: COMMENT; Schema: public; Owner: postgres
3379--
3380
3381COMMENT ON COLUMN project.end_date IS 'Date the project operations ended - No cargo movement dates allowed after this date';
3382
3383
3384--
3385-- Name: COLUMN project.close_date; Type: COMMENT; Schema: public; Owner: postgres
3386--
3387
3388COMMENT ON COLUMN project.close_date IS 'Date the project was closed';
3389
3390
3391--
3392-- Name: COLUMN project.storage_duration; Type: COMMENT; Schema: public; Owner: postgres
3393--
3394
3395COMMENT ON COLUMN project.storage_duration IS 'Maximum length of time goods will be stored in a warehouse (applies to Request and Cust_Order) (0=No Maximum)';
3396
3397
3398--
3399-- Name: COLUMN project.external_idnf; Type: COMMENT; Schema: public; Owner: postgres
3400--
3401
3402COMMENT ON COLUMN project.external_idnf IS 'Project Identifier to external systems (Normally SLA projects only)';
3403
3404
3405--
3406-- Name: COLUMN project.budget_idnf; Type: COMMENT; Schema: public; Owner: postgres
3407--
3408
3409COMMENT ON COLUMN project.budget_idnf IS 'Project Budget Code (Normally SLA projects only)';
3410
3411
3412--
3413-- Name: COLUMN project.subsidy_pct; Type: COMMENT; Schema: public; Owner: postgres
3414--
3415
3416COMMENT ON COLUMN project.subsidy_pct IS 'Percent of total transport cost subsidised by WFP';
3417
3418
3419--
3420-- Name: COLUMN project.email_address; Type: COMMENT; Schema: public; Owner: postgres
3421--
3422
3423COMMENT ON COLUMN project.email_address IS 'Project Email (Shown on the bottom of all external communications)';
3424
3425
3426--
3427-- Name: COLUMN project.web_address; Type: COMMENT; Schema: public; Owner: postgres
3428--
3429
3430COMMENT ON COLUMN project.web_address IS 'Project Website (Shown on the bottom of all external communications)';
3431
3432
3433--
3434-- Name: COLUMN project.sop_address; Type: COMMENT; Schema: public; Owner: postgres
3435--
3436
3437COMMENT ON COLUMN project.sop_address IS 'Project Standard Operating Procedures (Direct Link)';
3438
3439
3440--
3441-- Name: COLUMN project.record_version; Type: COMMENT; Schema: public; Owner: postgres
3442--
3443
3444COMMENT ON COLUMN project.record_version IS 'Audit field: Lastest (local) change version number of the data';
3445
3446
3447--
3448-- Name: COLUMN project.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
3449--
3450
3451COMMENT ON COLUMN project.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
3452
3453
3454--
3455-- Name: project_classify; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
3456--
3457
3458CREATE TABLE project_classify (
3459    code character(1) NOT NULL,
3460    description character varying(255) NOT NULL,
3461    record_version bigint NOT NULL,
3462    is_deleted smallint NOT NULL
3463);
3464
3465
3466ALTER TABLE public.project_classify OWNER TO postgres;
3467
3468--
3469-- Name: COLUMN project_classify.code; Type: COMMENT; Schema: public; Owner: postgres
3470--
3471
3472COMMENT ON COLUMN project_classify.code IS 'Project Class Code: S=Service Level Agreement; O=Special Operation';
3473
3474
3475--
3476-- Name: COLUMN project_classify.description; Type: COMMENT; Schema: public; Owner: postgres
3477--
3478
3479COMMENT ON COLUMN project_classify.description IS 'English language description';
3480
3481
3482--
3483-- Name: COLUMN project_classify.record_version; Type: COMMENT; Schema: public; Owner: postgres
3484--
3485
3486COMMENT ON COLUMN project_classify.record_version IS 'Audit field: Lastest (local) change version number of the data';
3487
3488
3489--
3490-- Name: COLUMN project_classify.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
3491--
3492
3493COMMENT ON COLUMN project_classify.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
3494
3495
3496--
3497-- Name: project_purpose; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
3498--
3499
3500CREATE TABLE project_purpose (
3501    id integer NOT NULL,
3502    description character varying(255) NOT NULL,
3503    project_classify_code character(1) NOT NULL,
3504    record_version bigint NOT NULL,
3505    is_deleted smallint NOT NULL
3506);
3507
3508
3509ALTER TABLE public.project_purpose OWNER TO postgres;
3510
3511--
3512-- Name: COLUMN project_purpose.id; Type: COMMENT; Schema: public; Owner: postgres
3513--
3514
3515COMMENT ON COLUMN project_purpose.id IS 'Internally generated unique identifier';
3516
3517
3518--
3519-- Name: COLUMN project_purpose.description; Type: COMMENT; Schema: public; Owner: postgres
3520--
3521
3522COMMENT ON COLUMN project_purpose.description IS 'English language description';
3523
3524
3525--
3526-- Name: COLUMN project_purpose.project_classify_code; Type: COMMENT; Schema: public; Owner: postgres
3527--
3528
3529COMMENT ON COLUMN project_purpose.project_classify_code IS 'Relates to which Project Classification';
3530
3531
3532--
3533-- Name: COLUMN project_purpose.record_version; Type: COMMENT; Schema: public; Owner: postgres
3534--
3535
3536COMMENT ON COLUMN project_purpose.record_version IS 'Audit field: Lastest (local) change version number of the data';
3537
3538
3539--
3540-- Name: COLUMN project_purpose.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
3541--
3542
3543COMMENT ON COLUMN project_purpose.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
3544
3545
3546--
3547-- Name: project_site; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
3548--
3549
3550CREATE TABLE project_site (
3551    project_id integer NOT NULL,
3552    site_id integer NOT NULL,
3553    site_prefix character(3),
3554    record_version bigint NOT NULL,
3555    is_deleted smallint NOT NULL
3556);
3557
3558
3559ALTER TABLE public.project_site OWNER TO postgres;
3560
3561--
3562-- Name: COLUMN project_site.project_id; Type: COMMENT; Schema: public; Owner: postgres
3563--
3564
3565COMMENT ON COLUMN project_site.project_id IS 'Project ID';
3566
3567
3568--
3569-- Name: COLUMN project_site.site_id; Type: COMMENT; Schema: public; Owner: postgres
3570--
3571
3572COMMENT ON COLUMN project_site.site_id IS 'Project is Active for which sites';
3573
3574
3575--
3576-- Name: COLUMN project_site.site_prefix; Type: COMMENT; Schema: public; Owner: postgres
3577--
3578
3579COMMENT ON COLUMN project_site.site_prefix IS 'Site Prefix (for orders initiated from this project/site) - Mandatory if ''Is_Entry_Point'' is TRUE';
3580
3581
3582--
3583-- Name: COLUMN project_site.record_version; Type: COMMENT; Schema: public; Owner: postgres
3584--
3585
3586COMMENT ON COLUMN project_site.record_version IS 'Audit field: Lastest (local) change version number of the data';
3587
3588
3589--
3590-- Name: COLUMN project_site.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
3591--
3592
3593COMMENT ON COLUMN project_site.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
3594
3595
3596--
3597-- Name: region; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
3598--
3599
3600CREATE TABLE region (
3601    id integer NOT NULL,
3602    name character varying(40) NOT NULL,
3603    is_system smallint NOT NULL,
3604    record_version bigint NOT NULL,
3605    is_deleted smallint NOT NULL
3606);
3607
3608
3609ALTER TABLE public.region OWNER TO postgres;
3610
3611--
3612-- Name: COLUMN region.id; Type: COMMENT; Schema: public; Owner: postgres
3613--
3614
3615COMMENT ON COLUMN region.id IS 'Internally generated unique identifier';
3616
3617
3618--
3619-- Name: COLUMN region.name; Type: COMMENT; Schema: public; Owner: postgres
3620--
3621
3622COMMENT ON COLUMN region.name IS 'Region Name';
3623
3624
3625--
3626-- Name: COLUMN region.is_system; Type: COMMENT; Schema: public; Owner: postgres
3627--
3628
3629COMMENT ON COLUMN region.is_system IS 'Identifies special rows needed for system purposes';
3630
3631
3632--
3633-- Name: COLUMN region.record_version; Type: COMMENT; Schema: public; Owner: postgres
3634--
3635
3636COMMENT ON COLUMN region.record_version IS 'Audit field: Lastest (local) change version number of the data';
3637
3638
3639--
3640-- Name: COLUMN region.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
3641--
3642
3643COMMENT ON COLUMN region.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
3644
3645
3646--
3647-- Name: request; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
3648--
3649
3650CREATE TABLE request (
3651    request_site_id integer NOT NULL,
3652    id integer NOT NULL,
3653    project_id integer NOT NULL,
3654    seqno integer NOT NULL,
3655    suffix character(2) NOT NULL,
3656    owners_ref character varying(40),
3657    arrival_type_code character(1) NOT NULL,
3658    arrival_location_site_id integer NOT NULL,
3659    arrival_location_id integer NOT NULL,
3660    arrival_instructions character varying(255),
3661    arrival_contact character varying(255),
3662    service_type_code character(1) NOT NULL,
3663    final_instructions character varying(255),
3664    initial_shipment_id integer NOT NULL,
3665    storage_duration smallint,
3666    status_code character(2) NOT NULL,
3667    sender_site_id integer NOT NULL,
3668    sender_contact_id integer NOT NULL,
3669    receiver_site_id integer NOT NULL,
3670    receiver_contact_id integer NOT NULL,
3671    invoice_site_id integer,
3672    invoice_contact_id integer,
3673    on_behalf_of character varying(255),
3674    cust_order_id integer,
3675    product_id integer,
3676    is_local_purchase smallint NOT NULL,
3677    identifier_history_desc character varying(255),
3678    dispatch_priority_id integer NOT NULL,
3679    request_raised_date date NOT NULL,
3680    transport_mode_code character(1),
3681    load_date date,
3682    dispatch_plan_date date,
3683    followup_date date,
3684    created_by_logon character varying(40) NOT NULL,
3685    created_time timestamp without time zone NOT NULL,
3686    track_idnf character(10) NOT NULL,
3687    record_version bigint NOT NULL,
3688    is_deleted smallint NOT NULL,
3689    CONSTRAINT ckc_storage_duration_request CHECK (((storage_duration IS NULL) OR (storage_duration >= 0)))
3690);
3691
3692
3693ALTER TABLE public.request OWNER TO postgres;
3694
3695--
3696-- Name: COLUMN request.request_site_id; Type: COMMENT; Schema: public; Owner: postgres
3697--
3698
3699COMMENT ON COLUMN request.request_site_id IS 'Site raising the request (will determine CMR prefix) - Also the record owner (sync partition on this field)';
3700
3701
3702--
3703-- Name: COLUMN request.id; Type: COMMENT; Schema: public; Owner: postgres
3704--
3705
3706COMMENT ON COLUMN request.id IS 'Internally generated unique identifier';
3707
3708
3709--
3710-- Name: COLUMN request.project_id; Type: COMMENT; Schema: public; Owner: postgres
3711--
3712
3713COMMENT ON COLUMN request.project_id IS 'Project';
3714
3715
3716--
3717-- Name: COLUMN request.seqno; Type: COMMENT; Schema: public; Owner: postgres
3718--
3719
3720COMMENT ON COLUMN request.seqno IS 'Request sequence Number';
3721
3722
3723--
3724-- Name: COLUMN request.suffix; Type: COMMENT; Schema: public; Owner: postgres
3725--
3726
3727COMMENT ON COLUMN request.suffix IS 'Request suffix';
3728
3729
3730--
3731-- Name: COLUMN request.owners_ref; Type: COMMENT; Schema: public; Owner: postgres
3732--
3733
3734COMMENT ON COLUMN request.owners_ref IS 'Owner''s Reference';
3735
3736
3737--
3738-- Name: COLUMN request.arrival_type_code; Type: COMMENT; Schema: public; Owner: postgres
3739--
3740
3741COMMENT ON COLUMN request.arrival_type_code IS 'Identifies the way in which the cargo will enter the tracking system: X=Direct Delivery by Client (Location Type = ''S''); C=Pickup from Client Site (Location Type = ''C''); P=Transshipment (Location Type = ''P''); I=Internal (Location Type = ''S'' or ''W'')';
3742
3743
3744--
3745-- Name: COLUMN request.arrival_location_site_id; Type: COMMENT; Schema: public; Owner: postgres
3746--
3747
3748COMMENT ON COLUMN request.arrival_location_site_id IS 'Point where goods initially enter the system';
3749
3750
3751--
3752-- Name: COLUMN request.arrival_location_id; Type: COMMENT; Schema: public; Owner: postgres
3753--
3754
3755COMMENT ON COLUMN request.arrival_location_id IS 'Point where goods initially enter the system';
3756
3757
3758--
3759-- Name: COLUMN request.arrival_instructions; Type: COMMENT; Schema: public; Owner: postgres
3760--
3761
3762COMMENT ON COLUMN request.arrival_instructions IS 'Additional instructions for the arrival of goods';
3763
3764
3765--
3766-- Name: COLUMN request.arrival_contact; Type: COMMENT; Schema: public; Owner: postgres
3767--
3768
3769COMMENT ON COLUMN request.arrival_contact IS 'Additional contact details (eg. name & tel. of supplier)';
3770
3771
3772--
3773-- Name: COLUMN request.service_type_code; Type: COMMENT; Schema: public; Owner: postgres
3774--
3775
3776COMMENT ON COLUMN request.service_type_code IS 'Service Type Code';
3777
3778
3779--
3780-- Name: COLUMN request.final_instructions; Type: COMMENT; Schema: public; Owner: postgres
3781--
3782
3783COMMENT ON COLUMN request.final_instructions IS 'Addtional handling instruictions for the final delivery (if appropriate) of the goods';
3784
3785
3786--
3787-- Name: COLUMN request.initial_shipment_id; Type: COMMENT; Schema: public; Owner: postgres
3788--
3789
3790COMMENT ON COLUMN request.initial_shipment_id IS 'Shipment record containing information from CUSTOMER to OPERATION';
3791
3792
3793--
3794-- Name: COLUMN request.storage_duration; Type: COMMENT; Schema: public; Owner: postgres
3795--
3796
3797COMMENT ON COLUMN request.storage_duration IS 'Length of time goods will be stored in the warehouse';
3798
3799
3800--
3801-- Name: COLUMN request.status_code; Type: COMMENT; Schema: public; Owner: postgres
3802--
3803
3804COMMENT ON COLUMN request.status_code IS 'Current CMR Status';
3805
3806
3807--
3808-- Name: COLUMN request.sender_site_id; Type: COMMENT; Schema: public; Owner: postgres
3809--
3810
3811COMMENT ON COLUMN request.sender_site_id IS 'Site owning the Sender''s Contact ID';
3812
3813
3814--
3815-- Name: COLUMN request.sender_contact_id; Type: COMMENT; Schema: public; Owner: postgres
3816--
3817
3818COMMENT ON COLUMN request.sender_contact_id IS 'Sender Organisation Contact (within Sender_Site_ID)';
3819
3820
3821--
3822-- Name: COLUMN request.receiver_site_id; Type: COMMENT; Schema: public; Owner: postgres
3823--
3824
3825COMMENT ON COLUMN request.receiver_site_id IS 'Site owning the Receiver''s Contact ID';
3826
3827
3828--
3829-- Name: COLUMN request.receiver_contact_id; Type: COMMENT; Schema: public; Owner: postgres
3830--
3831
3832COMMENT ON COLUMN request.receiver_contact_id IS 'Receiving Organisation Contact (within Receiver_Site_ID)';
3833
3834
3835--
3836-- Name: COLUMN request.invoice_site_id; Type: COMMENT; Schema: public; Owner: postgres
3837--
3838
3839COMMENT ON COLUMN request.invoice_site_id IS 'Site owning the Billable Contact ID';
3840
3841
3842--
3843-- Name: COLUMN request.invoice_contact_id; Type: COMMENT; Schema: public; Owner: postgres
3844--
3845
3846COMMENT ON COLUMN request.invoice_contact_id IS 'Billable Organisation Contact (within Invoice_Site_ID)';
3847
3848
3849--
3850-- Name: COLUMN request.on_behalf_of; Type: COMMENT; Schema: public; Owner: postgres
3851--
3852
3853COMMENT ON COLUMN request.on_behalf_of IS 'Additional information, in the event that the cargo will be fowarded on by the Consignee';
3854
3855
3856--
3857-- Name: COLUMN request.cust_order_id; Type: COMMENT; Schema: public; Owner: postgres
3858--
3859
3860COMMENT ON COLUMN request.cust_order_id IS 'Customer order ID';
3861
3862
3863--
3864-- Name: COLUMN request.product_id; Type: COMMENT; Schema: public; Owner: postgres
3865--
3866
3867COMMENT ON COLUMN request.product_id IS 'High-level sector being covered by the CMR (Null if none)';
3868
3869
3870--
3871-- Name: COLUMN request.is_local_purchase; Type: COMMENT; Schema: public; Owner: postgres
3872--
3873
3874COMMENT ON COLUMN request.is_local_purchase IS 'is a local purchase flag';
3875
3876
3877--
3878-- Name: COLUMN request.identifier_history_desc; Type: COMMENT; Schema: public; Owner: postgres
3879--
3880
3881COMMENT ON COLUMN request.identifier_history_desc IS 'Arrival_Type_Code=''I'': String of all Requests making up the current request';
3882
3883
3884--
3885-- Name: COLUMN request.dispatch_priority_id; Type: COMMENT; Schema: public; Owner: postgres
3886--
3887
3888COMMENT ON COLUMN request.dispatch_priority_id IS 'Current CMR Priority';
3889
3890
3891--
3892-- Name: COLUMN request.request_raised_date; Type: COMMENT; Schema: public; Owner: postgres
3893--
3894
3895COMMENT ON COLUMN request.request_raised_date IS 'The date the request was initially raised';
3896
3897
3898--
3899-- Name: COLUMN request.transport_mode_code; Type: COMMENT; Schema: public; Owner: postgres
3900--
3901
3902COMMENT ON COLUMN request.transport_mode_code IS 'Preferred Transport Mode: A=Air, W=Water, L=Land (NULL = No preference)';
3903
3904
3905--
3906-- Name: COLUMN request.load_date; Type: COMMENT; Schema: public; Owner: postgres
3907--
3908
3909COMMENT ON COLUMN request.load_date IS 'Planned loading date';
3910
3911
3912--
3913-- Name: COLUMN request.dispatch_plan_date; Type: COMMENT; Schema: public; Owner: postgres
3914--
3915
3916COMMENT ON COLUMN request.dispatch_plan_date IS 'Planned dispatch date';
3917
3918
3919--
3920-- Name: COLUMN request.followup_date; Type: COMMENT; Schema: public; Owner: postgres
3921--
3922
3923COMMENT ON COLUMN request.followup_date IS 'Set a date for followup (when Request is placed on HOLD)';
3924
3925
3926--
3927-- Name: COLUMN request.created_by_logon; Type: COMMENT; Schema: public; Owner: postgres
3928--
3929
3930COMMENT ON COLUMN request.created_by_logon IS 'User who created the request';
3931
3932
3933--
3934-- Name: COLUMN request.created_time; Type: COMMENT; Schema: public; Owner: postgres
3935--
3936
3937COMMENT ON COLUMN request.created_time IS 'Date the request was created';
3938
3939
3940--
3941-- Name: COLUMN request.track_idnf; Type: COMMENT; Schema: public; Owner: postgres
3942--
3943
3944COMMENT ON COLUMN request.track_idnf IS 'Tracking Identifier - The number the client will enter to track their request online';
3945
3946
3947--
3948-- Name: COLUMN request.record_version; Type: COMMENT; Schema: public; Owner: postgres
3949--
3950
3951COMMENT ON COLUMN request.record_version IS 'Audit field: Lastest (local) change version number of the data';
3952
3953
3954--
3955-- Name: COLUMN request.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
3956--
3957
3958COMMENT ON COLUMN request.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
3959
3960
3961--
3962-- Name: request_cust_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
3963--
3964
3965CREATE TABLE request_cust_type (
3966    code character(1) NOT NULL,
3967    description character varying(255) NOT NULL,
3968    record_version bigint NOT NULL,
3969    is_deleted smallint NOT NULL
3970);
3971
3972
3973ALTER TABLE public.request_cust_type OWNER TO postgres;
3974
3975--
3976-- Name: COLUMN request_cust_type.code; Type: COMMENT; Schema: public; Owner: postgres
3977--
3978
3979COMMENT ON COLUMN request_cust_type.code IS 'R = Request; C = Cust_Order';
3980
3981
3982--
3983-- Name: COLUMN request_cust_type.description; Type: COMMENT; Schema: public; Owner: postgres
3984--
3985
3986COMMENT ON COLUMN request_cust_type.description IS 'English language description';
3987
3988
3989--
3990-- Name: COLUMN request_cust_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
3991--
3992
3993COMMENT ON COLUMN request_cust_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
3994
3995
3996--
3997-- Name: COLUMN request_cust_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
3998--
3999
4000COMMENT ON COLUMN request_cust_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4001
4002
4003--
4004-- Name: request_history; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4005--
4006
4007CREATE TABLE request_history (
4008    commenting_site_id integer NOT NULL,
4009    request_site_id integer NOT NULL,
4010    request_id integer NOT NULL,
4011    change_time timestamp without time zone NOT NULL,
4012    change_type_code character(1) NOT NULL,
4013    new_status_code character(2),
4014    new_priority_id integer,
4015    remarks character varying(255),
4016    created_by_logon character varying(40) NOT NULL,
4017    record_version bigint NOT NULL,
4018    is_deleted smallint NOT NULL
4019);
4020
4021
4022ALTER TABLE public.request_history OWNER TO postgres;
4023
4024--
4025-- Name: COLUMN request_history.commenting_site_id; Type: COMMENT; Schema: public; Owner: postgres
4026--
4027
4028COMMENT ON COLUMN request_history.commenting_site_id IS 'Site owning this comment';
4029
4030
4031--
4032-- Name: COLUMN request_history.request_site_id; Type: COMMENT; Schema: public; Owner: postgres
4033--
4034
4035COMMENT ON COLUMN request_history.request_site_id IS 'Site owning the Request';
4036
4037
4038--
4039-- Name: COLUMN request_history.request_id; Type: COMMENT; Schema: public; Owner: postgres
4040--
4041
4042COMMENT ON COLUMN request_history.request_id IS 'Request ID';
4043
4044
4045--
4046-- Name: COLUMN request_history.change_time; Type: COMMENT; Schema: public; Owner: postgres
4047--
4048
4049COMMENT ON COLUMN request_history.change_time IS 'Date/Time of status change';
4050
4051
4052--
4053-- Name: COLUMN request_history.change_type_code; Type: COMMENT; Schema: public; Owner: postgres
4054--
4055
4056COMMENT ON COLUMN request_history.change_type_code IS '(S=Status Change; P=Priority Change; C=Comment)';
4057
4058
4059--
4060-- Name: COLUMN request_history.new_status_code; Type: COMMENT; Schema: public; Owner: postgres
4061--
4062
4063COMMENT ON COLUMN request_history.new_status_code IS 'If ChangeTypeCode="S": New request status; Otherwise NULL';
4064
4065
4066--
4067-- Name: COLUMN request_history.new_priority_id; Type: COMMENT; Schema: public; Owner: postgres
4068--
4069
4070COMMENT ON COLUMN request_history.new_priority_id IS 'If ChangeTypeCode="P": New priority; Otherwise NULL';
4071
4072
4073--
4074-- Name: COLUMN request_history.remarks; Type: COMMENT; Schema: public; Owner: postgres
4075--
4076
4077COMMENT ON COLUMN request_history.remarks IS 'If ChangeTypeCode="S", "P", "C": User comment';
4078
4079
4080--
4081-- Name: COLUMN request_history.created_by_logon; Type: COMMENT; Schema: public; Owner: postgres
4082--
4083
4084COMMENT ON COLUMN request_history.created_by_logon IS 'User who created the request';
4085
4086
4087--
4088-- Name: COLUMN request_history.record_version; Type: COMMENT; Schema: public; Owner: postgres
4089--
4090
4091COMMENT ON COLUMN request_history.record_version IS 'Audit field: Lastest (local) change version number of the data';
4092
4093
4094--
4095-- Name: COLUMN request_history.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
4096--
4097
4098COMMENT ON COLUMN request_history.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4099
4100
4101--
4102-- Name: request_line; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4103--
4104
4105CREATE TABLE request_line (
4106    request_site_id integer NOT NULL,
4107    id integer NOT NULL,
4108    request_id integer NOT NULL,
4109    seqno integer NOT NULL,
4110    kit_type_code character(1) NOT NULL,
4111    parent_line_id integer,
4112    ownr_item_desc character varying(255) NOT NULL,
4113    ownr_item_idnf character varying(40),
4114    product_id integer NOT NULL,
4115    is_cold_storage smallint NOT NULL,
4116    cold_min_temp numeric(4,1),
4117    cold_max_temp numeric(4,1),
4118    is_dangerous smallint NOT NULL,
4119    is_regulated smallint NOT NULL,
4120    is_fragile smallint NOT NULL,
4121    handling_instructions character varying(255),
4122    is_on_packing_list smallint NOT NULL,
4123    sku_id integer,
4124    sku_qty smallint,
4125    ltu_id integer NOT NULL,
4126    ltu_qty integer NOT NULL,
4127    ltu_weight numeric(12,6) NOT NULL,
4128    is_operator_weight smallint NOT NULL,
4129    ltu_volume numeric(12,6) NOT NULL,
4130    is_operator_volume smallint NOT NULL,
4131    origin_request_site_id integer,
4132    origin_line_id integer,
4133    record_version bigint NOT NULL,
4134    is_deleted smallint NOT NULL,
4135    CONSTRAINT ckc_ltu_volume_request_ CHECK ((ltu_volume >= (0)::numeric)),
4136    CONSTRAINT ckc_ltu_weight_request_ CHECK ((ltu_weight >= (0)::numeric)),
4137    CONSTRAINT ckc_sku_qty_request_ CHECK (((sku_qty IS NULL) OR (sku_qty >= 0)))
4138);
4139
4140
4141ALTER TABLE public.request_line OWNER TO postgres;
4142
4143--
4144-- Name: COLUMN request_line.request_site_id; Type: COMMENT; Schema: public; Owner: postgres
4145--
4146
4147COMMENT ON COLUMN request_line.request_site_id IS 'Site raising the request (will determine CMR prefix)';
4148
4149
4150--
4151-- Name: COLUMN request_line.id; Type: COMMENT; Schema: public; Owner: postgres
4152--
4153
4154COMMENT ON COLUMN request_line.id IS 'Internally generated unique identifier';
4155
4156
4157--
4158-- Name: COLUMN request_line.request_id; Type: COMMENT; Schema: public; Owner: postgres
4159--
4160
4161COMMENT ON COLUMN request_line.request_id IS 'Request (CMR) ID';
4162
4163
4164--
4165-- Name: COLUMN request_line.seqno; Type: COMMENT; Schema: public; Owner: postgres
4166--
4167
4168COMMENT ON COLUMN request_line.seqno IS 'Sequential Number within CMR';
4169
4170
4171--
4172-- Name: COLUMN request_line.kit_type_code; Type: COMMENT; Schema: public; Owner: postgres
4173--
4174
4175COMMENT ON COLUMN request_line.kit_type_code IS 'Kit Type: "N" = Normal (One or more items per single LTU); "S" = Splittable kit / "U" = Unsplittable Kit (multiple LTUs (boxes) make up one kit)';
4176
4177
4178--
4179-- Name: COLUMN request_line.parent_line_id; Type: COMMENT; Schema: public; Owner: postgres
4180--
4181
4182COMMENT ON COLUMN request_line.parent_line_id IS 'Parent line (multi-part kits)';
4183
4184
4185--
4186-- Name: COLUMN request_line.ownr_item_desc; Type: COMMENT; Schema: public; Owner: postgres
4187--
4188
4189COMMENT ON COLUMN request_line.ownr_item_desc IS 'Item description as known to the owner (copy master item description if none supplied by customer)';
4190
4191
4192--
4193-- Name: COLUMN request_line.ownr_item_idnf; Type: COMMENT; Schema: public; Owner: postgres
4194--
4195
4196COMMENT ON COLUMN request_line.ownr_item_idnf IS 'Item code as known to the owner';
4197
4198
4199--
4200-- Name: COLUMN request_line.product_id; Type: COMMENT; Schema: public; Owner: postgres
4201--
4202
4203COMMENT ON COLUMN request_line.product_id IS 'Product Identifier';
4204
4205
4206--
4207-- Name: COLUMN request_line.is_cold_storage; Type: COMMENT; Schema: public; Owner: postgres
4208--
4209
4210COMMENT ON COLUMN request_line.is_cold_storage IS 'Does the item requires cold storage?';
4211
4212
4213--
4214-- Name: COLUMN request_line.cold_min_temp; Type: COMMENT; Schema: public; Owner: postgres
4215--
4216
4217COMMENT ON COLUMN request_line.cold_min_temp IS 'Cold storage minimum temperature (NULL indicates no minimum)';
4218
4219
4220--
4221-- Name: COLUMN request_line.cold_max_temp; Type: COMMENT; Schema: public; Owner: postgres
4222--
4223
4224COMMENT ON COLUMN request_line.cold_max_temp IS 'Cold storage maximum temperature (NULL indicates no maximum (only when IsColdStorage = "N"))';
4225
4226
4227--
4228-- Name: COLUMN request_line.is_dangerous; Type: COMMENT; Schema: public; Owner: postgres
4229--
4230
4231COMMENT ON COLUMN request_line.is_dangerous IS 'Does the item require dangerous goods documentation?';
4232
4233
4234--
4235-- Name: COLUMN request_line.is_regulated; Type: COMMENT; Schema: public; Owner: postgres
4236--
4237
4238COMMENT ON COLUMN request_line.is_regulated IS 'Requires other special documentation (psychotropic drugs, etc)';
4239
4240
4241--
4242-- Name: COLUMN request_line.is_fragile; Type: COMMENT; Schema: public; Owner: postgres
4243--
4244
4245COMMENT ON COLUMN request_line.is_fragile IS 'Requires special handling';
4246
4247
4248--
4249-- Name: COLUMN request_line.handling_instructions; Type: COMMENT; Schema: public; Owner: postgres
4250--
4251
4252COMMENT ON COLUMN request_line.handling_instructions IS 'Handling instructions - made available whenever Is_Dangerous, Is_Regulated or Is_Fragile is set to TRUE';
4253
4254
4255--
4256-- Name: COLUMN request_line.is_on_packing_list; Type: COMMENT; Schema: public; Owner: postgres
4257--
4258
4259COMMENT ON COLUMN request_line.is_on_packing_list IS 'Determines whether Handling instructions are to be printed on the packing list or not';
4260
4261
4262--
4263-- Name: COLUMN request_line.sku_id; Type: COMMENT; Schema: public; Owner: postgres
4264--
4265
4266COMMENT ON COLUMN request_line.sku_id IS 'ProdSkuType = "N" only: Accounting Unit Identifier';
4267
4268
4269--
4270-- Name: COLUMN request_line.sku_qty; Type: COMMENT; Schema: public; Owner: postgres
4271--
4272
4273COMMENT ON COLUMN request_line.sku_qty IS 'ProdSkuType = "N" only: Accounting Unit Quantity per LTU';
4274
4275
4276--
4277-- Name: COLUMN request_line.ltu_id; Type: COMMENT; Schema: public; Owner: postgres
4278--
4279
4280COMMENT ON COLUMN request_line.ltu_id IS 'Selected Unit of Measurement';
4281
4282
4283--
4284-- Name: COLUMN request_line.ltu_qty; Type: COMMENT; Schema: public; Owner: postgres
4285--
4286
4287COMMENT ON COLUMN request_line.ltu_qty IS 'Quantity of goods (at Lowest Transportable Unit) being transported';
4288
4289
4290--
4291-- Name: COLUMN request_line.ltu_weight; Type: COMMENT; Schema: public; Owner: postgres
4292--
4293
4294COMMENT ON COLUMN request_line.ltu_weight IS 'Weight (kg) of each individual item (Lowest Transportable Unit)';
4295
4296
4297--
4298-- Name: COLUMN request_line.is_operator_weight; Type: COMMENT; Schema: public; Owner: postgres
4299--
4300
4301COMMENT ON COLUMN request_line.is_operator_weight IS 'FALSE=Value on original request; TRUE=Value has been revised by the operator, as considered to be more accurate';
4302
4303
4304--
4305-- Name: COLUMN request_line.ltu_volume; Type: COMMENT; Schema: public; Owner: postgres
4306--
4307
4308COMMENT ON COLUMN request_line.ltu_volume IS 'Volume (m3) of each individual item (Lowest Transportable Unit)';
4309
4310
4311--
4312-- Name: COLUMN request_line.is_operator_volume; Type: COMMENT; Schema: public; Owner: postgres
4313--
4314
4315COMMENT ON COLUMN request_line.is_operator_volume IS 'FALSE=Value on original request; TRUE=Value has been revised by the operator, as considered to be more accurate';
4316
4317
4318--
4319-- Name: COLUMN request_line.origin_request_site_id; Type: COMMENT; Schema: public; Owner: postgres
4320--
4321
4322COMMENT ON COLUMN request_line.origin_request_site_id IS 'Used when rebuilding/combining requests: Records the source of the combined/rebuilt line';
4323
4324
4325--
4326-- Name: COLUMN request_line.origin_line_id; Type: COMMENT; Schema: public; Owner: postgres
4327--
4328
4329COMMENT ON COLUMN request_line.origin_line_id IS 'Used when rebuilding/combining requests: Records the source of the combined/rebuilt line';
4330
4331
4332--
4333-- Name: COLUMN request_line.record_version; Type: COMMENT; Schema: public; Owner: postgres
4334--
4335
4336COMMENT ON COLUMN request_line.record_version IS 'Audit field: Lastest (local) change version number of the data';
4337
4338
4339--
4340-- Name: COLUMN request_line.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
4341--
4342
4343COMMENT ON COLUMN request_line.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4344
4345
4346--
4347-- Name: request_line_priority; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4348--
4349
4350CREATE TABLE request_line_priority (
4351    commenting_site_id integer NOT NULL,
4352    request_site_id integer NOT NULL,
4353    request_line_id integer NOT NULL,
4354    line_dispatch_priority_id integer NOT NULL,
4355    record_version bigint NOT NULL,
4356    is_deleted smallint NOT NULL
4357);
4358
4359
4360ALTER TABLE public.request_line_priority OWNER TO postgres;
4361
4362--
4363-- Name: COLUMN request_line_priority.commenting_site_id; Type: COMMENT; Schema: public; Owner: postgres
4364--
4365
4366COMMENT ON COLUMN request_line_priority.commenting_site_id IS 'Site owning this line priority';
4367
4368
4369--
4370-- Name: COLUMN request_line_priority.request_site_id; Type: COMMENT; Schema: public; Owner: postgres
4371--
4372
4373COMMENT ON COLUMN request_line_priority.request_site_id IS 'Site owning the request';
4374
4375
4376--
4377-- Name: COLUMN request_line_priority.request_line_id; Type: COMMENT; Schema: public; Owner: postgres
4378--
4379
4380COMMENT ON COLUMN request_line_priority.request_line_id IS 'Request line identifier';
4381
4382
4383--
4384-- Name: COLUMN request_line_priority.line_dispatch_priority_id; Type: COMMENT; Schema: public; Owner: postgres
4385--
4386
4387COMMENT ON COLUMN request_line_priority.line_dispatch_priority_id IS 'Request line Cargo Priority';
4388
4389
4390--
4391-- Name: COLUMN request_line_priority.record_version; Type: COMMENT; Schema: public; Owner: postgres
4392--
4393
4394COMMENT ON COLUMN request_line_priority.record_version IS 'Audit field: Lastest (local) change version number of the data';
4395
4396
4397--
4398-- Name: COLUMN request_line_priority.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
4399--
4400
4401COMMENT ON COLUMN request_line_priority.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4402
4403
4404--
4405-- Name: request_status; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4406--
4407
4408CREATE TABLE request_status (
4409    code character(2) NOT NULL,
4410    request_cust_type_code character(1) NOT NULL,
4411    description character varying(255) NOT NULL,
4412    name character varying(40) NOT NULL,
4413    next_code character(2),
4414    seqno integer,
4415    record_version bigint NOT NULL,
4416    is_deleted smallint NOT NULL
4417);
4418
4419
4420ALTER TABLE public.request_status OWNER TO postgres;
4421
4422--
4423-- Name: COLUMN request_status.code; Type: COMMENT; Schema: public; Owner: postgres
4424--
4425
4426COMMENT ON COLUMN request_status.code IS 'Static Request Code';
4427
4428
4429--
4430-- Name: COLUMN request_status.request_cust_type_code; Type: COMMENT; Schema: public; Owner: postgres
4431--
4432
4433COMMENT ON COLUMN request_status.request_cust_type_code IS 'Indicates whether the Request Status applies to a CUST_ORDER or a REQUEST';
4434
4435
4436--
4437-- Name: COLUMN request_status.description; Type: COMMENT; Schema: public; Owner: postgres
4438--
4439
4440COMMENT ON COLUMN request_status.description IS 'English language description';
4441
4442
4443--
4444-- Name: COLUMN request_status.name; Type: COMMENT; Schema: public; Owner: postgres
4445--
4446
4447COMMENT ON COLUMN request_status.name IS 'Status short name';
4448
4449
4450--
4451-- Name: COLUMN request_status.next_code; Type: COMMENT; Schema: public; Owner: postgres
4452--
4453
4454COMMENT ON COLUMN request_status.next_code IS 'Next Logical Status (Null if not applicable)';
4455
4456
4457--
4458-- Name: COLUMN request_status.seqno; Type: COMMENT; Schema: public; Owner: postgres
4459--
4460
4461COMMENT ON COLUMN request_status.seqno IS 'Status Sequence Number';
4462
4463
4464--
4465-- Name: COLUMN request_status.record_version; Type: COMMENT; Schema: public; Owner: postgres
4466--
4467
4468COMMENT ON COLUMN request_status.record_version IS 'Audit field: Lastest (local) change version number of the data';
4469
4470
4471--
4472-- Name: COLUMN request_status.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
4473--
4474
4475COMMENT ON COLUMN request_status.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4476
4477
4478--
4479-- Name: roles; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4480--
4481
4482CREATE TABLE roles (
4483    code character(3) NOT NULL,
4484    record_version bigint NOT NULL,
4485    is_deleted smallint NOT NULL
4486);
4487
4488
4489ALTER TABLE public.roles OWNER TO postgres;
4490
4491--
4492-- Name: COLUMN roles.code; Type: COMMENT; Schema: public; Owner: postgres
4493--
4494
4495COMMENT ON COLUMN roles.code IS 'Role';
4496
4497
4498--
4499-- Name: COLUMN roles.record_version; Type: COMMENT; Schema: public; Owner: postgres
4500--
4501
4502COMMENT ON COLUMN roles.record_version IS 'Audit field: Lastest (local) change version number of the data';
4503
4504
4505--
4506-- Name: COLUMN roles.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
4507--
4508
4509COMMENT ON COLUMN roles.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4510
4511
4512--
4513-- Name: screen_code; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4514--
4515
4516CREATE TABLE screen_code (
4517    code character(2) NOT NULL,
4518    name character varying(64) NOT NULL,
4519    record_version bigint NOT NULL,
4520    is_deleted smallint NOT NULL
4521);
4522
4523
4524ALTER TABLE public.screen_code OWNER TO postgres;
4525
4526--
4527-- Name: COLUMN screen_code.code; Type: COMMENT; Schema: public; Owner: postgres
4528--
4529
4530COMMENT ON COLUMN screen_code.code IS 'Screen using the viewpoint/action';
4531
4532
4533--
4534-- Name: COLUMN screen_code.record_version; Type: COMMENT; Schema: public; Owner: postgres
4535--
4536
4537COMMENT ON COLUMN screen_code.record_version IS 'Audit field: Lastest (local) change version number of the data';
4538
4539
4540--
4541-- Name: COLUMN screen_code.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
4542--
4543
4544COMMENT ON COLUMN screen_code.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4545
4546
4547--
4548-- Name: service_type; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4549--
4550
4551CREATE TABLE service_type (
4552    code character(1) NOT NULL,
4553    description character varying(255) NOT NULL,
4554    record_version bigint NOT NULL,
4555    is_deleted smallint NOT NULL
4556);
4557
4558
4559ALTER TABLE public.service_type OWNER TO postgres;
4560
4561--
4562-- Name: COLUMN service_type.code; Type: COMMENT; Schema: public; Owner: postgres
4563--
4564
4565COMMENT ON COLUMN service_type.code IS 'Static Service Type Code';
4566
4567
4568--
4569-- Name: COLUMN service_type.description; Type: COMMENT; Schema: public; Owner: postgres
4570--
4571
4572COMMENT ON COLUMN service_type.description IS 'English language description';
4573
4574
4575--
4576-- Name: COLUMN service_type.record_version; Type: COMMENT; Schema: public; Owner: postgres
4577--
4578
4579COMMENT ON COLUMN service_type.record_version IS 'Audit field: Lastest (local) change version number of the data';
4580
4581
4582--
4583-- Name: COLUMN service_type.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
4584--
4585
4586COMMENT ON COLUMN service_type.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4587
4588
4589--
4590-- Name: shipment; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4591--
4592
4593CREATE TABLE shipment (
4594    shipment_site_id integer NOT NULL,
4595    id integer NOT NULL,
4596    journey_id integer NOT NULL,
4597    seqno integer NOT NULL,
4598    destination_location_site_id integer NOT NULL,
4599    destination_location_id integer NOT NULL,
4600    est_delivery_time timestamp without time zone,
4601    is_delivery_note_received smallint NOT NULL,
4602    shipment_docm_idnf character varying(40),
4603    shipment_docm_numb character varying(40),
4604    pack_list_date date,
4605    pack_list_name character varying(40),
4606    remarks_shipment character varying(255),
4607    record_version bigint NOT NULL,
4608    is_deleted smallint NOT NULL
4609);
4610
4611
4612ALTER TABLE public.shipment OWNER TO postgres;
4613
4614--
4615-- Name: COLUMN shipment.shipment_site_id; Type: COMMENT; Schema: public; Owner: postgres
4616--
4617
4618COMMENT ON COLUMN shipment.shipment_site_id IS 'Site that owns the record';
4619
4620
4621--
4622-- Name: COLUMN shipment.id; Type: COMMENT; Schema: public; Owner: postgres
4623--
4624
4625COMMENT ON COLUMN shipment.id IS 'Internally generated unique identifier';
4626
4627
4628--
4629-- Name: COLUMN shipment.journey_id; Type: COMMENT; Schema: public; Owner: postgres
4630--
4631
4632COMMENT ON COLUMN shipment.journey_id IS 'Vehicle Trip Identifier';
4633
4634
4635--
4636-- Name: COLUMN shipment.seqno; Type: COMMENT; Schema: public; Owner: postgres
4637--
4638
4639COMMENT ON COLUMN shipment.seqno IS 'Sequence of the journey within a single trip';
4640
4641
4642--
4643-- Name: COLUMN shipment.destination_location_site_id; Type: COMMENT; Schema: public; Owner: postgres
4644--
4645
4646COMMENT ON COLUMN shipment.destination_location_site_id IS 'Destination Point';
4647
4648
4649--
4650-- Name: COLUMN shipment.destination_location_id; Type: COMMENT; Schema: public; Owner: postgres
4651--
4652
4653COMMENT ON COLUMN shipment.destination_location_id IS 'Destination Point';
4654
4655
4656--
4657-- Name: COLUMN shipment.est_delivery_time; Type: COMMENT; Schema: public; Owner: postgres
4658--
4659
4660COMMENT ON COLUMN shipment.est_delivery_time IS 'Estimated Date/Time of Delivery';
4661
4662
4663--
4664-- Name: COLUMN shipment.is_delivery_note_received; Type: COMMENT; Schema: public; Owner: postgres
4665--
4666
4667COMMENT ON COLUMN shipment.is_delivery_note_received IS 'Delivery Documents have been received back at sending location';
4668
4669
4670--
4671-- Name: COLUMN shipment.shipment_docm_idnf; Type: COMMENT; Schema: public; Owner: postgres
4672--
4673
4674COMMENT ON COLUMN shipment.shipment_docm_idnf IS 'Document Number (as typed by the user)';
4675
4676
4677--
4678-- Name: COLUMN shipment.shipment_docm_numb; Type: COMMENT; Schema: public; Owner: postgres
4679--
4680
4681COMMENT ON COLUMN shipment.shipment_docm_numb IS 'Document Number (Numeric and semicolon only)';
4682
4683
4684--
4685-- Name: COLUMN shipment.pack_list_date; Type: COMMENT; Schema: public; Owner: postgres
4686--
4687
4688COMMENT ON COLUMN shipment.pack_list_date IS 'Packing List date (automatically populate with today"s date)';
4689
4690
4691--
4692-- Name: COLUMN shipment.pack_list_name; Type: COMMENT; Schema: public; Owner: postgres
4693--
4694
4695COMMENT ON COLUMN shipment.pack_list_name IS 'Packing List Name/Sequence Number';
4696
4697
4698--
4699-- Name: COLUMN shipment.remarks_shipment; Type: COMMENT; Schema: public; Owner: postgres
4700--
4701
4702COMMENT ON COLUMN shipment.remarks_shipment IS 'Remarks pertaining to the particular shipment';
4703
4704
4705--
4706-- Name: COLUMN shipment.record_version; Type: COMMENT; Schema: public; Owner: postgres
4707--
4708
4709COMMENT ON COLUMN shipment.record_version IS 'Audit field: Lastest (local) change version number of the data';
4710
4711
4712--
4713-- Name: COLUMN shipment.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
4714--
4715
4716COMMENT ON COLUMN shipment.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4717
4718
4719--
4720-- Name: shipment_comment; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4721--
4722
4723CREATE TABLE shipment_comment (
4724    owner_site_id integer NOT NULL,
4725    shipment_site_id integer NOT NULL,
4726    shipment_id integer NOT NULL,
4727    actual_delivery_time timestamp without time zone NOT NULL,
4728    remarks_delivery character varying(255),
4729    record_version bigint NOT NULL,
4730    is_deleted smallint NOT NULL
4731);
4732
4733
4734ALTER TABLE public.shipment_comment OWNER TO postgres;
4735
4736--
4737-- Name: COLUMN shipment_comment.owner_site_id; Type: COMMENT; Schema: public; Owner: postgres
4738--
4739
4740COMMENT ON COLUMN shipment_comment.owner_site_id IS 'Destination Site (owns the records in this table)';
4741
4742
4743--
4744-- Name: COLUMN shipment_comment.shipment_site_id; Type: COMMENT; Schema: public; Owner: postgres
4745--
4746
4747COMMENT ON COLUMN shipment_comment.shipment_site_id IS 'Site originating the cargo movement';
4748
4749
4750--
4751-- Name: COLUMN shipment_comment.shipment_id; Type: COMMENT; Schema: public; Owner: postgres
4752--
4753
4754COMMENT ON COLUMN shipment_comment.shipment_id IS 'Journey ID';
4755
4756
4757--
4758-- Name: COLUMN shipment_comment.actual_delivery_time; Type: COMMENT; Schema: public; Owner: postgres
4759--
4760
4761COMMENT ON COLUMN shipment_comment.actual_delivery_time IS 'Actual Date/Time of Delivery';
4762
4763
4764--
4765-- Name: COLUMN shipment_comment.remarks_delivery; Type: COMMENT; Schema: public; Owner: postgres
4766--
4767
4768COMMENT ON COLUMN shipment_comment.remarks_delivery IS 'Dispatch Additional remarks';
4769
4770
4771--
4772-- Name: COLUMN shipment_comment.record_version; Type: COMMENT; Schema: public; Owner: postgres
4773--
4774
4775COMMENT ON COLUMN shipment_comment.record_version IS 'Audit field: Lastest (local) change version number of the data';
4776
4777
4778--
4779-- Name: COLUMN shipment_comment.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
4780--
4781
4782COMMENT ON COLUMN shipment_comment.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4783
4784
4785--
4786-- Name: site; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4787--
4788
4789CREATE TABLE site (
4790    id integer NOT NULL,
4791    site_name character varying(40) NOT NULL,
4792    rptg_site_id integer,
4793    org_id integer,
4794    rptg_ofcr_name character varying(255),
4795    radio_call_sign character varying(255),
4796    remarks character varying(255),
4797    site_dstr_type_id integer NOT NULL,
4798    site_bldg_type_id integer NOT NULL,
4799    site_bldg_qty smallint NOT NULL,
4800    record_version bigint NOT NULL,
4801    is_deleted smallint NOT NULL,
4802    CONSTRAINT ckc_site_bldg_qty_site CHECK ((site_bldg_qty >= 0))
4803);
4804
4805
4806ALTER TABLE public.site OWNER TO postgres;
4807
4808--
4809-- Name: COLUMN site.id; Type: COMMENT; Schema: public; Owner: postgres
4810--
4811
4812COMMENT ON COLUMN site.id IS 'Internally generated unique identifier';
4813
4814
4815--
4816-- Name: COLUMN site.site_name; Type: COMMENT; Schema: public; Owner: postgres
4817--
4818
4819COMMENT ON COLUMN site.site_name IS 'Site Name';
4820
4821
4822--
4823-- Name: COLUMN site.rptg_site_id; Type: COMMENT; Schema: public; Owner: postgres
4824--
4825
4826COMMENT ON COLUMN site.rptg_site_id IS 'Reporting (parent) Site (if any)';
4827
4828
4829--
4830-- Name: COLUMN site.org_id; Type: COMMENT; Schema: public; Owner: postgres
4831--
4832
4833COMMENT ON COLUMN site.org_id IS 'Organisation in charge at the site (if any)';
4834
4835
4836--
4837-- Name: COLUMN site.rptg_ofcr_name; Type: COMMENT; Schema: public; Owner: postgres
4838--
4839
4840COMMENT ON COLUMN site.rptg_ofcr_name IS 'Name of the reporting officer (if any)';
4841
4842
4843--
4844-- Name: COLUMN site.radio_call_sign; Type: COMMENT; Schema: public; Owner: postgres
4845--
4846
4847COMMENT ON COLUMN site.radio_call_sign IS 'Radio call sign';
4848
4849
4850--
4851-- Name: COLUMN site.remarks; Type: COMMENT; Schema: public; Owner: postgres
4852--
4853
4854COMMENT ON COLUMN site.remarks IS 'Additional comments';
4855
4856
4857--
4858-- Name: COLUMN site.site_dstr_type_id; Type: COMMENT; Schema: public; Owner: postgres
4859--
4860
4861COMMENT ON COLUMN site.site_dstr_type_id IS 'Distribution Type';
4862
4863
4864--
4865-- Name: COLUMN site.site_bldg_type_id; Type: COMMENT; Schema: public; Owner: postgres
4866--
4867
4868COMMENT ON COLUMN site.site_bldg_type_id IS 'Site Building Type Code';
4869
4870
4871--
4872-- Name: COLUMN site.site_bldg_qty; Type: COMMENT; Schema: public; Owner: postgres
4873--
4874
4875COMMENT ON COLUMN site.site_bldg_qty IS 'No of structures making up the wahrehouse site';
4876
4877
4878--
4879-- Name: COLUMN site.record_version; Type: COMMENT; Schema: public; Owner: postgres
4880--
4881
4882COMMENT ON COLUMN site.record_version IS 'Audit field: Lastest (local) change version number of the data';
4883
4884
4885--
4886-- Name: COLUMN site.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
4887--
4888
4889COMMENT ON COLUMN site.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4890
4891
4892--
4893-- Name: site_track_no; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4894--
4895
4896CREATE TABLE site_track_no (
4897    site_id integer NOT NULL,
4898    site_track_idnf character(18) NOT NULL,
4899    site_track_date date NOT NULL,
4900    site_track_cptr_name character varying(40) NOT NULL,
4901    is_active smallint
4902);
4903
4904
4905ALTER TABLE public.site_track_no OWNER TO postgres;
4906
4907--
4908-- Name: COLUMN site_track_no.site_id; Type: COMMENT; Schema: public; Owner: postgres
4909--
4910
4911COMMENT ON COLUMN site_track_no.site_id IS 'Site Identifier';
4912
4913
4914--
4915-- Name: COLUMN site_track_no.site_track_idnf; Type: COMMENT; Schema: public; Owner: postgres
4916--
4917
4918COMMENT ON COLUMN site_track_no.site_track_idnf IS 'Tracking Number';
4919
4920
4921--
4922-- Name: COLUMN site_track_no.site_track_date; Type: COMMENT; Schema: public; Owner: postgres
4923--
4924
4925COMMENT ON COLUMN site_track_no.site_track_date IS 'Date the Local Instance Clone (and tracking number) was generated';
4926
4927
4928--
4929-- Name: COLUMN site_track_no.site_track_cptr_name; Type: COMMENT; Schema: public; Owner: postgres
4930--
4931
4932COMMENT ON COLUMN site_track_no.site_track_cptr_name IS 'Name of the computer receiving the Local Instance Clone';
4933
4934
4935--
4936-- Name: COLUMN site_track_no.is_active; Type: COMMENT; Schema: public; Owner: postgres
4937--
4938
4939COMMENT ON COLUMN site_track_no.is_active IS 'True = Indicates the LIC  is active and editable by the user; False indicates initial Sync has not completed; NULL indicates de-registered or Master Instance';
4940
4941
4942--
4943-- Name: subregion; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4944--
4945
4946CREATE TABLE subregion (
4947    id integer NOT NULL,
4948    name character varying(40) NOT NULL,
4949    region_id integer NOT NULL,
4950    record_version bigint NOT NULL,
4951    is_deleted smallint NOT NULL
4952);
4953
4954
4955ALTER TABLE public.subregion OWNER TO postgres;
4956
4957--
4958-- Name: COLUMN subregion.id; Type: COMMENT; Schema: public; Owner: postgres
4959--
4960
4961COMMENT ON COLUMN subregion.id IS 'Internally generated unique identifier';
4962
4963
4964--
4965-- Name: COLUMN subregion.name; Type: COMMENT; Schema: public; Owner: postgres
4966--
4967
4968COMMENT ON COLUMN subregion.name IS 'Sub-region Name';
4969
4970
4971--
4972-- Name: COLUMN subregion.region_id; Type: COMMENT; Schema: public; Owner: postgres
4973--
4974
4975COMMENT ON COLUMN subregion.region_id IS 'Parent Region';
4976
4977
4978--
4979-- Name: COLUMN subregion.record_version; Type: COMMENT; Schema: public; Owner: postgres
4980--
4981
4982COMMENT ON COLUMN subregion.record_version IS 'Audit field: Lastest (local) change version number of the data';
4983
4984
4985--
4986-- Name: COLUMN subregion.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
4987--
4988
4989COMMENT ON COLUMN subregion.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
4990
4991
4992--
4993-- Name: sync_log; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
4994--
4995
4996CREATE TABLE sync_log (
4997    id integer NOT NULL,
4998    direction smallint NOT NULL,
4999    start_time timestamp without time zone NOT NULL,
5000    finish_time timestamp without time zone NOT NULL,
5001    num_rows integer NOT NULL,
5002    is_success smallint NOT NULL,
5003    message character varying(255),
5004    CONSTRAINT ckc_num_rows_sync_log CHECK ((num_rows >= 0))
5005);
5006
5007
5008ALTER TABLE public.sync_log OWNER TO postgres;
5009
5010--
5011-- Name: COLUMN sync_log.id; Type: COMMENT; Schema: public; Owner: postgres
5012--
5013
5014COMMENT ON COLUMN sync_log.id IS 'Internally generated unique identifier';
5015
5016
5017--
5018-- Name: COLUMN sync_log.direction; Type: COMMENT; Schema: public; Owner: postgres
5019--
5020
5021COMMENT ON COLUMN sync_log.direction IS 'True=Upload to Master Instance; False=Download to LIC';
5022
5023
5024--
5025-- Name: COLUMN sync_log.start_time; Type: COMMENT; Schema: public; Owner: postgres
5026--
5027
5028COMMENT ON COLUMN sync_log.start_time IS 'Local Date/Time the batch process started';
5029
5030
5031--
5032-- Name: COLUMN sync_log.finish_time; Type: COMMENT; Schema: public; Owner: postgres
5033--
5034
5035COMMENT ON COLUMN sync_log.finish_time IS 'Local Date/Time the batch process finished';
5036
5037
5038--
5039-- Name: COLUMN sync_log.num_rows; Type: COMMENT; Schema: public; Owner: postgres
5040--
5041
5042COMMENT ON COLUMN sync_log.num_rows IS 'Actual number of rows in the batch';
5043
5044
5045--
5046-- Name: COLUMN sync_log.is_success; Type: COMMENT; Schema: public; Owner: postgres
5047--
5048
5049COMMENT ON COLUMN sync_log.is_success IS 'Operation was a success?';
5050
5051
5052--
5053-- Name: COLUMN sync_log.message; Type: COMMENT; Schema: public; Owner: postgres
5054--
5055
5056COMMENT ON COLUMN sync_log.message IS 'Logging messages';
5057
5058
5059--
5060-- Name: sync_table_version; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
5061--
5062
5063CREATE TABLE sync_table_version (
5064    table_name character varying(40) NOT NULL,
5065    central_version bigint NOT NULL,
5066    uploaded_version bigint NOT NULL,
5067    last_sync_time timestamp without time zone NOT NULL
5068);
5069
5070
5071ALTER TABLE public.sync_table_version OWNER TO postgres;
5072
5073--
5074-- Name: COLUMN sync_table_version.table_name; Type: COMMENT; Schema: public; Owner: postgres
5075--
5076
5077COMMENT ON COLUMN sync_table_version.table_name IS 'Name of a synchronised table';
5078
5079
5080--
5081-- Name: COLUMN sync_table_version.central_version; Type: COMMENT; Schema: public; Owner: postgres
5082--
5083
5084COMMENT ON COLUMN sync_table_version.central_version IS 'Highest Central_Version number received by the LIC so far from the Central Database';
5085
5086
5087--
5088-- Name: COLUMN sync_table_version.uploaded_version; Type: COMMENT; Schema: public; Owner: postgres
5089--
5090
5091COMMENT ON COLUMN sync_table_version.uploaded_version IS 'Highest Local_Version that was completely, successfully sent from the LIC to the central Database';
5092
5093
5094--
5095-- Name: COLUMN sync_table_version.last_sync_time; Type: COMMENT; Schema: public; Owner: postgres
5096--
5097
5098COMMENT ON COLUMN sync_table_version.last_sync_time IS 'Time of last successful sync';
5099
5100
5101--
5102-- Name: sync_version; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
5103--
5104
5105CREATE TABLE sync_version (
5106    site_id integer,
5107    site_track_idnf character(18) NOT NULL,
5108    local_version bigint NOT NULL,
5109    last_upload_time timestamp without time zone,
5110    is_active smallint
5111);
5112
5113
5114ALTER TABLE public.sync_version OWNER TO postgres;
5115
5116--
5117-- Name: COLUMN sync_version.site_id; Type: COMMENT; Schema: public; Owner: postgres
5118--
5119
5120COMMENT ON COLUMN sync_version.site_id IS 'Site Identifier';
5121
5122
5123--
5124-- Name: COLUMN sync_version.site_track_idnf; Type: COMMENT; Schema: public; Owner: postgres
5125--
5126
5127COMMENT ON COLUMN sync_version.site_track_idnf IS 'Tracking Number';
5128
5129
5130--
5131-- Name: COLUMN sync_version.local_version; Type: COMMENT; Schema: public; Owner: postgres
5132--
5133
5134COMMENT ON COLUMN sync_version.local_version IS 'Version number assigned to the last transaction';
5135
5136
5137--
5138-- Name: COLUMN sync_version.last_upload_time; Type: COMMENT; Schema: public; Owner: postgres
5139--
5140
5141COMMENT ON COLUMN sync_version.last_upload_time IS 'Time of last successful upload';
5142
5143
5144--
5145-- Name: COLUMN sync_version.is_active; Type: COMMENT; Schema: public; Owner: postgres
5146--
5147
5148COMMENT ON COLUMN sync_version.is_active IS 'True = Indicates the LIC  is active and editable by the user; False indicates initial Sync has not completed; NULL indicates de-registered or Master Instance';
5149
5150
5151--
5152-- Name: table_control; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
5153--
5154
5155CREATE TABLE table_control (
5156    table_name character varying(40) NOT NULL,
5157    description character varying(255) NOT NULL,
5158    record_version bigint NOT NULL,
5159    is_deleted smallint NOT NULL
5160);
5161
5162
5163ALTER TABLE public.table_control OWNER TO postgres;
5164
5165--
5166-- Name: COLUMN table_control.table_name; Type: COMMENT; Schema: public; Owner: postgres
5167--
5168
5169COMMENT ON COLUMN table_control.table_name IS 'Table name';
5170
5171
5172--
5173-- Name: COLUMN table_control.description; Type: COMMENT; Schema: public; Owner: postgres
5174--
5175
5176COMMENT ON COLUMN table_control.description IS 'English language description';
5177
5178
5179--
5180-- Name: COLUMN table_control.record_version; Type: COMMENT; Schema: public; Owner: postgres
5181--
5182
5183COMMENT ON COLUMN table_control.record_version IS 'Audit field: Lastest (local) change version number of the data';
5184
5185
5186--
5187-- Name: COLUMN table_control.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
5188--
5189
5190COMMENT ON COLUMN table_control.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
5191
5192
5193--
5194-- Name: translations; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
5195--
5196
5197CREATE TABLE translations (
5198    id integer NOT NULL,
5199    table_name character varying(40) NOT NULL,
5200    language_idnf character(2) NOT NULL,
5201    lookup_id integer,
5202    lookup_code character(6),
5203    description character varying(255),
5204    name character varying(40),
5205    record_version bigint NOT NULL,
5206    is_deleted smallint NOT NULL
5207);
5208
5209
5210ALTER TABLE public.translations OWNER TO postgres;
5211
5212--
5213-- Name: COLUMN translations.id; Type: COMMENT; Schema: public; Owner: postgres
5214--
5215
5216COMMENT ON COLUMN translations.id IS 'Internally generated unique identifier';
5217
5218
5219--
5220-- Name: COLUMN translations.table_name; Type: COMMENT; Schema: public; Owner: postgres
5221--
5222
5223COMMENT ON COLUMN translations.table_name IS 'Table name';
5224
5225
5226--
5227-- Name: COLUMN translations.language_idnf; Type: COMMENT; Schema: public; Owner: postgres
5228--
5229
5230COMMENT ON COLUMN translations.language_idnf IS 'ISO639-1 language code';
5231
5232
5233--
5234-- Name: COLUMN translations.lookup_id; Type: COMMENT; Schema: public; Owner: postgres
5235--
5236
5237COMMENT ON COLUMN translations.lookup_id IS 'Identifier being looked up (Data-Control tables only)';
5238
5239
5240--
5241-- Name: COLUMN translations.lookup_code; Type: COMMENT; Schema: public; Owner: postgres
5242--
5243
5244COMMENT ON COLUMN translations.lookup_code IS 'Code being looked up (Program-Control tables only)';
5245
5246
5247--
5248-- Name: COLUMN translations.description; Type: COMMENT; Schema: public; Owner: postgres
5249--
5250
5251COMMENT ON COLUMN translations.description IS 'Translated description (Use english value in original lookup table if none found)';
5252
5253
5254--
5255-- Name: COLUMN translations.name; Type: COMMENT; Schema: public; Owner: postgres
5256--
5257
5258COMMENT ON COLUMN translations.name IS 'Translated short name (Use english value in original lookup table if none found)';
5259
5260
5261--
5262-- Name: COLUMN translations.record_version; Type: COMMENT; Schema: public; Owner: postgres
5263--
5264
5265COMMENT ON COLUMN translations.record_version IS 'Audit field: Lastest (local) change version number of the data';
5266
5267
5268--
5269-- Name: COLUMN translations.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
5270--
5271
5272COMMENT ON COLUMN translations.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
5273
5274
5275--
5276-- Name: transport_mode; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
5277--
5278
5279CREATE TABLE transport_mode (
5280    code character(1) NOT NULL,
5281    description character varying(255) NOT NULL,
5282    record_version bigint NOT NULL,
5283    is_deleted smallint NOT NULL
5284);
5285
5286
5287ALTER TABLE public.transport_mode OWNER TO postgres;
5288
5289--
5290-- Name: COLUMN transport_mode.code; Type: COMMENT; Schema: public; Owner: postgres
5291--
5292
5293COMMENT ON COLUMN transport_mode.code IS 'Mode: A=Air, W=Water, L=Land';
5294
5295
5296--
5297-- Name: COLUMN transport_mode.description; Type: COMMENT; Schema: public; Owner: postgres
5298--
5299
5300COMMENT ON COLUMN transport_mode.description IS 'English language description';
5301
5302
5303--
5304-- Name: COLUMN transport_mode.record_version; Type: COMMENT; Schema: public; Owner: postgres
5305--
5306
5307COMMENT ON COLUMN transport_mode.record_version IS 'Audit field: Lastest (local) change version number of the data';
5308
5309
5310--
5311-- Name: COLUMN transport_mode.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
5312--
5313
5314COMMENT ON COLUMN transport_mode.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
5315
5316
5317--
5318-- Name: user_parameters; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
5319--
5320
5321CREATE TABLE user_parameters (
5322    user_id integer NOT NULL,
5323    parameter_name character varying(40) NOT NULL,
5324    parameter_value character varying(40),
5325    last_updated_time timestamp without time zone,
5326    record_version bigint NOT NULL,
5327    is_deleted smallint NOT NULL
5328);
5329
5330
5331ALTER TABLE public.user_parameters OWNER TO postgres;
5332
5333--
5334-- Name: COLUMN user_parameters.user_id; Type: COMMENT; Schema: public; Owner: postgres
5335--
5336
5337COMMENT ON COLUMN user_parameters.user_id IS 'User identifier';
5338
5339
5340--
5341-- Name: COLUMN user_parameters.parameter_name; Type: COMMENT; Schema: public; Owner: postgres
5342--
5343
5344COMMENT ON COLUMN user_parameters.parameter_name IS 'Parameter Name';
5345
5346
5347--
5348-- Name: COLUMN user_parameters.parameter_value; Type: COMMENT; Schema: public; Owner: postgres
5349--
5350
5351COMMENT ON COLUMN user_parameters.parameter_value IS 'Parameter Value';
5352
5353
5354--
5355-- Name: COLUMN user_parameters.last_updated_time; Type: COMMENT; Schema: public; Owner: postgres
5356--
5357
5358COMMENT ON COLUMN user_parameters.last_updated_time IS 'Date/time the parameter was last updated';
5359
5360
5361--
5362-- Name: COLUMN user_parameters.record_version; Type: COMMENT; Schema: public; Owner: postgres
5363--
5364
5365COMMENT ON COLUMN user_parameters.record_version IS 'Audit field: Lastest (local) change version number of the data';
5366
5367
5368--
5369-- Name: COLUMN user_parameters.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
5370--
5371
5372COMMENT ON COLUMN user_parameters.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
5373
5374
5375--
5376-- Name: user_roles; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
5377--
5378
5379CREATE TABLE user_roles (
5380    id integer NOT NULL,
5381    user_id integer NOT NULL,
5382    role_code character(3) NOT NULL,
5383    project_id integer,
5384    site_id integer,
5385    expiry_date date,
5386    record_version bigint NOT NULL,
5387    is_deleted smallint NOT NULL
5388);
5389
5390
5391ALTER TABLE public.user_roles OWNER TO postgres;
5392
5393--
5394-- Name: COLUMN user_roles.id; Type: COMMENT; Schema: public; Owner: postgres
5395--
5396
5397COMMENT ON COLUMN user_roles.id IS 'Internally generated unique identifier';
5398
5399
5400--
5401-- Name: COLUMN user_roles.user_id; Type: COMMENT; Schema: public; Owner: postgres
5402--
5403
5404COMMENT ON COLUMN user_roles.user_id IS 'Unique User ID';
5405
5406
5407--
5408-- Name: COLUMN user_roles.role_code; Type: COMMENT; Schema: public; Owner: postgres
5409--
5410
5411COMMENT ON COLUMN user_roles.role_code IS 'User''s Role';
5412
5413
5414--
5415-- Name: COLUMN user_roles.project_id; Type: COMMENT; Schema: public; Owner: postgres
5416--
5417
5418COMMENT ON COLUMN user_roles.project_id IS 'Projects that the user is allowed to edit';
5419
5420
5421--
5422-- Name: COLUMN user_roles.site_id; Type: COMMENT; Schema: public; Owner: postgres
5423--
5424
5425COMMENT ON COLUMN user_roles.site_id IS 'Project is Active for which sites';
5426
5427
5428--
5429-- Name: COLUMN user_roles.expiry_date; Type: COMMENT; Schema: public; Owner: postgres
5430--
5431
5432COMMENT ON COLUMN user_roles.expiry_date IS 'Date this authorisation expires (NULL if no expiry date)';
5433
5434
5435--
5436-- Name: COLUMN user_roles.record_version; Type: COMMENT; Schema: public; Owner: postgres
5437--
5438
5439COMMENT ON COLUMN user_roles.record_version IS 'Audit field: Lastest (local) change version number of the data';
5440
5441
5442--
5443-- Name: COLUMN user_roles.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
5444--
5445
5446COMMENT ON COLUMN user_roles.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
5447
5448
5449--
5450-- Name: users; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
5451--
5452
5453CREATE TABLE users (
5454    id integer NOT NULL,
5455    org_id integer NOT NULL,
5456    email character varying(100) NOT NULL,
5457    password character varying(16) NOT NULL,
5458    name character varying(255) NOT NULL,
5459    expiry_date date,
5460    record_version bigint NOT NULL,
5461    is_deleted smallint NOT NULL
5462);
5463
5464
5465ALTER TABLE public.users OWNER TO postgres;
5466
5467--
5468-- Name: COLUMN users.id; Type: COMMENT; Schema: public; Owner: postgres
5469--
5470
5471COMMENT ON COLUMN users.id IS 'Internally generated unique identifier';
5472
5473
5474--
5475-- Name: COLUMN users.org_id; Type: COMMENT; Schema: public; Owner: postgres
5476--
5477
5478COMMENT ON COLUMN users.org_id IS 'User"s Organisation ID (Link to WFP or LogCluster for head office users)';
5479
5480
5481--
5482-- Name: COLUMN users.email; Type: COMMENT; Schema: public; Owner: postgres
5483--
5484
5485COMMENT ON COLUMN users.email IS 'User"s Email';
5486
5487
5488--
5489-- Name: COLUMN users.password; Type: COMMENT; Schema: public; Owner: postgres
5490--
5491
5492COMMENT ON COLUMN users.password IS 'User"s encrypted password';
5493
5494
5495--
5496-- Name: COLUMN users.name; Type: COMMENT; Schema: public; Owner: postgres
5497--
5498
5499COMMENT ON COLUMN users.name IS 'User"s Name';
5500
5501
5502--
5503-- Name: COLUMN users.expiry_date; Type: COMMENT; Schema: public; Owner: postgres
5504--
5505
5506COMMENT ON COLUMN users.expiry_date IS 'Date this UserID expires (NULL if no expiry date)';
5507
5508
5509--
5510-- Name: COLUMN users.record_version; Type: COMMENT; Schema: public; Owner: postgres
5511--
5512
5513COMMENT ON COLUMN users.record_version IS 'Audit field: Lastest (local) change version number of the data';
5514
5515
5516--
5517-- Name: COLUMN users.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
5518--
5519
5520COMMENT ON COLUMN users.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
5521
5522
5523--
5524-- Name: vehicle_category; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
5525--
5526
5527CREATE TABLE vehicle_category (
5528    id integer NOT NULL,
5529    description character varying(255) NOT NULL,
5530    transport_mode_code character(1) NOT NULL,
5531    record_version bigint NOT NULL,
5532    is_deleted smallint NOT NULL
5533);
5534
5535
5536ALTER TABLE public.vehicle_category OWNER TO postgres;
5537
5538--
5539-- Name: COLUMN vehicle_category.id; Type: COMMENT; Schema: public; Owner: postgres
5540--
5541
5542COMMENT ON COLUMN vehicle_category.id IS 'Internally generated unique identifier';
5543
5544
5545--
5546-- Name: COLUMN vehicle_category.description; Type: COMMENT; Schema: public; Owner: postgres
5547--
5548
5549COMMENT ON COLUMN vehicle_category.description IS 'English language description';
5550
5551
5552--
5553-- Name: COLUMN vehicle_category.transport_mode_code; Type: COMMENT; Schema: public; Owner: postgres
5554--
5555
5556COMMENT ON COLUMN vehicle_category.transport_mode_code IS 'Mode: A=Air, W=Water, L=Land';
5557
5558
5559--
5560-- Name: COLUMN vehicle_category.record_version; Type: COMMENT; Schema: public; Owner: postgres
5561--
5562
5563COMMENT ON COLUMN vehicle_category.record_version IS 'Audit field: Lastest (local) change version number of the data';
5564
5565
5566--
5567-- Name: COLUMN vehicle_category.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
5568--
5569
5570COMMENT ON COLUMN vehicle_category.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
5571
5572
5573--
5574-- Name: viewpoints; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
5575--
5576
5577CREATE TABLE viewpoints (
5578    screen_code character(2) NOT NULL,
5579    viewpoint_code character(3) NOT NULL,
5580    description character varying(255) NOT NULL,
5581    seqno integer NOT NULL,
5582    viewpoint_site_name character varying(40),
5583    is_default smallint NOT NULL,
5584    is_allowed_if_proj_closed smallint NOT NULL,
5585    record_version bigint NOT NULL,
5586    is_deleted smallint NOT NULL
5587);
5588
5589
5590ALTER TABLE public.viewpoints OWNER TO postgres;
5591
5592--
5593-- Name: COLUMN viewpoints.screen_code; Type: COMMENT; Schema: public; Owner: postgres
5594--
5595
5596COMMENT ON COLUMN viewpoints.screen_code IS 'Code of the screen using the viewpoint';
5597
5598
5599--
5600-- Name: COLUMN viewpoints.viewpoint_code; Type: COMMENT; Schema: public; Owner: postgres
5601--
5602
5603COMMENT ON COLUMN viewpoints.viewpoint_code IS 'The Viewpoint Code, as used in the RITA code';
5604
5605
5606--
5607-- Name: COLUMN viewpoints.description; Type: COMMENT; Schema: public; Owner: postgres
5608--
5609
5610COMMENT ON COLUMN viewpoints.description IS 'English language description of the viewpoint, for the given ScreenCode';
5611
5612
5613--
5614-- Name: COLUMN viewpoints.seqno; Type: COMMENT; Schema: public; Owner: postgres
5615--
5616
5617COMMENT ON COLUMN viewpoints.seqno IS 'Sequence Number in the Viewpoint dropdown list';
5618
5619
5620--
5621-- Name: COLUMN viewpoints.viewpoint_site_name; Type: COMMENT; Schema: public; Owner: postgres
5622--
5623
5624COMMENT ON COLUMN viewpoints.viewpoint_site_name IS 'Viewpoint has an additional ''Site'' restriction (NULL if no viewpoint site)';
5625
5626
5627--
5628-- Name: COLUMN viewpoints.is_default; Type: COMMENT; Schema: public; Owner: postgres
5629--
5630
5631COMMENT ON COLUMN viewpoints.is_default IS 'Is this the default selection';
5632
5633
5634--
5635-- Name: COLUMN viewpoints.is_allowed_if_proj_closed; Type: COMMENT; Schema: public; Owner: postgres
5636--
5637
5638COMMENT ON COLUMN viewpoints.is_allowed_if_proj_closed IS 'Is the viewpoint allowed/valid if the project is closed';
5639
5640
5641--
5642-- Name: COLUMN viewpoints.record_version; Type: COMMENT; Schema: public; Owner: postgres
5643--
5644
5645COMMENT ON COLUMN viewpoints.record_version IS 'Audit field: Lastest (local) change version number of the data';
5646
5647
5648--
5649-- Name: COLUMN viewpoints.is_deleted; Type: COMMENT; Schema: public; Owner: postgres
5650--
5651
5652COMMENT ON COLUMN viewpoints.is_deleted IS 'Record has been deleted (Remove from current slection lists)';
5653
5654
5655--
5656-- Name: ak_keyprojsite_project_2; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5657--
5658
5659ALTER TABLE ONLY project_site
5660    ADD CONSTRAINT ak_keyprojsite_project_2 PRIMARY KEY (project_id, site_id);
5661
5662
5663--
5664-- Name: pk_arrival_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5665--
5666
5667ALTER TABLE ONLY arrival_type
5668    ADD CONSTRAINT pk_arrival_type PRIMARY KEY (code);
5669
5670
5671--
5672-- Name: pk_building_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5673--
5674
5675ALTER TABLE ONLY building_type
5676    ADD CONSTRAINT pk_building_type PRIMARY KEY (id);
5677
5678
5679--
5680-- Name: pk_bundle; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5681--
5682
5683ALTER TABLE ONLY bundle
5684    ADD CONSTRAINT pk_bundle PRIMARY KEY (bundle_site_id, id);
5685
5686
5687--
5688-- Name: pk_bundle_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5689--
5690
5691ALTER TABLE ONLY bundle_type
5692    ADD CONSTRAINT pk_bundle_type PRIMARY KEY (id);
5693
5694
5695--
5696-- Name: pk_bundle_type_group; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5697--
5698
5699ALTER TABLE ONLY bundle_type_group
5700    ADD CONSTRAINT pk_bundle_type_group PRIMARY KEY (id);
5701
5702
5703--
5704-- Name: pk_change_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5705--
5706
5707ALTER TABLE ONLY change_type
5708    ADD CONSTRAINT pk_change_type PRIMARY KEY (code);
5709
5710
5711--
5712-- Name: pk_contact; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5713--
5714
5715ALTER TABLE ONLY contact
5716    ADD CONSTRAINT pk_contact PRIMARY KEY (owner_site_id, id);
5717
5718
5719--
5720-- Name: pk_country; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5721--
5722
5723ALTER TABLE ONLY country
5724    ADD CONSTRAINT pk_country PRIMARY KEY (id);
5725
5726
5727--
5728-- Name: pk_country_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5729--
5730
5731ALTER TABLE ONLY country_type
5732    ADD CONSTRAINT pk_country_type PRIMARY KEY (code);
5733
5734
5735--
5736-- Name: pk_currency; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5737--
5738
5739ALTER TABLE ONLY currency
5740    ADD CONSTRAINT pk_currency PRIMARY KEY (id);
5741
5742
5743--
5744-- Name: pk_cust_order; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5745--
5746
5747ALTER TABLE ONLY cust_order
5748    ADD CONSTRAINT pk_cust_order PRIMARY KEY (id);
5749
5750
5751--
5752-- Name: pk_cust_order_history; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5753--
5754
5755ALTER TABLE ONLY cust_order_history
5756    ADD CONSTRAINT pk_cust_order_history PRIMARY KEY (commenting_site_id, cust_order_id, change_time);
5757
5758
5759--
5760-- Name: pk_cust_order_line; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5761--
5762
5763ALTER TABLE ONLY cust_order_line
5764    ADD CONSTRAINT pk_cust_order_line PRIMARY KEY (id);
5765
5766
5767--
5768-- Name: pk_dispatch_priority; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5769--
5770
5771ALTER TABLE ONLY dispatch_priority
5772    ADD CONSTRAINT pk_dispatch_priority PRIMARY KEY (id);
5773
5774
5775--
5776-- Name: pk_distribution_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5777--
5778
5779ALTER TABLE ONLY distribution_type
5780    ADD CONSTRAINT pk_distribution_type PRIMARY KEY (id);
5781
5782
5783--
5784-- Name: pk_enclosure_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5785--
5786
5787ALTER TABLE ONLY enclosure_type
5788    ADD CONSTRAINT pk_enclosure_type PRIMARY KEY (code);
5789
5790
5791--
5792-- Name: pk_exchange_rate; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5793--
5794
5795ALTER TABLE ONLY exchange_rate
5796    ADD CONSTRAINT pk_exchange_rate PRIMARY KEY (currency_id, take_effect_date);
5797
5798
5799--
5800-- Name: pk_journey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5801--
5802
5803ALTER TABLE ONLY journey
5804    ADD CONSTRAINT pk_journey PRIMARY KEY (journey_site_id, id);
5805
5806
5807--
5808-- Name: pk_journey_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5809--
5810
5811ALTER TABLE ONLY journey_type
5812    ADD CONSTRAINT pk_journey_type PRIMARY KEY (code);
5813
5814
5815--
5816-- Name: pk_kit_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5817--
5818
5819ALTER TABLE ONLY kit_type
5820    ADD CONSTRAINT pk_kit_type PRIMARY KEY (code);
5821
5822
5823--
5824-- Name: pk_languages; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5825--
5826
5827ALTER TABLE ONLY languages
5828    ADD CONSTRAINT pk_languages PRIMARY KEY (iso2_idnf);
5829
5830
5831--
5832-- Name: pk_list_action; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5833--
5834
5835ALTER TABLE ONLY list_action
5836    ADD CONSTRAINT pk_list_action PRIMARY KEY (screen_code, list_action_code);
5837
5838
5839--
5840-- Name: pk_list_action_roles; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5841--
5842
5843ALTER TABLE ONLY list_action_roles
5844    ADD CONSTRAINT pk_list_action_roles PRIMARY KEY (screen_code, list_action_code, role_code);
5845
5846
5847--
5848-- Name: pk_list_action_viewpoints; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5849--
5850
5851ALTER TABLE ONLY list_action_viewpoints
5852    ADD CONSTRAINT pk_list_action_viewpoints PRIMARY KEY (screen_code, list_action_code, viewpoint_code);
5853
5854
5855--
5856-- Name: pk_location; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5857--
5858
5859ALTER TABLE ONLY location
5860    ADD CONSTRAINT pk_location PRIMARY KEY (location_site_id, id);
5861
5862
5863--
5864-- Name: pk_location_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5865--
5866
5867ALTER TABLE ONLY location_type
5868    ADD CONSTRAINT pk_location_type PRIMARY KEY (code);
5869
5870
5871--
5872-- Name: pk_movement; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5873--
5874
5875ALTER TABLE ONLY movement
5876    ADD CONSTRAINT pk_movement PRIMARY KEY (move_site_id, id);
5877
5878
5879--
5880-- Name: pk_movement_comment; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5881--
5882
5883ALTER TABLE ONLY movement_comment
5884    ADD CONSTRAINT pk_movement_comment PRIMARY KEY (move_site_id, id);
5885
5886
5887--
5888-- Name: pk_org; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5889--
5890
5891ALTER TABLE ONLY org
5892    ADD CONSTRAINT pk_org PRIMARY KEY (id);
5893
5894
5895--
5896-- Name: pk_org_address; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5897--
5898
5899ALTER TABLE ONLY org_address
5900    ADD CONSTRAINT pk_org_address PRIMARY KEY (id);
5901
5902
5903--
5904-- Name: pk_org_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5905--
5906
5907ALTER TABLE ONLY org_type
5908    ADD CONSTRAINT pk_org_type PRIMARY KEY (code);
5909
5910
5911--
5912-- Name: pk_port_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5913--
5914
5915ALTER TABLE ONLY port_type
5916    ADD CONSTRAINT pk_port_type PRIMARY KEY (id);
5917
5918
5919--
5920-- Name: pk_product; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5921--
5922
5923ALTER TABLE ONLY product
5924    ADD CONSTRAINT pk_product PRIMARY KEY (id);
5925
5926
5927--
5928-- Name: pk_product_ltu; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5929--
5930
5931ALTER TABLE ONLY product_ltu
5932    ADD CONSTRAINT pk_product_ltu PRIMARY KEY (id);
5933
5934
5935--
5936-- Name: pk_product_sku; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5937--
5938
5939ALTER TABLE ONLY product_sku
5940    ADD CONSTRAINT pk_product_sku PRIMARY KEY (id);
5941
5942
5943--
5944-- Name: pk_project; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5945--
5946
5947ALTER TABLE ONLY project
5948    ADD CONSTRAINT pk_project PRIMARY KEY (id);
5949
5950
5951--
5952-- Name: pk_project_classify; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5953--
5954
5955ALTER TABLE ONLY project_classify
5956    ADD CONSTRAINT pk_project_classify PRIMARY KEY (code);
5957
5958
5959--
5960-- Name: pk_project_purpose; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5961--
5962
5963ALTER TABLE ONLY project_purpose
5964    ADD CONSTRAINT pk_project_purpose PRIMARY KEY (id);
5965
5966
5967--
5968-- Name: pk_region; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5969--
5970
5971ALTER TABLE ONLY region
5972    ADD CONSTRAINT pk_region PRIMARY KEY (id);
5973
5974
5975--
5976-- Name: pk_request; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5977--
5978
5979ALTER TABLE ONLY request
5980    ADD CONSTRAINT pk_request PRIMARY KEY (request_site_id, id);
5981
5982
5983--
5984-- Name: pk_request_cust_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5985--
5986
5987ALTER TABLE ONLY request_cust_type
5988    ADD CONSTRAINT pk_request_cust_type PRIMARY KEY (code);
5989
5990
5991--
5992-- Name: pk_request_history; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
5993--
5994
5995ALTER TABLE ONLY request_history
5996    ADD CONSTRAINT pk_request_history PRIMARY KEY (commenting_site_id, request_site_id, request_id, change_time);
5997
5998
5999--
6000-- Name: pk_request_line; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6001--
6002
6003ALTER TABLE ONLY request_line
6004    ADD CONSTRAINT pk_request_line PRIMARY KEY (id, request_site_id);
6005
6006
6007--
6008-- Name: pk_request_line_priority; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6009--
6010
6011ALTER TABLE ONLY request_line_priority
6012    ADD CONSTRAINT pk_request_line_priority PRIMARY KEY (commenting_site_id, request_line_id, request_site_id);
6013
6014
6015--
6016-- Name: pk_request_status; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6017--
6018
6019ALTER TABLE ONLY request_status
6020    ADD CONSTRAINT pk_request_status PRIMARY KEY (code);
6021
6022
6023--
6024-- Name: pk_roles; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6025--
6026
6027ALTER TABLE ONLY roles
6028    ADD CONSTRAINT pk_roles PRIMARY KEY (code);
6029
6030
6031--
6032-- Name: pk_screen_code; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6033--
6034
6035ALTER TABLE ONLY screen_code
6036    ADD CONSTRAINT pk_screen_code PRIMARY KEY (code);
6037
6038
6039--
6040-- Name: pk_service_type; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6041--
6042
6043ALTER TABLE ONLY service_type
6044    ADD CONSTRAINT pk_service_type PRIMARY KEY (code);
6045
6046
6047--
6048-- Name: pk_shipment; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6049--
6050
6051ALTER TABLE ONLY shipment
6052    ADD CONSTRAINT pk_shipment PRIMARY KEY (shipment_site_id, id);
6053
6054
6055--
6056-- Name: pk_shipment_comment; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6057--
6058
6059ALTER TABLE ONLY shipment_comment
6060    ADD CONSTRAINT pk_shipment_comment PRIMARY KEY (shipment_site_id, shipment_id, owner_site_id);
6061
6062
6063--
6064-- Name: pk_site; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6065--
6066
6067ALTER TABLE ONLY site
6068    ADD CONSTRAINT pk_site PRIMARY KEY (id);
6069
6070
6071--
6072-- Name: pk_site_track_no; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6073--
6074
6075ALTER TABLE ONLY site_track_no
6076    ADD CONSTRAINT pk_site_track_no PRIMARY KEY (site_id);
6077
6078
6079--
6080-- Name: pk_subregion; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6081--
6082
6083ALTER TABLE ONLY subregion
6084    ADD CONSTRAINT pk_subregion PRIMARY KEY (id);
6085
6086
6087--
6088-- Name: pk_sync_log; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6089--
6090
6091ALTER TABLE ONLY sync_log
6092    ADD CONSTRAINT pk_sync_log PRIMARY KEY (id);
6093
6094
6095--
6096-- Name: pk_sync_table_version; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6097--
6098
6099ALTER TABLE ONLY sync_table_version
6100    ADD CONSTRAINT pk_sync_table_version PRIMARY KEY (table_name);
6101
6102
6103--
6104-- Name: pk_table_control; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6105--
6106
6107ALTER TABLE ONLY table_control
6108    ADD CONSTRAINT pk_table_control PRIMARY KEY (table_name);
6109
6110
6111--
6112-- Name: pk_translations; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6113--
6114
6115ALTER TABLE ONLY translations
6116    ADD CONSTRAINT pk_translations PRIMARY KEY (id);
6117
6118
6119--
6120-- Name: pk_transport_mode; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6121--
6122
6123ALTER TABLE ONLY transport_mode
6124    ADD CONSTRAINT pk_transport_mode PRIMARY KEY (code);
6125
6126
6127--
6128-- Name: pk_user_parameters; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6129--
6130
6131ALTER TABLE ONLY user_parameters
6132    ADD CONSTRAINT pk_user_parameters PRIMARY KEY (user_id, parameter_name);
6133
6134
6135--
6136-- Name: pk_user_roles; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6137--
6138
6139ALTER TABLE ONLY user_roles
6140    ADD CONSTRAINT pk_user_roles PRIMARY KEY (id);
6141
6142
6143--
6144-- Name: pk_users; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6145--
6146
6147ALTER TABLE ONLY users
6148    ADD CONSTRAINT pk_users PRIMARY KEY (id);
6149
6150
6151--
6152-- Name: pk_vehicle_category; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6153--
6154
6155ALTER TABLE ONLY vehicle_category
6156    ADD CONSTRAINT pk_vehicle_category PRIMARY KEY (id);
6157
6158
6159--
6160-- Name: pk_viewpoints; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
6161--
6162
6163ALTER TABLE ONLY viewpoints
6164    ADD CONSTRAINT pk_viewpoints PRIMARY KEY (screen_code, viewpoint_code);
6165
6166
6167--
6168-- Name: idxactivetrack; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6169--
6170
6171CREATE UNIQUE INDEX idxactivetrack ON site_track_no USING btree (site_id, is_active);
6172
6173
6174--
6175-- Name: idxctryname; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6176--
6177
6178CREATE UNIQUE INDEX idxctryname ON country USING btree (name);
6179
6180
6181--
6182-- Name: idxcurrcode; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6183--
6184
6185CREATE UNIQUE INDEX idxcurrcode ON currency USING btree (iso3_idnf);
6186
6187
6188--
6189-- Name: idxcurrname; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6190--
6191
6192CREATE UNIQUE INDEX idxcurrname ON currency USING btree (name);
6193
6194
6195--
6196-- Name: idxcustline; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6197--
6198
6199CREATE UNIQUE INDEX idxcustline ON cust_order_line USING btree (cust_order_id, seqno);
6200
6201
6202--
6203-- Name: idxdpchprtyseqnnumb; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6204--
6205
6206CREATE UNIQUE INDEX idxdpchprtyseqnnumb ON dispatch_priority USING btree (seqno);
6207
6208
6209--
6210-- Name: idxiso2; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6211--
6212
6213CREATE UNIQUE INDEX idxiso2 ON country USING btree (iso2_idnf);
6214
6215
6216--
6217-- Name: idxiso3; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6218--
6219
6220CREATE UNIQUE INDEX idxiso3 ON country USING btree (iso3_idnf);
6221
6222
6223--
6224-- Name: idxjourney; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6225--
6226
6227CREATE INDEX idxjourney ON movement USING btree (bundle_site_id, bundle_id);
6228
6229
6230--
6231-- Name: idxlineseqnnumb; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6232--
6233
6234CREATE UNIQUE INDEX idxlineseqnnumb ON request_line USING btree (request_site_id, request_id, seqno);
6235
6236
6237--
6238-- Name: idxlistdesc; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6239--
6240
6241CREATE UNIQUE INDEX idxlistdesc ON list_action USING btree (screen_code, description);
6242
6243
6244--
6245-- Name: idxlistseqno; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6246--
6247
6248CREATE UNIQUE INDEX idxlistseqno ON list_action USING btree (screen_code, seqno);
6249
6250
6251--
6252-- Name: idxlookup; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6253--
6254
6255CREATE INDEX idxlookup ON contact USING btree (org_id);
6256
6257
6258--
6259-- Name: idxlookupcode; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6260--
6261
6262CREATE UNIQUE INDEX idxlookupcode ON translations USING btree (table_name, language_idnf, lookup_code);
6263
6264
6265--
6266-- Name: idxlookupid; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6267--
6268
6269CREATE UNIQUE INDEX idxlookupid ON translations USING btree (table_name, language_idnf, lookup_id);
6270
6271
6272--
6273-- Name: idxofficialname; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6274--
6275
6276CREATE UNIQUE INDEX idxofficialname ON country USING btree (official_name);
6277
6278
6279--
6280-- Name: idxorgabrv; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6281--
6282
6283CREATE INDEX idxorgabrv ON org USING btree (abrv);
6284
6285
6286--
6287-- Name: idxorgname; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6288--
6289
6290CREATE INDEX idxorgname ON org USING btree (name);
6291
6292
6293--
6294-- Name: idxprodtemidnf; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6295--
6296
6297CREATE UNIQUE INDEX idxprodtemidnf ON product USING btree (product_idnf);
6298
6299
6300--
6301-- Name: idxprojidnf; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6302--
6303
6304CREATE UNIQUE INDEX idxprojidnf ON project USING btree (project_idnf);
6305
6306
6307--
6308-- Name: idxprojname; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6309--
6310
6311CREATE UNIQUE INDEX idxprojname ON project USING btree (name);
6312
6313
6314--
6315-- Name: idxregnname; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6316--
6317
6318CREATE INDEX idxregnname ON region USING btree (name);
6319
6320
6321--
6322-- Name: idxrequest; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6323--
6324
6325CREATE INDEX idxrequest ON movement USING btree (request_site_id);
6326
6327
6328--
6329-- Name: idxrequestline; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6330--
6331
6332CREATE INDEX idxrequestline ON movement USING btree (request_site_id, request_line_id);
6333
6334
6335--
6336-- Name: idxrqstseqnnumb; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6337--
6338
6339CREATE UNIQUE INDEX idxrqstseqnnumb ON request USING btree (project_id, request_site_id, seqno, suffix, service_type_code);
6340
6341
6342--
6343-- Name: idxrqststatname; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6344--
6345
6346CREATE UNIQUE INDEX idxrqststatname ON request_status USING btree (request_cust_type_code, name);
6347
6348
6349--
6350-- Name: idxrqststatseqnnumb; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6351--
6352
6353CREATE UNIQUE INDEX idxrqststatseqnnumb ON request_status USING btree (request_cust_type_code, seqno);
6354
6355
6356--
6357-- Name: idxshipmentid; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6358--
6359
6360CREATE UNIQUE INDEX idxshipmentid ON request USING btree (request_site_id, initial_shipment_id);
6361
6362
6363--
6364-- Name: idxsitename; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6365--
6366
6367CREATE UNIQUE INDEX idxsitename ON site USING btree (site_name);
6368
6369
6370--
6371-- Name: idxsiteprfx; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6372--
6373
6374CREATE UNIQUE INDEX idxsiteprfx ON project_site USING btree (site_prefix);
6375
6376
6377--
6378-- Name: idxsitetrcknumb; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6379--
6380
6381CREATE UNIQUE INDEX idxsitetrcknumb ON site_track_no USING btree (site_track_idnf);
6382
6383
6384--
6385-- Name: idxsrgnname; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6386--
6387
6388CREATE INDEX idxsrgnname ON subregion USING btree (region_id, name);
6389
6390
6391--
6392-- Name: idxuser; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6393--
6394
6395CREATE UNIQUE INDEX idxuser ON user_roles USING btree (user_id, project_id, site_id, role_code);
6396
6397
6398--
6399-- Name: idxuserlogon; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6400--
6401
6402CREATE UNIQUE INDEX idxuserlogon ON users USING btree (email);
6403
6404
6405--
6406-- Name: idxviewdesc; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6407--
6408
6409CREATE UNIQUE INDEX idxviewdesc ON viewpoints USING btree (description);
6410
6411
6412--
6413-- Name: idxviewseqno; Type: INDEX; Schema: public; Owner: postgres; Tablespace:
6414--
6415
6416CREATE UNIQUE INDEX idxviewseqno ON viewpoints USING btree (seqno, screen_code);
6417
6418
6419--
6420-- Name: fk_bundle_t_reference_bundle_t; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6421--
6422
6423ALTER TABLE ONLY bundle_type
6424    ADD CONSTRAINT fk_bundle_t_reference_bundle_t FOREIGN KEY (group_id) REFERENCES bundle_type_group(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6425
6426
6427--
6428-- Name: fk_bundle_t_reference_enclosur; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6429--
6430
6431ALTER TABLE ONLY bundle_type
6432    ADD CONSTRAINT fk_bundle_t_reference_enclosur FOREIGN KEY (enclosure_type_code) REFERENCES enclosure_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6433
6434
6435--
6436-- Name: fk_contact_reference_project_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6437--
6438
6439ALTER TABLE ONLY contact
6440    ADD CONSTRAINT fk_contact_reference_project_ FOREIGN KEY (project_id, owner_site_id) REFERENCES project_site(project_id, site_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6441
6442
6443--
6444-- Name: fk_country_reference_country_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6445--
6446
6447ALTER TABLE ONLY country
6448    ADD CONSTRAINT fk_country_reference_country_ FOREIGN KEY (country_type_code) REFERENCES country_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6449
6450
6451--
6452-- Name: fk_country_reference_currency; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6453--
6454
6455ALTER TABLE ONLY country
6456    ADD CONSTRAINT fk_country_reference_currency FOREIGN KEY (currency_id) REFERENCES currency(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6457
6458
6459--
6460-- Name: fk_country_reference_subregio; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6461--
6462
6463ALTER TABLE ONLY country
6464    ADD CONSTRAINT fk_country_reference_subregio FOREIGN KEY (subregion_id) REFERENCES subregion(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6465
6466
6467--
6468-- Name: fk_cust_ord_reference_change_t; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6469--
6470
6471ALTER TABLE ONLY cust_order_history
6472    ADD CONSTRAINT fk_cust_ord_reference_change_t FOREIGN KEY (change_type_code) REFERENCES change_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6473
6474
6475--
6476-- Name: fk_cust_ord_reference_contact; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6477--
6478
6479ALTER TABLE ONLY cust_order
6480    ADD CONSTRAINT fk_cust_ord_reference_contact FOREIGN KEY (sender_site_id, sender_contact_id) REFERENCES contact(owner_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6481
6482
6483--
6484-- Name: fk_cust_ord_reference_contact2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6485--
6486
6487ALTER TABLE ONLY cust_order
6488    ADD CONSTRAINT fk_cust_ord_reference_contact2 FOREIGN KEY (invoice_site_id, invoice_contact_id) REFERENCES contact(owner_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6489
6490
6491--
6492-- Name: fk_cust_ord_reference_contact3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6493--
6494
6495ALTER TABLE ONLY cust_order
6496    ADD CONSTRAINT fk_cust_ord_reference_contact3 FOREIGN KEY (receiver_site_id, receiver_contact_id) REFERENCES contact(owner_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6497
6498
6499--
6500-- Name: fk_cust_ord_reference_cust_ord; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6501--
6502
6503ALTER TABLE ONLY cust_order_history
6504    ADD CONSTRAINT fk_cust_ord_reference_cust_ord FOREIGN KEY (cust_order_id) REFERENCES cust_order(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6505
6506
6507--
6508-- Name: fk_cust_ord_reference_cust_ord2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6509--
6510
6511ALTER TABLE ONLY cust_order_line
6512    ADD CONSTRAINT fk_cust_ord_reference_cust_ord2 FOREIGN KEY (cust_order_id) REFERENCES cust_order(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6513
6514
6515--
6516-- Name: fk_cust_ord_reference_kit_type; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6517--
6518
6519ALTER TABLE ONLY cust_order_line
6520    ADD CONSTRAINT fk_cust_ord_reference_kit_type FOREIGN KEY (kit_type_code) REFERENCES kit_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6521
6522
6523--
6524-- Name: fk_cust_ord_reference_location; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6525--
6526
6527ALTER TABLE ONLY cust_order
6528    ADD CONSTRAINT fk_cust_ord_reference_location FOREIGN KEY (arrival_location_site_id, arrival_location_id) REFERENCES location(location_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6529
6530
6531--
6532-- Name: fk_cust_ord_reference_location2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6533--
6534
6535ALTER TABLE ONLY cust_order
6536    ADD CONSTRAINT fk_cust_ord_reference_location2 FOREIGN KEY (exit_location_site_id, exit_location_id) REFERENCES location(location_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6537
6538
6539--
6540-- Name: fk_cust_ord_reference_product; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6541--
6542
6543ALTER TABLE ONLY cust_order_line
6544    ADD CONSTRAINT fk_cust_ord_reference_product FOREIGN KEY (product_id) REFERENCES product(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6545
6546
6547--
6548-- Name: fk_cust_ord_reference_product2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6549--
6550
6551ALTER TABLE ONLY cust_order
6552    ADD CONSTRAINT fk_cust_ord_reference_product2 FOREIGN KEY (product_id) REFERENCES product(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6553
6554
6555--
6556-- Name: fk_cust_ord_reference_product_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6557--
6558
6559ALTER TABLE ONLY cust_order_line
6560    ADD CONSTRAINT fk_cust_ord_reference_product_ FOREIGN KEY (sku_id) REFERENCES product_sku(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6561
6562
6563--
6564-- Name: fk_cust_ord_reference_product_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6565--
6566
6567ALTER TABLE ONLY cust_order_line
6568    ADD CONSTRAINT fk_cust_ord_reference_product_2 FOREIGN KEY (ltu_id) REFERENCES product_ltu(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6569
6570
6571--
6572-- Name: fk_cust_ord_reference_project_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6573--
6574
6575ALTER TABLE ONLY cust_order
6576    ADD CONSTRAINT fk_cust_ord_reference_project_2 FOREIGN KEY (project_id, request_site_id) REFERENCES project_site(project_id, site_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6577
6578
6579--
6580-- Name: fk_cust_ord_reference_request_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6581--
6582
6583ALTER TABLE ONLY cust_order_history
6584    ADD CONSTRAINT fk_cust_ord_reference_request_ FOREIGN KEY (new_status_code) REFERENCES request_status(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6585
6586
6587--
6588-- Name: fk_cust_ord_reference_request_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6589--
6590
6591ALTER TABLE ONLY cust_order
6592    ADD CONSTRAINT fk_cust_ord_reference_request_2 FOREIGN KEY (status_code) REFERENCES request_status(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6593
6594
6595--
6596-- Name: fk_cust_ord_reference_request_3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6597--
6598
6599ALTER TABLE ONLY cust_order
6600    ADD CONSTRAINT fk_cust_ord_reference_request_3 FOREIGN KEY (service_type_code) REFERENCES service_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6601
6602
6603--
6604-- Name: fk_exchange_reference_currency; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6605--
6606
6607ALTER TABLE ONLY exchange_rate
6608    ADD CONSTRAINT fk_exchange_reference_currency FOREIGN KEY (currency_id) REFERENCES currency(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6609
6610
6611--
6612-- Name: fk_journey_reference_journey_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6613--
6614
6615ALTER TABLE ONLY journey
6616    ADD CONSTRAINT fk_journey_reference_journey_ FOREIGN KEY (journey_type_code) REFERENCES journey_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6617
6618
6619--
6620-- Name: fk_journey_reference_vehicle_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6621--
6622
6623ALTER TABLE ONLY journey
6624    ADD CONSTRAINT fk_journey_reference_vehicle_ FOREIGN KEY (vehicle_category_id) REFERENCES vehicle_category(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6625
6626
6627--
6628-- Name: fk_list_act_reference_list_act; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6629--
6630
6631ALTER TABLE ONLY list_action_viewpoints
6632    ADD CONSTRAINT fk_list_act_reference_list_act FOREIGN KEY (screen_code, list_action_code) REFERENCES list_action(screen_code, list_action_code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6633
6634
6635--
6636-- Name: fk_list_act_reference_list_act2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6637--
6638
6639ALTER TABLE ONLY list_action_roles
6640    ADD CONSTRAINT fk_list_act_reference_list_act2 FOREIGN KEY (screen_code, list_action_code) REFERENCES list_action(screen_code, list_action_code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6641
6642
6643--
6644-- Name: fk_list_act_reference_roles; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6645--
6646
6647ALTER TABLE ONLY list_action_roles
6648    ADD CONSTRAINT fk_list_act_reference_roles FOREIGN KEY (role_code) REFERENCES roles(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6649
6650
6651--
6652-- Name: fk_list_act_reference_screen_c; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6653--
6654
6655ALTER TABLE ONLY list_action
6656    ADD CONSTRAINT fk_list_act_reference_screen_c FOREIGN KEY (screen_code) REFERENCES screen_code(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6657
6658
6659--
6660-- Name: fk_list_act_reference_viewpoin; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6661--
6662
6663ALTER TABLE ONLY list_action_viewpoints
6664    ADD CONSTRAINT fk_list_act_reference_viewpoin FOREIGN KEY (screen_code, viewpoint_code) REFERENCES viewpoints(screen_code, viewpoint_code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6665
6666
6667--
6668-- Name: fk_location_reference_country; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6669--
6670
6671ALTER TABLE ONLY location
6672    ADD CONSTRAINT fk_location_reference_country FOREIGN KEY (country_id) REFERENCES country(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6673
6674
6675--
6676-- Name: fk_location_reference_location; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6677--
6678
6679ALTER TABLE ONLY location
6680    ADD CONSTRAINT fk_location_reference_location FOREIGN KEY (location_type_code) REFERENCES location_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6681
6682
6683--
6684-- Name: fk_location_reference_port_typ; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6685--
6686
6687ALTER TABLE ONLY location
6688    ADD CONSTRAINT fk_location_reference_port_typ FOREIGN KEY (port_type_id) REFERENCES port_type(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6689
6690
6691--
6692-- Name: fk_location_reference_project; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6693--
6694
6695ALTER TABLE ONLY location
6696    ADD CONSTRAINT fk_location_reference_project FOREIGN KEY (project_id) REFERENCES project(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6697
6698
6699--
6700-- Name: fk_location_reference_project_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6701--
6702
6703ALTER TABLE ONLY location
6704    ADD CONSTRAINT fk_location_reference_project_ FOREIGN KEY (project_id, parent_site_id) REFERENCES project_site(project_id, site_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6705
6706
6707--
6708-- Name: fk_movement_reference_bundle; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6709--
6710
6711ALTER TABLE ONLY movement
6712    ADD CONSTRAINT fk_movement_reference_bundle FOREIGN KEY (bundle_site_id, bundle_id) REFERENCES bundle(bundle_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6713
6714
6715--
6716-- Name: fk_movement_reference_location; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6717--
6718
6719ALTER TABLE ONLY movement
6720    ADD CONSTRAINT fk_movement_reference_location FOREIGN KEY (affected_location_site_id, affected_location_id) REFERENCES location(location_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6721
6722
6723--
6724-- Name: fk_movement_reference_movement; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6725--
6726
6727ALTER TABLE ONLY movement_comment
6728    ADD CONSTRAINT fk_movement_reference_movement FOREIGN KEY (move_site_id, id) REFERENCES movement(move_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6729
6730
6731--
6732-- Name: fk_movement_reference_shipment; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6733--
6734
6735ALTER TABLE ONLY movement
6736    ADD CONSTRAINT fk_movement_reference_shipment FOREIGN KEY (shipment_site_id, shipment_id) REFERENCES shipment(shipment_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6737
6738
6739--
6740-- Name: fk_org_addr_reference_org; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6741--
6742
6743ALTER TABLE ONLY org_address
6744    ADD CONSTRAINT fk_org_addr_reference_org FOREIGN KEY (org_id) REFERENCES org(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6745
6746
6747--
6748-- Name: fk_org_reference_country; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6749--
6750
6751ALTER TABLE ONLY org
6752    ADD CONSTRAINT fk_org_reference_country FOREIGN KEY (country_id) REFERENCES country(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6753
6754
6755--
6756-- Name: fk_org_reference_org_type; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6757--
6758
6759ALTER TABLE ONLY org
6760    ADD CONSTRAINT fk_org_reference_org_type FOREIGN KEY (org_type_code) REFERENCES org_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6761
6762
6763--
6764-- Name: fk_product_reference_product_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6765--
6766
6767ALTER TABLE ONLY product
6768    ADD CONSTRAINT fk_product_reference_product_ FOREIGN KEY (dflt_sku_id) REFERENCES product_sku(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6769
6770
6771--
6772-- Name: fk_product_reference_product_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6773--
6774
6775ALTER TABLE ONLY product
6776    ADD CONSTRAINT fk_product_reference_product_2 FOREIGN KEY (dflt_ltu_id) REFERENCES product_ltu(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6777
6778
6779--
6780-- Name: fk_project__reference_project_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6781--
6782
6783ALTER TABLE ONLY project_purpose
6784    ADD CONSTRAINT fk_project__reference_project_2 FOREIGN KEY (project_classify_code) REFERENCES project_classify(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6785
6786
6787--
6788-- Name: fk_project__reference_site; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6789--
6790
6791ALTER TABLE ONLY project_site
6792    ADD CONSTRAINT fk_project__reference_site FOREIGN KEY (site_id) REFERENCES site(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6793
6794
6795--
6796-- Name: fk_project_reference_org; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6797--
6798
6799ALTER TABLE ONLY project
6800    ADD CONSTRAINT fk_project_reference_org FOREIGN KEY (org_id) REFERENCES org(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6801
6802
6803--
6804-- Name: fk_project_reference_region; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6805--
6806
6807ALTER TABLE ONLY project
6808    ADD CONSTRAINT fk_project_reference_region FOREIGN KEY (region_id) REFERENCES region(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6809
6810
6811--
6812-- Name: fk_project_reference_subregio; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6813--
6814
6815ALTER TABLE ONLY project
6816    ADD CONSTRAINT fk_project_reference_subregio FOREIGN KEY (subregion_id) REFERENCES subregion(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6817
6818
6819--
6820-- Name: fk_request__reference_change_t; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6821--
6822
6823ALTER TABLE ONLY request_history
6824    ADD CONSTRAINT fk_request__reference_change_t FOREIGN KEY (change_type_code) REFERENCES change_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6825
6826
6827--
6828-- Name: fk_request__reference_dispatch; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6829--
6830
6831ALTER TABLE ONLY request_line_priority
6832    ADD CONSTRAINT fk_request__reference_dispatch FOREIGN KEY (line_dispatch_priority_id) REFERENCES dispatch_priority(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6833
6834
6835--
6836-- Name: fk_request__reference_kit_type; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6837--
6838
6839ALTER TABLE ONLY request_line
6840    ADD CONSTRAINT fk_request__reference_kit_type FOREIGN KEY (kit_type_code) REFERENCES kit_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6841
6842
6843--
6844-- Name: fk_request__reference_product; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6845--
6846
6847ALTER TABLE ONLY request_line
6848    ADD CONSTRAINT fk_request__reference_product FOREIGN KEY (product_id) REFERENCES product(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6849
6850
6851--
6852-- Name: fk_request__reference_product_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6853--
6854
6855ALTER TABLE ONLY request_line
6856    ADD CONSTRAINT fk_request__reference_product_ FOREIGN KEY (sku_id) REFERENCES product_sku(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6857
6858
6859--
6860-- Name: fk_request__reference_product_2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6861--
6862
6863ALTER TABLE ONLY request_line
6864    ADD CONSTRAINT fk_request__reference_product_2 FOREIGN KEY (ltu_id) REFERENCES product_ltu(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6865
6866
6867--
6868-- Name: fk_request__reference_request2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6869--
6870
6871ALTER TABLE ONLY request_history
6872    ADD CONSTRAINT fk_request__reference_request2 FOREIGN KEY (request_site_id, request_id) REFERENCES request(request_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6873
6874
6875--
6876-- Name: fk_request__reference_request_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6877--
6878
6879ALTER TABLE ONLY request_line_priority
6880    ADD CONSTRAINT fk_request__reference_request_ FOREIGN KEY (request_line_id, request_site_id) REFERENCES request_line(id, request_site_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6881
6882
6883--
6884-- Name: fk_request__reference_request_3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6885--
6886
6887ALTER TABLE ONLY request_status
6888    ADD CONSTRAINT fk_request__reference_request_3 FOREIGN KEY (request_cust_type_code) REFERENCES request_cust_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6889
6890
6891--
6892-- Name: fk_request_reference_arrival_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6893--
6894
6895ALTER TABLE ONLY request
6896    ADD CONSTRAINT fk_request_reference_arrival_ FOREIGN KEY (arrival_type_code) REFERENCES arrival_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6897
6898
6899--
6900-- Name: fk_request_reference_contact; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6901--
6902
6903ALTER TABLE ONLY request
6904    ADD CONSTRAINT fk_request_reference_contact FOREIGN KEY (invoice_site_id, invoice_contact_id) REFERENCES contact(owner_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6905
6906
6907--
6908-- Name: fk_request_reference_location; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6909--
6910
6911ALTER TABLE ONLY request
6912    ADD CONSTRAINT fk_request_reference_location FOREIGN KEY (arrival_location_site_id, arrival_location_id) REFERENCES location(location_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6913
6914
6915--
6916-- Name: fk_request_reference_product; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6917--
6918
6919ALTER TABLE ONLY request
6920    ADD CONSTRAINT fk_request_reference_product FOREIGN KEY (product_id) REFERENCES product(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6921
6922
6923--
6924-- Name: fk_request_reference_project_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6925--
6926
6927ALTER TABLE ONLY request
6928    ADD CONSTRAINT fk_request_reference_project_ FOREIGN KEY (project_id, request_site_id) REFERENCES project_site(project_id, site_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6929
6930
6931--
6932-- Name: fk_request_reference_service_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6933--
6934
6935ALTER TABLE ONLY request
6936    ADD CONSTRAINT fk_request_reference_service_ FOREIGN KEY (service_type_code) REFERENCES service_type(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6937
6938
6939--
6940-- Name: fk_request_reference_shipment; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6941--
6942
6943ALTER TABLE ONLY request
6944    ADD CONSTRAINT fk_request_reference_shipment FOREIGN KEY (request_site_id, initial_shipment_id) REFERENCES shipment(shipment_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6945
6946
6947--
6948-- Name: fk_request_reference_transpor; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6949--
6950
6951ALTER TABLE ONLY request
6952    ADD CONSTRAINT fk_request_reference_transpor FOREIGN KEY (transport_mode_code) REFERENCES transport_mode(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
6953
6954
6955--
6956-- Name: fk_shipment_reference_journey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6957--
6958
6959ALTER TABLE ONLY shipment
6960    ADD CONSTRAINT fk_shipment_reference_journey FOREIGN KEY (shipment_site_id, journey_id) REFERENCES journey(journey_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6961
6962
6963--
6964-- Name: fk_shipment_reference_location; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6965--
6966
6967ALTER TABLE ONLY shipment
6968    ADD CONSTRAINT fk_shipment_reference_location FOREIGN KEY (destination_location_site_id, destination_location_id) REFERENCES location(location_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6969
6970
6971--
6972-- Name: fk_shipment_reference_shipment; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6973--
6974
6975ALTER TABLE ONLY shipment_comment
6976    ADD CONSTRAINT fk_shipment_reference_shipment FOREIGN KEY (shipment_site_id, shipment_id) REFERENCES shipment(shipment_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6977
6978
6979--
6980-- Name: fk_site_reference_building; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6981--
6982
6983ALTER TABLE ONLY site
6984    ADD CONSTRAINT fk_site_reference_building FOREIGN KEY (site_bldg_type_id) REFERENCES building_type(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6985
6986
6987--
6988-- Name: fk_site_reference_distribu; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6989--
6990
6991ALTER TABLE ONLY site
6992    ADD CONSTRAINT fk_site_reference_distribu FOREIGN KEY (site_dstr_type_id) REFERENCES distribution_type(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
6993
6994
6995--
6996-- Name: fk_site_reference_org; Type: FK CONSTRAINT; Schema: public; Owner: postgres
6997--
6998
6999ALTER TABLE ONLY site
7000    ADD CONSTRAINT fk_site_reference_org FOREIGN KEY (org_id) REFERENCES org(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7001
7002
7003--
7004-- Name: fk_site_tra_reference_site; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7005--
7006
7007ALTER TABLE ONLY site_track_no
7008    ADD CONSTRAINT fk_site_tra_reference_site FOREIGN KEY (site_id) REFERENCES site(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7009
7010
7011--
7012-- Name: fk_subregio_reference_region; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7013--
7014
7015ALTER TABLE ONLY subregion
7016    ADD CONSTRAINT fk_subregio_reference_region FOREIGN KEY (region_id) REFERENCES region(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7017
7018
7019--
7020-- Name: fk_tblconta_reference_tblcont2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7021--
7022
7023ALTER TABLE ONLY bundle
7024    ADD CONSTRAINT fk_tblconta_reference_tblcont2 FOREIGN KEY (bundle_type_id) REFERENCES bundle_type(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7025
7026
7027--
7028-- Name: fk_tblmovem_reference_tblrequ2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7029--
7030
7031ALTER TABLE ONLY movement
7032    ADD CONSTRAINT fk_tblmovem_reference_tblrequ2 FOREIGN KEY (request_line_id, request_site_id) REFERENCES request_line(id, request_site_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7033
7034
7035--
7036-- Name: fk_tblproje_reference_tblcoun2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7037--
7038
7039ALTER TABLE ONLY contact
7040    ADD CONSTRAINT fk_tblproje_reference_tblcoun2 FOREIGN KEY (country_id) REFERENCES country(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7041
7042
7043--
7044-- Name: fk_tblproje_reference_tbllocn2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7045--
7046
7047ALTER TABLE ONLY project
7048    ADD CONSTRAINT fk_tblproje_reference_tbllocn2 FOREIGN KEY (country_id) REFERENCES country(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7049
7050
7051--
7052-- Name: fk_tblproje_reference_tblorga2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7053--
7054
7055ALTER TABLE ONLY contact
7056    ADD CONSTRAINT fk_tblproje_reference_tblorga2 FOREIGN KEY (org_id) REFERENCES org(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7057
7058
7059--
7060-- Name: fk_tblproje_reference_tblproj3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7061--
7062
7063ALTER TABLE ONLY project
7064    ADD CONSTRAINT fk_tblproje_reference_tblproj3 FOREIGN KEY (purpose_id) REFERENCES project_purpose(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7065
7066
7067--
7068-- Name: fk_tblproje_reference_tblproj6; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7069--
7070
7071ALTER TABLE ONLY project_site
7072    ADD CONSTRAINT fk_tblproje_reference_tblproj6 FOREIGN KEY (project_id) REFERENCES project(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7073
7074
7075--
7076-- Name: fk_tblreque_reference_tblproj2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7077--
7078
7079ALTER TABLE ONLY request
7080    ADD CONSTRAINT fk_tblreque_reference_tblproj2 FOREIGN KEY (sender_site_id, sender_contact_id) REFERENCES contact(owner_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7081
7082
7083--
7084-- Name: fk_tblreque_reference_tblproj3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7085--
7086
7087ALTER TABLE ONLY request
7088    ADD CONSTRAINT fk_tblreque_reference_tblproj3 FOREIGN KEY (receiver_site_id, receiver_contact_id) REFERENCES contact(owner_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7089
7090
7091--
7092-- Name: fk_tblreque_reference_tblrequ2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7093--
7094
7095ALTER TABLE ONLY request
7096    ADD CONSTRAINT fk_tblreque_reference_tblrequ2 FOREIGN KEY (status_code) REFERENCES request_status(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
7097
7098
7099--
7100-- Name: fk_tblreque_reference_tblrequ3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7101--
7102
7103ALTER TABLE ONLY request
7104    ADD CONSTRAINT fk_tblreque_reference_tblrequ3 FOREIGN KEY (dispatch_priority_id) REFERENCES dispatch_priority(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7105
7106
7107--
7108-- Name: fk_tblreque_reference_tblrequ4; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7109--
7110
7111ALTER TABLE ONLY request_line
7112    ADD CONSTRAINT fk_tblreque_reference_tblrequ4 FOREIGN KEY (request_site_id, request_id) REFERENCES request(request_site_id, id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7113
7114
7115--
7116-- Name: fk_tblreque_reference_tblrequ6; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7117--
7118
7119ALTER TABLE ONLY request_history
7120    ADD CONSTRAINT fk_tblreque_reference_tblrequ6 FOREIGN KEY (new_priority_id) REFERENCES dispatch_priority(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7121
7122
7123--
7124-- Name: fk_tblreque_reference_tblrequ7; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7125--
7126
7127ALTER TABLE ONLY request_history
7128    ADD CONSTRAINT fk_tblreque_reference_tblrequ7 FOREIGN KEY (new_status_code) REFERENCES request_status(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
7129
7130
7131--
7132-- Name: fk_tbluser_reference_tblorg2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7133--
7134
7135ALTER TABLE ONLY users
7136    ADD CONSTRAINT fk_tbluser_reference_tblorg2 FOREIGN KEY (org_id) REFERENCES org(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7137
7138
7139--
7140-- Name: fk_translat_reference_language; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7141--
7142
7143ALTER TABLE ONLY translations
7144    ADD CONSTRAINT fk_translat_reference_language FOREIGN KEY (language_idnf) REFERENCES languages(iso2_idnf) ON UPDATE RESTRICT ON DELETE RESTRICT;
7145
7146
7147--
7148-- Name: fk_translat_reference_table_co; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7149--
7150
7151ALTER TABLE ONLY translations
7152    ADD CONSTRAINT fk_translat_reference_table_co FOREIGN KEY (table_name) REFERENCES table_control(table_name) ON UPDATE RESTRICT ON DELETE RESTRICT;
7153
7154
7155--
7156-- Name: fk_user_par_reference_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7157--
7158
7159ALTER TABLE ONLY user_parameters
7160    ADD CONSTRAINT fk_user_par_reference_users FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7161
7162
7163--
7164-- Name: fk_user_rol_reference_project; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7165--
7166
7167ALTER TABLE ONLY user_roles
7168    ADD CONSTRAINT fk_user_rol_reference_project FOREIGN KEY (project_id) REFERENCES project(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7169
7170
7171--
7172-- Name: fk_user_rol_reference_project_; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7173--
7174
7175ALTER TABLE ONLY user_roles
7176    ADD CONSTRAINT fk_user_rol_reference_project_ FOREIGN KEY (project_id, site_id) REFERENCES project_site(project_id, site_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7177
7178
7179--
7180-- Name: fk_user_rol_reference_roles; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7181--
7182
7183ALTER TABLE ONLY user_roles
7184    ADD CONSTRAINT fk_user_rol_reference_roles FOREIGN KEY (role_code) REFERENCES roles(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
7185
7186
7187--
7188-- Name: fk_user_rol_reference_users; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7189--
7190
7191ALTER TABLE ONLY user_roles
7192    ADD CONSTRAINT fk_user_rol_reference_users FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
7193
7194
7195--
7196-- Name: fk_vehicle__reference_transpor; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7197--
7198
7199ALTER TABLE ONLY vehicle_category
7200    ADD CONSTRAINT fk_vehicle__reference_transpor FOREIGN KEY (transport_mode_code) REFERENCES transport_mode(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
7201
7202
7203--
7204-- Name: fk_viewpoin_reference_screen_c; Type: FK CONSTRAINT; Schema: public; Owner: postgres
7205--
7206
7207ALTER TABLE ONLY viewpoints
7208    ADD CONSTRAINT fk_viewpoin_reference_screen_c FOREIGN KEY (screen_code) REFERENCES screen_code(code) ON UPDATE RESTRICT ON DELETE RESTRICT;
7209
7210
7211--
7212-- Name: public; Type: ACL; Schema: -; Owner: postgres
7213--
7214
7215REVOKE ALL ON SCHEMA public FROM PUBLIC;
7216REVOKE ALL ON SCHEMA public FROM postgres;
7217GRANT ALL ON SCHEMA public TO postgres;
7218GRANT ALL ON SCHEMA public TO PUBLIC;
7219
7220
7221-- Completed on 2010-07-14 14:25:35
7222
7223--
7224-- PostgreSQL database dump complete
7225--
Note: See TracBrowser for help on using the browser.