CREATE TABLE BASIC_FILM_SESSION
(
	DERowID varchar (64) NOT NULL,
	SOPInstanceUID varchar (64) NOT NULL,
	VRType integer NOT NULL,
	GroupNumber integer NOT NULL,
	ElementNumber integer NOT NULL,
	IsSQ varchar (64) NOT NULL,
	ParentSQUID varchar (64) DEFAULT '',
	Value varchar (64) DEFAULT '',
	SQUUID varchar (64) DEFAULT '',
	ItemUUID varchar (64) DEFAULT ''
);

ALTER TABLE BASIC_FILM_SESSION ADD 
	CONSTRAINT BASIC_FILM_SESSION_PK PRIMARY KEY 
	(
		DERowID
	);

CREATE TABLE BASIC_FILM_BOX
(
	DERowID varchar (64) NOT NULL,
	SOPInstanceUID varchar (64) NOT NULL,
	VRType integer NOT NULL,
	GroupNumber integer NOT NULL,
	ElementNumber integer NOT NULL,
	IsSQ varchar (64) NOT NULL,
	ParentSQUID varchar (64) DEFAULT '',
	Value varchar (64) DEFAULT '',
	SQUUID varchar (64) DEFAULT '',
	ItemUUID varchar (64) DEFAULT ''
);

ALTER TABLE BASIC_FILM_BOX ADD 
	CONSTRAINT BASIC_FILM_BOX_PK PRIMARY KEY 
	(
		DERowID
	);

CREATE TABLE BASIC_ANNOTATION_BOX
(
	DERowID varchar (64) NOT NULL,
	SOPInstanceUID varchar (64) NOT NULL,
	VRType integer NOT NULL,
	GroupNumber integer NOT NULL,
	ElementNumber integer NOT NULL,
	IsSQ varchar (64) NOT NULL,
	ParentSQUID varchar (64) DEFAULT '',
	Value varchar (64) DEFAULT '',
	SQUUID varchar (64) DEFAULT '',
	ItemUUID varchar (64) DEFAULT ''
);

ALTER TABLE BASIC_ANNOTATION_BOX ADD 
	CONSTRAINT BASIC_ANNOTATION_BOX_PK PRIMARY KEY 
	(
		DERowID
	);

CREATE TABLE IMAGE_BOX
(
	DERowID varchar (64) NOT NULL,
	SOPInstanceUID varchar (64) NOT NULL,
	VRType integer NOT NULL,
	GroupNumber integer NOT NULL,
	ElementNumber integer NOT NULL,
	IsSQ varchar (64) NOT NULL,
	ParentSQUID varchar (64) DEFAULT '',
	Value varchar (256) DEFAULT '',
	SQUUID varchar (64) DEFAULT '',
	ItemUUID varchar (64) DEFAULT ''
);

ALTER TABLE IMAGE_BOX ADD 
	CONSTRAINT IMAGE_BOX_PK PRIMARY KEY 
	(
		DERowID
	);

CREATE TABLE PULL_PRINT_CREATE
(
	DERowID varchar (64) NOT NULL,
	SOPInstanceUID varchar (64) NOT NULL,
	VRType integer NOT NULL,
	GroupNumber integer NOT NULL,
	ElementNumber integer NOT NULL,
	IsSQ varchar (64) NOT NULL,
	ParentSQUID varchar (64) DEFAULT '',
	Value varchar (64) DEFAULT '',
	SQUUID varchar (64) DEFAULT '',
	ItemUUID varchar (64) DEFAULT ''
);

ALTER TABLE PULL_PRINT_CREATE ADD 
	CONSTRAINT PULL_PRINT_CREATE_PK PRIMARY KEY 
	(
		DERowID
	);

CREATE TABLE BASIC_PRINT_IMAGE_OVERLAY_BOX
(
	DERowID varchar (64) NOT NULL,
	SOPInstanceUID varchar (64) NOT NULL,
	VRType integer NOT NULL,
	GroupNumber integer NOT NULL,
	ElementNumber integer NOT NULL,
	IsSQ varchar (64) NOT NULL,
	ParentSQUID varchar (64) DEFAULT '',
	Value varchar (64) DEFAULT '',
	SQUUID varchar (64) DEFAULT '',
	ItemUUID varchar (64) DEFAULT ''
);

ALTER TABLE BASIC_PRINT_IMAGE_OVERLAY_BOX ADD 
	CONSTRAINT BASIC_PRINT_IMAGE_OVERLAY_BOX_PK PRIMARY KEY 
	(
		DERowID
	);

CREATE TABLE PRESENTATION_LUT
(
	DERowID varchar (64) NOT NULL,
	SOPInstanceUID varchar (64) NOT NULL,
	VRType integer NOT NULL,
	GroupNumber integer NOT NULL,
	ElementNumber integer NOT NULL,
	IsSQ varchar (64) NOT NULL,
	ParentSQUID varchar (64) DEFAULT '',
	Value varchar (64) DEFAULT '',
	SQUUID varchar (64) DEFAULT '',
	ItemUUID varchar (64) DEFAULT ''
);

ALTER TABLE PRESENTATION_LUT ADD 
	CONSTRAINT PRESENTATION_LUT_PK PRIMARY KEY 
	(
		DERowID
	);


CREATE TABLE MAPPING_TABLE
(
	BasicFilmSessionSOPInstanceUID varchar (64) NOT NULL,
	BasicFilmBoxSOPInstanceUID varchar (64) NOT NULL,
	ImageBoxSOPInstanceUID varchar (64) NOT NULL,
	BasicAnnotationSOPInstanceUID varchar (64)  DEFAULT '',
	PresentationLUTSOPInstanceUID varchar (64)  DEFAULT '',
	ImageOverlaySOPInstanceUID varchar (64)  DEFAULT ''
);


CREATE TABLE PRINT_QUEUE_MANAGEMENT
(
	DERowID varchar (64) NOT NULL,
	SOPInstanceUID varchar (64) NOT NULL,
	VRType integer NOT NULL,
	GroupNumber integer NOT NULL,
	ElementNumber integer NOT NULL,
	IsSQ varchar (64) NOT NULL,
	ParentSQUID varchar (64) DEFAULT '',
	Value varchar (64) DEFAULT '',
	SQUUID varchar (64) DEFAULT '',
	ItemUUID varchar (64) DEFAULT ''
);

ALTER TABLE PRINT_QUEUE_MANAGEMENT ADD 
	CONSTRAINT PRINT_QUEUE_MANAGEMENT_PK PRIMARY KEY 
	(
		DERowID
	);


CREATE TABLE STORED_PRINT_STORAGE
(
	DERowID varchar (64) NOT NULL,
	SOPInstanceUID varchar (64) NOT NULL,
	VRType integer NOT NULL,
	GroupNumber integer NOT NULL,
	ElementNumber integer NOT NULL,
	IsSQ varchar (64) NOT NULL,
	ParentSQUID varchar (64) DEFAULT '',
	Value varchar (64) DEFAULT '',
	SQUUID varchar (64) DEFAULT '',
	ItemUUID varchar (64) DEFAULT ''
);

ALTER TABLE STORED_PRINT_STORAGE ADD 
	CONSTRAINT STORED_PRINT_STORAGE_PK PRIMARY KEY 
	(
		DERowID
	);
