Added query for set foreign key

user-service-10389
Nishan Sangeeth 1 year ago
parent f406399dca
commit b9b2c97841

@ -39,5 +39,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE (
TENANT_ID INTEGER DEFAULT 0,
DEVICE_IDENTIFIER VARCHAR(300),
USERNAME VARCHAR(500) DEFAULT NULL,
PRIMARY KEY (ID)
PRIMARY KEY (ID),
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER)
REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION) ON DELETE NO ACTION ON UPDATE NO ACTION
);

@ -15,7 +15,10 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE (
TENANT_ID INTEGER DEFAULT 0,
DEVICE_IDENTIFIER VARCHAR(300),
USERNAME VARCHAR(500) DEFAULT NULL,
PRIMARY KEY (ID)
PRIMARY KEY (ID),
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER)
REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION)
);
CREATE TABLE IF NOT EXISTS DM_GROUP (

@ -25,7 +25,9 @@ CREATE TABLE DM_DEVICE_CERTIFICATE (
TENANT_ID INTEGER DEFAULT 0,
DEVICE_IDENTIFIER VARCHAR(300),
USERNAME VARCHAR(500) DEFAULT NULL,
PRIMARY KEY (ID)
PRIMARY KEY (ID),
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER)
REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION)
);
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_DEVICE_TYPE' AND OBJECT_ID = OBJECT_ID('DM_DEVICE_TYPE'))

@ -19,7 +19,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_CERTIFICATE (
TENANT_ID INTEGER DEFAULT 0,
DEVICE_IDENTIFIER VARCHAR(300),
USERNAME VARCHAR(500) DEFAULT NULL,
PRIMARY KEY (ID)
PRIMARY KEY (ID),
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER)
REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION)
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS DM_GROUP (

@ -30,7 +30,9 @@ CREATE TABLE DM_DEVICE_CERTIFICATE (
TENANT_ID NUMBER(10) DEFAULT 0,
DEVICE_IDENTIFIER VARCHAR(300),
USERNAME VARCHAR2(500) DEFAULT NULL,
PRIMARY KEY (ID)
PRIMARY KEY (ID),
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER)
REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION)
)
/

@ -843,6 +843,8 @@ CREATE TABLE DM_DEVICE_CERTIFICATE (
TENANT_ID NUMBER(10) DEFAULT 0,
DEVICE_IDENTIFIER VARCHAR(300),
USERNAME VARCHAR2(500) DEFAULT NULL,
PRIMARY KEY (ID)
PRIMARY KEY (ID),
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_CERTIFICATE FOREIGN KEY (DEVICE_IDENTIFIER)
REFERENCES DM_DEVICE (DEVICE_IDENTIFICATION)
)

Loading…
Cancel
Save