-- -----------------------------------------------------
-- Database OpenIDM - case-sensitive and accent-sensitive
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Login openidm
-- -----------------------------------------------------
IF (NOT EXISTS (select loginname from master.dbo.syslogins where name = N'openidm' and dbname = N'openidm'))
CREATE LOGIN [openidm] WITH PASSWORD=N'Passw0rd', DEFAULT_DATABASE=[openidm], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
-- -----------------------------------------------------
-- User openidm - Database owner user
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema openidm
-- -----------------------------------------------------
BEGIN TRANSACTION
-- -----------------------------------------------------
-- Table `openidm`.`objecttypes`
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[objecttypes]
(
);
END
-- -----------------------------------------------------
-- Table `openidm`.`genericobjects`
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[genericobjects]
(
fullobject NTEXT NULL ,
CONSTRAINT fk_genericobjects_objecttypes
FOREIGN KEY (objecttypes_id)
ON DELETE CASCADE
ON UPDATE NO ACTION,
);
CREATE UNIQUE INDEX idx_genericobjects_object ON [openidm].[genericobjects] (objecttypes_id ASC, objectid ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`genericobjectproperties`
-- -----------------------------------------------------
BEGIN
(
CONSTRAINT fk_genericobjectproperties_genericobjects
FOREIGN KEY (genericobjects_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
);
CREATE INDEX fk_genericobjectproperties_genericobjects ON [openidm].[genericobjectproperties] (genericobjects_id ASC);
CREATE INDEX idx_genericobjectproperties_propkey ON [openidm].[genericobjectproperties] (propkey ASC);
CREATE INDEX idx_genericobjectproperties_propvalue ON [openidm].[genericobjectproperties] (propvalue ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`managedobjects`
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[managedobjects]
(
fullobject NTEXT NULL ,
CONSTRAINT fk_managedobjects_objectypes
FOREIGN KEY (objecttypes_id)
ON DELETE CASCADE
ON UPDATE NO ACTION,
);
CREATE UNIQUE INDEX idx_managedobjects_object ON [openidm].[managedobjects] (objecttypes_id ASC, objectid ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`managedobjectproperties`
-- -----------------------------------------------------
BEGIN
(
CONSTRAINT fk_managedobjectproperties_managedobjects
FOREIGN KEY (managedobjects_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
);
CREATE INDEX fk_managedobjectproperties_managedobjects ON [openidm].[managedobjectproperties] (managedobjects_id ASC);
CREATE INDEX idx_managedobjectproperties_propkey ON [openidm].[managedobjectproperties] (propkey ASC);
CREATE INDEX idx_managedobjectproperties_propvalue ON [openidm].[managedobjectproperties] (propvalue ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`configobjects`
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[configobjects]
(
fullobject NTEXT NULL ,
CONSTRAINT fk_configobjects_objecttypes
FOREIGN KEY (objecttypes_id)
ON DELETE CASCADE
ON UPDATE NO ACTION,
);
CREATE UNIQUE INDEX idx_configobjects_object ON [openidm].[configobjects] (objecttypes_id ASC, objectid ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`configobjectproperties`
-- -----------------------------------------------------
BEGIN
CONSTRAINT fk_configobjectproperties_configobjects
FOREIGN KEY (configobjects_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
);
CREATE INDEX fk_configobjectproperties_configobjects ON [openidm].[configobjectproperties] (configobjects_id ASC);
CREATE INDEX idx_configobjectproperties_propkey ON [openidm].[configobjectproperties] (propkey ASC);
CREATE INDEX idx_configobjectproperties_propvalue ON [openidm].[configobjectproperties] (propvalue ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`relationships`
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[relationships]
(
fullobject NTEXT NULL ,
CONSTRAINT fk_relationships_objecttypes
FOREIGN KEY (objecttypes_id)
ON DELETE CASCADE
ON UPDATE NO ACTION,
);
CREATE UNIQUE INDEX idx_relationships_object ON [openidm].[relationships] (objecttypes_id ASC, objectid ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`relationshipproperties`
-- -----------------------------------------------------
BEGIN
CONSTRAINT fk_relationshipproperties_relationships
FOREIGN KEY (relationships_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
);
CREATE INDEX fk_relationshipproperties_relationships ON [openidm].[relationshipproperties] (relationships_id ASC);
CREATE INDEX idx_relationshipproperties_propkey ON [openidm].[relationshipproperties] (propkey ASC);
CREATE INDEX idx_relationshipproperties_propvalue ON [openidm].[relationshipproperties] (propvalue ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`links`
-- -----------------------------------------------------
BEGIN
(
);
CREATE UNIQUE INDEX idx_links_first ON [openidm].[links] (linktype ASC, linkqualifier ASC, firstid ASC);
CREATE UNIQUE INDEX idx_links_second ON [openidm].[links] (linktype ASC, linkqualifier ASC, secondid ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`security`
-- -----------------------------------------------------
BEGIN
(
storestring NTEXT NOT NULL ,
);
END
-- -----------------------------------------------------
-- Table `openidm`.`securitykeys`
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[securitykeys]
(
);
END
-- -----------------------------------------------------
-- Table `openidm`.`auditrecon`
-- -----------------------------------------------------
BEGIN
(
exceptiondetail NTEXT NULL ,
messagedetail NTEXT NULL ,
ambiguoustargetobjectids NTEXT NULL ,
);
EXEC sp_addextendedproperty 'MS_Description', 'Date format: 2011-09-09T14:58:17.654+02:00', 'SCHEMA', openidm, 'TABLE', auditrecon, 'COLUMN', activitydate;
END
-- -----------------------------------------------------
-- Table `openidm`.`auditsync`
-- -----------------------------------------------------
BEGIN
(
exceptiondetail NTEXT NULL ,
messagedetail NTEXT NULL ,
);
EXEC sp_addextendedproperty 'MS_Description', 'Date format: 2011-09-09T14:58:17.654+02:00', 'SCHEMA', openidm, 'TABLE', auditsync, 'COLUMN', activitydate;
END
-- -----------------------------------------------------
-- Table `openidm`.`auditconfig`
-- -----------------------------------------------------
BEGIN
(
);
EXEC sp_addextendedproperty 'MS_Description', 'Date format: 2011-09-09T14:58:17.654+02:00', 'SCHEMA', openidm, 'TABLE', auditconfig, 'COLUMN', activitydate;
END
-- -----------------------------------------------------
-- Table `openidm`.`auditactivity`
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[auditactivity]
(
);
EXEC sp_addextendedproperty 'MS_Description', 'Date format: 2011-09-09T14:58:17.654+02:00', 'SCHEMA', openidm, 'TABLE', auditactivity, 'COLUMN', activitydate;
END
-- -----------------------------------------------------
-- Table `openidm`.`auditaccess`
-- -----------------------------------------------------
BEGIN
request_detail NTEXT NULL ,
http_request_headers NTEXT NULL ,
http_request_cookies NTEXT NULL ,
http_response_headers NTEXT NULL ,
);
EXEC sp_addextendedproperty 'MS_Description', 'Date format: 2011-09-09T14:58:17.654+02:00', 'SCHEMA', openidm, 'TABLE', auditaccess, 'COLUMN', activitydate;
END
-- -----------------------------------------------------
-- Table openidm.auditauthentication
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[auditauthentication] (
result NVARCHAR(255) NULL ,
principals NTEXT NULL ,
);
EXEC sp_addextendedproperty 'MS_Description', 'Date format: 2011-09-09T14:58:17.654+02:00', 'SCHEMA', openidm, 'TABLE', auditauthentication, 'COLUMN', activitydate;
END
-- -----------------------------------------------------
-- Table `openidm`.`internaluser`
-- -----------------------------------------------------
BEGIN
(
);
END
-- -----------------------------------------------------
-- Table `openidm`.`internalrole`
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[internalrole]
(
);
END
-- -----------------------------------------------------
-- Table `openidm`.`schedulerobjects`
-- -----------------------------------------------------
BEGIN
(
fullobject NTEXT NULL ,
CONSTRAINT fk_schedulerobjects_objecttypes
FOREIGN KEY (objecttypes_id)
ON DELETE CASCADE
ON UPDATE NO ACTION,
);
CREATE UNIQUE INDEX idx_schedulerobjects_object ON [openidm].[schedulerobjects] (objecttypes_id ASC, objectid ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`schedulerobjectproperties`
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[schedulerobjectproperties] (
FOREIGN KEY (schedulerobjects_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
);
CREATE INDEX fk_schedulerobjectproperties_schedulerobjects ON [openidm].[schedulerobjectproperties] (schedulerobjects_id ASC);
CREATE INDEX idx_schedulerobjectproperties_propkey ON [openidm].[schedulerobjectproperties] (propkey ASC);
CREATE INDEX idx_schedulerobjectproperties_propvalue ON [openidm].[schedulerobjectproperties] (propvalue ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`clusterobjects`
-- -----------------------------------------------------
BEGIN
(
fullobject NTEXT NULL ,
CONSTRAINT fk_clusterobjects_objecttypes
FOREIGN KEY (objecttypes_id)
ON DELETE CASCADE
ON UPDATE NO ACTION,
);
CREATE UNIQUE INDEX idx_clusterobjects_object ON [openidm].[clusterobjects] (objecttypes_id ASC, objectid ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`clusterobjectproperties`
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[clusterobjectproperties] (
CONSTRAINT fk_clusterobjectproperties_clusterobjects
FOREIGN KEY (clusterobjects_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
);
CREATE INDEX fk_clusterobjectproperties_clusterobjects ON [openidm].[clusterobjectproperties] (clusterobjects_id ASC);
CREATE INDEX idx_clusterobjectproperties_propkey ON [openidm].[clusterobjectproperties] (propkey ASC);
CREATE INDEX idx_clusterobjectproperties_propvalue ON [openidm].[clusterobjectproperties] (propvalue ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`uinotification`
-- -----------------------------------------------------
BEGIN
);
EXEC sp_addextendedproperty 'MS_Description', 'Date format: 2011-09-09T14:58:17.654+02:00', 'SCHEMA', openidm, 'TABLE', uinotification, 'COLUMN', createdate;
END
-- -----------------------------------------------------
-- Table `openidm`.`updateobjects`
-- -----------------------------------------------------
BEGIN
CREATE TABLE [openidm].[updateobjects]
(
fullobject NTEXT NULL ,
CONSTRAINT fk_updateobjects_objecttypes
FOREIGN KEY (objecttypes_id)
ON DELETE CASCADE
ON UPDATE NO ACTION,
);
CREATE UNIQUE INDEX idx_updateobjects_object ON [openidm].[updateobjects] (objecttypes_id ASC, objectid ASC);
END
-- -----------------------------------------------------
-- Table `openidm`.`updateobjectproperties`
-- -----------------------------------------------------
BEGIN
(
CONSTRAINT fk_updateobjectproperties_updateobjects
FOREIGN KEY (updateobjects_id)
ON DELETE CASCADE
ON UPDATE NO ACTION
);
CREATE INDEX fk_updateobjectproperties_updateobjects ON [openidm].[updateobjectproperties] (updateobjects_id ASC);
CREATE INDEX idx_updateobjectproperties_propkey ON [openidm].[updateobjectproperties] (propkey ASC);
CREATE INDEX idx_updateobjectproperties_propvalue ON [openidm].[updateobjectproperties] (propvalue ASC);
END
-- -----------------------------------------------------
-- Data for table `openidm`.`internaluser`
-- -----------------------------------------------------
INSERT INTO [openidm].[internaluser] (objectid, rev, pwd, roles) VALUES (N'openidm-admin', '0', 'openidm-admin', '[ { "_ref" : "repo/internal/role/openidm-admin" }, { "_ref" : "repo/internal/role/openidm-authorized" } ]');
INSERT INTO [openidm].[internaluser] (objectid, rev, pwd, roles) VALUES ('anonymous', '0', 'anonymous', '[ { "_ref" : "repo/internal/role/openidm-reg" } ]');
VALUES
('openidm-authorized', '0', 'Basic minimum user'),
('openidm-admin', '0', 'Administrative access'),
('openidm-cert', '0', 'Authenticated via certificate'),
('openidm-tasks-manager', '0', 'Allowed to reassign workflow tasks'),
('openidm-reg', '0', 'Anonymous access');
COMMIT