IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[dbo].[UM_HYBRID_GROUP_ROLE]') AND TYPE IN (N'U'))
CREATE TABLE UM_HYBRID_GROUP_ROLE(
        UM_ID INTEGER IDENTITY(1, 1) NOT NULL,
        UM_GROUP_NAME VARCHAR(255),
        UM_ROLE_ID INTEGER NOT NULL,
        UM_TENANT_ID INTEGER DEFAULT 0,
        UM_DOMAIN_ID INTEGER,
        UNIQUE (UM_GROUP_NAME, UM_ROLE_ID, UM_TENANT_ID, UM_DOMAIN_ID),
        FOREIGN KEY (UM_ROLE_ID, UM_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE,
        FOREIGN KEY (UM_DOMAIN_ID, UM_TENANT_ID) REFERENCES UM_DOMAIN(UM_DOMAIN_ID, UM_TENANT_ID) ON DELETE CASCADE,
        PRIMARY KEY (UM_ID, UM_TENANT_ID)
);
