Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.37 KB | None | 0 0
  1. CREATE TABLE protocols{
  2.     id                  uuid            NOT NULL,
  3.     code                VARCHAR(255),
  4.     notes               VARCHAR(255),
  5.     created_at          datetime,
  6.     updated_at          datetime,
  7.     fixation_target     uuid,
  8.     is_active           BOOLEAN         DEFAULT TRUE,
  9.     is_default          BOOLEAN         DEFAULT FALSE,
  10.     PRIMARY KEY (id),
  11.     FOREIGN KEY (fixation_point) REFERENCES fixation_targets(id) ON UPDATE CASCADE
  12. };
  13.  
  14. CREATE TABLE protocols_execution{
  15.     id                          uuid            NOT NULL,
  16.     exam_id                     uuid            NOT NULL,
  17.     serialized_protocol_data    VARCHAR(10000)  NOT NULL,
  18.     PRIMARY KEY (id),
  19.     FOREIGN KEY (exam_id) REFERENCES exams(id) ON UPDATE CASCADE ON DELETE CASCADE,
  20. };
  21.  
  22. CREATE TABLE protocol_steps{
  23.     id                  uuid            NOT NULL,
  24.     notes               VARCHAR(255),
  25.     image_tipe          VARCHAR(255)    NOT NULL,
  26.     number_of_frames    INT             NOT NULL,
  27.     focus_shift         INT             DEFAULT 0,
  28.     PRIMARY KEY (id)
  29. };
  30.  
  31. CREATE TABLE protocol_configurations{
  32.     protocol_id         uuid            NOT NULL,
  33.     step_id             uuid            NOT NULL,
  34.     step_position       INT             NOT NULL,
  35.     CONSTRAINT PK_detail PRIMARY KEY (protocol_id, step_id, step_position),
  36.     FOREIGN KEY (protocol_id) REFERENCES protocols(id),
  37.     FOREIGN KEY (step_id) REFERENCES protocol_steps(id)
  38. };
  39.  
  40. CREATE TABLE protocol_data{
  41.     id                      uuid            NOT NULL,
  42.     image_id                uuid            NOT NULL,
  43.     serialized_step_data    VARCHAR(10000)  NOT NULL,          
  44.     PRIMARY KEY (id),
  45.     FOREIGN KEY (image_id) REFERENCES images(id) ON UPDATE CASCADE ON DELETE CASCADE
  46. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement