fixing dm_profile constraint issue

revert-70aa11f8
Vishanth 8 years ago
parent 96f0c633d9
commit e98af24f29

@ -5,11 +5,11 @@ CREATE TABLE DM_DEVICE_TYPE (
PROVIDER_TENANT_ID INTEGER NULL, PROVIDER_TENANT_ID INTEGER NULL,
SHARED_WITH_ALL_TENANTS BIT NOT NULL DEFAULT 0, SHARED_WITH_ALL_TENANTS BIT NOT NULL DEFAULT 0,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT DEVICE_TYPE_NAME UNIQUE(NAME) CONSTRAINT DEVICE_TYPE_NAME UNIQUE(NAME, PROVIDER_TENANT_ID)
); );
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_DEVICE_TYPE' AND OBJECT_ID = OBJECT_ID('DM_DEVICE_TYPE')) IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_DEVICE_TYPE' AND OBJECT_ID = OBJECT_ID('DM_DEVICE_TYPE'))
CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME); CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID);
IF NOT EXISTS(SELECT * IF NOT EXISTS(SELECT *
FROM SYS.OBJECTS FROM SYS.OBJECTS

@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
PRIMARY KEY (ID) PRIMARY KEY (ID)
)ENGINE = InnoDB; )ENGINE = InnoDB;
CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME); CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID);
CREATE TABLE IF NOT EXISTS DM_GROUP ( CREATE TABLE IF NOT EXISTS DM_GROUP (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,

@ -4,7 +4,7 @@ CREATE TABLE DM_DEVICE_TYPE (
PROVIDER_TENANT_ID INTEGER DEFAULT 0, PROVIDER_TENANT_ID INTEGER DEFAULT 0,
SHARED_WITH_ALL_TENANTS NUMBER(1) DEFAULT 0 NOT NULL, SHARED_WITH_ALL_TENANTS NUMBER(1) DEFAULT 0 NOT NULL,
CONSTRAINT PK_DM_DEVICE_TYPE PRIMARY KEY (ID), CONSTRAINT PK_DM_DEVICE_TYPE PRIMARY KEY (ID),
UNIQUE (NAME) UNIQUE (NAME, PROVIDER_TENANT_ID)
) )
/ /
-- Generate ID using sequence and trigger -- Generate ID using sequence and trigger

@ -3,10 +3,10 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
NAME VARCHAR(300) DEFAULT NULL, NAME VARCHAR(300) DEFAULT NULL,
PROVIDER_TENANT_ID INTEGER DEFAULT 0, PROVIDER_TENANT_ID INTEGER DEFAULT 0,
SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE, SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE,
UNIQUE(NAME) UNIQUE(NAME, PROVIDER_TENANT_ID)
); );
CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME); CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID);
CREATE TABLE IF NOT EXISTS DM_GROUP ( CREATE TABLE IF NOT EXISTS DM_GROUP (
ID BIGSERIAL NOT NULL PRIMARY KEY, ID BIGSERIAL NOT NULL PRIMARY KEY,

Loading…
Cancel
Save