Add unique key constraint into AP_DEVICE_SUBSCRIPTION tables

db-constraint
Pahansith Gunathilake 2 years ago
parent 9ad7438d69
commit 2926c2e523

@ -117,7 +117,8 @@ CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION(
PRIMARY KEY (ID),
CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT uq_AP_DEVICE_SUBSCRIPTION UNIQUE (DM_DEVICE_ID, AP_APP_RELEASE_ID)
);
CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);

@ -118,7 +118,8 @@ CREATE TABLE AP_DEVICE_SUBSCRIPTION(
PRIMARY KEY (ID),
CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT uq_AP_DEVICE_SUBSCRIPTION UNIQUE (DM_DEVICE_ID, AP_APP_RELEASE_ID)
);
CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);

@ -104,7 +104,8 @@ CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION(
DM_DEVICE_ID INTEGER NOT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1 FOREIGN KEY (AP_APP_RELEASE_ID) REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1 FOREIGN KEY (AP_APP_RELEASE_ID) REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT uq_AP_DEVICE_SUBSCRIPTION UNIQUE (DM_DEVICE_ID, AP_APP_RELEASE_ID)
);
CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
-- -----------------------------------------------------

@ -129,7 +129,8 @@ CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION(
PRIMARY KEY (ID),
CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1
FOREIGN KEY (AP_APP_RELEASE_ID)
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT uq_AP_DEVICE_SUBSCRIPTION UNIQUE (DM_DEVICE_ID, AP_APP_RELEASE_ID)
);
CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);

Loading…
Cancel
Save