Code Monkey home page Code Monkey logo

Comments (5)

KarlLevik avatar KarlLevik commented on August 24, 2024

The ALTER statements would look something like this:

ALTER TABLE CourierTermsAccepted
  DROP FOREIGN KEY CourierTermsAccepted_ibfk_3,
  DROP shippingId;

ALTER TABLE Shipping
  DROP deliveryAgent_flightCodeTimestamp,
  DROP deliveryAgent_label,
  DROP readyByTime,
  DROP closeTime,
  DROP physicalLocation,
  DROP deliveryAgent_pickupConfirmationTimestamp,
  DROP deliveryAgent_pickupConfirmation,
  DROP deliveryAgent_readyByTime,
  DROP deliveryAgent_callinTime,
  DROP deliveryAgent_productcode,
  DROP FOREIGN KEY Shipping_ibfk_4,
  DROP deliveryAgent_flightCodePersonId;
  
ALTER TABLE Dewar
  DROP weight, 
  DROP deliveryAgent_barcode;
  
ALTER TABLE Laboratory
  DROP postcode;

ALTER TABLE CourierTermsAccepted
  ADD shippingId int(11) unsigned,
  ADD CONSTRAINT CourierTermsAccepted_ibfk_3
      FOREIGN KEY (shippingId) REFERENCES Shipping(shippingId) ON DELETE CASCADE ON UPDATE CASCADE;
      
ALTER TABLE Shipping 
  ADD deliveryAgent_flightCodeTimestamp timestamp NULL DEFAULT NULL COMMENT 'Date flight code created, if automatic',
  ADD deliveryAgent_label text COMMENT 'Base64 encoded pdf of airway label',
  ADD readyByTime time COMMENT 'Time shipment will be ready',
  ADD closeTime time COMMENT 'Time after which shipment cannot be picked up',
  ADD physicalLocation varchar(50) COMMENT 'Where shipment can be picked up from: i.e. Stores',
  ADD deliveryAgent_pickupConfirmationTimestamp timestamp NULL DEFAULT NULL COMMENT 'Date picked confirmed',
  ADD deliveryAgent_pickupConfirmation varchar(10) COMMENT 'Confirmation number of requested pickup',
  ADD deliveryAgent_readyByTime time COMMENT 'Confirmed ready-by time',
  ADD deliveryAgent_callinTime time COMMENT 'Confirmed courier call-in time',
  ADD deliveryAgent_productCode varchar(10) COMMENT 'A code that identifies which shipment service was used',
  ADD deliveryAgent_flightCodePersonId int(10) unsigned COMMENT 'The person who created the AWB (for auditing)',
  ADD CONSTRAINT Shipping_ibfk_4
      FOREIGN KEY (deliveryAgent_flightCodePersonId) REFERENCES Person(personId);

ALTER TABLE Dewar
  ADD weight float COMMENT 'Dewar weight in kg',
  ADD deliveryAgent_barcode varchar(30) COMMENT 'Courier piece barcode (not the airway bill)';

ALTER TABLE Laboratory
  ADD postcode varchar(15);

from ispyb-database-modeling.

KarlLevik avatar KarlLevik commented on August 24, 2024

I've just edited the above comment and removed the second underscore in two of the proposed columns for the Shipping table. I think that should make it more compliant with the convention we seem to be following.

from ispyb-database-modeling.

KarlLevik avatar KarlLevik commented on August 24, 2024

Have updated the script again to allow for NULL + make NULL the default value in the proposed Shipping timestamp columns.

from ispyb-database-modeling.

KarlLevik avatar KarlLevik commented on August 24, 2024

I've again updated the script to add the columns Shipping.deliveryAgent_productcode and Dewar.deliveryAgent_barcode. These are needed to store information needed to produce a report required by DHL, though can be used more generally, of course.

from ispyb-database-modeling.

KarlLevik avatar KarlLevik commented on August 24, 2024

I've updated the script with an additional column and its foreign key definition: deliveryAgent_flightCodePersonId. As the column comment says, this is to record who actually created the airway bill.

from ispyb-database-modeling.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.