Skip to content

Commit

Permalink
Merge pull request #253 from dcsaorg/ddt-991-equipment-references
Browse files Browse the repository at this point in the history
DDT-991: Requested Equipment Equipment
  • Loading branch information
pimg authored Apr 19, 2022
2 parents dbd863a + 35b49dd commit 9629b08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 8 additions & 0 deletions datamodel/initdb.d/03_dcsa_im_v3_0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ CREATE TABLE dcsa_im_v3_0.iso_equipment_code (

DROP TABLE IF EXISTS dcsa_im_v3_0.requested_equipment CASCADE;
CREATE TABLE dcsa_im_v3_0.requested_equipment (
id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
booking_id uuid NOT NULL REFERENCES dcsa_im_v3_0.booking (id),
shipment_id uuid NULL REFERENCES dcsa_im_v3_0.shipment (id),
requested_equipment_sizetype varchar(4) NOT NULL REFERENCES dcsa_im_v3_0.iso_equipment_code (iso_equipment_code),
Expand Down Expand Up @@ -472,6 +473,13 @@ CREATE TABLE dcsa_im_v3_0.equipment (

-- Supporting FK constraints
CREATE INDEX ON dcsa_im_v3_0.equipment (iso_equipment_code);
CREATE INDEX ON dcsa_im_v3_0.equipment (equipment_reference);

DROP TABLE IF EXISTS dcsa_im_v3_0.requested_equipment_equipment CASCADE;
CREATE TABLE dcsa_im_v3_0.requested_equipment_equipment (
requested_equipment_id uuid NOT NULL REFERENCES dcsa_im_v3_0.requested_equipment(id),
equipment_reference varchar(15) NOT NULL REFERENCES dcsa_im_v3_0.equipment(equipment_reference)
);

DROP TABLE IF EXISTS dcsa_im_v3_0.package_code CASCADE;
CREATE TABLE dcsa_im_v3_0.package_code (
Expand Down
3 changes: 0 additions & 3 deletions datamodel/initdb.d/06_metadata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ ALTER TABLE dcsa_im_v3_0.value_added_service_request
ALTER TABLE dcsa_im_v3_0.commodity
ADD COLUMN IF NOT EXISTS id uuid DEFAULT uuid_generate_v4() PRIMARY KEY;

ALTER TABLE dcsa_im_v3_0.requested_equipment
ADD COLUMN IF NOT EXISTS id uuid DEFAULT uuid_generate_v4() PRIMARY KEY;

-- DateTime metadata

-- Metadata for Booking table to avoid having to query shipmentEvent for
Expand Down

0 comments on commit 9629b08

Please sign in to comment.