Merge pull request #547 from Vishanth/release-2.0.x

fixing sql scripts to support multi tenancy
revert-70aa11f8
Ayyoob Hamza 8 years ago committed by GitHub
commit 810bd1d2ad

@ -192,8 +192,8 @@ CREATE TABLE DM_PROFILE (
CREATED_TIME DATETIME NOT NULL ,
UPDATED_TIME DATETIME NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT DM_PROFILE_DEVICE_TYPE FOREIGN KEY (DEVICE_TYPE) REFERENCES
DM_DEVICE_TYPE (NAME) ON DELETE NO ACTION ON UPDATE NO ACTION
CONSTRAINT DM_PROFILE_DEVICE_TYPE FOREIGN KEY (DEVICE_TYPE, TENANT_ID) REFERENCES
DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID) ON DELETE NO ACTION ON UPDATE NO ACTION
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_POLICY]') AND TYPE IN (N'U'))
@ -234,8 +234,6 @@ CREATE TABLE DM_DEVICE_TYPE_POLICY (
POLICY_ID INTEGER NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT FK_DEVICE_TYPE_POLICY FOREIGN KEY (POLICY_ID) REFERENCES DM_POLICY (ID)
ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE FOREIGN KEY (DEVICE_TYPE_ID) REFERENCES DM_DEVICE_TYPE (ID)
ON DELETE NO ACTION ON UPDATE NO ACTION
);

@ -170,8 +170,8 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
UPDATED_TIME DATETIME NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT DM_PROFILE_DEVICE_TYPE
FOREIGN KEY (DEVICE_TYPE)
REFERENCES DM_DEVICE_TYPE (NAME)
FOREIGN KEY (DEVICE_TYPE, TENANT_ID)
REFERENCES DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)ENGINE = InnoDB;
@ -226,11 +226,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
FOREIGN KEY (POLICY_ID )
REFERENCES DM_POLICY (ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
FOREIGN KEY (DEVICE_TYPE )
REFERENCES DM_DEVICE_TYPE (NAME )
ON DELETE NO ACTION
ON UPDATE NO ACTION
)ENGINE = InnoDB;

@ -270,8 +270,8 @@ CREATE TABLE DM_PROFILE (
UPDATED_TIME TIMESTAMP(0) NOT NULL ,
CONSTRAINT PK_DM_PROFILE PRIMARY KEY (ID) ,
CONSTRAINT DM_PROFILE_DEVICE_TYPE
FOREIGN KEY (DEVICE_TYPE )
REFERENCES DM_DEVICE_TYPE (NAME )
FOREIGN KEY (DEVICE_TYPE, TENANT_ID)
REFERENCES DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID)
)
/
-- Generate ID using sequence and trigger
@ -358,10 +358,7 @@ CREATE TABLE DM_DEVICE_TYPE_POLICY (
CONSTRAINT PK_DEV_TYPE_POLICY PRIMARY KEY (ID) ,
CONSTRAINT FK_DEV_TYPE_POLICY
FOREIGN KEY (POLICY_ID )
REFERENCES DM_POLICY (ID ),
CONSTRAINT FK_DEV_TYPE_POLICY_DEV_TYPE
FOREIGN KEY (DEVICE_TYPE )
REFERENCES DM_DEVICE_TYPE (NAME )
REFERENCES DM_POLICY (ID )
)
/

@ -150,8 +150,8 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
CREATED_TIME TIMESTAMP NOT NULL ,
UPDATED_TIME TIMESTAMP NOT NULL ,
CONSTRAINT DM_PROFILE_DEVICE_TYPE
FOREIGN KEY (DEVICE_TYPE )
REFERENCES DM_DEVICE_TYPE (NAME )
FOREIGN KEY (DEVICE_TYPE, TENANT_ID)
REFERENCES DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
@ -201,11 +201,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
FOREIGN KEY (POLICY_ID )
REFERENCES DM_POLICY (ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
FOREIGN KEY (DEVICE_TYPE )
REFERENCES DM_DEVICE_TYPE (NAME )
ON DELETE NO ACTION
ON UPDATE NO ACTION
);

Loading…
Cancel
Save