diff --git a/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/ContainerHandler.java b/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/ContainerHandler.java index e780dde95e84..59cf228da54c 100644 --- a/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/ContainerHandler.java +++ b/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/ContainerHandler.java @@ -63,6 +63,7 @@ import com.dotmarketing.business.APILocator; import com.dotmarketing.business.CacheLocator; import com.dotmarketing.business.UserAPI; +import com.dotmarketing.common.db.DotConnect; import com.dotmarketing.exception.DotDataException; import com.dotmarketing.portlets.containers.business.ContainerAPI; import com.dotmarketing.portlets.containers.model.Container; @@ -72,6 +73,7 @@ import com.dotmarketing.util.PushPublishLogger; import com.dotmarketing.util.PushPublishLogger.PushPublishAction; import com.dotmarketing.util.PushPublishLogger.PushPublishHandler; +import com.dotmarketing.util.UtilMethods; import com.liferay.portal.model.User; import com.liferay.util.FileUtil; import com.liferay.util.StringPool; @@ -84,6 +86,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Objects; /** * This handler class is part of the Push Publishing mechanism that deals with Container-related information inside a @@ -174,6 +177,14 @@ private void handleContainers(final Collection containers) throws DotPubli unpublish = containerWrapper.getOperation().equals(Operation.UNPUBLISH); Host localHost = APILocator.getHostAPI().find(containerId.getHostId(), systemUser, false); + if(UtilMethods.isEmpty(()->localHost.getIdentifier())){ + final Container finalContainer = container; + Logger.warn(this.getClass(), "Ignoring container on non-existing host. Id:" + container.getIdentifier() + ", title:" + Try.of(()->finalContainer.getTitle()).getOrElse("unknown") + ". Unable to find referenced host id:" + containerId.getHostId()); + continue; + } + + + if (containerWrapper.getOperation().equals(PushPublisherConfig.Operation.UNPUBLISH)) { String containerIden = container.getIdentifier(); @@ -184,12 +195,12 @@ private void handleContainers(final Collection containers) throws DotPubli } else { // save if it doesn't exists final Container existing = containerAPI.find(container.getInode(), systemUser, false); - if (existing == null || !InodeUtils.isSet(existing.getIdentifier())) { + if (UtilMethods.isEmpty(()->existing.getIdentifier())) { containerAPI.save(container, containerWrapper.getCsList(), localHost, systemUser, false); PushPublishLogger.log(getClass(), PushPublishHandler.CONTAINER, PushPublishAction.PUBLISH_CREATE, container.getIdentifier(), container.getInode(), container.getName(), config.getId()); } else { - containerAPI.save(existing, containerWrapper.getCsList(), localHost, systemUser, false); + container= containerAPI.save(existing, containerWrapper.getCsList(), localHost, systemUser, false); PushPublishLogger.log(getClass(), PushPublishHandler.CONTAINER, PushPublishAction.PUBLISH_UPDATE, container.getIdentifier(), container.getInode(), container.getName(), config.getId()); } @@ -201,6 +212,19 @@ private void handleContainers(final Collection containers) throws DotPubli if (!unpublish) { final VersionInfo info = containerWrapper.getCvi(); + if(!Objects.equals(info.getWorkingInode(), info.getLiveInode())){ + boolean workingNotExists = new DotConnect() + .setSQL("select inode from dot_containers where inode=?") + .addParam(info.getWorkingInode()) + .loadResults() + .isEmpty(); + if(workingNotExists){ + info.setWorkingInode(container.getInode()); + } + } + + + //info.setWorkingInode(container.getInode()); if (info.isLocked() && info.getLockedBy() != null) { final User user = Try.of(()-> APILocator.getUserAPI().loadUserById(info.getLockedBy())).getOrElse(systemUser); info.setLockedBy(user.getUserId()); diff --git a/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/ContentHandler.java b/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/ContentHandler.java index 3a4ffa980339..2c79285274ba 100644 --- a/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/ContentHandler.java +++ b/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/ContentHandler.java @@ -120,6 +120,7 @@ import com.thoughtworks.xstream.XStream; import io.vavr.Lazy; import io.vavr.control.Try; +import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.Pair; import java.io.File; @@ -218,7 +219,7 @@ public void handle(final File bundleFolder, final Boolean isHost) throws Excepti List contents = isHost?FileUtil.listFilesRecursively(bundleFolder, new HostBundler().getFileFilter()): FileUtil.listFilesRecursively(bundleFolder, new ContentBundler().getFileFilter()); Collections.sort(contents); - + contents = contents.stream().filter(File::isFile).collect(Collectors.toList()); handleContents(contents, bundleFolder, isHost); HandlerUtil.setExistingContent(config.getId(), existingContentMap); @@ -241,11 +242,22 @@ public void handle(final File bundleFolder, final Boolean isHost) throws Excepti } } + + + private boolean ignoreContent(Contentlet contentlet){ + + // if a host does not exist on target, skip content + Host localHost = Try.of(()->APILocator.getHostAPI().find(contentlet.getHost(), APILocator.systemUser(), false)).getOrNull(); + return UtilMethods.isEmpty(()->localHost.getIdentifier()); + + } + + /** * Reads the information of the contentlets contained in the bundle and * saves them in the destination server. * - * @param contents + * @param contentsIn * The list of data files containing the contentlet information. * @param folderOut * - The location of the bundle in the file system. @@ -257,7 +269,7 @@ public void handle(final File bundleFolder, final Boolean isHost) throws Excepti * @throws DotDataException * An error occurred when interacting with the database. */ - private void handleContents(final Collection contents, final File folderOut, final Boolean isHost) throws DotPublishingException, DotDataException{ + private void handleContents(final Collection contentsIn, final File folderOut, final Boolean isHost) throws DotPublishingException, DotDataException{ if(LicenseUtil.getLevel() < LicenseLevel.PROFESSIONAL.level) { throw new RuntimeException("need an enterprise pro license to run this"); } @@ -265,15 +277,14 @@ private void handleContents(final Collection contents, final File folderOu File workingOn=null; Contentlet content = null; ContentWrapper wrapper = null; + final Collection contents = contentsIn.stream().filter(File::isFile).collect(Collectors.toList()); try{ final XStream xstream = XStreamHandler.newXStreamInstance(); final Set> pushedIdsToIgnore = new HashSet<>(); for (final File contentFile : contents) { workingOn=contentFile; content = null; - if ( contentFile.isDirectory() ) { - continue; - } + try(final InputStream input = Files.newInputStream(contentFile.toPath())){ wrapper = (ContentWrapper) xstream.fromXML(input); } @@ -311,6 +322,15 @@ private void handleContents(final Collection contents, final File folderOu content.getMap().remove(PAGE_FRIENDLY_NAME_FIELD_VAR.toLowerCase()); } + + // if a host does not exist on target, skip content + if(ignoreContent(content)){ + Contentlet finalContent = content; + Logger.warn(this.getClass(), "Ignoring contentlet:" + content.getIdentifier() + " | " + Try.of( + finalContent::getTitle).getOrElse("unknown") + " . Unable to find referenced host id:" + content.getHost()); + continue; + } + content.setVariantId(wrapper.getContent().getVariantId()); // get the local language and assign it to the version info, and content, since the id's might be different @@ -387,6 +407,15 @@ private void handleContents(final Collection contents, final File folderOu final Language remoteLang = wrapper.getLanguage(); final Pair remoteLocalLanguages = this.existingContentMap.getRemoteLocalLanguages(wrapper); + + // if a host does not exist on target, skip content + if(ignoreContent(content)){ + Contentlet finalContent = content; + Logger.warn(this.getClass(), "Ignoring contentlet:" + content.getIdentifier() + " | " + Try.of(()->finalContent.getTitle()).getOrElse("unknown") + " . Unable to find referenced host id:" + content.getHost()); + continue; + } + + if(UtilMethods.isSet(remoteLang) && remoteLang.getId() > 0) { // This should take care of solving any existing conflicts. Previously solved by the Language Handler. final Language mappedRemoteLanguage = config.getMappedRemoteLanguage(remoteLang.getId()); @@ -781,6 +810,7 @@ public void run () { } } ); } + //Saving the content if (content.isArchived()){ this.contentletAPI.unarchive(content, userToUse, !RESPECT_FRONTEND_ROLES); diff --git a/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/FolderHandler.java b/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/FolderHandler.java index 09908e2f0913..94359e54caf7 100644 --- a/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/FolderHandler.java +++ b/dotCMS/src/enterprise/java/com/dotcms/enterprise/publishing/remote/handler/FolderHandler.java @@ -183,7 +183,7 @@ private void handleFolders(Collection folders) throws DotPublishingExcepti continue; } - folderName = Try.of(()-> folder.getPath()).getOrNull(); + folderName = Try.of(folder::getPath).getOrNull(); folderId = folderWrapper.getFolderId(); host = folderWrapper.getHost(); @@ -194,7 +194,12 @@ private void handleFolders(Collection folders) throws DotPublishingExcepti //Check Host if exists otherwise create Host localHost = APILocator.getHostAPI().find(host.getIdentifier(), systemUser, false); + if(UtilMethods.isEmpty(()->localHost.getIdentifier())){ + Logger.warn(FolderHandler.class, "Unable to publish folder:" + folderName + ". Unable to find referenced host id:" + folder.getHostId()); + Logger.warn(FolderHandler.class, "Make sure the host exists with the id:" + folder.getHostId() + " before pushing the folder or run the integrity checker before pushing."); + continue; + } temp = fAPI.findFolderByPath(folderId.getPath(), localHost, systemUser, false); if(folderWrapper.getOperation().equals(PushPublisherConfig.Operation.UNPUBLISH)) { String folderIden = temp.getIdentifier(); @@ -328,7 +333,7 @@ else if(!folderId.getAssetName().equals(id.getAssetName())) { final String errorMsg = String.format("An error occurred when processing Folder in '%s': %s", workingOn, e.getMessage()); Logger.error(this.getClass(), errorMsg); - Logger.error(this, "-- Local Folder: " + (UtilMethods.isSet(temp) ? temp.toString() : "- object is null -")); + Logger.error(this, "-- Local Folder: " + (UtilMethods.isSet(temp) ? temp : "- object is null -")); if(UtilMethods.isSet(temp) && UtilMethods.isSet(folderName)) { Logger.error(this, "-- folderName:" + folderName); } diff --git a/dotCMS/src/main/java/com/dotcms/publisher/ajax/RemotePublishAjaxAction.java b/dotCMS/src/main/java/com/dotcms/publisher/ajax/RemotePublishAjaxAction.java index a08164c27379..09425e7b3294 100644 --- a/dotCMS/src/main/java/com/dotcms/publisher/ajax/RemotePublishAjaxAction.java +++ b/dotCMS/src/main/java/com/dotcms/publisher/ajax/RemotePublishAjaxAction.java @@ -41,6 +41,7 @@ import com.dotmarketing.portlets.folders.model.Folder; import com.dotmarketing.portlets.workflows.model.WorkflowActionFailureException; import com.dotmarketing.servlets.ajax.AjaxAction; +import com.dotmarketing.util.Config; import com.dotmarketing.util.ConfigUtils; import com.dotmarketing.util.DateUtil; import com.dotmarketing.util.FileUtil; @@ -653,6 +654,13 @@ public void downloadUnpushedBundle ( HttpServletRequest request, HttpServletResp */ public void uploadBundle ( HttpServletRequest request, HttpServletResponse response ) throws FileUploadException, IOException{ + if(!Config.getBooleanProperty("ENABLE_OLD_BUNDLE_UPLOAD_ENDPOINT", false)){ + response.getWriter().println("Endpoint disabled, POST your bundle to: /api/bundle/sync or set DOT_ENABLE_OLD_BUNDLE_UPLOAD_ENDPOINT=true to use this old endpoint."); + } + + + + try { if(!APILocator.getLayoutAPI().doesUserHaveAccessToPortlet("publishing-queue", getUser())){ response.sendError(401); diff --git a/dotCMS/src/main/java/com/dotcms/publisher/receiver/BundlePublisher.java b/dotCMS/src/main/java/com/dotcms/publisher/receiver/BundlePublisher.java index 2303224288cf..22f289c3969c 100644 --- a/dotCMS/src/main/java/com/dotcms/publisher/receiver/BundlePublisher.java +++ b/dotCMS/src/main/java/com/dotcms/publisher/receiver/BundlePublisher.java @@ -118,10 +118,8 @@ public PublisherConfig init(PublisherConfig config) throws DotPublishingExceptio handlers.add(new HostHandler(config)); handlers.add(new FolderHandler(config)); handlers.add(new WorkflowHandler(config)); - if (Config.getBooleanProperty("PUSH_PUBLISHING_PUSH_STRUCTURES", true)) { - handlers.add(new ContentTypeHandler(config)); - handlers.add(new RelationshipHandler(config)); - } + handlers.add(new ContentTypeHandler(config)); + handlers.add(new RelationshipHandler(config)); handlers.add(new ContainerHandler(config)); handlers.add(new TemplateHandler(config)); handlers.add(new LanguageHandler(config)); diff --git a/dotCMS/src/main/java/com/dotcms/rest/BundleResource.java b/dotCMS/src/main/java/com/dotcms/rest/BundleResource.java index 928cd3fc2a06..e269a1c04499 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/BundleResource.java +++ b/dotCMS/src/main/java/com/dotcms/rest/BundleResource.java @@ -923,15 +923,15 @@ public final Response uploadBundleSync(@Context final HttpServletRequest request response.setContentType("text/html; charset=utf-8"); PublishAuditStatus previousStatus = PublishAuditAPI .getInstance().updateAuditTable(endpointId, endpointId, bundleFolder); - - final PublisherConfig config = !previousStatus.getStatus().equals(Status.PUBLISHING_BUNDLE)? - new PushPublisherJob().processBundle(bundleName, previousStatus): null; - - final String finalStatus = config != null ? - config.getPublishAuditStatus().getStatus().name(): - Status.RECEIVED_BUNDLE.name(); - - return Response.ok(ImmutableMap.of("bundleName", bundleName, "status", finalStatus)) + DotConcurrentFactory.getInstance().getSubmitter().submit(()-> { + final PublisherConfig config = !previousStatus.getStatus().equals(Status.PUBLISHING_BUNDLE) ? + new PushPublisherJob().processBundle(bundleName, previousStatus) : null; + + final String finalStatus = config != null ? + config.getPublishAuditStatus().getStatus().name() : + Status.RECEIVED_BUNDLE.name(); + }); + return Response.ok(ImmutableMap.of("bundleName", bundleName, "status", Status.RECEIVED_BUNDLE.name())) .build(); } catch (IOException e) { Logger.error(this, "Unable to import Bundle", e); @@ -943,6 +943,7 @@ public final Response uploadBundleSync(@Context final HttpServletRequest request return Response.ok().build(); } // uploadBundleSync. + @Path("/async") @POST @JSONP @NoCache diff --git a/dotCMS/src/main/resources/mssql.sql b/dotCMS/src/main/resources/mssql.sql deleted file mode 100644 index 87e265038626..000000000000 --- a/dotCMS/src/main/resources/mssql.sql +++ /dev/null @@ -1,2707 +0,0 @@ -SET TRANSACTION ISOLATION LEVEL READ COMMITTED; - -create table Address ( - addressId NVARCHAR(100) not null primary key, - companyId NVARCHAR(100) not null, - userId NVARCHAR(100) not null, - userName NVARCHAR(100) null, - createDate datetimeoffset(3) null, - modifiedDate datetimeoffset(3) null, - className NVARCHAR(100) null, - classPK NVARCHAR(100) null, - description NVARCHAR(100) null, - street1 NVARCHAR(100) null, - street2 NVARCHAR(100) null, - city NVARCHAR(100) null, - state NVARCHAR(100) null, - zip NVARCHAR(100) null, - country NVARCHAR(100) null, - phone NVARCHAR(100) null, - fax NVARCHAR(100) null, - cell NVARCHAR(100) null, - priority int -); - -create table AdminConfig ( - configId NVARCHAR(100) not null primary key, - companyId NVARCHAR(100) not null, - type_ NVARCHAR(100) null, - name NVARCHAR(100) null, - config NVARCHAR(MAX) null -); - -create table Company ( - companyId NVARCHAR(100) not null primary key, - key_ NVARCHAR(MAX) null, - portalURL NVARCHAR(100) not null, - homeURL NVARCHAR(100) not null, - mx NVARCHAR(100) default 'dotcms.com', - name NVARCHAR(100) not null, - shortName NVARCHAR(100) not null, - type_ NVARCHAR(100) null, - size_ NVARCHAR(100) null, - street NVARCHAR(100) null, - city NVARCHAR(100) null, - state NVARCHAR(100) null, - zip NVARCHAR(100) null, - phone NVARCHAR(100) null, - fax NVARCHAR(100) null, - emailAddress NVARCHAR(100) null, - authType NVARCHAR(100) null, - autoLogin bit, - strangers bit, - default_language_id numeric(19,0) null -); - -create table Counter ( - name NVARCHAR(100) not null primary key, - currentId int -); - -create table Image ( - imageId NVARCHAR(200) not null primary key, - text_ NVARCHAR(MAX) not null -); - -create table PasswordTracker ( - passwordTrackerId NVARCHAR(100) not null primary key, - userId NVARCHAR(100) not null, - createDate datetimeoffset(3) not null, - password_ NVARCHAR(100) not null -); - -create table PollsChoice ( - choiceId NVARCHAR(100) not null, - questionId NVARCHAR(100) not null, - description NVARCHAR(1000) null, - primary key (choiceId, questionId) -); - -create table PollsDisplay ( - layoutId NVARCHAR(100) not null, - userId NVARCHAR(100) not null, - portletId NVARCHAR(100) not null, - questionId NVARCHAR(100) not null, - primary key (layoutId, userId, portletId) -); - -create table PollsQuestion ( - questionId NVARCHAR(100) not null primary key, - portletId NVARCHAR(100) not null, - groupId NVARCHAR(100) not null, - companyId NVARCHAR(100) not null, - userId NVARCHAR(100) not null, - userName NVARCHAR(100) null, - createDate datetimeoffset(3) null, - modifiedDate datetimeoffset(3) null, - title NVARCHAR(100) null, - description NVARCHAR(1000) null, - expirationDate datetimeoffset(3) null, - lastVoteDate datetimeoffset(3) null -); - -create table PollsVote ( - questionId NVARCHAR(100) not null, - userId NVARCHAR(100) not null, - choiceId NVARCHAR(100) not null, - voteDate datetimeoffset(3) null, - primary key (questionId, userId) -); - -create table Portlet ( - portletId NVARCHAR(100) not null, - groupId NVARCHAR(100) not null, - companyId NVARCHAR(100) not null, - defaultPreferences NVARCHAR(MAX) null, - narrow bit, - roles NVARCHAR(1000) null, - active_ bit, - primary key (portletId, groupId, companyId) -); - -create table PortletPreferences ( - portletId NVARCHAR(100) not null, - userId NVARCHAR(100) not null, - layoutId NVARCHAR(100) not null, - preferences NVARCHAR(MAX) null, - primary key (portletId, userId, layoutId) -); - -create table User_ ( - userId NVARCHAR(100) not null primary key, - companyId NVARCHAR(100) not null, - createDate datetimeoffset(3) null, - mod_date datetimeoffset(3) null, - password_ NVARCHAR(MAX) null, - passwordEncrypted bit, - passwordExpirationDate datetimeoffset(3) null, - passwordReset bit, - firstName NVARCHAR(100) null, - middleName NVARCHAR(100) null, - lastName NVARCHAR(100) null, - nickName NVARCHAR(100) null, - male bit, - birthday datetimeoffset(3) null, - emailAddress NVARCHAR(100) null, - smsId NVARCHAR(100) null, - aimId NVARCHAR(100) null, - icqId NVARCHAR(100) null, - msnId NVARCHAR(100) null, - ymId NVARCHAR(100) null, - favoriteActivity NVARCHAR(100) null, - favoriteBibleVerse NVARCHAR(100) null, - favoriteFood NVARCHAR(100) null, - favoriteMovie NVARCHAR(100) null, - favoriteMusic NVARCHAR(100) null, - languageId NVARCHAR(100) null, - timeZoneId NVARCHAR(100) null, - skinId NVARCHAR(100) null, - dottedSkins bit, - roundedSkins bit, - greeting NVARCHAR(100) null, - resolution NVARCHAR(100) null, - refreshRate NVARCHAR(100) null, - layoutIds NVARCHAR(100) null, - comments NVARCHAR(1000) null, - loginDate datetimeoffset(3) null, - loginIP NVARCHAR(100) null, - lastLoginDate datetimeoffset(3) null, - lastLoginIP NVARCHAR(100) null, - failedLoginAttempts int, - agreedToTermsOfUse bit, - active_ bit, - delete_in_progress TINYINT DEFAULT 0, - delete_date datetimeoffset(3) NULL, - additional_info NVARCHAR(MAX) NULL -); - -create table UserTracker ( - userTrackerId NVARCHAR(100) not null primary key, - companyId NVARCHAR(100) not null, - userId NVARCHAR(100) not null, - modifiedDate datetimeoffset(3) null, - remoteAddr NVARCHAR(100) null, - remoteHost NVARCHAR(100) null, - userAgent NVARCHAR(100) null -); - -create table UserTrackerPath ( - userTrackerPathId NVARCHAR(100) not null primary key, - userTrackerId NVARCHAR(100) not null, - path NVARCHAR(1000) not null, - pathDate datetimeoffset(3) not null -); - --- --- Global --- - -insert into Counter values ('com.liferay.portal.model.Address', 10); -insert into Counter values ('com.liferay.portal.model.Role', 100); -insert into Counter values ('com.liferay.portal.model.User.liferay.com', 10); -insert into Counter values ('com.liferay.portlet.polls.model.PollsQuestion', 10); - --- --- Liferay, LLC --- - -insert into Company (companyId, portalURL, homeURL, mx, name, shortName, type_, size_, emailAddress, authType, autoLogin, strangers) values ('liferay.com', 'localhost', 'localhost', 'liferay.com', 'Liferay, LLC', 'Liferay', 'biz', '', 'test@liferay.com', 'emailAddress', '1', '1'); -update Company set street = '1220 Brea Canyon Rd.', city = 'Diamond Bar', state = 'CA', zip = '91789' where companyId = 'liferay.com'; - -insert into PollsDisplay (layoutId, userId, portletId, questionId) values ('1.1', 'group.1', '59', '1'); -insert into PollsChoice (choiceId, questionId, description) values ('a', '1', 'Chocolate'); -insert into PollsChoice (choiceId, questionId, description) values ('b', '1', 'Strawberry'); -insert into PollsChoice (choiceId, questionId, description) values ('c', '1', 'Vanilla'); -insert into PollsQuestion (questionId, portletId, groupId, companyId, userId, userName, createDate, modifiedDate, title, description) values ('1', '25', '-1', 'liferay.com', 'liferay.com.1', 'John Wayne', GetDate(), GetDate(), 'What is your favorite ice cream flavor?', 'What is your favorite ice cream flavor?'); - --- --- Default User --- - -insert into User_ (userId, companyId, createDate, password_, passwordEncrypted, passwordReset, firstName, middleName, lastName, male, birthday, emailAddress, skinId, dottedSkins, roundedSkins, greeting, layoutIds, loginDate, failedLoginAttempts, agreedToTermsOfUse, active_) values ('liferay.com.default', 'default', GetDate(), 'password', '0', '0', '', '', '', '1', '19700101', 'default@liferay.com', '01', '0', '0', 'Welcome!', '', GetDate(), 0, '0', '1'); - --- --- Test User --- - -insert into User_ (userId, companyId, createDate, password_, passwordEncrypted, passwordReset, firstName, middleName, lastName, nickName, male, birthday, emailAddress, skinId, dottedSkins, roundedSkins, greeting, layoutIds, loginDate, failedLoginAttempts, agreedToTermsOfUse, active_) values ('liferay.com.1', 'liferay.com', GetDate(), 'test', '0', '0', 'John', '', 'Wayne', 'Duke', '1', '19700101', 'test@liferay.com', '01', '0', '1', 'Welcome John Wayne!', '1,', GetDate(), 0, '1', '1'); - -CREATE TABLE [dbo].[QRTZ_CALENDARS] ( - [CALENDAR_NAME] [NVARCHAR] (80) NOT NULL , - [CALENDAR] [IMAGE] NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_CRON_TRIGGERS] ( - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [CRON_EXPRESSION] [NVARCHAR] (80) NOT NULL , - [TIME_ZONE_ID] [NVARCHAR] (80) -) -GO - -CREATE TABLE [dbo].[QRTZ_FIRED_TRIGGERS] ( - [ENTRY_ID] [NVARCHAR] (95) NOT NULL , - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [IS_VOLATILE] [NVARCHAR] (1) NOT NULL , - [INSTANCE_NAME] [NVARCHAR] (80) NOT NULL , - [FIRED_TIME] [BIGINT] NOT NULL , - [PRIORITY] [INTEGER] NOT NULL , - [STATE] [NVARCHAR] (16) NOT NULL, - [JOB_NAME] [NVARCHAR] (80) NULL , - [JOB_GROUP] [NVARCHAR] (80) NULL , - [IS_STATEFUL] [NVARCHAR] (1) NULL , - [REQUESTS_RECOVERY] [NVARCHAR] (1) NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] ( - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_SCHEDULER_STATE] ( - [INSTANCE_NAME] [NVARCHAR] (80) NOT NULL , - [LAST_CHECKIN_TIME] [BIGINT] NOT NULL , - [CHECKIN_INTERVAL] [BIGINT] NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_LOCKS] ( - [LOCK_NAME] [NVARCHAR] (40) NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_JOB_DETAILS] ( - [JOB_NAME] [NVARCHAR] (80) NOT NULL , - [JOB_GROUP] [NVARCHAR] (80) NOT NULL , - [DESCRIPTION] [NVARCHAR] (120) NULL , - [JOB_CLASS_NAME] [NVARCHAR] (128) NOT NULL , - [IS_DURABLE] [NVARCHAR] (1) NOT NULL , - [IS_VOLATILE] [NVARCHAR] (1) NOT NULL , - [IS_STATEFUL] [NVARCHAR] (1) NOT NULL , - [REQUESTS_RECOVERY] [NVARCHAR] (1) NOT NULL , - [JOB_DATA] [IMAGE] NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_JOB_LISTENERS] ( - [JOB_NAME] [NVARCHAR] (80) NOT NULL , - [JOB_GROUP] [NVARCHAR] (80) NOT NULL , - [JOB_LISTENER] [NVARCHAR] (80) NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] ( - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [REPEAT_COUNT] [BIGINT] NOT NULL , - [REPEAT_INTERVAL] [BIGINT] NOT NULL , - [TIMES_TRIGGERED] [BIGINT] NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_BLOB_TRIGGERS] ( - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [BLOB_DATA] [IMAGE] NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_TRIGGER_LISTENERS] ( - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [TRIGGER_LISTENER] [NVARCHAR] (80) NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_TRIGGERS] ( - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [JOB_NAME] [NVARCHAR] (80) NOT NULL , - [JOB_GROUP] [NVARCHAR] (80) NOT NULL , - [IS_VOLATILE] [NVARCHAR] (1) NOT NULL , - [DESCRIPTION] [NVARCHAR] (120) NULL , - [NEXT_FIRE_TIME] [BIGINT] NULL , - [PREV_FIRE_TIME] [BIGINT] NULL , - [PRIORITY] [INTEGER] NULL , - [TRIGGER_STATE] [NVARCHAR] (16) NOT NULL , - [TRIGGER_TYPE] [NVARCHAR] (8) NOT NULL , - [START_TIME] [BIGINT] NOT NULL , - [END_TIME] [BIGINT] NULL , - [CALENDAR_NAME] [NVARCHAR] (80) NULL , - [MISFIRE_INSTR] [SMALLINT] NULL , - [JOB_DATA] [IMAGE] NULL -) -GO - -ALTER TABLE [dbo].[QRTZ_CALENDARS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_CALENDARS] PRIMARY KEY CLUSTERED - ( - [CALENDAR_NAME] - ) -GO - -ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_CRON_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_FIRED_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_FIRED_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [ENTRY_ID] - ) -GO - -ALTER TABLE [dbo].[QRTZ_PAUSED_TRIGGER_GRPS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_PAUSED_TRIGGER_GRPS] PRIMARY KEY CLUSTERED - ( - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_SCHEDULER_STATE] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_SCHEDULER_STATE] PRIMARY KEY CLUSTERED - ( - [INSTANCE_NAME] - ) -GO - -ALTER TABLE [dbo].[QRTZ_LOCKS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_LOCKS] PRIMARY KEY CLUSTERED - ( - [LOCK_NAME] - ) -GO - -ALTER TABLE [dbo].[QRTZ_JOB_DETAILS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_JOB_DETAILS] PRIMARY KEY CLUSTERED - ( - [JOB_NAME], - [JOB_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_JOB_LISTENERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_JOB_LISTENERS] PRIMARY KEY CLUSTERED - ( - [JOB_NAME], - [JOB_GROUP], - [JOB_LISTENER] - ) -GO - -ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_SIMPLE_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_TRIGGER_LISTENERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_TRIGGER_LISTENERS] PRIMARY KEY CLUSTERED - ( - [TRIGGER_NAME], - [TRIGGER_GROUP], - [TRIGGER_LISTENER] - ) -GO - -ALTER TABLE [dbo].[QRTZ_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_CRON_TRIGGERS] ADD - CONSTRAINT [FK_QRTZ_CRON_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) REFERENCES [dbo].[QRTZ_TRIGGERS] ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) ON DELETE CASCADE -GO - -ALTER TABLE [dbo].[QRTZ_JOB_LISTENERS] ADD - CONSTRAINT [FK_QRTZ_JOB_LISTENERS_QRTZ_JOB_DETAILS] FOREIGN KEY - ( - [JOB_NAME], - [JOB_GROUP] - ) REFERENCES [dbo].[QRTZ_JOB_DETAILS] ( - [JOB_NAME], - [JOB_GROUP] - ) ON DELETE CASCADE -GO - -ALTER TABLE [dbo].[QRTZ_SIMPLE_TRIGGERS] ADD - CONSTRAINT [FK_QRTZ_SIMPLE_TRIGGERS_QRTZ_TRIGGERS] FOREIGN KEY - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) REFERENCES [dbo].[QRTZ_TRIGGERS] ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) ON DELETE CASCADE -GO - -ALTER TABLE [dbo].[QRTZ_TRIGGER_LISTENERS] ADD - CONSTRAINT [FK_QRTZ_TRIGGER_LISTENERS_QRTZ_TRIGGERS] FOREIGN KEY - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) REFERENCES [dbo].[QRTZ_TRIGGERS] ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) ON DELETE CASCADE -GO - -ALTER TABLE [dbo].[QRTZ_TRIGGERS] ADD - CONSTRAINT [FK_QRTZ_TRIGGERS_QRTZ_JOB_DETAILS] FOREIGN KEY - ( - [JOB_NAME], - [JOB_GROUP] - ) REFERENCES [dbo].[QRTZ_JOB_DETAILS] ( - [JOB_NAME], - [JOB_GROUP] - ) -GO - -INSERT INTO [dbo].[QRTZ_LOCKS] VALUES('TRIGGER_ACCESS'); -INSERT INTO [dbo].[QRTZ_LOCKS] VALUES('JOB_ACCESS'); -INSERT INTO [dbo].[QRTZ_LOCKS] VALUES('CALENDAR_ACCESS'); -INSERT INTO [dbo].[QRTZ_LOCKS] VALUES('STATE_ACCESS'); -INSERT INTO [dbo].[QRTZ_LOCKS] VALUES('MISFIRE_ACCESS'); - -CREATE TABLE [dbo].[QRTZ_EXCL_CALENDARS] ( - [CALENDAR_NAME] [NVARCHAR] (80) NOT NULL , - [CALENDAR] [IMAGE] NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_EXCL_CRON_TRIGGERS] ( - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [CRON_EXPRESSION] [NVARCHAR] (80) NOT NULL , - [TIME_ZONE_ID] [NVARCHAR] (80) -) -GO - -CREATE TABLE [dbo].[QRTZ_EXCL_FIRED_TRIGGERS] ( - [ENTRY_ID] [NVARCHAR] (95) NOT NULL , - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [IS_VOLATILE] [NVARCHAR] (1) NOT NULL , - [INSTANCE_NAME] [NVARCHAR] (80) NOT NULL , - [FIRED_TIME] [BIGINT] NOT NULL , - [PRIORITY] [INTEGER] NOT NULL , - [STATE] [NVARCHAR] (16) NOT NULL, - [JOB_NAME] [NVARCHAR] (80) NULL , - [JOB_GROUP] [NVARCHAR] (80) NULL , - [IS_STATEFUL] [NVARCHAR] (1) NULL , - [REQUESTS_RECOVERY] [NVARCHAR] (1) NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_EXCL_PAUSED_TRIGGER_GRPS] ( - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_EXCL_SCHEDULER_STATE] ( - [INSTANCE_NAME] [NVARCHAR] (80) NOT NULL , - [LAST_CHECKIN_TIME] [BIGINT] NOT NULL , - [CHECKIN_INTERVAL] [BIGINT] NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_EXCL_LOCKS] ( - [LOCK_NAME] [NVARCHAR] (40) NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_EXCL_JOB_DETAILS] ( - [JOB_NAME] [NVARCHAR] (80) NOT NULL , - [JOB_GROUP] [NVARCHAR] (80) NOT NULL , - [DESCRIPTION] [NVARCHAR] (120) NULL , - [JOB_CLASS_NAME] [NVARCHAR] (128) NOT NULL , - [IS_DURABLE] [NVARCHAR] (1) NOT NULL , - [IS_VOLATILE] [NVARCHAR] (1) NOT NULL , - [IS_STATEFUL] [NVARCHAR] (1) NOT NULL , - [REQUESTS_RECOVERY] [NVARCHAR] (1) NOT NULL , - [JOB_DATA] [IMAGE] NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_EXCL_JOB_LISTENERS] ( - [JOB_NAME] [NVARCHAR] (80) NOT NULL , - [JOB_GROUP] [NVARCHAR] (80) NOT NULL , - [JOB_LISTENER] [NVARCHAR] (80) NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_EXCL_SIMPLE_TRIGGERS] ( - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [REPEAT_COUNT] [BIGINT] NOT NULL , - [REPEAT_INTERVAL] [BIGINT] NOT NULL , - [TIMES_TRIGGERED] [BIGINT] NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_EXCL_BLOB_TRIGGERS] ( - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [BLOB_DATA] [IMAGE] NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_EXCL_TRIGGER_LISTENERS] ( - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [TRIGGER_LISTENER] [NVARCHAR] (80) NOT NULL -) -GO - -CREATE TABLE [dbo].[QRTZ_EXCL_TRIGGERS] ( - [TRIGGER_NAME] [NVARCHAR] (80) NOT NULL , - [TRIGGER_GROUP] [NVARCHAR] (80) NOT NULL , - [JOB_NAME] [NVARCHAR] (80) NOT NULL , - [JOB_GROUP] [NVARCHAR] (80) NOT NULL , - [IS_VOLATILE] [NVARCHAR] (1) NOT NULL , - [DESCRIPTION] [NVARCHAR] (120) NULL , - [NEXT_FIRE_TIME] [BIGINT] NULL , - [PREV_FIRE_TIME] [BIGINT] NULL , - [PRIORITY] [INTEGER] NULL , - [TRIGGER_STATE] [NVARCHAR] (16) NOT NULL , - [TRIGGER_TYPE] [NVARCHAR] (8) NOT NULL , - [START_TIME] [BIGINT] NOT NULL , - [END_TIME] [BIGINT] NULL , - [CALENDAR_NAME] [NVARCHAR] (80) NULL , - [MISFIRE_INSTR] [SMALLINT] NULL , - [JOB_DATA] [IMAGE] NULL -) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_CALENDARS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_EXCL_CALENDARS] PRIMARY KEY CLUSTERED - ( - [CALENDAR_NAME] - ) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_CRON_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_EXCL_CRON_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_FIRED_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_EXCL_FIRED_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [ENTRY_ID] - ) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_PAUSED_TRIGGER_GRPS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_EXCL_PAUSED_TRIGGER_GRPS] PRIMARY KEY CLUSTERED - ( - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_SCHEDULER_STATE] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_EXCL_SCHEDULER_STATE] PRIMARY KEY CLUSTERED - ( - [INSTANCE_NAME] - ) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_LOCKS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_EXCL_LOCKS] PRIMARY KEY CLUSTERED - ( - [LOCK_NAME] - ) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_JOB_DETAILS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_EXCL_JOB_DETAILS] PRIMARY KEY CLUSTERED - ( - [JOB_NAME], - [JOB_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_JOB_LISTENERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_EXCL_JOB_LISTENERS] PRIMARY KEY CLUSTERED - ( - [JOB_NAME], - [JOB_GROUP], - [JOB_LISTENER] - ) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_SIMPLE_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_EXCL_SIMPLE_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_TRIGGER_LISTENERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_EXCL_TRIGGER_LISTENERS] PRIMARY KEY CLUSTERED - ( - [TRIGGER_NAME], - [TRIGGER_GROUP], - [TRIGGER_LISTENER] - ) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_TRIGGERS] WITH NOCHECK ADD - CONSTRAINT [PK_QRTZ_EXCL_TRIGGERS] PRIMARY KEY CLUSTERED - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_CRON_TRIGGERS] ADD - CONSTRAINT [FK_QRTZ_EXCL_CRON_TRIGGERS_QRTZ_EXCL_TRIGGERS] FOREIGN KEY - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) REFERENCES [dbo].[QRTZ_EXCL_TRIGGERS] ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) ON DELETE CASCADE -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_JOB_LISTENERS] ADD - CONSTRAINT [FK_QRTZ_EXCL_JOB_LISTENERS_QRTZ_EXCL_JOB_DETAILS] FOREIGN KEY - ( - [JOB_NAME], - [JOB_GROUP] - ) REFERENCES [dbo].[QRTZ_EXCL_JOB_DETAILS] ( - [JOB_NAME], - [JOB_GROUP] - ) ON DELETE CASCADE -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_SIMPLE_TRIGGERS] ADD - CONSTRAINT [FK_QRTZ_EXCL_SIMPLE_TRIGGERS_QRTZ_EXCL_TRIGGERS] FOREIGN KEY - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) REFERENCES [dbo].[QRTZ_EXCL_TRIGGERS] ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) ON DELETE CASCADE -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_TRIGGER_LISTENERS] ADD - CONSTRAINT [FK_QRTZ_EXCL_TRIGGER_LISTENERS_QRTZ_EXCL_TRIGGERS] FOREIGN KEY - ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) REFERENCES [dbo].[QRTZ_EXCL_TRIGGERS] ( - [TRIGGER_NAME], - [TRIGGER_GROUP] - ) ON DELETE CASCADE -GO - -ALTER TABLE [dbo].[QRTZ_EXCL_TRIGGERS] ADD - CONSTRAINT [FK_QRTZ_EXCL_TRIGGERS_QRTZ_EXCL_JOB_DETAILS] FOREIGN KEY - ( - [JOB_NAME], - [JOB_GROUP] - ) REFERENCES [dbo].[QRTZ_EXCL_JOB_DETAILS] ( - [JOB_NAME], - [JOB_GROUP] - ) -GO - -create index IDX_QRTZ_EXCL_TRIGGERS_QRTZ_EXCL_JOB_DETAILS on QRTZ_EXCL_TRIGGERS (JOB_NAME, JOB_GROUP); - -INSERT INTO [dbo].[QRTZ_EXCL_LOCKS] VALUES('TRIGGER_ACCESS'); -INSERT INTO [dbo].[QRTZ_EXCL_LOCKS] VALUES('JOB_ACCESS'); -INSERT INTO [dbo].[QRTZ_EXCL_LOCKS] VALUES('CALENDAR_ACCESS'); -INSERT INTO [dbo].[QRTZ_EXCL_LOCKS] VALUES('STATE_ACCESS'); -INSERT INTO [dbo].[QRTZ_EXCL_LOCKS] VALUES('MISFIRE_ACCESS'); - -create table analytic_summary_pages ( - id numeric(19,0) identity not null, - summary_id numeric(19,0) not null, - inode NVARCHAR(255) null, - hits numeric(19,0) null, - uri NVARCHAR(255) null, - primary key (id) -); -create table tag ( - tag_id NVARCHAR(100) not null, - tagname NVARCHAR(255) not null, - host_id NVARCHAR(255) null, - user_id NVARCHAR(255) null, - persona tinyint default 0, - mod_date datetimeoffset(3) null, - primary key (tag_id) -); -create table user_comments ( - inode NVARCHAR(36) not null, - user_id NVARCHAR(255) null, - cdate datetimeoffset(3) null, - comment_user_id NVARCHAR(100) null, - type NVARCHAR(255) null, - method NVARCHAR(255) null, - subject NVARCHAR(255) null, - ucomment NVARCHAR(MAX) null, - communication_id NVARCHAR(36) null, - primary key (inode) -); -create table permission_reference ( - id numeric(19,0) identity not null, - asset_id NVARCHAR(36) null, - reference_id NVARCHAR(36) null, - permission_type NVARCHAR(100) null, - primary key (id), - unique (asset_id) -); -create table contentlet_version_info ( - identifier NVARCHAR(36) not null, - lang numeric(19,0) not null, - working_inode NVARCHAR(36) not null, - live_inode NVARCHAR(36) null, - deleted tinyint not null, - locked_by NVARCHAR(100) null, - locked_on datetimeoffset(3) null, - version_ts datetimeoffset(3) not null, - variant_id NVARCHAR(255) default 'DEFAULT' not null, - primary key (identifier, lang, variant_id) -); -create table fixes_audit ( - id NVARCHAR(36) not null, - table_name NVARCHAR(255) null, - action NVARCHAR(255) null, - records_altered int null, - datetime datetimeoffset(3) null, - primary key (id) -); -create table container_version_info ( - identifier NVARCHAR(36) not null, - working_inode NVARCHAR(36) not null, - live_inode NVARCHAR(36) null, - deleted tinyint not null, - locked_by NVARCHAR(100) null, - locked_on datetimeoffset(3) null, - version_ts datetimeoffset(3) not null, - primary key (identifier) -); -create table trackback ( - id numeric(19,0) identity not null, - asset_identifier NVARCHAR(36) null, - title NVARCHAR(255) null, - excerpt NVARCHAR(255) null, - url NVARCHAR(255) null, - blog_name NVARCHAR(255) null, - track_date datetimeoffset(3) not null, - primary key (id) -); -create table plugin ( - id NVARCHAR(255) not null, - plugin_name NVARCHAR(255) not null, - plugin_version NVARCHAR(255) not null, - author NVARCHAR(255) not null, - first_deployed_date datetimeoffset(3) not null, - last_deployed_date datetimeoffset(3) not null, - primary key (id) -); -create table mailing_list ( - inode NVARCHAR(36) not null, - title NVARCHAR(255) null, - public_list tinyint null, - user_id NVARCHAR(255) null, - primary key (inode) -); -create table recipient ( - inode NVARCHAR(36) not null, - name NVARCHAR(255) null, - lastname NVARCHAR(255) null, - email NVARCHAR(255) null, - sent datetimeoffset(3) null, - opened datetimeoffset(3) null, - last_result int null, - last_message NVARCHAR(255) null, - user_id NVARCHAR(100) null, - primary key (inode) -); -create table web_form ( - web_form_id NVARCHAR(36) not null, - form_type NVARCHAR(255) null, - submit_date datetimeoffset(3) null, - prefix NVARCHAR(255) null, - first_name NVARCHAR(255) null, - middle_initial NVARCHAR(255) null, - middle_name NVARCHAR(255) null, - full_name NVARCHAR(255) null, - organization NVARCHAR(255) null, - title NVARCHAR(255) null, - last_name NVARCHAR(255) null, - address NVARCHAR(255) null, - address1 NVARCHAR(255) null, - address2 NVARCHAR(255) null, - city NVARCHAR(255) null, - state NVARCHAR(255) null, - zip NVARCHAR(255) null, - country NVARCHAR(255) null, - phone NVARCHAR(255) null, - email NVARCHAR(255) null, - custom_fields NVARCHAR(MAX) null, - user_inode NVARCHAR(36) null, - categories NVARCHAR(255) null, - primary key (web_form_id) -); -create table analytic_summary_period ( - id numeric(19,0) identity not null, - full_date datetimeoffset(3) null, - day int null, - week int null, - month int null, - year NVARCHAR(255) null, - dayname NVARCHAR(50) not null, - monthname NVARCHAR(50) not null, - primary key (id), - unique (full_date) -); -create table tree ( - child NVARCHAR(36) not null, - parent NVARCHAR(36) not null, - relation_type NVARCHAR(64) not null, - tree_order int null, - primary key (child, parent, relation_type) -); -create table analytic_summary ( - id numeric(19,0) identity not null, - summary_period_id numeric(19,0) not null, - host_id NVARCHAR(36) not null, - visits numeric(19,0) null, - page_views numeric(19,0) null, - unique_visits numeric(19,0) null, - new_visits numeric(19,0) null, - direct_traffic numeric(19,0) null, - referring_sites numeric(19,0) null, - search_engines numeric(19,0) null, - bounce_rate int null, - avg_time_on_site datetimeoffset(3) null, - primary key (id), - unique (summary_period_id, host_id) -); -create table users_cms_roles ( - id NVARCHAR(36) not null, - user_id NVARCHAR(100) not null, - role_id NVARCHAR(36) not null, - primary key (id) -); -create table template ( - inode NVARCHAR(36) not null, - show_on_menu tinyint null, - title NVARCHAR(255) null, - mod_date datetimeoffset(3) null, - mod_user NVARCHAR(100) null, - sort_order int null, - friendly_name NVARCHAR(255) null, - body NVARCHAR(MAX) null, - header NVARCHAR(MAX) null, - footer NVARCHAR(MAX) null, - image NVARCHAR(36) null, - identifier NVARCHAR(36) null, - drawed tinyint null, - drawed_body NVARCHAR(MAX) null, - add_container_links int null, - containers_added int null, - head_code NVARCHAR(MAX) null, - theme NVARCHAR(255) null, - primary key (inode) -); -create table analytic_summary_content ( - id numeric(19,0) identity not null, - summary_id numeric(19,0) not null, - inode NVARCHAR(255) null, - hits numeric(19,0) null, - uri NVARCHAR(255) null, - title NVARCHAR(255) null, - primary key (id) -); -create table structure ( - inode NVARCHAR(36) not null, - name NVARCHAR(255) null, - description NVARCHAR(255) null, - default_structure tinyint null, - review_interval NVARCHAR(255) null, - reviewer_role NVARCHAR(255) null, - page_detail NVARCHAR(36) null, - structuretype int null, - system tinyint null, - fixed tinyint not null, - velocity_var_name NVARCHAR(255) null, - url_map_pattern NVARCHAR(512) null, - host NVARCHAR(36) not null, - folder NVARCHAR(36) not null, - expire_date_var NVARCHAR(255) null, - publish_date_var NVARCHAR(255) null, - mod_date datetimeoffset(3) null, - sort_order int null, - icon NVARCHAR(255) null, - marked_for_deletion tinyint not null default 0, - primary key (inode) -); -create table cms_role ( - id NVARCHAR(36) not null, - role_name NVARCHAR(255) not null, - description NVARCHAR(MAX) null, - role_key NVARCHAR(255) null, - db_fqn NVARCHAR(1000) not null, - parent NVARCHAR(36) not null, - edit_permissions tinyint null, - edit_users tinyint null, - edit_layouts tinyint null, - locked tinyint null, - system tinyint null, - primary key (id) -); -create table container_structures ( - id NVARCHAR(36) not null, - container_id NVARCHAR(36) not null, - container_inode NVARCHAR(36) not null, - structure_id NVARCHAR(36) not null, - code NVARCHAR(MAX) null, - primary key (id) -); -create table permission ( - id numeric(19,0) identity not null, - permission_type NVARCHAR(100) null, - inode_id NVARCHAR(36) null, - roleid NVARCHAR(36) null, - permission int null, - primary key (id), - unique (permission_type, inode_id, roleid) -); - create table contentlet (inode NVARCHAR(36) not null, - show_on_menu tinyint null, - title NVARCHAR(255) null, - mod_date datetimeoffset(3) null, - mod_user NVARCHAR(100) null, - sort_order int null, - friendly_name NVARCHAR(255) null, - structure_inode NVARCHAR(36) null, - disabled_wysiwyg NVARCHAR(255) null, - identifier NVARCHAR(36) null, - language_id numeric(19,0) null, - contentlet_as_json NVARCHAR(MAX), - date1 datetimeoffset(3) null, - date2 datetimeoffset(3) null, - date3 datetimeoffset(3) null, - date4 datetimeoffset(3) null, - date5 datetimeoffset(3) null, - date6 datetimeoffset(3) null, - date7 datetimeoffset(3) null, - date8 datetimeoffset(3) null, - date9 datetimeoffset(3) null, - date10 datetimeoffset(3) null, - date11 datetimeoffset(3) null, - date12 datetimeoffset(3) null, - date13 datetimeoffset(3) null, - date14 datetimeoffset(3) null, - date15 datetimeoffset(3) null, - date16 datetimeoffset(3) null, - date17 datetimeoffset(3) null, - date18 datetimeoffset(3) null, - date19 datetimeoffset(3) null, - date20 datetimeoffset(3) null, - date21 datetimeoffset(3) null, - date22 datetimeoffset(3) null, - date23 datetimeoffset(3) null, - date24 datetimeoffset(3) null, - date25 datetimeoffset(3) null, - text1 NVARCHAR(255) null, - text2 NVARCHAR(255) null, - text3 NVARCHAR(255) null, - text4 NVARCHAR(255) null, - text5 NVARCHAR(255) null, - text6 NVARCHAR(255) null, - text7 NVARCHAR(255) null, - text8 NVARCHAR(255) null, - text9 NVARCHAR(255) null, - text10 NVARCHAR(255) null, - text11 NVARCHAR(255) null, - text12 NVARCHAR(255) null, - text13 NVARCHAR(255) null, - text14 NVARCHAR(255) null, - text15 NVARCHAR(255) null, - text16 NVARCHAR(255) null, - text17 NVARCHAR(255) null, - text18 NVARCHAR(255) null, - text19 NVARCHAR(255) null, - text20 NVARCHAR(255) null, - text21 NVARCHAR(255) null, - text22 NVARCHAR(255) null, - text23 NVARCHAR(255) null, - text24 NVARCHAR(255) null, - text25 NVARCHAR(255) null, - text_area1 NVARCHAR(MAX) null, - text_area2 NVARCHAR(MAX) null, - text_area3 NVARCHAR(MAX) null, - text_area4 NVARCHAR(MAX) null, - text_area5 NVARCHAR(MAX) null, - text_area6 NVARCHAR(MAX) null, - text_area7 NVARCHAR(MAX) null, - text_area8 NVARCHAR(MAX) null, - text_area9 NVARCHAR(MAX) null, - text_area10 NVARCHAR(MAX) null, - text_area11 NVARCHAR(MAX) null, - text_area12 NVARCHAR(MAX) null, - text_area13 NVARCHAR(MAX) null, - text_area14 NVARCHAR(MAX) null, - text_area15 NVARCHAR(MAX) null, - text_area16 NVARCHAR(MAX) null, - text_area17 NVARCHAR(MAX) null, - text_area18 NVARCHAR(MAX) null, - text_area19 NVARCHAR(MAX) null, - text_area20 NVARCHAR(MAX) null, - text_area21 NVARCHAR(MAX) null, - text_area22 NVARCHAR(MAX) null, - text_area23 NVARCHAR(MAX) null, - text_area24 NVARCHAR(MAX) null, - text_area25 NVARCHAR(MAX) null, - integer1 numeric(19,0) null, - integer2 numeric(19,0) null, - integer3 numeric(19,0) null, - integer4 numeric(19,0) null, - integer5 numeric(19,0) null, - integer6 numeric(19,0) null, - integer7 numeric(19,0) null, - integer8 numeric(19,0) null, - integer9 numeric(19,0) null, - integer10 numeric(19,0) null, - integer11 numeric(19,0) null, - integer12 numeric(19,0) null, - integer13 numeric(19,0) null, - integer14 numeric(19,0) null, - integer15 numeric(19,0) null, - integer16 numeric(19,0) null, - integer17 numeric(19,0) null, - integer18 numeric(19,0) null, - integer19 numeric(19,0) null, - integer20 numeric(19,0) null, - integer21 numeric(19,0) null, - integer22 numeric(19,0) null, - integer23 numeric(19,0) null, - integer24 numeric(19,0) null, - integer25 numeric(19,0) null, - "float1" float null, - "float2" float null, - "float3" float null, - "float4" float null, - "float5" float null, - "float6" float null, - "float7" float null, - "float8" float null, - "float9" float null, - "float10" float null, - "float11" float null, - "float12" float null, - "float13" float null, - "float14" float null, - "float15" float null, - "float16" float null, - "float17" float null, - "float18" float null, - "float19" float null, - "float20" float null, - "float21" float null, - "float22" float null, - "float23" float null, - "float24" float null, - "float25" float null, - bool1 tinyint null, - bool2 tinyint null, - bool3 tinyint null, - bool4 tinyint null, - bool5 tinyint null, - bool6 tinyint null, - bool7 tinyint null, - bool8 tinyint null, - bool9 tinyint null, - bool10 tinyint null, - bool11 tinyint null, - bool12 tinyint null, - bool13 tinyint null, - bool14 tinyint null, - bool15 tinyint null, - bool16 tinyint null, - bool17 tinyint null, - bool18 tinyint null, - bool19 tinyint null, - bool20 tinyint null, - bool21 tinyint null, - bool22 tinyint null, - bool23 tinyint null, - bool24 tinyint null, - bool25 tinyint null, - primary key (inode)); -create table analytic_summary_404 ( - id numeric(19,0) identity not null, - summary_period_id numeric(19,0) not null, - host_id NVARCHAR(36) null, - uri NVARCHAR(255) null, - referer_uri NVARCHAR(255) null, - primary key (id) -); -create table cms_layouts_portlets ( - id NVARCHAR(36) not null, - layout_id NVARCHAR(36) not null, - portlet_id NVARCHAR(100) not null, - portlet_order int null, - primary key (id) -); -create table report_asset ( - inode NVARCHAR(36) not null, - report_name NVARCHAR(255) not null, - report_description NVARCHAR(1000) not null, - requires_input tinyint null, - ds NVARCHAR(100) not null, - web_form_report tinyint null, - primary key (inode) -); -create table workflow_comment ( - id NVARCHAR(36) not null, - creation_date datetimeoffset(3) null, - posted_by NVARCHAR(255) null, - wf_comment NVARCHAR(MAX) null, - workflowtask_id NVARCHAR(36) null, - primary key (id) -); -create table category ( - inode NVARCHAR(36) not null, - category_name NVARCHAR(255) null, - category_key NVARCHAR(255) null, - sort_order int null, - active tinyint null, - keywords NVARCHAR(MAX) null, - category_velocity_var_name NVARCHAR(255) null, - mod_date datetimeoffset(3) null, - primary key (inode) -); -create table chain_link_code ( - id numeric(19,0) identity not null, - class_name NVARCHAR(255) null unique, - code NVARCHAR(MAX) not null, - last_mod_date datetimeoffset(3) not null, - language NVARCHAR(255) not null, - primary key (id) -); -create table analytic_summary_visits ( - id numeric(19,0) identity not null, - summary_period_id numeric(19,0) not null, - host_id NVARCHAR(36) null, - visit_time datetimeoffset(3) null, - visits numeric(19,0) null, - primary key (id) -); -create table template_version_info ( - identifier NVARCHAR(36) not null, - working_inode NVARCHAR(36) not null, - live_inode NVARCHAR(36) null, - deleted tinyint not null, - locked_by NVARCHAR(100) null, - locked_on datetimeoffset(3) null, - version_ts datetimeoffset(3) not null, - primary key (identifier) -); -create table user_preferences ( - id numeric(19,0) identity not null, - user_id NVARCHAR(100) not null, - preference NVARCHAR(255) null, - pref_value NVARCHAR(MAX) null, - primary key (id) -); -create table language ( - id numeric(19,0) not null, - language_code NVARCHAR(5) null, - country_code NVARCHAR(255) null, - language NVARCHAR(255) null, - country NVARCHAR(255) null, - primary key (id) -); -create table users_to_delete ( - id numeric(19,0) identity not null, - user_id NVARCHAR(255) null, - primary key (id) -); -create table identifier ( - id NVARCHAR(36) not null, - parent_path NVARCHAR(255) null, - asset_name NVARCHAR(255) null, - host_inode NVARCHAR(36) null, - asset_type NVARCHAR(64) null, - syspublish_date datetimeoffset(3) null, - sysexpire_date datetimeoffset(3) null, - full_path_lc as CASE WHEN parent_path = 'System folder' THEN '/' ELSE LOWER(CONCAT(parent_path, asset_name)) END, - owner NVARCHAR(255), - create_date datetimeoffset(3), - asset_subtype NVARCHAR(255), - primary key (id), - unique (parent_path, asset_name, host_inode) -); -create table clickstream ( - clickstream_id numeric(19,0) identity not null, - cookie_id NVARCHAR(255) null, - user_id NVARCHAR(255) null, - start_date datetimeoffset(3) null, - end_date datetimeoffset(3) null, - referer NVARCHAR(255) null, - remote_address NVARCHAR(255) null, - remote_hostname NVARCHAR(255) null, - user_agent NVARCHAR(255) null, - bot tinyint null, - number_of_requests int null, - host_id NVARCHAR(36) null, - last_page_id NVARCHAR(50) null, - first_page_id NVARCHAR(50) null, - operating_system NVARCHAR(50) null, - browser_name NVARCHAR(50) null, - browser_version NVARCHAR(50) null, - mobile_device tinyint null, - primary key (clickstream_id) -); -create table multi_tree ( - child NVARCHAR(36) not null, - parent1 NVARCHAR(36) not null, - parent2 NVARCHAR(36) not null, - relation_type NVARCHAR(64) not null, - tree_order int null, - personalization NVARCHAR(255) not null default 'dot:default', - variant_id NVARCHAR(255) default 'DEFAULT' not null, - primary key (child, parent1, parent2, relation_type, personalization, variant_id) -); -create table workflow_task ( - id NVARCHAR(36) not null, - creation_date datetimeoffset(3) null, - mod_date datetimeoffset(3) null, - due_date datetimeoffset(3) null, - created_by NVARCHAR(255) null, - assigned_to NVARCHAR(36) null, - belongs_to NVARCHAR(255) null, - title NVARCHAR(255) null, - description NVARCHAR(MAX) null, - status NVARCHAR(36) null, - webasset NVARCHAR(36) null, - language_id NUMERIC(19,0) null, - primary key (id) -); - -create table workflow_action_mappings ( - id NVARCHAR(36) primary key, - action NVARCHAR(36) not null, - workflow_action NVARCHAR(255) not null, - scheme_or_content_type NVARCHAR(255) not null -); - -CREATE UNIQUE INDEX idx_workflow_action_mappings ON workflow_action_mappings (action, workflow_action, scheme_or_content_type); - -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('3d6be719-6b61-4ef8-a594-a9764e461597','NEW' ,'ceca71a0-deee-4999-bd47-b01baa1bcfc8','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('63865890-c863-43a1-ab61-4b495dba5eb5','EDIT' ,'ceca71a0-deee-4999-bd47-b01baa1bcfc8','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('2016a72e-85c7-4ee0-936f-36ce52df355e','PUBLISH' ,'000ec468-0a63-4283-beb7-fcb36c107b2f','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('3ec446c8-a9b6-47fe-830f-1e623493090c','UNPUBLISH','38efc763-d78f-4e4b-b092-59cd8c579b93','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('e7b8c8a3-e605-473c-8680-6d95cac15c9b','ARCHIVE' ,'4da13a42-5d59-480c-ad8f-94a3adf809fe','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('99019118-df2c-4297-a5aa-2fe3fe0f52ce','UNARCHIVE','c92f9aa1-9503-4567-ac30-d3242b54d02d','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('d073436e-3c10-4e4c-8c97-225e9cddf320','DELETE' ,'777f1c6b-c877-4a37-ba4b-10627316c2cc','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('3d73437e-3f1c-8e5c-ac97-a25e9cddf320','DESTROY' ,'1e0f1c6b-b67f-4c99-983d-db2b4bfa88b2','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); - -create table tag_inode ( - tag_id NVARCHAR(100) not null, - inode NVARCHAR(100) not null, - field_var_name NVARCHAR(255), - mod_date datetimeoffset(3) null, - primary key (tag_id, inode) -); -create table click ( - inode NVARCHAR(36) not null, - link NVARCHAR(255) null, - click_count int null, - primary key (inode) -); -create table challenge_question ( - cquestionid numeric(19,0) not null, - cqtext NVARCHAR(255) null, - primary key (cquestionid) -); -create table layouts_cms_roles ( - id NVARCHAR(36) not null, - layout_id NVARCHAR(36) not null, - role_id NVARCHAR(36) not null, - primary key (id) -); -create table clickstream_request ( - clickstream_request_id numeric(19,0) identity not null, - clickstream_id numeric(19,0) null, - server_name NVARCHAR(255) null, - protocol NVARCHAR(255) null, - server_port int null, - request_uri NVARCHAR(255) null, - request_order int null, - query_string NVARCHAR(MAX) null, - language_id numeric(19,0) null, - timestampper datetimeoffset(3) null, - host_id NVARCHAR(36) null, - associated_identifier NVARCHAR(36) null, - primary key (clickstream_request_id) -); -create table content_rating ( - id numeric(19,0) identity not null, - rating float null, - user_id NVARCHAR(255) null, - session_id NVARCHAR(255) null, - identifier NVARCHAR(36) null, - rating_date datetimeoffset(3) null, - user_ip NVARCHAR(255) null, - long_live_cookie_id NVARCHAR(255) null, - primary key (id) -); -create table chain_state ( - id numeric(19,0) identity not null, - chain_id numeric(19,0) not null, - link_code_id numeric(19,0) not null, - state_order numeric(19,0) not null, - primary key (id) -); -create table analytic_summary_workstream ( - id numeric(19,0) identity not null, - inode NVARCHAR(255) null, - asset_type NVARCHAR(255) null, - mod_user_id NVARCHAR(255) null, - host_id NVARCHAR(36) null, - mod_date datetimeoffset(3) null, - action NVARCHAR(255) null, - name NVARCHAR(255) null, - primary key (id) -); -create table dashboard_user_preferences ( - id numeric(19,0) identity not null, - summary_404_id numeric(19,0) null, - user_id NVARCHAR(255) null, - ignored tinyint null, - mod_date datetimeoffset(3) null, - primary key (id) -); -create table campaign ( - inode NVARCHAR(36) not null, - title NVARCHAR(255) null, - from_email NVARCHAR(255) null, - from_name NVARCHAR(255) null, - subject NVARCHAR(255) null, - message NVARCHAR(MAX) null, - user_id NVARCHAR(255) null, - start_date datetimeoffset(3) null, - completed_date datetimeoffset(3) null, - active tinyint null, - locked tinyint null, - sends_per_hour NVARCHAR(15) null, - sendemail tinyint null, - communicationinode NVARCHAR(36) null, - userfilterinode NVARCHAR(36) null, - sendto NVARCHAR(15) null, - isrecurrent tinyint null, - wassent tinyint null, - expiration_date datetimeoffset(3) null, - parent_campaign NVARCHAR(36) null, - primary key (inode) -); -create table workflowtask_files ( - id NVARCHAR(36) not null, - workflowtask_id NVARCHAR(36) not null, - file_inode NVARCHAR(36) not null, - primary key (id) -); -create table analytic_summary_referer ( - id numeric(19,0) identity not null, - summary_id numeric(19,0) not null, - hits numeric(19,0) null, - uri NVARCHAR(255) null, - primary key (id) -); -create table dot_containers ( - inode NVARCHAR(36) not null, - code NVARCHAR(MAX) null, - pre_loop NVARCHAR(MAX) null, - post_loop NVARCHAR(MAX) null, - show_on_menu tinyint null, - title NVARCHAR(255) null, - mod_date datetimeoffset(3) null, - mod_user NVARCHAR(100) null, - sort_order int null, - friendly_name NVARCHAR(255) null, - max_contentlets int null, - use_div tinyint null, - staticify tinyint null, - sort_contentlets_by NVARCHAR(255) null, - lucene_query NVARCHAR(MAX) null, - notes NVARCHAR(255) null, - identifier NVARCHAR(36) null, - primary key (inode) -); -create table communication ( - inode NVARCHAR(36) not null, - title NVARCHAR(255) null, - trackback_link_inode NVARCHAR(36) null, - communication_type NVARCHAR(255) null, - from_name NVARCHAR(255) null, - from_email NVARCHAR(255) null, - email_subject NVARCHAR(255) null, - html_page_inode NVARCHAR(36) null, - text_message NVARCHAR(MAX) null, - mod_date datetimeoffset(3) null, - modified_by NVARCHAR(255) null, - ext_comm_id NVARCHAR(255) null, - primary key (inode) -); -create table workflow_history ( - id NVARCHAR(36) not null, - creation_date datetimeoffset(3) null, - made_by NVARCHAR(255) null, - change_desc NVARCHAR(MAX) null, - workflowtask_id NVARCHAR(36) null, - workflow_action_id NVARCHAR(36) null, - workflow_step_id NVARCHAR(36) null, - primary key (id) -); -create table host_variable ( - id NVARCHAR(36) not null, - host_id NVARCHAR(36) null, - variable_name NVARCHAR(255) null, - variable_key NVARCHAR(255) null, - variable_value NVARCHAR(255) null, - user_id NVARCHAR(255) null, - last_mod_date datetimeoffset(3) null, - primary key (id) -); -create table links ( - inode NVARCHAR(36) not null, - show_on_menu tinyint null, - title NVARCHAR(255) null, - mod_date datetimeoffset(3) null, - mod_user NVARCHAR(100) null, - sort_order int null, - friendly_name NVARCHAR(255) null, - protocal NVARCHAR(100) null, - url NVARCHAR(255) null, - target NVARCHAR(100) null, - internal_link_identifier NVARCHAR(36) null, - link_type NVARCHAR(255) null, - link_code NVARCHAR(MAX) null, - identifier NVARCHAR(36) null, - primary key (inode) -); -create table chain_state_parameter ( - id numeric(19,0) identity not null, - chain_state_id numeric(19,0) not null, - name NVARCHAR(255) not null, - value NVARCHAR(255) not null, - primary key (id) -); -create table field ( - inode NVARCHAR(36) not null, - structure_inode NVARCHAR(255) null, - field_name NVARCHAR(255) null, - field_type NVARCHAR(255) null, - field_relation_type NVARCHAR(255) null, - field_contentlet NVARCHAR(255) null, - required tinyint null, - indexed tinyint null, - listed tinyint null, - velocity_var_name NVARCHAR(255) null, - sort_order int null, - field_values NVARCHAR(MAX) null, - regex_check NVARCHAR(255) null, - hint NVARCHAR(255) null, - default_value NVARCHAR(255) null, - fixed tinyint null, - read_only tinyint null, - searchable tinyint null, - unique_ tinyint null, - mod_date datetimeoffset(3) null, - primary key (inode) -); -create table relationship ( - inode NVARCHAR(36) not null, - parent_structure_inode NVARCHAR(255) null, - child_structure_inode NVARCHAR(255) null, - parent_relation_name NVARCHAR(255) null, - child_relation_name NVARCHAR(255) null, - relation_type_value NVARCHAR(255) null, - cardinality int null, - parent_required tinyint null, - child_required tinyint null, - fixed tinyint null, - mod_date datetimeoffset(3) null, - primary key (inode), - unique (relation_type_value) -); -create table folder ( - inode NVARCHAR(36) not null, - name NVARCHAR(255) null, - title NVARCHAR(255) not null, - show_on_menu tinyint null, - sort_order int null, - files_masks NVARCHAR(255) null, - identifier NVARCHAR(36) null, - default_file_type NVARCHAR(36) null, - mod_date datetimeoffset(3) null, - owner NVARCHAR(255) null, - idate datetimeoffset(3) null, - primary key (inode) -); -create table clickstream_404 ( - clickstream_404_id numeric(19,0) identity not null, - referer_uri NVARCHAR(255) null, - query_string NVARCHAR(MAX) null, - request_uri NVARCHAR(255) null, - user_id NVARCHAR(255) null, - host_id NVARCHAR(36) null, - timestampper datetimeoffset(3) null, - primary key (clickstream_404_id) -); -create table cms_layout ( - id NVARCHAR(36) not null, - layout_name NVARCHAR(255) not null, - description NVARCHAR(255) null, - tab_order int null, - primary key (id) -); -create table field_variable ( - id NVARCHAR(36) not null, - field_id NVARCHAR(36) null, - variable_name NVARCHAR(255) null, - variable_key NVARCHAR(255) null, - variable_value NVARCHAR(MAX) null, - user_id NVARCHAR(255) null, - last_mod_date datetimeoffset(3) null, - primary key (id) -); -create table report_parameter ( - inode NVARCHAR(36) not null, - report_inode NVARCHAR(36) null, - parameter_description NVARCHAR(1000) null, - parameter_name NVARCHAR(255) null, - class_type NVARCHAR(250) null, - default_value NVARCHAR(4000) null, - primary key (inode), - unique (report_inode, parameter_name) -); -create table chain ( - id numeric(19,0) identity not null, - key_name NVARCHAR(255) null unique, - name NVARCHAR(255) not null, - success_value NVARCHAR(255) not null, - failure_value NVARCHAR(255) not null, - primary key (id) -); -create table link_version_info ( - identifier NVARCHAR(36) not null, - working_inode NVARCHAR(36) not null, - live_inode NVARCHAR(36) null, - deleted tinyint not null, - locked_by NVARCHAR(100) null, - locked_on datetimeoffset(3) null, - version_ts datetimeoffset(3) not null, - primary key (identifier) -); -create table template_containers ( - id NVARCHAR(36) not null, - template_id NVARCHAR(36) not null, - container_id NVARCHAR(36) not null, - primary key (id) -); -create table user_filter ( - inode NVARCHAR(36) not null, - title NVARCHAR(255) null, - firstname NVARCHAR(100) null, - middlename NVARCHAR(100) null, - lastname NVARCHAR(100) null, - emailaddress NVARCHAR(100) null, - birthdaytypesearch NVARCHAR(100) null, - birthday datetimeoffset(3) null, - birthdayfrom datetimeoffset(3) null, - birthdayto datetimeoffset(3) null, - lastlogintypesearch NVARCHAR(100) null, - lastloginsince NVARCHAR(100) null, - loginfrom datetimeoffset(3) null, - loginto datetimeoffset(3) null, - createdtypesearch NVARCHAR(100) null, - createdsince NVARCHAR(100) null, - createdfrom datetimeoffset(3) null, - createdto datetimeoffset(3) null, - lastvisittypesearch NVARCHAR(100) null, - lastvisitsince NVARCHAR(100) null, - lastvisitfrom datetimeoffset(3) null, - lastvisitto datetimeoffset(3) null, - city NVARCHAR(100) null, - state NVARCHAR(100) null, - country NVARCHAR(100) null, - zip NVARCHAR(100) null, - cell NVARCHAR(100) null, - phone NVARCHAR(100) null, - fax NVARCHAR(100) null, - active_ NVARCHAR(255) null, - tagname NVARCHAR(255) null, - var1 NVARCHAR(255) null, - var2 NVARCHAR(255) null, - var3 NVARCHAR(255) null, - var4 NVARCHAR(255) null, - var5 NVARCHAR(255) null, - var6 NVARCHAR(255) null, - var7 NVARCHAR(255) null, - var8 NVARCHAR(255) null, - var9 NVARCHAR(255) null, - var10 NVARCHAR(255) null, - var11 NVARCHAR(255) null, - var12 NVARCHAR(255) null, - var13 NVARCHAR(255) null, - var14 NVARCHAR(255) null, - var15 NVARCHAR(255) null, - var16 NVARCHAR(255) null, - var17 NVARCHAR(255) null, - var18 NVARCHAR(255) null, - var19 NVARCHAR(255) null, - var20 NVARCHAR(255) null, - var21 NVARCHAR(255) null, - var22 NVARCHAR(255) null, - var23 NVARCHAR(255) null, - var24 NVARCHAR(255) null, - var25 NVARCHAR(255) null, - categories NVARCHAR(255) null, - primary key (inode) -); -create table inode ( - inode NVARCHAR(36) not null, - owner NVARCHAR(255) null, - idate datetimeoffset(3) null, - type NVARCHAR(64) null, - primary key (inode) -); -alter table analytic_summary_pages add constraint fka1ad33b9ed30e054 foreign key (summary_id) references analytic_summary; -create index idx_user_comments_1 on user_comments (user_id); -alter table user_comments add constraint fkdf1b37e85fb51eb foreign key (inode) references inode; -create index idx_trackback_2 on trackback (url); -create index idx_trackback_1 on trackback (asset_identifier); -create index idx_mailinglist_1 on mailing_list (user_id); -alter table mailing_list add constraint fk7bc2cd925fb51eb foreign key (inode) references inode; -create index idx_communication_user_id on recipient (user_id); -create index idx_recipiets_1 on recipient (email); -create index idx_recipiets_2 on recipient (sent); -alter table recipient add constraint fk30e172195fb51eb foreign key (inode) references inode; -create index idx_user_webform_1 on web_form (form_type); -create index idx_analytic_summary_period_4 on analytic_summary_period (month); -create index idx_analytic_summary_period_3 on analytic_summary_period (week); -create index idx_analytic_summary_period_2 on analytic_summary_period (day); -create index idx_analytic_summary_period_5 on analytic_summary_period (year); -create index idx_analytic_summary_1 on analytic_summary (host_id); -create index idx_analytic_summary_2 on analytic_summary (visits); -create index idx_analytic_summary_3 on analytic_summary (page_views); -alter table analytic_summary add constraint fk9e1a7f4b7b46300 foreign key (summary_period_id) references analytic_summary_period; -alter table template add constraint fkb13acc7a5fb51eb foreign key (inode) references inode; -alter table analytic_summary_content add constraint fk53cb4f2eed30e054 foreign key (summary_id) references analytic_summary; -alter table structure add constraint fk89d2d735fb51eb foreign key (inode) references inode; -create index idx_permission_2 on permission (permission_type, inode_id); -create index idx_permission_3 on permission (roleid); -alter table contentlet add constraint fkfc4ef025fb51eb foreign key (inode) references inode; -create index idx_analytic_summary_404_1 on analytic_summary_404 (host_id); -alter table analytic_summary_404 add constraint fk7050866db7b46300 foreign key (summary_period_id) references analytic_summary_period; -alter table report_asset add constraint fk3765ec255fb51eb foreign key (inode) references inode; -create index idx_category_1 on category (category_name); -create index idx_category_2 on category (category_key); -alter table category add constraint fk302bcfe5fb51eb foreign key (inode) references inode; -create index idx_chain_link_code_classname on chain_link_code (class_name); -create index idx_analytic_summary_visits_2 on analytic_summary_visits (visit_time); -create index idx_analytic_summary_visits_1 on analytic_summary_visits (host_id); -alter table analytic_summary_visits add constraint fk9eac9733b7b46300 foreign key (summary_period_id) references analytic_summary_period; -create index idx_preference_1 on user_preferences (preference); -create index idx_identifier_pub on identifier (syspublish_date); -create index idx_identifier_exp on identifier (sysexpire_date); -create index idx_identifier_asset_subtype on identifier (asset_subtype); -create index idx_user_clickstream11 on clickstream (host_id); -create index idx_user_clickstream12 on clickstream (last_page_id); -create index idx_user_clickstream15 on clickstream (browser_name); -create index idx_user_clickstream_2 on clickstream (user_id); -create index idx_user_clickstream16 on clickstream (browser_version); -create index idx_user_clickstream_1 on clickstream (cookie_id); -create index idx_user_clickstream13 on clickstream (first_page_id); -create index idx_user_clickstream14 on clickstream (operating_system); -create index idx_user_clickstream17 on clickstream (remote_address); -create index idx_multitree_1 on multi_tree (relation_type); - -create index idx_workflow_6 on workflow_task (language_id); -create index idx_workflow_4 on workflow_task (webasset); -create index idx_workflow_5 on workflow_task (created_by); -create index idx_workflow_2 on workflow_task (belongs_to); -create index idx_workflow_3 on workflow_task (status); -create index idx_workflow_1 on workflow_task (assigned_to); -create index idx_click_1 on click (link); -alter table click add constraint fk5a5c5885fb51eb foreign key (inode) references inode; -create index idx_user_clickstream_request_2 on clickstream_request (request_uri); -create index idx_user_clickstream_request_1 on clickstream_request (clickstream_id); -create index idx_user_clickstream_request_4 on clickstream_request (timestampper); -create index idx_user_clickstream_request_3 on clickstream_request (associated_identifier); -create index idx_dashboard_workstream_2 on analytic_summary_workstream (host_id); -create index idx_dashboard_workstream_1 on analytic_summary_workstream (mod_user_id); -create index idx_dashboard_workstream_3 on analytic_summary_workstream (mod_date); -create index idx_dashboard_prefs_2 on dashboard_user_preferences (user_id); -alter table dashboard_user_preferences add constraint fk496242cfd12c0c3b foreign key (summary_404_id) references analytic_summary_404; -create index idx_campaign_4 on campaign (expiration_date); -create index idx_campaign_3 on campaign (completed_date); -create index idx_campaign_2 on campaign (start_date); -create index idx_campaign_1 on campaign (user_id); -alter table campaign add constraint fkf7a901105fb51eb foreign key (inode) references inode; -alter table analytic_summary_referer add constraint fk5bc0f3e2ed30e054 foreign key (summary_id) references analytic_summary; -alter table dot_containers add constraint fk8a844125fb51eb foreign key (inode) references inode; -alter table communication add constraint fkc24acfd65fb51eb foreign key (inode) references inode; -alter table links add constraint fk6234fb95fb51eb foreign key (inode) references inode; -create index idx_field_1 on field (structure_inode); -alter table field add constraint fk5cea0fa5fb51eb foreign key (inode) references inode; -create index idx_relationship_1 on relationship (parent_structure_inode); -create index idx_relationship_2 on relationship (child_structure_inode); -create index idx_folder_1 on folder (name); -create index idx_user_clickstream_404_2 on clickstream_404 (user_id); -create index idx_user_clickstream_404_3 on clickstream_404 (host_id); -create index idx_user_clickstream_404_1 on clickstream_404 (request_uri); -alter table report_parameter add constraint fk22da125e5fb51eb foreign key (inode) references inode; -create index idx_chain_key_name on chain (key_name); -alter table user_filter add constraint fke042126c5fb51eb foreign key (inode) references inode; -create index idx_index_1 on inode (type); ---mssql -CREATE INDEX idx_tree ON tree (child, parent, relation_type); -CREATE INDEX idx_tree_1 ON tree (parent); -CREATE INDEX idx_tree_2 ON tree (child); -CREATE INDEX idx_tree_3 ON tree (relation_type); -CREATE INDEX idx_tree_4 ON tree (parent, child, relation_type); -CREATE INDEX idx_tree_5 ON tree (parent, relation_type); -CREATE INDEX idx_tree_6 ON tree (child, relation_type); - -CREATE INDEX idx_contentlet_3 ON contentlet (inode); - -CREATE INDEX idx_identifier ON identifier (id); -CREATE INDEX idx_permisision_4 ON permission (permission_type); - - -CREATE INDEX idx_permission_reference_2 ON permission_reference (reference_id); -CREATE INDEX idx_permission_reference_3 ON permission_reference (reference_id,permission_type); -CREATE INDEX idx_permission_reference_4 ON permission_reference (asset_id,permission_type); -CREATE INDEX idx_permission_reference_5 ON permission_reference (asset_id,reference_id,permission_type); -CREATE INDEX idx_permission_reference_6 ON permission_reference (permission_type); - -CREATE UNIQUE INDEX idx_field_velocity_structure ON field (velocity_var_name,structure_inode); - -alter table chain_state add constraint fk_state_chain foreign key (chain_id) references chain(id); -alter table chain_state add constraint fk_state_code foreign key (link_code_id) references chain_link_code(id); -alter table chain_state_parameter add constraint fk_parameter_state foreign key (chain_state_id) references chain_state(id); - -alter table permission add constraint permission_role_fk foreign key (roleid) references cms_role(id); - -alter table contentlet add constraint FK_structure_inode foreign key (structure_inode) references structure(inode); - -ALTER TABLE structure ALTER COLUMN fixed tinyint NOT NULL; -alter table structure add CONSTRAINT [DF_structure_fixed] DEFAULT ((0)) for fixed; - -ALTER TABLE field ALTER COLUMN fixed tinyint NOT NULL; -ALTER TABLE field ALTER COLUMN read_only tinyint NOT NULL; -ALTER TABLE campaign ALTER COLUMN active tinyint NOT NULL; -alter table field add CONSTRAINT [DF_field_fixed] DEFAULT ((0)) for fixed; -alter table field add CONSTRAINT [DF_field_read_only] DEFAULT ((0)) for read_only; - -insert into User_ (userId, companyId, createDate, password_, passwordEncrypted, passwordReset, firstName, middleName, lastName, male, birthday, emailAddress, skinId, dottedSkins, roundedSkins, greeting, layoutIds, loginDate, failedLoginAttempts, agreedToTermsOfUse, active_) values ('dotcms.org.default', 'default', GetDate(), 'password', '0', '0', '', '', '', '1', '19700101', 'default@dotcms.org', '01', '0', '0', 'Welcome!', '', GetDate(), 0, '0', '1'); - -create index addres_userid_index on address(userid); -create index tag_user_id_index on tag(user_id); -create index tag_is_persona_index on tag(persona); -create index tag_inode_tagid on tag_inode(tag_id); -create index tag_inode_inode on tag_inode(inode); -CREATE TABLE dist_journal - ( - id bigint NOT NULL IDENTITY (1, 1), - object_to_index NVARCHAR(1024) NOT NULL, - serverid NVARCHAR(64) NOT NULL, - journal_type int NOT NULL, - time_entered datetimeoffset(3) NOT NULL - ) ; - -ALTER TABLE dist_journal ADD CONSTRAINT - PK_dist_journal PRIMARY KEY CLUSTERED - ( - id - ); - - -ALTER TABLE dist_journal ADD CONSTRAINT - IX_dist_journal UNIQUE NONCLUSTERED - ( - object_to_index, - serverid, - journal_type - ); -CREATE TABLE dist_process ( id bigint NOT NULL IDENTITY (1, 1), object_to_index NVARCHAR(1024) NOT NULL, serverid NVARCHAR(64) NOT NULL, journal_type int NOT NULL, time_entered datetimeoffset(3) NOT NULL ) ; -ALTER TABLE dist_process ADD CONSTRAINT PK_dist_process PRIMARY KEY CLUSTERED ( id); - -create table plugin_property ( - plugin_id NVARCHAR(255) not null, - propkey NVARCHAR(255) not null, - original_value NVARCHAR(255) not null, - current_value NVARCHAR(255) not null, - primary key (plugin_id, propkey) -); - -alter table plugin_property add constraint fk_plugin_plugin_property foreign key (plugin_id) references plugin(id); - -CREATE TABLE dist_reindex_journal ( id bigint NOT NULL IDENTITY (1, 1), inode_to_index NVARCHAR(100) NOT NULL,ident_to_index NVARCHAR(100) NOT NULL, serverid NVARCHAR(64), priority int NOT NULL, time_entered datetimeoffset(3) DEFAULT getDate(), index_val NVARCHAR(325),dist_action integer NOT NULL DEFAULT 1); - -CREATE INDEX dist_reindex_index1 on dist_reindex_journal (inode_to_index); -CREATE INDEX dist_reindex_index2 on dist_reindex_journal (dist_action); -CREATE INDEX dist_reindex_index3 on dist_reindex_journal (serverid); -CREATE INDEX dist_reindex_index4 on dist_reindex_journal (ident_to_index,serverid); -CREATE INDEX dist_reindex_index on dist_reindex_journal (serverid,dist_action); -CREATE INDEX dist_reindex_index5 ON dist_reindex_journal (priority, time_entered); -CREATE INDEX dist_reindex_index6 ON dist_reindex_journal (priority); - -ALTER TABLE dist_reindex_journal ADD CONSTRAINT PK_dist_reindex_journal PRIMARY KEY CLUSTERED ( id); - -CREATE TABLE quartz_log ( id bigint NOT NULL IDENTITY (1, 1), JOB_NAME NVARCHAR(255) NOT NULL, serverid NVARCHAR(64) , time_started datetimeoffset(3) NOT NULL, primary key (id)); - -CREATE TRIGGER check_role_key_uniqueness -ON cms_role -FOR INSERT, UPDATE -AS -DECLARE @c NVARCHAR(100) -SELECT @c = count(*) -FROM cms_role e INNER JOIN inserted i ON i.role_key = e.role_key WHERE i.role_key IS NOT NULL AND i.id <> e.id -IF (@c > 0) -BEGIN - RAISERROR ('Duplicated role key.', 16, 1) - ROLLBACK TRANSACTION -END; - -CREATE TRIGGER check_identifier_host_inode -ON identifier -FOR INSERT, UPDATE AS -DECLARE @assetType NVARCHAR(10) -DECLARE @hostInode NVARCHAR(50) -DECLARE cur_Inserted cursor -LOCAL FAST_FORWARD for - Select asset_type, host_inode - from inserted - for Read Only -open cur_Inserted -fetch next from cur_Inserted into @assetType,@hostInode -while @@FETCH_STATUS <> -1 -BEGIN - IF(@assetType <> 'content' AND (@hostInode is null OR @hostInode = '')) - BEGIN - RAISERROR (N'Cannot insert/update a null or empty host inode for this kind of identifier', 10, 1) - ROLLBACK WORK - END -fetch next from cur_Inserted into @assetType,@hostInode -END; - -ALTER TABLE cms_role ADD CONSTRAINT IX_cms_role2 UNIQUE NONCLUSTERED (db_fqn); -alter table cms_role add constraint fkcms_role_parent foreign key (parent) references cms_role; - -ALTER TABLE users_cms_roles ADD CONSTRAINT IX_cms_role UNIQUE NONCLUSTERED (role_id, user_id); -alter table users_cms_roles add constraint fkusers_cms_roles1 foreign key (role_id) references cms_role; -alter table users_cms_roles add constraint fkusers_cms_roles2 foreign key (user_id) references user_; - -ALTER TABLE cms_layout ADD CONSTRAINT IX_cms_layout UNIQUE NONCLUSTERED (layout_name); - -ALTER TABLE portlet ADD CONSTRAINT IX_portletid UNIQUE NONCLUSTERED (portletid); - -ALTER TABLE cms_layouts_portlets ADD CONSTRAINT IX_cms_layouts_portlets UNIQUE NONCLUSTERED (portlet_id, layout_id); -alter table cms_layouts_portlets add constraint fklcms_layouts_portlets foreign key (layout_id) references cms_layout; - -ALTER TABLE layouts_cms_roles ADD CONSTRAINT IX_layouts_cms_roles UNIQUE NONCLUSTERED (role_id, layout_id); -alter table layouts_cms_roles add constraint fklayouts_cms_roles1 foreign key (role_id) references cms_role; -alter table layouts_cms_roles add constraint fklayouts_cms_roles2 foreign key (layout_id) references cms_layout; - -ALTER TABLE dot_containers add constraint containers_identifier_fk foreign key (identifier) references identifier(id); -ALTER TABLE template add constraint template_identifier_fk foreign key (identifier) references identifier(id); -ALTER TABLE contentlet add constraint content_identifier_fk foreign key (identifier) references identifier(id); -ALTER TABLE links add constraint links_identifier_fk foreign key (identifier) references identifier(id); - - -create table dist_reindex_lock (dummy int not null); -ALTER TABLE dist_reindex_lock ADD CONSTRAINT PK_dist_reindex_lock PRIMARY KEY CLUSTERED (dummy); -create table dist_lock (dummy int not null); -ALTER TABLE dist_lock ADD CONSTRAINT PK_dist_lock PRIMARY KEY CLUSTERED (dummy); -insert into dist_reindex_lock (dummy) values (1); -insert into dist_lock (dummy) values (1); - -create table import_audit ( - id bigint not null, - start_date datetimeoffset(3), - userid NVARCHAR(255), - filename NVARCHAR(512), - status int, - last_inode NVARCHAR(100), - records_to_import bigint, - serverid NVARCHAR(255), - primary key (id) - ); - -alter table category alter column category_velocity_var_name NVARCHAR(255) not null; - -alter table import_audit add warnings NVARCHAR(MAX), - errors NVARCHAR(MAX), - results NVARCHAR(MAX), - messages NVARCHAR(MAX); - -alter table structure add CONSTRAINT [DF_structure_host] DEFAULT 'SYSTEM_HOST' for host; -alter table structure add CONSTRAINT [DF_structure_folder] DEFAULT 'SYSTEM_FOLDER' for folder; -alter table structure add CONSTRAINT [CK_structure_host] CHECK(host <> '' AND host IS NOT NULL); -alter table structure alter column velocity_var_name NVARCHAR(255) not null; -alter table structure add constraint unique_struct_vel_var_name unique (velocity_var_name); - -CREATE TRIGGER structure_host_folder_trigger -ON structure -FOR INSERT, UPDATE AS -DECLARE @newFolder NVARCHAR(100) -DECLARE @newHost NVARCHAR(100) -DECLARE @folderInode NVARCHAR(100) -DECLARE @hostInode NVARCHAR(100) -DECLARE cur_Inserted cursor -LOCAL FAST_FORWARD for - Select folder, host - from inserted - for Read Only -open cur_Inserted -fetch next from cur_Inserted into @newFolder,@newHost -while @@FETCH_STATUS <> -1 -BEGIN - IF (@newHost <> 'SYSTEM_HOST' AND @newFolder <> 'SYSTEM_FOLDER') - BEGIN - SELECT @hostInode = identifier.host_inode, @folderInode = folder.inode from folder,identifier where folder.identifier = identifier.id and folder.inode = @newFolder - IF (@folderInode IS NULL OR @folderInode = '' OR @newHost <> @hostInode) - BEGIN - RAISERROR (N'Cannot assign host/folder to structure, folder does not belong to given host', 10, 1) - ROLLBACK WORK - END - END -fetch next from cur_Inserted into @newFolder,@newHost -END; - -CREATE Trigger check_content_versions -ON contentlet -FOR DELETE AS - DECLARE @totalCount int - DECLARE @identifier NVARCHAR(100) - DECLARE content_cur_Deleted cursor LOCAL FAST_FORWARD for - Select identifier - from deleted - for Read Only - open content_cur_Deleted - fetch next from content_cur_Deleted into @identifier - while @@FETCH_STATUS <> -1 - BEGIN - select @totalCount = count(*) from contentlet where identifier = @identifier - IF (@totalCount = 0) - BEGIN - DELETE from identifier where id = @identifier - END -fetch next from content_cur_Deleted into @identifier -END; - -CREATE Trigger check_link_versions -ON links -FOR DELETE AS - DECLARE @totalCount int - DECLARE @identifier NVARCHAR(100) - DECLARE link_cur_Deleted cursor LOCAL FAST_FORWARD for - Select identifier - from deleted - for Read Only - open link_cur_Deleted - fetch next from link_cur_Deleted into @identifier - while @@FETCH_STATUS <> -1 - BEGIN - select @totalCount = count(*) from links where identifier = @identifier - IF (@totalCount = 0) - BEGIN - DELETE from identifier where id = @identifier - END -fetch next from link_cur_Deleted into @identifier -END; - -CREATE Trigger check_container_versions -ON dot_containers -FOR DELETE AS - DECLARE @totalCount int - DECLARE @identifier NVARCHAR(100) - DECLARE container_cur_Deleted cursor LOCAL FAST_FORWARD for - Select identifier - from deleted - for Read Only - open container_cur_Deleted - fetch next from container_cur_Deleted into @identifier - while @@FETCH_STATUS <> -1 - BEGIN - select @totalCount = count(*) from dot_containers where identifier = @identifier - IF (@totalCount = 0) - BEGIN - DELETE from identifier where id = @identifier - END -fetch next from container_cur_Deleted into @identifier -END; - - -CREATE Trigger check_template_versions -ON template -FOR DELETE AS - DECLARE @totalCount int - DECLARE @identifier NVARCHAR(100) - DECLARE template_cur_Deleted cursor LOCAL FAST_FORWARD for - Select identifier - from deleted - for Read Only - open template_cur_Deleted - fetch next from template_cur_Deleted into @identifier - while @@FETCH_STATUS <> -1 - BEGIN - select @totalCount = count(*) from template where identifier = @identifier - IF (@totalCount = 0) - BEGIN - DELETE from identifier where id = @identifier - END -fetch next from template_cur_Deleted into @identifier -END; - -CREATE Trigger check_identifier_parent_path - ON identifier - FOR INSERT,UPDATE AS - DECLARE @folderId NVARCHAR(100) - DECLARE @id NVARCHAR(100) - DECLARE @assetType NVARCHAR(100) - DECLARE @parentPath NVARCHAR(255) - DECLARE @hostInode NVARCHAR(100) - DECLARE cur_Inserted cursor LOCAL FAST_FORWARD for - Select id,asset_type,parent_path,host_inode - from inserted - for Read Only - open cur_Inserted - fetch next from cur_Inserted into @id,@assetType,@parentPath,@hostInode - while @@FETCH_STATUS <> -1 - BEGIN - IF(@parentPath <>'/' AND @parentPath <>'/System folder') - BEGIN - select @folderId = id from identifier where asset_type='folder' and host_inode = @hostInode and parent_path+asset_name+'/' = @parentPath and id <>@id - IF (@folderId IS NULL) - BEGIN - RAISERROR (N'Cannot insert/update parent folder %s [%s] as one or more folders do not exist in Site %s', 10, 1, @parentPath, @id, @hostInode) - ROLLBACK WORK - END - END - fetch next from cur_Inserted into @id,@assetType,@parentPath,@hostInode -END; - -alter table structure add constraint fk_structure_host foreign key (host) references identifier(id); - -create index idx_template3 on template (title); - -CREATE INDEX idx_contentlet_4 ON contentlet (structure_inode); - -CREATE INDEX idx_contentlet_identifier ON contentlet (identifier); - -ALTER TABLE Folder add constraint folder_identifier_fk foreign key (identifier) references identifier(id); ---ALTER TABLE dot_containers add constraint structure_fk foreign key (structure_inode) references structure(inode); - -CREATE Trigger folder_identifier_check -ON folder -FOR DELETE AS -DECLARE @totalCount int -DECLARE @identifier NVARCHAR(100) -DECLARE folder_cur_Deleted cursor LOCAL FAST_FORWARD for - Select identifier - from deleted - for Read Only - open folder_cur_Deleted - fetch next from folder_cur_Deleted into @identifier - while @@FETCH_STATUS <> -1 - BEGIN - select @totalCount = count(*) from folder where identifier = @identifier - IF (@totalCount = 0) - BEGIN - DELETE from identifier where id = @identifier - END - fetch next from folder_cur_Deleted into @identifier -END; - -alter table contentlet add constraint fk_user_contentlet foreign key (mod_user) references user_(userid); -alter table dot_containers add constraint fk_user_containers foreign key (mod_user) references user_(userid); -alter table template add constraint fk_user_template foreign key (mod_user) references user_(userid); -alter table links add constraint fk_user_links foreign key (mod_user) references user_(userid); - -create index idx_template_id on template_containers(template_id); -alter table template_containers add constraint FK_template_id foreign key (template_id) references identifier(id); -alter table template_containers add constraint FK_container_id foreign key (container_id) references identifier(id); - -CREATE Trigger check_child_assets -on identifier -FOR DELETE AS -DECLARE @pathCount int -DECLARE @identifier NVARCHAR(100) -DECLARE @assetType NVARCHAR(100) -DECLARE @assetName NVARCHAR(255) -DECLARE @parentPath NVARCHAR(255) -DECLARE @hostInode NVARCHAR(100) -DECLARE cur_Deleted cursor LOCAL FAST_FORWARD for - Select id,asset_type,asset_name,parent_path,host_inode - from deleted - for Read Only - open cur_Deleted - fetch next from cur_Deleted into @identifier,@assetType,@assetName,@parentPath,@hostInode - while @@FETCH_STATUS <> -1 - BEGIN - IF(@assetType='folder') - BEGIN - select @pathCount = count(*) from identifier where parent_path= @parentPath+@assetName+'/' and host_inode = @hostInode - END - IF(@assetType='contentlet') - BEGIN - select @pathCount = count(*) from identifier where host_inode = @identifier - END - IF (@pathCount > 0) - BEGIN - RAISERROR (N'Cannot delete as this path has children', 10, 1) - ROLLBACK WORK - END -fetch next from cur_Deleted into @identifier,@assetType,@assetName,@parentPath,@hostInode -END; - -CREATE PROCEDURE renameFolderChildren @oldPath NVARCHAR(255),@newPath NVARCHAR(255),@hostInode NVARCHAR(100) AS -DECLARE @newFolderPath NVARCHAR(255) -DECLARE @oldFolderPath NVARCHAR(255) -DECLARE @assetName NVARCHAR(255) -DECLARE @folderPathLength INT -DECLARE @errorMsg NVARCHAR(1000) -UPDATE identifier SET parent_path = @newPath where parent_path = @oldPath and host_inode = @hostInode -DECLARE folder_data_cursor CURSOR LOCAL FAST_FORWARD for -select asset_name from identifier where asset_type='folder' and parent_path = @newPath and host_inode = @hostInode -OPEN folder_data_cursor -FETCH NEXT FROM folder_data_cursor INTO @assetName -while @@FETCH_STATUS <> -1 -BEGIN - SET @folderPathLength = 0 - SET @newFolderPath = @newPath + @assetName + '/' - SET @folderPathLength = LEN(@newPath) + LEN(@assetName) + 1 - IF (@folderPathLength > 255) - BEGIN - SET @errorMsg = 'Folder path ' + @newPath + @assetName + '/' + ' is longer than 255 characters' - RAISERROR (@errorMsg, 16, 1) - ROLLBACK WORK - RETURN - END - SET @oldFolderPath = @oldPath + @assetName + '/' - EXEC renameFolderChildren @oldFolderPath,@newFolderPath,@hostInode -fetch next from folder_data_cursor into @assetName -END; - -CREATE Trigger rename_folder_assets_trigger -on Folder -FOR UPDATE AS -DECLARE @oldPath NVARCHAR(255) -DECLARE @newPath NVARCHAR(255) -DECLARE @newName NVARCHAR(255) -DECLARE @hostInode NVARCHAR(100) -DECLARE @ident NVARCHAR(100) -DECLARE @folderPathLength INT -DECLARE @errorMsg NVARCHAR(1000) -DECLARE folder_cur_Updated cursor LOCAL FAST_FORWARD for - Select inserted.identifier,inserted.name - from inserted join deleted on (inserted.inode=deleted.inode) - where inserted.name<>deleted.name - for Read Only -open folder_cur_Updated -fetch next from folder_cur_Updated into @ident,@newName -while @@FETCH_STATUS <> -1 -BEGIN - SET @folderPathLength = 0 - SELECT @oldPath = parent_path+asset_name+'/',@newPath = parent_path +@newName+'/',@hostInode = host_inode from identifier where id = @ident - SET @folderPathLength = LEN(@newPath) - IF (@folderPathLength > 255) - BEGIN - SET @errorMsg = 'Folder path ' + @newPath + ' is longer than 255 characters' - RAISERROR (@errorMsg, 16, 1) - ROLLBACK WORK - RETURN - END - UPDATE identifier SET asset_name = @newName where id = @ident - EXEC renameFolderChildren @oldPath,@newPath,@hostInode -fetch next from folder_cur_Updated into @ident,@newName -END; - -CREATE FUNCTION dbo.dotFolderPath(@parent_path NVARCHAR(36), @asset_name NVARCHAR(36)) -RETURNS NVARCHAR(36) -BEGIN - IF(@parent_path='/System folder') - BEGIN - RETURN '/' - END - RETURN @parent_path+@asset_name+'/' -END; - -alter table contentlet_version_info add constraint fk_contentlet_version_info_identifier foreign key (identifier) references identifier(id) on delete cascade; -create index cvi_identifier_index on contentlet_version_info (identifier); -alter table container_version_info add constraint fk_container_version_info_identifier foreign key (identifier) references identifier(id); -alter table template_version_info add constraint fk_template_version_info_identifier foreign key (identifier) references identifier(id); -alter table link_version_info add constraint fk_link_version_info_identifier foreign key (identifier) references identifier(id); - -alter table contentlet_version_info add constraint fk_contentlet_version_info_working foreign key (working_inode) references contentlet(inode); -create index cvi_working_inode_index on contentlet_version_info (working_inode); -alter table container_version_info add constraint fk_container_version_info_working foreign key (working_inode) references dot_containers(inode); -alter table template_version_info add constraint fk_template_version_info_working foreign key (working_inode) references template(inode); -alter table link_version_info add constraint fk_link_version_info_working foreign key (working_inode) references links(inode); - -alter table contentlet_version_info add constraint fk_contentlet_version_info_live foreign key (live_inode) references contentlet(inode); -create index cvi_live_inode_index on contentlet_version_info (live_inode); -alter table container_version_info add constraint fk_container_version_info_live foreign key (live_inode) references dot_containers(inode); -alter table template_version_info add constraint fk_template_version_info_live foreign key (live_inode) references template(inode); -alter table link_version_info add constraint fk_link_version_info_live foreign key (live_inode) references links(inode); - -alter table contentlet_version_info add constraint fk_contentlet_version_info_lang foreign key (lang) references language(id); -create index cvi_lang_index on contentlet_version_info (lang); - -alter table folder add constraint fk_folder_file_structure_type foreign key(default_file_type) references structure(inode); - -alter table workflowtask_files add constraint FK_workflow_id foreign key (workflowtask_id) references workflow_task(id); -alter table workflow_comment add constraint workflowtask_id_comment_FK foreign key (workflowtask_id) references workflow_task(id); -alter table workflow_history add constraint workflowtask_id_history_FK foreign key (workflowtask_id) references workflow_task(id); - -alter table contentlet add constraint fk_contentlet_lang foreign key (language_id) references language(id); - -ALTER TABLE Company ADD CONSTRAINT fk_default_lang_id FOREIGN KEY (default_language_id) REFERENCES language(id); - -create table workflow_scheme( - id NVARCHAR(36) primary key, - name NVARCHAR(255) not null, - description NVARCHAR(255), - archived tinyint default 0, - mandatory tinyint default 0, - default_scheme tinyint default 0, - entry_action_id NVARCHAR(36), - mod_date datetimeoffset(3) -); - - -create table workflow_step( - id NVARCHAR(36) primary key, - name NVARCHAR(255) not null, - scheme_id NVARCHAR(36) references workflow_scheme(id), - my_order int default 0, - resolved tinyint default 0, - escalation_enable tinyint default 0, - escalation_action NVARCHAR(36), - escalation_time int default 0 -); -create index workflow_idx_step_scheme on workflow_step(scheme_id); - --- Permissionable --- -create table workflow_action( - id NVARCHAR(36) primary key, - step_id NVARCHAR(36), - name NVARCHAR(255) not null, - condition_to_progress NVARCHAR(MAX), - next_step_id NVARCHAR(36), - next_assign NVARCHAR(36) not null references cms_role(id), - my_order int default 0, - assignable tinyint default 0, - commentable tinyint default 0, - requires_checkout tinyint default 0, - icon NVARCHAR(255) default 'defaultWfIcon', - show_on NVARCHAR(255) default 'LOCKED,UNLOCKED', - use_role_hierarchy_assign tinyint default 0, - scheme_id NVARCHAR(36) NOT NULL -); - -CREATE TABLE workflow_action_step ( - action_id NVARCHAR(36) NOT NULL, - step_id NVARCHAR(36) NOT NULL, - action_order INT default 0, - CONSTRAINT pk_workflow_action_step PRIMARY KEY NONCLUSTERED (action_id, step_id) -); - -CREATE index idx_workflow_action_step_action_id on workflow_action_step(action_id); -CREATE index idx_workflow_action_step_step_id on workflow_action_step(step_id); -ALTER TABLE workflow_action_step ADD CONSTRAINT fk_w_action_step_action_id foreign key (action_id) references workflow_action(id); -ALTER TABLE workflow_action_step ADD CONSTRAINT fk_w_action_step_step_id foreign key (step_id) references workflow_step (id); -CREATE index idx_workflow_action_step on workflow_action(step_id); - -create table workflow_action_class( - id NVARCHAR(36) primary key, - action_id NVARCHAR(36) references workflow_action(id), - name NVARCHAR(255) not null, - my_order int default 0, - clazz NVARCHAR(MAX) -); -create index workflow_idx_action_class_action on workflow_action_class(action_id); - -create table workflow_action_class_pars( - id NVARCHAR(36) primary key, - workflow_action_class_id NVARCHAR(36) not null references workflow_action_class(id), - "key" NVARCHAR(255) not null, - value NVARCHAR(MAX) -); -create index workflow_idx_action_class_param_action on - workflow_action_class_pars(workflow_action_class_id); - - -create table workflow_scheme_x_structure( - id NVARCHAR(36) primary key, - scheme_id NVARCHAR(36) references workflow_scheme(id), - structure_id NVARCHAR(36) references structure(inode) -); -create index workflow_idx_scheme_structure_1 on - workflow_scheme_x_structure(structure_id); - - -delete from workflow_history; -delete from workflow_comment; -delete from workflowtask_files; -delete from workflow_task; - -ALTER TABLE workflow_task ADD CONSTRAINT FK_workflow_task_language FOREIGN KEY (language_id) REFERENCES language(id); -ALTER TABLE workflow_task ADD CONSTRAINT FK_workflow_assign FOREIGN KEY (assigned_to) REFERENCES cms_role (id); -ALTER TABLE workflow_task ADD CONSTRAINT FK_workflow_step FOREIGN KEY (status) REFERENCES workflow_step (id); -ALTER TABLE workflow_task ADD CONSTRAINT unique_workflow_task unique (webasset,language_id); - -CREATE index idx_workflow_step_escalation_action on workflow_step(escalation_action); -alter table workflow_step add constraint fk_escalation_action foreign key (escalation_action) references workflow_action(id); - -alter table contentlet_version_info add constraint FK_con_ver_lockedby foreign key (locked_by) references user_(userid); -create index cvi_locked_by_index on contentlet_version_info (locked_by); -alter table container_version_info add constraint FK_tainer_ver_info_lockedby foreign key (locked_by) references user_(userid); -alter table template_version_info add constraint FK_temp_ver_info_lockedby foreign key (locked_by) references user_(userid); -alter table link_version_info add constraint FK_link_ver_info_lockedby foreign key (locked_by) references user_(userid); - -ALTER TABLE tag add CONSTRAINT [DF_tag_host] DEFAULT 'SYSTEM_HOST' for host_id; -alter table tag add constraint tag_tagname_host unique (tagname, host_id); -alter table tag_inode add constraint fk_tag_inode_tagid foreign key (tag_id) references tag (tag_id); - -drop index tag_user_id_index on tag; -alter table tag alter column user_id NVARCHAR(MAX); - - --- ****** Indicies Data Storage ******* -create table indicies ( - index_name NVARCHAR(100) primary key, - index_type NVARCHAR(16) not null unique -); --- ****** Log Console Table ******* - CREATE TABLE log_mapper ( - enabled numeric(1,0) not null, - log_name NVARCHAR(30) not null, - description NVARCHAR(50) not null, - primary key (log_name) - ); - - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-userActivity.log','Log Users action on pages, structures, documents.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-security.log','Log users login activity into dotCMS.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-adminaudit.log','Log Admin activity on dotCMS.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-pushpublish.log','Log Push Publishing activity on dotCMS.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','visitor-v3.log','Log Visitor Filter activity on dotCMS.'); - - -create index idx_identifier_perm on identifier (asset_type,host_inode); - -CREATE TABLE broken_link ( - id NVARCHAR(36) PRIMARY KEY, - inode NVARCHAR(36) NOT NULL, - field NVARCHAR(36) NOT NULL, - link NVARCHAR(255) NOT NULL, - title NVARCHAR(255) NOT NULL, - status_code bigint NOT NULL -); - -alter table broken_link add CONSTRAINT fk_brokenl_content - FOREIGN KEY (inode) REFERENCES contentlet(inode) ON DELETE CASCADE; - -alter table broken_link add CONSTRAINT fk_brokenl_field - FOREIGN KEY (field) REFERENCES field(inode) ON DELETE CASCADE; - --- ****** Content Publishing Framework ******* -CREATE TABLE publishing_queue ( - id BIGINT IDENTITY (1, 1) PRIMARY KEY NOT NULL, - operation NUMERIC(19,0), - asset NVARCHAR(2000) NOT NULL, - language_id NUMERIC(19,0) NOT NULL, - entered_date datetimeoffset(3), - publish_date datetimeoffset(3), - type NVARCHAR(256), - bundle_id NVARCHAR(256) -); - -CREATE TABLE publishing_queue_audit -(bundle_id NVARCHAR(256) PRIMARY KEY NOT NULL, -status INTEGER, -status_pojo NVARCHAR(MAX), -status_updated datetimeoffset(3), -create_date datetimeoffset(3)); - --- ****** Content Publishing Framework - End Point Management ******* -CREATE TABLE publishing_end_point ( - id NVARCHAR(36) PRIMARY KEY, - group_id NVARCHAR(700), - server_name NVARCHAR(700) unique, - address NVARCHAR(250), - port NVARCHAR(10), - protocol NVARCHAR(10), - enabled tinyint DEFAULT 0, - auth_key NVARCHAR(MAX), - sending tinyint DEFAULT 0); - -create table publishing_environment( - id NVARCHAR(36) NOT NULL primary key, - name NVARCHAR(255) NOT NULL unique, - push_to_all tinyint NOT NULL -); - - -create table sitesearch_audit ( - job_id NVARCHAR(36), - job_name NVARCHAR(255) not null, - fire_date datetimeoffset(3) not null, - incremental tinyint not null, - start_date datetimeoffset(3), - end_date datetimeoffset(3), - host_list NVARCHAR(500) not null, - all_hosts tinyint not null, - lang_list NVARCHAR(500) not null, - path NVARCHAR(500) not null, - path_include tinyint not null, - files_count numeric(19,0) not null, - pages_count numeric(19,0) not null, - urlmaps_count numeric(19,0) not null, - index_name NVARCHAR(100) not null, - primary key(job_id,fire_date) -); - -create table publishing_bundle( - id NVARCHAR(36) NOT NULL primary key, - name NVARCHAR(255) NOT NULL, - publish_date datetimeoffset(3), - expire_date datetimeoffset(3), - owner NVARCHAR(100), - force_push tinyint, - filter_key NVARCHAR(100) -); - -ALTER TABLE publishing_bundle ADD CONSTRAINT FK_publishing_bundle_owner FOREIGN KEY (owner) REFERENCES user_(userid); - -create table publishing_bundle_environment( - id NVARCHAR(36) NOT NULL primary key, - bundle_id NVARCHAR(36) NOT NULL, - environment_id NVARCHAR(36) NOT NULL -); - -alter table publishing_bundle_environment add constraint FK_bundle_id foreign key (bundle_id) references publishing_bundle(id); -alter table publishing_bundle_environment add constraint FK_environment_id foreign key (environment_id) references publishing_environment(id); - -create table publishing_pushed_assets( - bundle_id NVARCHAR(36) NOT NULL, - asset_id NVARCHAR(255) NOT NULL, - asset_type NVARCHAR(255) NOT NULL, - push_date datetimeoffset(3), - environment_id NVARCHAR(36) NOT NULL, - endpoint_ids NVARCHAR(MAX), - publisher NVARCHAR(MAX) -); - -CREATE INDEX idx_pushed_assets_1 ON publishing_pushed_assets (bundle_id); -CREATE INDEX idx_pushed_assets_2 ON publishing_pushed_assets (environment_id); -CREATE INDEX idx_pushed_assets_3 ON publishing_pushed_assets (asset_id, environment_id); - -CREATE INDEX idx_pub_qa_1 ON publishing_queue_audit (status); - ---Cluster Tables - -CREATE TABLE dot_cluster(cluster_id NVARCHAR(36), cluster_salt VARCHAR(256) ,PRIMARY KEY (cluster_id) ); -CREATE TABLE cluster_server(server_id NVARCHAR(36) NOT NULL, cluster_id NVARCHAR(36) NOT NULL, name NVARCHAR(100), ip_address NVARCHAR(39) NOT NULL, host NVARCHAR(255), cache_port SMALLINT, es_transport_tcp_port SMALLINT, es_network_port SMALLINT, es_http_port SMALLINT, key_ NVARCHAR(100), PRIMARY KEY (server_id) ); -ALTER TABLE cluster_server add constraint fk_cluster_id foreign key (cluster_id) REFERENCES dot_cluster(cluster_id); -CREATE TABLE cluster_server_uptime(id NVARCHAR(36) NOT NULL, server_id NVARCHAR(36) NOT NULL, startup datetimeoffset(3) null, heartbeat datetimeoffset(3) null, PRIMARY KEY (id) ); -ALTER TABLE cluster_server_uptime add constraint fk_cluster_server_id foreign key (server_id) REFERENCES cluster_server(server_id); - --- Notifications Table -CREATE TABLE notification ( - group_id NVARCHAR(36) NOT NULL, - user_id NVARCHAR(255) NOT NULL, - message NVARCHAR(MAX) NOT NULL, - notification_type NVARCHAR(100), - notification_level NVARCHAR(100), - time_sent datetimeoffset(3) NOT NULL, - was_read TINYINT -); -ALTER TABLE notification ADD CONSTRAINT pk_notification PRIMARY KEY (group_id, user_id); -ALTER TABLE notification ADD CONSTRAINT df_notification_was_read DEFAULT ((0)) FOR was_read; -CREATE INDEX idx_not_read ON notification (was_read); - --- indices for version_info tables on version_ts -create index idx_contentlet_vi_version_ts on contentlet_version_info(version_ts); -create index idx_container_vi_version_ts on container_version_info(version_ts); -create index idx_template_vi_version_ts on template_version_info(version_ts); -create index idx_link_vi_version_ts on link_version_info(version_ts); - --- container multiple structures -create index idx_container_id on container_structures(container_id); -alter table container_structures add constraint FK_cs_container_id foreign key (container_id) references identifier(id); -alter table container_structures add constraint FK_cs_inode foreign key (container_inode) references inode(inode); - - --- license repo -create table sitelic(id NVARCHAR(36) primary key, serverid NVARCHAR(100), license NVARCHAR(MAX) not null, lastping datetimeoffset(3) not null, startup_time bigint); - --- Integrity Checker -create table folders_ir(folder NVARCHAR(255), local_inode NVARCHAR(36), remote_inode NVARCHAR(36), local_identifier NVARCHAR(36), remote_identifier NVARCHAR(36), endpoint_id NVARCHAR(40), PRIMARY KEY (local_inode, endpoint_id)); -create table hosts_ir(local_identifier varchar(36), remote_identifier varchar(36), endpoint_id varchar(40), local_working_inode varchar(36), local_live_inode varchar(36), remote_working_inode varchar(36), remote_live_inode varchar(36), language_id numeric(19,0), host varchar(255), PRIMARY KEY (local_working_inode, language_id, endpoint_id)); -create table structures_ir(velocity_name NVARCHAR(255), local_inode NVARCHAR(36), remote_inode NVARCHAR(36), endpoint_id NVARCHAR(40), PRIMARY KEY (local_inode, endpoint_id)); -create table schemes_ir(name NVARCHAR(255), local_inode NVARCHAR(36), remote_inode NVARCHAR(36), endpoint_id NVARCHAR(40), PRIMARY KEY (local_inode, endpoint_id)); -create table htmlpages_ir(html_page NVARCHAR(255), local_working_inode NVARCHAR(36), local_live_inode NVARCHAR(36), remote_working_inode NVARCHAR(36), remote_live_inode NVARCHAR(36),local_identifier NVARCHAR(36), remote_identifier NVARCHAR(36), endpoint_id NVARCHAR(40), language_id bigint, PRIMARY KEY (local_working_inode, language_id, endpoint_id)); -create table fileassets_ir(file_name NVARCHAR(255), local_working_inode NVARCHAR(36), local_live_inode NVARCHAR(36), remote_working_inode NVARCHAR(36), remote_live_inode NVARCHAR(36),local_identifier NVARCHAR(36), remote_identifier NVARCHAR(36), endpoint_id NVARCHAR(40), language_id bigint, PRIMARY KEY (local_working_inode, language_id, endpoint_id)); -create table cms_roles_ir(name NVARCHAR(1000), role_key NVARCHAR(255), local_role_id NVARCHAR(36), remote_role_id NVARCHAR(36), local_role_fqn NVARCHAR(1000), remote_role_fqn NVARCHAR(1000), endpoint_id NVARCHAR(40), PRIMARY KEY (local_role_id, endpoint_id)); - - ----Server Action -create table cluster_server_action( - server_action_id NVARCHAR(36) not null, - originator_id NVARCHAR(36) not null, - server_id NVARCHAR(36) not null, - failed bit not null, - response NVARCHAR(2048), - action_id NVARCHAR(1024) not null, - completed bit not null, - entered_date datetimeoffset(3) not null, - time_out_seconds bigint not null, - PRIMARY KEY (server_action_id) -); - --- Rules Engine -create table dot_rule(id NVARCHAR(36) primary key,name NVARCHAR(255) not null,fire_on NVARCHAR(20),short_circuit tinyint default 0,parent_id NVARCHAR(36) not null,folder NVARCHAR(36) not null,priority int default 0,enabled tinyint default 0,mod_date datetimeoffset(3)); -create table rule_condition_group(id NVARCHAR(36) primary key,rule_id NVARCHAR(36) references dot_rule(id),operator NVARCHAR(10) not null,priority int default 0,mod_date datetimeoffset(3)); -create table rule_condition(id NVARCHAR(36) primary key,conditionlet NVARCHAR(MAX) not null,condition_group NVARCHAR(36) references rule_condition_group(id),comparison NVARCHAR(36) not null,operator NVARCHAR(10) not null,priority int default 0,mod_date datetimeoffset(3)); -create table rule_condition_value (id NVARCHAR(36) primary key,condition_id NVARCHAR(36) references rule_condition(id), paramkey NVARCHAR(255) not null, value NVARCHAR(MAX),priority int default 0); -create table rule_action (id NVARCHAR(36) primary key,rule_id NVARCHAR(36) references dot_rule(id),priority int default 0,actionlet NVARCHAR(MAX) not null,mod_date datetimeoffset(3)); -create table rule_action_pars(id NVARCHAR(36) primary key,rule_action_id NVARCHAR(36) references rule_action(id), paramkey NVARCHAR(255) not null,value NVARCHAR(MAX)); -create index idx_rules_fire_on on dot_rule (fire_on); - -CREATE TABLE system_event ( - identifier NVARCHAR(36) NOT NULL, - event_type NVARCHAR(50) NOT NULL, - payload NVARCHAR(MAX) NOT NULL, - created BIGINT NOT NULL, - server_id NVARCHAR(36) NOT NULL -); -ALTER TABLE system_event ADD CONSTRAINT pk_system_event PRIMARY KEY (identifier); -CREATE INDEX idx_system_event ON system_event (created); - - -CREATE TABLE api_token_issued( - token_id NVARCHAR(255) NOT NULL, - token_userid NVARCHAR(255) NOT NULL, - issue_date datetimeoffset(3) NOT NULL, - expire_date datetimeoffset(3) NOT NULL, - requested_by_userid NVARCHAR(255) NOT NULL, - requested_by_ip NVARCHAR(255) NOT NULL, - revoke_date datetimeoffset(3) DEFAULT NULL, - allowed_from NVARCHAR(255) , - issuer NVARCHAR(255) , - claims NVARCHAR(MAX) , - mod_date datetimeoffset(3) NOT NULL, - PRIMARY KEY (token_id) - ); - -create index idx_api_token_issued_user ON api_token_issued (token_userid); - -CREATE UNIQUE INDEX idx_ident_uniq_asset_name on identifier (full_path_lc,host_inode); - -create table storage_group ( - group_name varchar(255) not null, - mod_date datetimeoffset(3) NOT NULL DEFAULT GETDATE(), - PRIMARY KEY (group_name) -); - -create table storage ( - path varchar(255) not null, - group_name varchar(255) not null, - hash varchar(64) not null, - mod_date datetimeoffset(3) NOT NULL DEFAULT GETDATE(), - hash_ref varchar(64), - PRIMARY KEY (path, group_name), - FOREIGN KEY (group_name) REFERENCES storage_group (group_name) -); - -CREATE INDEX idx_storage_hash ON storage (hash); - -create table storage_data ( - hash_id varchar(64) not null, - data varbinary(max) not null, - mod_date datetimeoffset(3) NOT NULL DEFAULT GETDATE(), - PRIMARY KEY (hash_id) -); - -create table storage_x_data ( - storage_hash varchar(64) not null, - data_hash varchar(64) not null, - data_order integer not null, - mod_date datetimeoffset(3) NOT NULL DEFAULT GETDATE(), - PRIMARY KEY (storage_hash, data_hash), - FOREIGN KEY (data_hash) REFERENCES storage_data (hash_id) -); - -CREATE TABLE shedlock(name VARCHAR(64) NOT NULL, lock_until datetime NOT NULL, - locked_at datetime NOT NULL, locked_by VARCHAR(255) NOT NULL, PRIMARY KEY (name)); - -create table variant ( - name NVARCHAR(255) primary key, - description NVARCHAR(255) not null, - archived tinyint not null default 0, -); - -create table experiment ( - id NVARCHAR(255) primary key, - page_id NVARCHAR(255) not null, - name NVARCHAR(255) not null, - description NVARCHAR(255) not null, - status NVARCHAR(255) not null, - traffic_proportion NVARCHAR(MAX) not null, - traffic_allocation float not null, - mod_date datetimeoffset(3) not null, - scheduling NVARCHAR(MAX), - creation_date datetimeoffset(3) not null, - created_by NVARCHAR(255) not null, - last_modified_by NVARCHAR(255) not null, - goals NVARCHAR(MAX), - lookback_window numeric(19,0) not null -); - -CREATE INDEX idx_exp_pageid ON experiment (page_id); - diff --git a/dotCMS/src/main/resources/mysql.sql b/dotCMS/src/main/resources/mysql.sql deleted file mode 100644 index 83618d0efbd8..000000000000 --- a/dotCMS/src/main/resources/mysql.sql +++ /dev/null @@ -1,2308 +0,0 @@ -create table Address ( - addressId varchar(100) not null primary key, - companyId varchar(100) not null, - userId varchar(100) not null, - userName varchar(100) null, - createDate datetime null, - modifiedDate datetime null, - className varchar(100) null, - classPK varchar(100) null, - description varchar(100) null, - street1 varchar(100) null, - street2 varchar(100) null, - city varchar(100) null, - state varchar(100) null, - zip varchar(100) null, - country varchar(100) null, - phone varchar(100) null, - fax varchar(100) null, - cell varchar(100) null, - priority integer -); - -create table AdminConfig ( - configId varchar(100) not null primary key, - companyId varchar(100) not null, - type_ varchar(100) null, - name varchar(100) null, - config longtext null -); - -create table Company ( - companyId varchar(100) not null primary key, - key_ longtext null, - portalURL varchar(100) not null, - homeURL varchar(100) not null, - mx varchar(100) default 'dotcms.com', - name varchar(100) not null, - shortName varchar(100) not null, - type_ varchar(100) null, - size_ varchar(100) null, - street varchar(100) null, - city varchar(100) null, - state varchar(100) null, - zip varchar(100) null, - phone varchar(100) null, - fax varchar(100) null, - emailAddress varchar(100) null, - authType varchar(100) null, - autoLogin tinyint, - strangers tinyint, - default_language_id bigint null -); - -create table Counter ( - name varchar(100) not null primary key, - currentId integer -); - -create table Image ( - imageId varchar(200) not null primary key, - text_ longtext not null -); - -create table PasswordTracker ( - passwordTrackerId varchar(100) not null primary key, - userId varchar(100) not null, - createDate datetime not null, - password_ varchar(100) not null -); - -create table PollsChoice ( - choiceId varchar(100) not null, - questionId varchar(100) not null, - description longtext null, - primary key (choiceId, questionId) -); - -create table PollsDisplay ( - layoutId varchar(100) not null, - userId varchar(100) not null, - portletId varchar(100) not null, - questionId varchar(100) not null, - primary key (layoutId, userId, portletId) -); - -create table PollsQuestion ( - questionId varchar(100) not null primary key, - portletId varchar(100) not null, - groupId varchar(100) not null, - companyId varchar(100) not null, - userId varchar(100) not null, - userName varchar(100) null, - createDate datetime null, - modifiedDate datetime null, - title varchar(100) null, - description longtext null, - expirationDate datetime null, - lastVoteDate datetime null -); - -create table PollsVote ( - questionId varchar(100) not null, - userId varchar(100) not null, - choiceId varchar(100) not null, - voteDate datetime null, - primary key (questionId, userId) -); - -create table Portlet ( - portletId varchar(100) not null, - groupId varchar(100) not null, - companyId varchar(100) not null, - defaultPreferences longtext null, - narrow tinyint, - roles longtext null, - active_ tinyint, - primary key (portletId, groupId, companyId) -); - -create table PortletPreferences ( - portletId varchar(100) not null, - userId varchar(100) not null, - layoutId varchar(100) not null, - preferences longtext null, - primary key (portletId, userId, layoutId) -); - -create table User_ ( - userId varchar(100) not null primary key, - companyId varchar(100) not null, - createDate datetime null, - mod_date datetime null, - password_ longtext null, - passwordEncrypted tinyint, - passwordExpirationDate datetime null, - passwordReset tinyint, - firstName varchar(100) null, - middleName varchar(100) null, - lastName varchar(100) null, - nickName varchar(100) null, - male tinyint, - birthday datetime null, - emailAddress varchar(100) null, - smsId varchar(100) null, - aimId varchar(100) null, - icqId varchar(100) null, - msnId varchar(100) null, - ymId varchar(100) null, - favoriteActivity varchar(100) null, - favoriteBibleVerse varchar(100) null, - favoriteFood varchar(100) null, - favoriteMovie varchar(100) null, - favoriteMusic varchar(100) null, - languageId varchar(100) null, - timeZoneId varchar(100) null, - skinId varchar(100) null, - dottedSkins tinyint, - roundedSkins tinyint, - greeting varchar(100) null, - resolution varchar(100) null, - refreshRate varchar(100) null, - layoutIds varchar(100) null, - comments longtext null, - loginDate datetime null, - loginIP varchar(100) null, - lastLoginDate datetime null, - lastLoginIP varchar(100) null, - failedLoginAttempts integer, - agreedToTermsOfUse tinyint, - active_ tinyint, - delete_in_progress BOOLEAN DEFAULT FALSE, - delete_date DATETIME, - additional_info text NULL -); - -create table UserTracker ( - userTrackerId varchar(100) not null primary key, - companyId varchar(100) not null, - userId varchar(100) not null, - modifiedDate datetime null, - remoteAddr varchar(100) null, - remoteHost varchar(100) null, - userAgent varchar(100) null -); - -create table UserTrackerPath ( - userTrackerPathId varchar(100) not null primary key, - userTrackerId varchar(100) not null, - path longtext not null, - pathDate datetime not null -); - -## -## Global -## - -insert into Counter values ('com.liferay.portal.model.Address', 10); -insert into Counter values ('com.liferay.portal.model.Role', 100); -insert into Counter values ('com.liferay.portal.model.User.liferay.com', 10); -insert into Counter values ('com.liferay.portlet.polls.model.PollsQuestion', 10); -## -## Liferay, LLC -## - -insert into Company (companyId, portalURL, homeURL, mx, name, shortName, type_, size_, emailAddress, authType, autoLogin, strangers) values ('liferay.com', 'localhost', 'localhost', 'liferay.com', 'Liferay, LLC', 'Liferay', 'biz', '', 'test@liferay.com', 'emailAddress', '1', '1'); -update Company set street = '1220 Brea Canyon Rd.', city = 'Diamond Bar', state = 'CA', zip = '91789' where companyId = 'liferay.com'; - -insert into PollsDisplay (layoutId, userId, portletId, questionId) values ('1.1', 'group.1', '59', '1'); -insert into PollsChoice (choiceId, questionId, description) values ('a', '1', 'Chocolate'); -insert into PollsChoice (choiceId, questionId, description) values ('b', '1', 'Strawberry'); -insert into PollsChoice (choiceId, questionId, description) values ('c', '1', 'Vanilla'); -insert into PollsQuestion (questionId, portletId, groupId, companyId, userId, userName, createDate, modifiedDate, title, description) values ('1', '25', '-1', 'liferay.com', 'liferay.com.1', 'John Wayne', now(), now(), 'What is your favorite ice cream flavor?', 'What is your favorite ice cream flavor?'); - -## -## Default User -## - -insert into User_ (userId, companyId, createDate, password_, passwordEncrypted, passwordReset, firstName, middleName, lastName, male, birthday, emailAddress, skinId, dottedSkins, roundedSkins, greeting, layoutIds, loginDate, failedLoginAttempts, agreedToTermsOfUse, active_) values ('liferay.com.default', 'default', now(), 'password', '0', '0', '', '', '', '1', '1970-01-01', 'default@liferay.com', '01', '0', '0', 'Welcome!', '', now(), 0, '0', '1'); - -## -## Test User -## - -insert into User_ (userId, companyId, createDate, password_, passwordEncrypted, passwordReset, firstName, middleName, lastName, nickName, male, birthday, emailAddress, skinId, dottedSkins, roundedSkins, greeting, layoutIds, loginDate, failedLoginAttempts, agreedToTermsOfUse, active_) values ('liferay.com.1', 'liferay.com', now(), 'test', '0', '0', 'John', '', 'Wayne', 'Duke', '1', '1970-01-01', 'test@liferay.com', '01', '0', '1', 'Welcome John Wayne!', '1,', now(), 0, '1', '1'); -CREATE TABLE QRTZ_JOB_DETAILS - ( - JOB_NAME VARCHAR(80) NOT NULL, - JOB_GROUP VARCHAR(80) NOT NULL, - DESCRIPTION VARCHAR(120) NULL, - JOB_CLASS_NAME VARCHAR(128) NOT NULL, - IS_DURABLE tinyint(1) NOT NULL, - IS_VOLATILE tinyint(1) NOT NULL, - IS_STATEFUL tinyint(1) NOT NULL, - REQUESTS_RECOVERY tinyint(1) NOT NULL, - JOB_DATA LONGBLOB NULL, - PRIMARY KEY (JOB_NAME,JOB_GROUP) -); - -CREATE TABLE QRTZ_JOB_LISTENERS - ( - JOB_NAME VARCHAR(80) NOT NULL, - JOB_GROUP VARCHAR(80) NOT NULL, - JOB_LISTENER VARCHAR(80) NOT NULL, - PRIMARY KEY (JOB_NAME,JOB_GROUP,JOB_LISTENER), - FOREIGN KEY (JOB_NAME,JOB_GROUP) - REFERENCES QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP) -); - -CREATE TABLE QRTZ_TRIGGERS - ( - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - JOB_NAME VARCHAR(80) NOT NULL, - JOB_GROUP VARCHAR(80) NOT NULL, - IS_VOLATILE tinyint(1) NOT NULL, - DESCRIPTION VARCHAR(120) NULL, - NEXT_FIRE_TIME BIGINT(13) NULL, - PREV_FIRE_TIME BIGINT(13) NULL, - PRIORITY INTEGER NULL, - TRIGGER_STATE VARCHAR(16) NOT NULL, - TRIGGER_TYPE VARCHAR(8) NOT NULL, - START_TIME BIGINT(13) NOT NULL, - END_TIME BIGINT(13) NULL, - CALENDAR_NAME VARCHAR(80) NULL, - MISFIRE_INSTR SMALLINT(2) NULL, - JOB_DATA LONGBLOB NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (JOB_NAME,JOB_GROUP) - REFERENCES QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP) -); - -CREATE TABLE QRTZ_SIMPLE_TRIGGERS - ( - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - REPEAT_COUNT BIGINT(7) NOT NULL, - REPEAT_INTERVAL BIGINT(12) NOT NULL, - TIMES_TRIGGERED BIGINT(7) NOT NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); - -CREATE TABLE QRTZ_CRON_TRIGGERS - ( - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - CRON_EXPRESSION VARCHAR(80) NOT NULL, - TIME_ZONE_ID VARCHAR(80), - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); - -CREATE TABLE QRTZ_BLOB_TRIGGERS - ( - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - BLOB_DATA BLOB NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); - -CREATE TABLE QRTZ_TRIGGER_LISTENERS - ( - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - TRIGGER_LISTENER VARCHAR(80) NOT NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_LISTENER), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); - - -CREATE TABLE QRTZ_CALENDARS - ( - CALENDAR_NAME VARCHAR(80) NOT NULL, - CALENDAR BLOB NOT NULL, - PRIMARY KEY (CALENDAR_NAME) -); - - - -CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS - ( - TRIGGER_GROUP VARCHAR(80) NOT NULL, - PRIMARY KEY (TRIGGER_GROUP) -); - -CREATE TABLE QRTZ_FIRED_TRIGGERS - ( - ENTRY_ID VARCHAR(95) NOT NULL, - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - IS_VOLATILE tinyint(1) NOT NULL, - INSTANCE_NAME VARCHAR(80) NOT NULL, - FIRED_TIME BIGINT(13) NOT NULL, - PRIORITY INTEGER NOT NULL, - STATE VARCHAR(16) NOT NULL, - JOB_NAME VARCHAR(80) NULL, - JOB_GROUP VARCHAR(80) NULL, - IS_STATEFUL tinyint(1) NULL, - REQUESTS_RECOVERY tinyint(1) NULL, - PRIMARY KEY (ENTRY_ID) -); - -CREATE TABLE QRTZ_SCHEDULER_STATE - ( - INSTANCE_NAME VARCHAR(80) NOT NULL, - LAST_CHECKIN_TIME BIGINT(13) NOT NULL, - CHECKIN_INTERVAL BIGINT(13) NOT NULL, - PRIMARY KEY (INSTANCE_NAME) -); - -CREATE TABLE QRTZ_LOCKS - ( - LOCK_NAME VARCHAR(40) NOT NULL, - PRIMARY KEY (LOCK_NAME) -); - - -INSERT INTO QRTZ_LOCKS values('TRIGGER_ACCESS'); -INSERT INTO QRTZ_LOCKS values('JOB_ACCESS'); -INSERT INTO QRTZ_LOCKS values('CALENDAR_ACCESS'); -INSERT INTO QRTZ_LOCKS values('STATE_ACCESS'); -INSERT INTO QRTZ_LOCKS values('MISFIRE_ACCESS'); - -CREATE TABLE QRTZ_EXCL_JOB_DETAILS - ( - JOB_NAME VARCHAR(80) NOT NULL, - JOB_GROUP VARCHAR(80) NOT NULL, - DESCRIPTION VARCHAR(120) NULL, - JOB_CLASS_NAME VARCHAR(128) NOT NULL, - IS_DURABLE tinyint(1) NOT NULL, - IS_VOLATILE tinyint(1) NOT NULL, - IS_STATEFUL tinyint(1) NOT NULL, - REQUESTS_RECOVERY tinyint(1) NOT NULL, - JOB_DATA LONGBLOB NULL, - PRIMARY KEY (JOB_NAME,JOB_GROUP) -); - -CREATE TABLE QRTZ_EXCL_JOB_LISTENERS - ( - JOB_NAME VARCHAR(80) NOT NULL, - JOB_GROUP VARCHAR(80) NOT NULL, - JOB_LISTENER VARCHAR(80) NOT NULL, - PRIMARY KEY (JOB_NAME,JOB_GROUP,JOB_LISTENER), - FOREIGN KEY (JOB_NAME,JOB_GROUP) - REFERENCES QRTZ_EXCL_JOB_DETAILS(JOB_NAME,JOB_GROUP) -); - -CREATE TABLE QRTZ_EXCL_TRIGGERS - ( - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - JOB_NAME VARCHAR(80) NOT NULL, - JOB_GROUP VARCHAR(80) NOT NULL, - IS_VOLATILE tinyint(1) NOT NULL, - DESCRIPTION VARCHAR(120) NULL, - NEXT_FIRE_TIME BIGINT(13) NULL, - PREV_FIRE_TIME BIGINT(13) NULL, - PRIORITY INTEGER NULL, - TRIGGER_STATE VARCHAR(16) NOT NULL, - TRIGGER_TYPE VARCHAR(8) NOT NULL, - START_TIME BIGINT(13) NOT NULL, - END_TIME BIGINT(13) NULL, - CALENDAR_NAME VARCHAR(80) NULL, - MISFIRE_INSTR SMALLINT(2) NULL, - JOB_DATA LONGBLOB NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (JOB_NAME,JOB_GROUP) - REFERENCES QRTZ_EXCL_JOB_DETAILS(JOB_NAME,JOB_GROUP) -); - -CREATE TABLE QRTZ_EXCL_SIMPLE_TRIGGERS - ( - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - REPEAT_COUNT BIGINT(7) NOT NULL, - REPEAT_INTERVAL BIGINT(12) NOT NULL, - TIMES_TRIGGERED BIGINT(7) NOT NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_EXCL_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); - -CREATE TABLE QRTZ_EXCL_CRON_TRIGGERS - ( - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - CRON_EXPRESSION VARCHAR(80) NOT NULL, - TIME_ZONE_ID VARCHAR(80), - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_EXCL_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); - -CREATE TABLE QRTZ_EXCL_BLOB_TRIGGERS - ( - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - BLOB_DATA BLOB NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_EXCL_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); - -CREATE TABLE QRTZ_EXCL_TRIGGER_LISTENERS - ( - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - TRIGGER_LISTENER VARCHAR(80) NOT NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_LISTENER), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_EXCL_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); - - -CREATE TABLE QRTZ_EXCL_CALENDARS - ( - CALENDAR_NAME VARCHAR(80) NOT NULL, - CALENDAR BLOB NOT NULL, - PRIMARY KEY (CALENDAR_NAME) -); - - - -CREATE TABLE QRTZ_EXCL_PAUSED_TRIGGER_GRPS - ( - TRIGGER_GROUP VARCHAR(80) NOT NULL, - PRIMARY KEY (TRIGGER_GROUP) -); - -CREATE TABLE QRTZ_EXCL_FIRED_TRIGGERS - ( - ENTRY_ID VARCHAR(95) NOT NULL, - TRIGGER_NAME VARCHAR(80) NOT NULL, - TRIGGER_GROUP VARCHAR(80) NOT NULL, - IS_VOLATILE tinyint(1) NOT NULL, - INSTANCE_NAME VARCHAR(80) NOT NULL, - FIRED_TIME BIGINT(13) NOT NULL, - PRIORITY INTEGER NOT NULL, - STATE VARCHAR(16) NOT NULL, - JOB_NAME VARCHAR(80) NULL, - JOB_GROUP VARCHAR(80) NULL, - IS_STATEFUL tinyint(1) NULL, - REQUESTS_RECOVERY tinyint(1) NULL, - PRIMARY KEY (ENTRY_ID) -); - -CREATE TABLE QRTZ_EXCL_SCHEDULER_STATE - ( - INSTANCE_NAME VARCHAR(80) NOT NULL, - LAST_CHECKIN_TIME BIGINT(13) NOT NULL, - CHECKIN_INTERVAL BIGINT(13) NOT NULL, - PRIMARY KEY (INSTANCE_NAME) -); - -CREATE TABLE QRTZ_EXCL_LOCKS - ( - LOCK_NAME VARCHAR(40) NOT NULL, - PRIMARY KEY (LOCK_NAME) -); - - -INSERT INTO QRTZ_EXCL_LOCKS values('TRIGGER_ACCESS'); -INSERT INTO QRTZ_EXCL_LOCKS values('JOB_ACCESS'); -INSERT INTO QRTZ_EXCL_LOCKS values('CALENDAR_ACCESS'); -INSERT INTO QRTZ_EXCL_LOCKS values('STATE_ACCESS'); -INSERT INTO QRTZ_EXCL_LOCKS values('MISFIRE_ACCESS'); - -create table analytic_summary_pages ( - id bigint not null auto_increment, - summary_id bigint not null, - inode varchar(255), - hits bigint, - uri varchar(255), - primary key (id) -); -create table tag ( - tag_id varchar(100) not null, - tagname varchar(255) not null, - host_id varchar(255), - user_id varchar(255), - persona boolean default false, - mod_date datetime, - primary key (tag_id) -); -create table user_comments ( - inode varchar(36) not null, - user_id varchar(255), - cdate datetime, - comment_user_id varchar(100), - type varchar(255), - method varchar(255), - subject varchar(255), - ucomment longtext, - communication_id varchar(36), - primary key (inode) -); -create table permission_reference ( - id bigint not null auto_increment, - asset_id varchar(36), - reference_id varchar(36), - permission_type varchar(100), - primary key (id), - unique (asset_id) -); -create table contentlet_version_info ( - identifier varchar(36) not null, - lang bigint not null, - working_inode varchar(36) not null, - live_inode varchar(36), - deleted bit not null, - locked_by varchar(100), - locked_on datetime, - version_ts datetime not null, - primary key (identifier, lang) -); -create table fixes_audit ( - id varchar(36) not null, - table_name varchar(255), - action varchar(255), - records_altered integer, - datetime datetime, - primary key (id) -); -create table container_version_info ( - identifier varchar(36) not null, - working_inode varchar(36) not null, - live_inode varchar(36), - deleted bit not null, - locked_by varchar(100), - locked_on datetime, - version_ts datetime not null, - primary key (identifier) -); -create table trackback ( - id bigint not null auto_increment, - asset_identifier varchar(36), - title varchar(255), - excerpt varchar(255), - url varchar(255), - blog_name varchar(255), - track_date datetime not null, - primary key (id) -); -create table plugin ( - id varchar(255) not null, - plugin_name varchar(255) not null, - plugin_version varchar(255) not null, - author varchar(255) not null, - first_deployed_date datetime not null, - last_deployed_date datetime not null, - primary key (id) -); -create table mailing_list ( - inode varchar(36) not null, - title varchar(255), - public_list tinyint(1), - user_id varchar(255), - primary key (inode) -); -create table recipient ( - inode varchar(36) not null, - name varchar(255), - lastname varchar(255), - email varchar(255), - sent datetime, - opened datetime, - last_result integer, - last_message varchar(255), - user_id varchar(100), - primary key (inode) -); -create table web_form ( - web_form_id varchar(36) not null, - form_type varchar(255), - submit_date datetime, - prefix varchar(255), - first_name varchar(255), - middle_initial varchar(255), - middle_name varchar(255), - full_name varchar(255), - organization varchar(255), - title varchar(255), - last_name varchar(255), - address varchar(255), - address1 varchar(255), - address2 varchar(255), - city varchar(255), - state varchar(255), - zip varchar(255), - country varchar(255), - phone varchar(255), - email varchar(255), - custom_fields longtext, - user_inode varchar(36), - categories varchar(255), - primary key (web_form_id) -); -create table analytic_summary_period ( - id bigint not null auto_increment, - full_date datetime, - day integer, - week integer, - month integer, - year varchar(255), - dayname varchar(50) not null, - monthname varchar(50) not null, - primary key (id), - unique (full_date) -); -create table tree ( - child varchar(36) not null, - parent varchar(36) not null, - relation_type varchar(64) not null, - tree_order integer, - primary key (child, parent, relation_type) -); -create table analytic_summary ( - id bigint not null auto_increment, - summary_period_id bigint not null, - host_id varchar(36) not null, - visits bigint, - page_views bigint, - unique_visits bigint, - new_visits bigint, - direct_traffic bigint, - referring_sites bigint, - search_engines bigint, - bounce_rate integer, - avg_time_on_site datetime, - primary key (id), - unique (summary_period_id, host_id) -); -create table users_cms_roles ( - id varchar(36) not null, - user_id varchar(100) not null, - role_id varchar(36) not null, - primary key (id) -); -create table template ( - inode varchar(36) not null, - show_on_menu tinyint(1), - title varchar(255), - mod_date datetime, - mod_user varchar(100), - sort_order integer, - friendly_name varchar(255), - body longtext, - header longtext, - footer longtext, - image varchar(36), - identifier varchar(36), - drawed tinyint(1), - drawed_body longtext, - add_container_links integer, - containers_added integer, - head_code longtext, - theme varchar(255), - primary key (inode) -); -create table analytic_summary_content ( - id bigint not null auto_increment, - summary_id bigint not null, - inode varchar(255), - hits bigint, - uri varchar(255), - title varchar(255), - primary key (id) -); -create table structure ( - inode varchar(36) not null, - name varchar(255), - description varchar(255), - default_structure tinyint(1), - review_interval varchar(255), - reviewer_role varchar(255), - page_detail varchar(36), - structuretype integer, - system tinyint(1), - fixed bit not null, - velocity_var_name varchar(255), - url_map_pattern text, - host varchar(36) not null, - folder varchar(36) not null, - expire_date_var varchar(255), - publish_date_var varchar(255), - mod_date datetime, - sort_order integer, - icon varchar(255), - primary key (inode) -); -create table cms_role ( - id varchar(36) not null, - role_name varchar(255) not null, - description longtext, - role_key varchar(255), - db_fqn text not null, - parent varchar(36) not null, - edit_permissions tinyint(1), - edit_users tinyint(1), - edit_layouts tinyint(1), - locked tinyint(1), - system tinyint(1), - primary key (id) -); -create table container_structures ( - id varchar(36) not null, - container_id varchar(36) not null, - container_inode varchar(36) not null, - structure_id varchar(36) not null, - code longtext, - primary key (id) -); -create table permission ( - id bigint not null auto_increment, - permission_type varchar(100), - inode_id varchar(36), - roleid varchar(36), - permission integer, - primary key (id), - unique (permission_type, inode_id, roleid) -); -create table contentlet ( - inode varchar(36) not null, - show_on_menu tinyint(1), - title varchar(255), - mod_date datetime, - mod_user varchar(100), - sort_order integer, - friendly_name varchar(255), - structure_inode varchar(36), - disabled_wysiwyg varchar(255), - identifier varchar(36), - language_id bigint, - contentlet_as_json text, - date1 datetime, - date2 datetime, - date3 datetime, - date4 datetime, - date5 datetime, - date6 datetime, - date7 datetime, - date8 datetime, - date9 datetime, - date10 datetime, - date11 datetime, - date12 datetime, - date13 datetime, - date14 datetime, - date15 datetime, - date16 datetime, - date17 datetime, - date18 datetime, - date19 datetime, - date20 datetime, - date21 datetime, - date22 datetime, - date23 datetime, - date24 datetime, - date25 datetime, - text1 varchar(255), - text2 varchar(255), - text3 varchar(255), - text4 varchar(255), - text5 varchar(255), - text6 varchar(255), - text7 varchar(255), - text8 varchar(255), - text9 varchar(255), - text10 varchar(255), - text11 varchar(255), - text12 varchar(255), - text13 varchar(255), - text14 varchar(255), - text15 varchar(255), - text16 varchar(255), - text17 varchar(255), - text18 varchar(255), - text19 varchar(255), - text20 varchar(255), - text21 varchar(255), - text22 varchar(255), - text23 varchar(255), - text24 varchar(255), - text25 varchar(255), - text_area1 longtext, - text_area2 longtext, - text_area3 longtext, - text_area4 longtext, - text_area5 longtext, - text_area6 longtext, - text_area7 longtext, - text_area8 longtext, - text_area9 longtext, - text_area10 longtext, - text_area11 longtext, - text_area12 longtext, - text_area13 longtext, - text_area14 longtext, - text_area15 longtext, - text_area16 longtext, - text_area17 longtext, - text_area18 longtext, - text_area19 longtext, - text_area20 longtext, - text_area21 longtext, - text_area22 longtext, - text_area23 longtext, - text_area24 longtext, - text_area25 longtext, - integer1 bigint, - integer2 bigint, - integer3 bigint, - integer4 bigint, - integer5 bigint, - integer6 bigint, - integer7 bigint, - integer8 bigint, - integer9 bigint, - integer10 bigint, - integer11 bigint, - integer12 bigint, - integer13 bigint, - integer14 bigint, - integer15 bigint, - integer16 bigint, - integer17 bigint, - integer18 bigint, - integer19 bigint, - integer20 bigint, - integer21 bigint, - integer22 bigint, - integer23 bigint, - integer24 bigint, - integer25 bigint, - `float1` float, - `float2` float, - `float3` float, - `float4` float, - `float5` float, - `float6` float, - `float7` float, - `float8` float, - `float9` float, - `float10` float, - `float11` float, - `float12` float, - `float13` float, - `float14` float, - `float15` float, - `float16` float, - `float17` float, - `float18` float, - `float19` float, - `float20` float, - `float21` float, - `float22` float, - `float23` float, - `float24` float, - `float25` float, - bool1 tinyint(1), - bool2 tinyint(1), - bool3 tinyint(1), - bool4 tinyint(1), - bool5 tinyint(1), - bool6 tinyint(1), - bool7 tinyint(1), - bool8 tinyint(1), - bool9 tinyint(1), - bool10 tinyint(1), - bool11 tinyint(1), - bool12 tinyint(1), - bool13 tinyint(1), - bool14 tinyint(1), - bool15 tinyint(1), - bool16 tinyint(1), - bool17 tinyint(1), - bool18 tinyint(1), - bool19 tinyint(1), - bool20 tinyint(1), - bool21 tinyint(1), - bool22 tinyint(1), - bool23 tinyint(1), - bool24 tinyint(1), - bool25 tinyint(1), - primary key (inode) -); -create table analytic_summary_404 ( - id bigint not null auto_increment, - summary_period_id bigint not null, - host_id varchar(36), - uri varchar(255), - referer_uri varchar(255), - primary key (id) -); -create table cms_layouts_portlets ( - id varchar(36) not null, - layout_id varchar(36) not null, - portlet_id varchar(100) not null, - portlet_order integer, - primary key (id) -); -create table report_asset ( - inode varchar(36) not null, - report_name varchar(255) not null, - report_description text not null, - requires_input tinyint(1), - ds varchar(100) not null, - web_form_report tinyint(1), - primary key (inode) -); -create table workflow_comment ( - id varchar(36) not null, - creation_date datetime, - posted_by varchar(255), - wf_comment longtext, - workflowtask_id varchar(36), - primary key (id) -); -create table category ( - inode varchar(36) not null, - category_name varchar(255), - category_key varchar(255), - sort_order integer, - active tinyint(1), - keywords longtext, - category_velocity_var_name varchar(255), - mod_date datetime, - primary key (inode) -); -create table chain_link_code ( - id bigint not null auto_increment, - class_name varchar(255) unique, - code longtext not null, - last_mod_date datetime not null, - language varchar(255) not null, - primary key (id) -); -create table analytic_summary_visits ( - id bigint not null auto_increment, - summary_period_id bigint not null, - host_id varchar(36), - visit_time datetime, - visits bigint, - primary key (id) -); -create table template_version_info ( - identifier varchar(36) not null, - working_inode varchar(36) not null, - live_inode varchar(36), - deleted bit not null, - locked_by varchar(100), - locked_on datetime, - version_ts datetime not null, - primary key (identifier) -); -create table user_preferences ( - id bigint not null auto_increment, - user_id varchar(100) not null, - preference varchar(255), - pref_value longtext, - primary key (id) -); -create table language ( - id bigint not null, - language_code varchar(5), - country_code varchar(255), - language varchar(255), - country varchar(255), - primary key (id) -); -create table users_to_delete ( - id bigint not null auto_increment, - user_id varchar(255), - primary key (id) -); -create table identifier ( - id varchar(36) not null, - parent_path varchar(255), - asset_name varchar(255), - host_inode varchar(36), - asset_type varchar(64), - syspublish_date datetime, - sysexpire_date datetime, - full_path_lc varchar(510) as ( IF(parent_path = 'System folder', '/', lower(concat(parent_path, asset_name)) )), - owner varchar(255), - create_date datetime, - asset_subtype varchar(255), - primary key (id), - unique (parent_path, asset_name, host_inode) -); -create table clickstream ( - clickstream_id bigint not null auto_increment, - cookie_id varchar(255), - user_id varchar(255), - start_date datetime, - end_date datetime, - referer varchar(255), - remote_address varchar(255), - remote_hostname varchar(255), - user_agent varchar(255), - bot tinyint(1), - number_of_requests integer, - host_id varchar(36), - last_page_id varchar(50), - first_page_id varchar(50), - operating_system varchar(50), - browser_name varchar(50), - browser_version varchar(50), - mobile_device tinyint(1), - primary key (clickstream_id) -); -create table multi_tree ( - child varchar(36) not null, - parent1 varchar(36) not null, - parent2 varchar(36) not null, - relation_type varchar(64) not null, - tree_order integer, - personalization varchar(255) not null default 'dot:default', - primary key (child, parent1, parent2, relation_type, personalization) -); -create table workflow_task ( - id varchar(36) not null, - creation_date datetime, - mod_date datetime, - due_date datetime, - created_by varchar(255), - assigned_to varchar(255), - belongs_to varchar(255), - title varchar(255), - description longtext, - status varchar(255), - webasset varchar(255), - language_id bigint, - primary key (id) -); - -create table workflow_action_mappings ( - id varchar(36) not null, - action varchar(36) not null, - workflow_action varchar(255) not null, - scheme_or_content_type varchar(255) not null, - primary key (id) -); - -CREATE UNIQUE INDEX idx_workflow_action_mappings ON workflow_action_mappings (action, workflow_action, scheme_or_content_type); - -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('3d6be719-6b61-4ef8-a594-a9764e461597','NEW' ,'ceca71a0-deee-4999-bd47-b01baa1bcfc8','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('63865890-c863-43a1-ab61-4b495dba5eb5','EDIT' ,'ceca71a0-deee-4999-bd47-b01baa1bcfc8','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('2016a72e-85c7-4ee0-936f-36ce52df355e','PUBLISH' ,'000ec468-0a63-4283-beb7-fcb36c107b2f','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('3ec446c8-a9b6-47fe-830f-1e623493090c','UNPUBLISH','38efc763-d78f-4e4b-b092-59cd8c579b93','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('e7b8c8a3-e605-473c-8680-6d95cac15c9b','ARCHIVE' ,'4da13a42-5d59-480c-ad8f-94a3adf809fe','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('99019118-df2c-4297-a5aa-2fe3fe0f52ce','UNARCHIVE','c92f9aa1-9503-4567-ac30-d3242b54d02d','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('d073436e-3c10-4e4c-8c97-225e9cddf320','DELETE' ,'777f1c6b-c877-4a37-ba4b-10627316c2cc','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('3d73437e-3f1c-8e5c-ac97-a25e9cddf320','DESTROY' ,'1e0f1c6b-b67f-4c99-983d-db2b4bfa88b2','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); - -create table tag_inode ( - tag_id varchar(100) not null, - inode varchar(100) not null, - field_var_name varchar(255), - mod_date datetime, - primary key (tag_id, inode) -); -create table click ( - inode varchar(36) not null, - link varchar(255), - click_count integer, - primary key (inode) -); -create table challenge_question ( - cquestionid bigint not null, - cqtext varchar(255), - primary key (cquestionid) -); -create table layouts_cms_roles ( - id varchar(36) not null, - layout_id varchar(36) not null, - role_id varchar(36) not null, - primary key (id) -); -create table clickstream_request ( - clickstream_request_id bigint not null auto_increment, - clickstream_id bigint, - server_name varchar(255), - protocol varchar(255), - server_port integer, - request_uri varchar(255), - request_order integer, - query_string longtext, - language_id bigint, - timestampper datetime, - host_id varchar(36), - associated_identifier varchar(36), - primary key (clickstream_request_id) -); -create table content_rating ( - id bigint not null auto_increment, - rating float, - user_id varchar(255), - session_id varchar(255), - identifier varchar(36), - rating_date datetime, - user_ip varchar(255), - long_live_cookie_id varchar(255), - primary key (id) -); -create table chain_state ( - id bigint not null auto_increment, - chain_id bigint not null, - link_code_id bigint not null, - state_order bigint not null, - primary key (id) -); -create table analytic_summary_workstream ( - id bigint not null auto_increment, - inode varchar(255), - asset_type varchar(255), - mod_user_id varchar(255), - host_id varchar(36), - mod_date datetime, - action varchar(255), - name varchar(255), - primary key (id) -); -create table dashboard_user_preferences ( - id bigint not null auto_increment, - summary_404_id bigint, - user_id varchar(255), - ignored tinyint(1), - mod_date datetime, - primary key (id) -); -create table campaign ( - inode varchar(36) not null, - title varchar(255), - from_email varchar(255), - from_name varchar(255), - subject varchar(255), - message longtext, - user_id varchar(255), - start_date datetime, - completed_date datetime, - active tinyint(1), - locked tinyint(1), - sends_per_hour varchar(15), - sendemail tinyint(1), - communicationinode varchar(36), - userfilterinode varchar(36), - sendto varchar(15), - isrecurrent tinyint(1), - wassent tinyint(1), - expiration_date datetime, - parent_campaign varchar(36), - primary key (inode) -); -create table workflowtask_files ( - id varchar(36) not null, - workflowtask_id varchar(36) not null, - file_inode varchar(36) not null, - primary key (id) -); -create table analytic_summary_referer ( - id bigint not null auto_increment, - summary_id bigint not null, - hits bigint, - uri varchar(255), - primary key (id) -); -create table dot_containers ( - inode varchar(36) not null, - code longtext, - pre_loop longtext, - post_loop longtext, - show_on_menu tinyint(1), - title varchar(255), - mod_date datetime, - mod_user varchar(100), - sort_order integer, - friendly_name varchar(255), - max_contentlets integer, - use_div tinyint(1), - staticify tinyint(1), - sort_contentlets_by varchar(255), - lucene_query longtext, - notes varchar(255), - identifier varchar(36), - primary key (inode) -); -create table communication ( - inode varchar(36) not null, - title varchar(255), - trackback_link_inode varchar(36), - communication_type varchar(255), - from_name varchar(255), - from_email varchar(255), - email_subject varchar(255), - html_page_inode varchar(36), - text_message longtext, - mod_date datetime, - modified_by varchar(255), - ext_comm_id varchar(255), - primary key (inode) -); -create table workflow_history ( - id varchar(36) not null, - creation_date datetime, - made_by varchar(255), - change_desc longtext, - workflowtask_id varchar(36), - workflow_action_id varchar(36), - workflow_step_id varchar(36), - primary key (id) -); -create table host_variable ( - id varchar(36) not null, - host_id varchar(36), - variable_name varchar(255), - variable_key varchar(255), - variable_value varchar(255), - user_id varchar(255), - last_mod_date datetime, - primary key (id) -); -create table links ( - inode varchar(36) not null, - show_on_menu tinyint(1), - title varchar(255), - mod_date datetime, - mod_user varchar(100), - sort_order integer, - friendly_name varchar(255), - protocal varchar(100), - url varchar(255), - target varchar(100), - internal_link_identifier varchar(36), - link_type varchar(255), - link_code longtext, - identifier varchar(36), - primary key (inode) -); -create table chain_state_parameter ( - id bigint not null auto_increment, - chain_state_id bigint not null, - name varchar(255) not null, - value varchar(255) not null, - primary key (id) -); -create table field ( - inode varchar(36) not null, - structure_inode varchar(255), - field_name varchar(255), - field_type varchar(255), - field_relation_type varchar(255), - field_contentlet varchar(255), - required tinyint(1), - indexed tinyint(1), - listed tinyint(1), - velocity_var_name varchar(255), - sort_order integer, - field_values longtext, - regex_check varchar(255), - hint varchar(255), - default_value varchar(255), - fixed tinyint(1), - read_only tinyint(1), - searchable tinyint(1), - unique_ tinyint(1), - mod_date datetime, - primary key (inode) -); -create table relationship ( - inode varchar(36) not null, - parent_structure_inode varchar(255), - child_structure_inode varchar(255), - parent_relation_name varchar(255), - child_relation_name varchar(255), - relation_type_value varchar(255), - cardinality integer, - parent_required tinyint(1), - child_required tinyint(1), - fixed tinyint(1), - mod_date datetime, - primary key (inode), - unique (relation_type_value) -); -create table folder ( - inode varchar(36) not null, - name varchar(255), - title varchar(255) not null, - show_on_menu tinyint(1), - sort_order integer, - files_masks varchar(255), - identifier varchar(36), - default_file_type varchar(36), - mod_date datetime, - owner varchar(255), - idate datetime, - primary key (inode) -); -create table clickstream_404 ( - clickstream_404_id bigint not null auto_increment, - referer_uri varchar(255), - query_string longtext, - request_uri varchar(255), - user_id varchar(255), - host_id varchar(36), - timestampper datetime, - primary key (clickstream_404_id) -); -create table cms_layout ( - id varchar(36) not null, - layout_name varchar(255) not null, - description varchar(255), - tab_order integer, - primary key (id) -); -create table field_variable ( - id varchar(36) not null, - field_id varchar(36), - variable_name varchar(255), - variable_key varchar(255), - variable_value longtext, - user_id varchar(255), - last_mod_date datetime, - primary key (id) -); -create table report_parameter ( - inode varchar(36) not null, - report_inode varchar(36), - parameter_description text, - parameter_name varchar(255), - class_type varchar(250), - default_value text, - primary key (inode), - unique (report_inode, parameter_name) -); -create table chain ( - id bigint not null auto_increment, - key_name varchar(255) unique, - name varchar(255) not null, - success_value varchar(255) not null, - failure_value varchar(255) not null, - primary key (id) -); -create table link_version_info ( - identifier varchar(36) not null, - working_inode varchar(36) not null, - live_inode varchar(36), - deleted bit not null, - locked_by varchar(100), - locked_on datetime, - version_ts datetime not null, - primary key (identifier) -); -create table template_containers ( - id varchar(36) not null, - template_id varchar(36) not null, - container_id varchar(36) not null, - primary key (id) -); -create table user_filter ( - inode varchar(36) not null, - title varchar(255), - firstname varchar(100), - middlename varchar(100), - lastname varchar(100), - emailaddress varchar(100), - birthdaytypesearch varchar(100), - birthday datetime, - birthdayfrom datetime, - birthdayto datetime, - lastlogintypesearch varchar(100), - lastloginsince varchar(100), - loginfrom datetime, - loginto datetime, - createdtypesearch varchar(100), - createdsince varchar(100), - createdfrom datetime, - createdto datetime, - lastvisittypesearch varchar(100), - lastvisitsince varchar(100), - lastvisitfrom datetime, - lastvisitto datetime, - city varchar(100), - state varchar(100), - country varchar(100), - zip varchar(100), - cell varchar(100), - phone varchar(100), - fax varchar(100), - active_ varchar(255), - tagname varchar(255), - var1 varchar(255), - var2 varchar(255), - var3 varchar(255), - var4 varchar(255), - var5 varchar(255), - var6 varchar(255), - var7 varchar(255), - var8 varchar(255), - var9 varchar(255), - var10 varchar(255), - var11 varchar(255), - var12 varchar(255), - var13 varchar(255), - var14 varchar(255), - var15 varchar(255), - var16 varchar(255), - var17 varchar(255), - var18 varchar(255), - var19 varchar(255), - var20 varchar(255), - var21 varchar(255), - var22 varchar(255), - var23 varchar(255), - var24 varchar(255), - var25 varchar(255), - categories varchar(255), - primary key (inode) -); -create table inode ( - inode varchar(36) not null, - owner varchar(255), - idate datetime, - type varchar(64), - primary key (inode) -); -alter table analytic_summary_pages add index fka1ad33b9ed30e054 (summary_id), add constraint fka1ad33b9ed30e054 foreign key (summary_id) references analytic_summary (id); -create index idx_user_comments_1 on user_comments (user_id); -alter table user_comments add index fkdf1b37e85fb51eb (inode), add constraint fkdf1b37e85fb51eb foreign key (inode) references inode (inode); -create index idx_trackback_2 on trackback (url); -create index idx_trackback_1 on trackback (asset_identifier); -create index idx_mailinglist_1 on mailing_list (user_id); -alter table mailing_list add index fk7bc2cd925fb51eb (inode), add constraint fk7bc2cd925fb51eb foreign key (inode) references inode (inode); -create index idx_communication_user_id on recipient (user_id); -create index idx_recipiets_1 on recipient (email); -create index idx_recipiets_2 on recipient (sent); -alter table recipient add index fk30e172195fb51eb (inode), add constraint fk30e172195fb51eb foreign key (inode) references inode (inode); -create index idx_user_webform_1 on web_form (form_type); -create index idx_analytic_summary_period_4 on analytic_summary_period (month); -create index idx_analytic_summary_period_3 on analytic_summary_period (week); -create index idx_analytic_summary_period_2 on analytic_summary_period (day); -create index idx_analytic_summary_period_5 on analytic_summary_period (year); -create index idx_analytic_summary_1 on analytic_summary (host_id); -create index idx_analytic_summary_2 on analytic_summary (visits); -create index idx_analytic_summary_3 on analytic_summary (page_views); -alter table analytic_summary add index fk9e1a7f4b7b46300 (summary_period_id), add constraint fk9e1a7f4b7b46300 foreign key (summary_period_id) references analytic_summary_period (id); -alter table template add index fkb13acc7a5fb51eb (inode), add constraint fkb13acc7a5fb51eb foreign key (inode) references inode (inode); -alter table analytic_summary_content add index fk53cb4f2eed30e054 (summary_id), add constraint fk53cb4f2eed30e054 foreign key (summary_id) references analytic_summary (id); -alter table structure add index fk89d2d735fb51eb (inode), add constraint fk89d2d735fb51eb foreign key (inode) references inode (inode); -create index idx_permission_2 on permission (permission_type, inode_id); -create index idx_permission_3 on permission (roleid); -alter table contentlet add index fkfc4ef025fb51eb (inode), add constraint fkfc4ef025fb51eb foreign key (inode) references inode (inode); -create index idx_analytic_summary_404_1 on analytic_summary_404 (host_id); -alter table analytic_summary_404 add index fk7050866db7b46300 (summary_period_id), add constraint fk7050866db7b46300 foreign key (summary_period_id) references analytic_summary_period (id); -alter table report_asset add index fk3765ec255fb51eb (inode), add constraint fk3765ec255fb51eb foreign key (inode) references inode (inode); -create index idx_category_1 on category (category_name); -create index idx_category_2 on category (category_key); -alter table category add index fk302bcfe5fb51eb (inode), add constraint fk302bcfe5fb51eb foreign key (inode) references inode (inode); -create index idx_chain_link_code_classname on chain_link_code (class_name); -create index idx_analytic_summary_visits_2 on analytic_summary_visits (visit_time); -create index idx_analytic_summary_visits_1 on analytic_summary_visits (host_id); -alter table analytic_summary_visits add index fk9eac9733b7b46300 (summary_period_id), add constraint fk9eac9733b7b46300 foreign key (summary_period_id) references analytic_summary_period (id); -create index idx_preference_1 on user_preferences (preference); -create index idx_identifier_pub on identifier (syspublish_date); -create index idx_identifier_exp on identifier (sysexpire_date); -create index idx_identifier_asset_subtype on identifier (asset_subtype); -create index idx_user_clickstream11 on clickstream (host_id); -create index idx_user_clickstream12 on clickstream (last_page_id); -create index idx_user_clickstream15 on clickstream (browser_name); -create index idx_user_clickstream_2 on clickstream (user_id); -create index idx_user_clickstream16 on clickstream (browser_version); -create index idx_user_clickstream_1 on clickstream (cookie_id); -create index idx_user_clickstream13 on clickstream (first_page_id); -create index idx_user_clickstream14 on clickstream (operating_system); -create index idx_user_clickstream17 on clickstream (remote_address); -create index idx_multitree_1 on multi_tree (relation_type); -create index idx_workflow_6 on workflow_task (language_id); -create index idx_workflow_4 on workflow_task (webasset); -create index idx_workflow_5 on workflow_task (created_by); -create index idx_workflow_2 on workflow_task (belongs_to); -create index idx_workflow_3 on workflow_task (status); -create index idx_workflow_1 on workflow_task (assigned_to); -create index idx_click_1 on click (link); -alter table click add index fk5a5c5885fb51eb (inode), add constraint fk5a5c5885fb51eb foreign key (inode) references inode (inode); -create index idx_user_clickstream_request_2 on clickstream_request (request_uri); -create index idx_user_clickstream_request_1 on clickstream_request (clickstream_id); -create index idx_user_clickstream_request_4 on clickstream_request (timestampper); -create index idx_user_clickstream_request_3 on clickstream_request (associated_identifier); -create index idx_dashboard_workstream_2 on analytic_summary_workstream (host_id); -create index idx_dashboard_workstream_1 on analytic_summary_workstream (mod_user_id); -create index idx_dashboard_workstream_3 on analytic_summary_workstream (mod_date); -create index idx_dashboard_prefs_2 on dashboard_user_preferences (user_id); -alter table dashboard_user_preferences add index fk496242cfd12c0c3b (summary_404_id), add constraint fk496242cfd12c0c3b foreign key (summary_404_id) references analytic_summary_404 (id); -create index idx_campaign_4 on campaign (expiration_date); -create index idx_campaign_3 on campaign (completed_date); -create index idx_campaign_2 on campaign (start_date); -create index idx_campaign_1 on campaign (user_id); -alter table campaign add index fkf7a901105fb51eb (inode), add constraint fkf7a901105fb51eb foreign key (inode) references inode (inode); -alter table analytic_summary_referer add index fk5bc0f3e2ed30e054 (summary_id), add constraint fk5bc0f3e2ed30e054 foreign key (summary_id) references analytic_summary (id); -alter table dot_containers add index fk8a844125fb51eb (inode), add constraint fk8a844125fb51eb foreign key (inode) references inode (inode); -alter table communication add index fkc24acfd65fb51eb (inode), add constraint fkc24acfd65fb51eb foreign key (inode) references inode (inode); -alter table links add index fk6234fb95fb51eb (inode), add constraint fk6234fb95fb51eb foreign key (inode) references inode (inode); -create index idx_field_1 on field (structure_inode); -alter table field add index fk5cea0fa5fb51eb (inode), add constraint fk5cea0fa5fb51eb foreign key (inode) references inode (inode); -create index idx_relationship_1 on relationship (parent_structure_inode); -create index idx_relationship_2 on relationship (child_structure_inode); -create index idx_folder_1 on folder (name); -create index idx_user_clickstream_404_2 on clickstream_404 (user_id); -create index idx_user_clickstream_404_3 on clickstream_404 (host_id); -create index idx_user_clickstream_404_1 on clickstream_404 (request_uri); -alter table report_parameter add index fk22da125e5fb51eb (inode), add constraint fk22da125e5fb51eb foreign key (inode) references inode (inode); -create index idx_chain_key_name on chain (key_name); -alter table user_filter add index fke042126c5fb51eb (inode), add constraint fke042126c5fb51eb foreign key (inode) references inode (inode); -create index idx_index_1 on inode (type); --- mysql -CREATE INDEX idx_tree ON tree (child, parent, relation_type); -CREATE INDEX idx_tree_1 ON tree (parent); -CREATE INDEX idx_tree_2 ON tree (child); -CREATE INDEX idx_tree_3 ON tree (relation_type); -CREATE INDEX idx_tree_4 ON tree (parent, child, relation_type); -CREATE INDEX idx_tree_5 ON tree (parent, relation_type); -CREATE INDEX idx_tree_6 ON tree (child, relation_type); - -CREATE INDEX idx_contentlet_3 ON contentlet (inode); - - -CREATE INDEX idx_identifier ON identifier (id); -CREATE INDEX idx_permisision_4 ON permission (permission_type); - - -CREATE INDEX idx_permission_reference_2 ON permission_reference (reference_id); -CREATE INDEX idx_permission_reference_3 ON permission_reference (reference_id,permission_type); -CREATE INDEX idx_permission_reference_4 ON permission_reference (asset_id,permission_type); -CREATE INDEX idx_permission_reference_5 ON permission_reference (asset_id,reference_id,permission_type); -CREATE INDEX idx_permission_reference_6 ON permission_reference (permission_type); - -CREATE UNIQUE INDEX idx_field_velocity_structure ON field (velocity_var_name,structure_inode); - -alter table tree add index (parent); -alter table tree add index (child); - -alter table chain_state add constraint fk_state_chain foreign key (chain_id) references chain(id); -alter table chain_state add constraint fk_state_code foreign key (link_code_id) references chain_link_code(id); -alter table chain_state_parameter add constraint fk_parameter_state foreign key (chain_state_id) references chain_state(id); - -alter table permission add constraint permission_role_fk foreign key (roleid) references cms_role(id); - -alter table contentlet add constraint FK_structure_inode foreign key (structure_inode) references structure(inode); - -ALTER TABLE structure MODIFY fixed tinyint(1) DEFAULT '0' NOT NULL; - -ALTER TABLE field MODIFY fixed tinyint(1) DEFAULT '0' NOT NULL; -ALTER TABLE field MODIFY read_only tinyint(1) DEFAULT '1' NOT NULL; - -ALTER TABLE campaign MODIFY active tinyint(1) DEFAULT '0' NOT NULL; - -insert into User_ (userId, companyId, createDate, password_, passwordEncrypted, passwordReset, firstName, middleName, lastName, male, birthday, emailAddress, skinId, dottedSkins, roundedSkins, greeting, layoutIds, loginDate, failedLoginAttempts, agreedToTermsOfUse, active_) values ('dotcms.org.default', 'default', now(), 'password', '0', '0', '', '', '', '1', '1970-01-01', 'default@dotcms.org', '01', '0', '0', 'Welcome!', '', now(), 0, '0', '1'); - -create index addres_userid_index on address(userid); -create index tag_user_id_index on tag(user_id); -create index tag_is_persona_index on tag(persona); -create index tag_inode_tagid on tag_inode(tag_id); -create index tag_inode_inode on tag_inode(inode); -CREATE TABLE `dist_journal` ( - `id` BIGINT NOT NULL AUTO_INCREMENT, - `object_to_index` VARCHAR(1024) NOT NULL, - `serverid` VARCHAR(64) NOT NULL, - `journal_type` INTEGER NOT NULL, - `time_entered` DATETIME NOT NULL, - PRIMARY KEY (`id`) -); -ALTER TABLE dist_journal ADD UNIQUE (object_to_index(255), serverid,journal_type); - -create table plugin_property ( - plugin_id varchar(255) not null, - propkey varchar(255) not null, - original_value varchar(255) not null, - current_value varchar(255) not null -); -alter table plugin_property add constraint fk_plugin_plugin_property foreign key (plugin_id) references plugin(id); - -CREATE TABLE `dist_process` (`id` BIGINT NOT NULL AUTO_INCREMENT,`object_to_index` VARCHAR(1024) NOT NULL,`serverid` VARCHAR(64) NOT NULL,`journal_type` INTEGER NOT NULL,`time_entered` DATETIME NOT NULL, PRIMARY KEY (`id`)); -CREATE INDEX dist_process_index USING BTREE on dist_process (object_to_index (255), serverid,journal_type); - -CREATE TABLE `dist_reindex_journal` (`id` BIGINT NOT NULL AUTO_INCREMENT,`inode_to_index` VARCHAR(100) NOT NULL,`ident_to_index` VARCHAR(100) NOT NULL,`serverid` VARCHAR(64),`priority` INTEGER NOT NULL,`time_entered` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, index_val varchar(325), dist_action integer NOT NULL DEFAULT 1, PRIMARY KEY (`id`)); - -CREATE INDEX dist_reindex_index1 USING BTREE on dist_reindex_journal (inode_to_index (100)); -CREATE INDEX dist_reindex_index2 USING BTREE on dist_reindex_journal (dist_action); -CREATE INDEX dist_reindex_index3 USING BTREE on dist_reindex_journal (serverid); -CREATE INDEX dist_reindex_index4 USING BTREE on dist_reindex_journal (ident_to_index,serverid); -CREATE INDEX dist_reindex_index USING BTREE on dist_reindex_journal (serverid,dist_action); -CREATE INDEX dist_reindex_index5 USING BTREE ON dist_reindex_journal (priority, time_entered); -CREATE INDEX dist_reindex_index6 USING BTREE ON dist_reindex_journal (priority); - -CREATE TABLE `quartz_log` (`id` BIGINT NOT NULL AUTO_INCREMENT,`JOB_NAME` VARCHAR(255) NOT NULL,`serverid` VARCHAR(64) ,`time_started` DATETIME NOT NULL, PRIMARY KEY (`id`)); - - -ALTER TABLE cms_role ADD UNIQUE (role_key); -alter table cms_role add constraint fkcms_role_parent foreign key (parent) references cms_role (id) ON DELETE CASCADE; - - -ALTER TABLE cms_layout ADD UNIQUE (layout_name); -ALTER TABLE portlet ADD UNIQUE (portletid); -ALTER TABLE cms_layouts_portlets ADD UNIQUE (portlet_id, layout_id); -alter table cms_layouts_portlets add constraint fkcms_layouts_portlets foreign key (layout_id) references cms_layout(id); - -ALTER TABLE users_cms_roles ADD UNIQUE (role_id, user_id); -alter table users_cms_roles add constraint fkusers_cms_roles1 foreign key (role_id) references cms_role (id); -alter table users_cms_roles add constraint fkusers_cms_roles2 foreign key (user_id) references user_ (userid); - -ALTER TABLE layouts_cms_roles ADD UNIQUE (role_id, layout_id); -alter table layouts_cms_roles add constraint fklayouts_cms_roles1 foreign key (role_id) references cms_role (id); -alter table layouts_cms_roles add constraint fklayouts_cms_roles2 foreign key (layout_id) references cms_layout (id); - -ALTER TABLE dot_containers add constraint containers_identifier_fk foreign key (identifier) references identifier(id); -ALTER TABLE template add constraint template_identifier_fk foreign key (identifier) references identifier(id); -ALTER TABLE contentlet add constraint content_identifier_fk foreign key (identifier) references identifier(id); -ALTER TABLE links add constraint links_identifier_fk foreign key (identifier) references identifier(id); - - -create table dist_reindex_lock (dummy int); -create table dist_lock (dummy int); - -create table import_audit ( - id bigint not null, - start_date timestamp, - userid varchar(255), - filename varchar(512), - status int, - last_inode varchar(100), - records_to_import bigint, - serverid varchar(255), - primary key (id) - ); - -alter table category modify column category_velocity_var_name varchar(255) not null; - -alter table import_audit add column warnings text, - add column errors text, - add column results text, - add column messages text; - -alter table structure modify host varchar(100) default 'SYSTEM_HOST' not null; -alter table structure modify folder varchar(100) default 'SYSTEM_FOLDER' not null; -alter table structure modify column velocity_var_name varchar(255) not null; -alter table structure add constraint unique_struct_vel_var_name unique (velocity_var_name); - -DROP TRIGGER IF EXISTS check_parent_path_when_update; -CREATE TRIGGER check_parent_path_when_update BEFORE UPDATE -on identifier -FOR EACH ROW -BEGIN -DECLARE idCount INT; -DECLARE canUpdate boolean default false; - IF @disable_trigger IS NULL THEN - select count(id)into idCount from identifier where asset_type='folder' and CONCAT(parent_path,asset_name,'/') = NEW.parent_path and host_inode = NEW.host_inode and id <> NEW.id; - IF(idCount > 0 OR NEW.parent_path = '/' OR NEW.parent_path = '/System folder') THEN - SET canUpdate := TRUE; - END IF; - IF(canUpdate = FALSE) THEN - delete from Cannot_update_for_this_path_does_not_exist_for_the_given_host; - END IF; - END IF; -END -# -DROP TRIGGER IF EXISTS check_parent_path_when_insert; -CREATE TRIGGER check_parent_path_when_insert BEFORE INSERT -on identifier -FOR EACH ROW -BEGIN -DECLARE idCount INT; -DECLARE canInsert boolean default false; - select count(id)into idCount from identifier where asset_type='folder' and CONCAT(parent_path,asset_name,'/')= NEW.parent_path and host_inode = NEW.host_inode and id <> NEW.id; - IF(idCount > 0 OR NEW.parent_path = '/' OR NEW.parent_path = '/System folder') THEN - SET canInsert := TRUE; - END IF; - IF(canInsert = FALSE) THEN - delete from Cannot_insert_for_this_path_does_not_exist_for_the_given_host; - END IF; -END -# -DROP PROCEDURE IF EXISTS checkVersions; -CREATE PROCEDURE checkVersions(IN ident VARCHAR(100),IN tableName VARCHAR(20), OUT versionsCount INT) -BEGIN - SET versionsCount := 0; - IF(tableName = 'links') THEN - select count(inode) into versionsCount from links where identifier = ident; - END IF; - IF(tableName = 'dot_containers') THEN - select count(inode) into versionsCount from dot_containers where identifier = ident; - END IF; - IF(tableName = 'template') THEN - select count(inode) into versionsCount from template where identifier = ident; - END IF; - IF(tableName = 'contentlet') THEN - select count(inode) into versionsCount from contentlet where identifier = ident; - END IF; - IF(tableName = 'folder') THEN - select count(inode) into versionsCount from folder where identifier = ident; - END IF; -END -# - -DROP TRIGGER IF EXISTS check_links_versions; -CREATE TRIGGER check_links_versions AFTER DELETE -on links -FOR EACH ROW -BEGIN -DECLARE tableName VARCHAR(20); -DECLARE count INT; -SET tableName = 'links'; -CALL checkVersions(OLD.identifier,tableName,count); -IF(count = 0)THEN - delete from identifier where id = OLD.identifier; -END IF; -END -# -DROP TRIGGER IF EXISTS check_container_versions; -CREATE TRIGGER check_container_versions AFTER DELETE -on dot_containers -FOR EACH ROW -BEGIN -DECLARE tableName VARCHAR(20); -DECLARE count INT; -SET tableName = 'dot_containers'; -CALL checkVersions(OLD.identifier,tableName,count); -IF(count = 0)THEN - delete from identifier where id = OLD.identifier; -END IF; -END -# -DROP TRIGGER IF EXISTS check_template_versions; -CREATE TRIGGER check_template_versions AFTER DELETE -on template -FOR EACH ROW -BEGIN -DECLARE tableName VARCHAR(20); -DECLARE count INT; -SET tableName = 'template'; -CALL checkVersions(OLD.identifier,tableName,count); -IF(count = 0)THEN - delete from identifier where id = OLD.identifier; -END IF; -END -# -DROP TRIGGER IF EXISTS check_content_versions; -CREATE TRIGGER check_content_versions AFTER DELETE -on contentlet -FOR EACH ROW -BEGIN -DECLARE tableName VARCHAR(20); -DECLARE count INT; -SET tableName = 'contentlet'; -CALL checkVersions(OLD.identifier,tableName,count); -IF(count = 0)THEN - delete from identifier where id = OLD.identifier; -END IF; -END -# -alter table structure add constraint fk_structure_host foreign key (host) references identifier(id); - -create index idx_template3 on template (title); - -CREATE INDEX idx_contentlet_4 ON contentlet (structure_inode); - -CREATE INDEX idx_contentlet_identifier ON contentlet (identifier); - -ALTER TABLE Folder add constraint folder_identifier_fk foreign key (identifier) references identifier(id); ---ALTER TABLE dot_containers add constraint structure_fk foreign key (structure_inode) references structure(inode); - -DROP TRIGGER IF EXISTS folder_identifier_check; -CREATE TRIGGER folder_identifier_check AFTER DELETE -on folder -FOR EACH ROW -BEGIN -DECLARE tableName VARCHAR(20); -DECLARE count INT; -SET tableName = 'folder'; -CALL checkVersions(OLD.identifier,tableName,count); -IF(count = 0)THEN -delete from identifier where id = OLD.identifier; -END IF; -END -# -alter table contentlet add constraint fk_user_contentlet foreign key (mod_user) references user_(userid); -alter table dot_containers add constraint fk_user_containers foreign key (mod_user) references user_(userid); -alter table template add constraint fk_user_template foreign key (mod_user) references user_(userid); -alter table links add constraint fk_user_links foreign key (mod_user) references user_(userid); - -create index idx_template_id on template_containers(template_id); -alter table template_containers add constraint FK_template_id foreign key (template_id) references identifier(id); -alter table template_containers add constraint FK_container_id foreign key (container_id) references identifier(id); - -DROP TRIGGER IF EXISTS check_child_assets; -CREATE TRIGGER check_child_assets BEFORE DELETE -ON IDENTIFIER -FOR EACH ROW -BEGIN - DECLARE pathCount INT; - IF(OLD.asset_type ='folder') THEN - select count(*) into pathCount from identifier where parent_path = CONCAT(OLD.parent_path,OLD.asset_name,'/') and host_inode = OLD.host_inode; - END IF; - IF(OLD.asset_type ='contentlet') THEN - select count(*) into pathCount from identifier where host_inode = OLD.id; - END IF; - IF(pathCount > 0) THEN - delete from Cannot_delete_as_this_path_has_children; - END IF; -END -# -DROP PROCEDURE IF EXISTS renameFolderChildren; -CREATE PROCEDURE renameFolderChildren(IN old_path varchar(255),IN new_path varchar(255),IN hostInode varchar(100)) -BEGIN - DECLARE new_folder_path varchar(255); - DECLARE old_folder_path varchar(255); - DECLARE assetName varchar(255); - DECLARE no_more_rows boolean; - DECLARE cur1 CURSOR FOR select asset_name from identifier where asset_type='folder' and parent_path = new_path and host_inode = hostInode; - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET no_more_rows := TRUE; - SET max_sp_recursion_depth=255; - SET @disable_trigger = 1; - UPDATE identifier SET parent_path = new_path where parent_path = old_path and host_inode = hostInode; - SET @disable_trigger = NULL; - OPEN cur1; - cur1_loop:LOOP - FETCH cur1 INTO assetName; - IF no_more_rows THEN - LEAVE cur1_loop; - END IF; - select CONCAT(new_path,assetName,'/')INTO new_folder_path; - select CONCAT(old_path,assetName,'/')INTO old_folder_path; - CALL renameFolderChildren(old_folder_path,new_folder_path,hostInode); -END LOOP; -CLOSE cur1; -END -# -DROP TRIGGER IF EXISTS rename_folder_assets_trigger; -CREATE TRIGGER rename_folder_assets_trigger AFTER UPDATE -on Folder -FOR EACH ROW -BEGIN -DECLARE old_parent_path varchar(255); -DECLARE old_path varchar(255); -DECLARE new_path varchar(255); -DECLARE old_name varchar(255); -DECLARE hostInode varchar(100); -IF @disable_trigger IS NULL AND NEW.name<>OLD.name THEN - select asset_name,parent_path,host_inode INTO old_name,old_parent_path,hostInode from identifier where id = NEW.identifier; - SELECT CONCAT(old_parent_path,old_name,'/')INTO old_path; - SELECT CONCAT(old_parent_path,NEW.name,'/')INTO new_path; - SET @disable_trigger = 1; - UPDATE identifier SET asset_name = NEW.name where id = NEW.identifier; - SET @disable_trigger = NULL; - CALL renameFolderChildren(old_path,new_path,hostInode); -END IF; -END -# - -DROP FUNCTION IF EXISTS dotFolderPath; -CREATE FUNCTION dotFolderPath (parent_path char(255), asset_name char(255)) RETURNS char(255) -DETERMINISTIC -BEGIN -IF (parent_path='/System folder') THEN - RETURN '/'; -ELSE - RETURN CONCAT(parent_path,asset_name,'/'); -END IF; -END -# -alter table contentlet_version_info add constraint fk_contentlet_version_info_identifier foreign key (identifier) references identifier(id) on delete cascade; -alter table container_version_info add constraint fk_container_version_info_identifier foreign key (identifier) references identifier(id); -alter table template_version_info add constraint fk_template_version_info_identifier foreign key (identifier) references identifier(id); -alter table link_version_info add constraint fk_link_version_info_identifier foreign key (identifier) references identifier(id); - -alter table contentlet_version_info add constraint fk_contentlet_version_info_working foreign key (working_inode) references contentlet(inode); -alter table container_version_info add constraint fk_container_version_info_working foreign key (working_inode) references dot_containers(inode); -alter table template_version_info add constraint fk_template_version_info_working foreign key (working_inode) references template(inode); -alter table link_version_info add constraint fk_link_version_info_working foreign key (working_inode) references links(inode); - -alter table contentlet_version_info add constraint fk_contentlet_version_info_live foreign key (live_inode) references contentlet(inode); -alter table container_version_info add constraint fk_container_version_info_live foreign key (live_inode) references dot_containers(inode); -alter table template_version_info add constraint fk_template_version_info_live foreign key (live_inode) references template(inode); -alter table link_version_info add constraint fk_link_version_info_live foreign key (live_inode) references links(inode); - -alter table contentlet_version_info add constraint fk_contentlet_version_info_lang foreign key (lang) references language(id); - -alter table folder add constraint fk_folder_file_structure_type foreign key(default_file_type) references structure(inode); - -alter table workflowtask_files add constraint FK_workflow_id foreign key (workflowtask_id) references workflow_task(id); -alter table workflow_comment add constraint workflowtask_id_comment_FK foreign key (workflowtask_id) references workflow_task(id); -alter table workflow_history add constraint workflowtask_id_history_FK foreign key (workflowtask_id) references workflow_task(id); - -alter table contentlet add constraint fk_contentlet_lang foreign key (language_id) references language(id); - -alter table company add constraint fk_default_lang_id foreign key (default_language_id) references language(id); - -create table workflow_scheme( - id varchar(36) primary key, - name varchar(255) not null, - description varchar(255), - archived boolean default false, - mandatory boolean default false, - default_scheme boolean default false, - entry_action_id varchar(36), - mod_date datetime -); - -create table workflow_step( - id varchar(36) primary key, - name varchar(255) not null, - scheme_id varchar(36) references workflow_scheme(id), - my_order int default 0, - resolved boolean default false, - escalation_enable boolean default false, - escalation_action varchar(36), - escalation_time int default 0 - -); -create index workflow_idx_step_scheme on workflow_step(scheme_id); - --- Permissionable --- -create table workflow_action( - id varchar(36) primary key, - step_id varchar(36), - name varchar(255) not null, - condition_to_progress text, - next_step_id varchar(36), - next_assign varchar(36) not null references cms_role(id), - my_order int default 0, - assignable boolean default false, - commentable boolean default false, - requires_checkout boolean default false, - icon varchar(255) default 'defaultWfIcon', - show_on varchar(255) default 'LOCKED,UNLOCKED', - use_role_hierarchy_assign bool default false, - scheme_id VARCHAR(36) NOT NULL -); - -CREATE TABLE workflow_action_step (action_id VARCHAR(36) NOT NULL, step_id VARCHAR(36) NOT NULL, action_order INT default 0); -ALTER TABLE workflow_action_step ADD CONSTRAINT pk_workflow_action_step PRIMARY KEY (action_id, step_id); -ALTER TABLE workflow_action_step ADD CONSTRAINT fk_w_action_step_action_id foreign key (action_id) references workflow_action(id); -ALTER TABLE workflow_action_step ADD CONSTRAINT fk_w_action_step_step_id foreign key (step_id) references workflow_step (id); - -create table workflow_action_class( - id varchar(36) primary key, - action_id varchar(36) references workflow_action(id), - name varchar(255) not null, - my_order int default 0, - clazz text -); -create index workflow_idx_action_class_action on workflow_action_class(action_id); -SET sql_mode='ANSI_QUOTES'; -create table workflow_action_class_pars( - id varchar(36) primary key, - workflow_action_class_id char(36) references workflow_action_class(id), - "key" varchar(255) not null, - value text -); -create index workflow_idx_action_class_param_action on - workflow_action_class_pars(workflow_action_class_id); - - -create table workflow_scheme_x_structure( - id varchar(36) primary key, - scheme_id varchar(36) not null references workflow_scheme(id), - structure_id varchar(36) not null references structure(inode) -); -create index workflow_idx_scheme_structure_1 on - workflow_scheme_x_structure(structure_id); - -delete from workflow_history; -delete from workflow_comment; -delete from workflowtask_files; -delete from workflow_task; - -ALTER TABLE workflow_task ADD CONSTRAINT FK_workflow_task_language FOREIGN KEY (language_id) REFERENCES language(id); -ALTER TABLE workflow_task ADD CONSTRAINT FK_workflow_assign FOREIGN KEY (assigned_to) REFERENCES cms_role (id); -ALTER TABLE workflow_task ADD CONSTRAINT FK_workflow_step FOREIGN KEY (status) REFERENCES workflow_step (id); -ALTER TABLE workflow_task ADD CONSTRAINT unique_workflow_task unique (webasset,language_id); - -alter table workflow_step add constraint fk_escalation_action foreign key (escalation_action) references workflow_action(id); - -alter table contentlet_version_info add constraint FK_con_ver_lockedby foreign key (locked_by) references user_(userid); -alter table container_version_info add constraint FK_tainer_ver_info_lockedby foreign key (locked_by) references user_(userid); -alter table template_version_info add constraint FK_temp_ver_info_lockedby foreign key (locked_by) references user_(userid); -alter table link_version_info add constraint FK_link_ver_info_lockedby foreign key (locked_by) references user_(userid); - -ALTER TABLE tag ALTER COLUMN host_id set default 'SYSTEM_HOST'; -alter table tag add constraint tag_tagname_host unique (tagname, host_id); -alter table tag_inode add constraint fk_tag_inode_tagid foreign key (tag_id) references tag (tag_id); - --- ****** Indicies Data Storage ******* -create table indicies ( - index_name varchar(100) primary key, - index_type varchar(16) not null unique -); - --- ****** Log Console Table ******* - CREATE TABLE log_mapper ( - enabled tinyint(1) not null, - log_name varchar(30) not null, - description varchar(50) not null, - primary key (log_name) - ); - - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-userActivity.log','Log Users action on pages, structures, documents.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-security.log','Log users login activity into dotCMS.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-adminaudit.log','Log Admin activity on dotCMS.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-pushpublish.log','Log Push Publishing activity on dotCMS.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','visitor-v3.log','Log Visitor Filter activity on dotCMS.'); - -create index idx_identifier_perm on identifier (asset_type,host_inode); - -CREATE TABLE broken_link ( - id VARCHAR(36) PRIMARY KEY, - inode VARCHAR(36) NOT NULL, - field VARCHAR(36) NOT NULL, - link VARCHAR(255) NOT NULL, - title VARCHAR(255) NOT NULL, - status_code integer NOT NULL -); - -alter table broken_link add CONSTRAINT fk_brokenl_content - FOREIGN KEY (inode) REFERENCES contentlet(inode) ON DELETE CASCADE; - -alter table broken_link add CONSTRAINT fk_brokenl_field - FOREIGN KEY (field) REFERENCES field(inode) ON DELETE CASCADE; - --- ****** Content Publishing Framework ******* -CREATE TABLE publishing_queue ( - id BIGINT AUTO_INCREMENT PRIMARY KEY NOT NULL, - operation BIGINT, - asset VARCHAR(2000) NOT NULL, - language_id BIGINT NOT NULL, - entered_date DATETIME, - publish_date DATETIME, - type VARCHAR(256), - bundle_id VARCHAR(256) -); - -CREATE TABLE IF NOT EXISTS publishing_queue_audit ( - bundle_id VARCHAR(36) PRIMARY KEY NOT NULL, - status INTEGER, - status_pojo LONGTEXT, - status_updated DATETIME, - create_date DATETIME); - --- ****** Content Publishing Framework - End Point Management ******* -CREATE TABLE IF NOT EXISTS publishing_end_point ( - id varchar(36) PRIMARY KEY, - group_id varchar(700), - server_name varchar(255) unique, - address varchar(250), - port varchar(10), - protocol varchar(10), - enabled tinyint, - auth_key text, - sending tinyint -); - -create table publishing_environment( - id varchar(36) NOT NULL primary key, - name varchar(255) NOT NULL unique, - push_to_all bool NOT NULL -); - -create table sitesearch_audit ( - job_id varchar(36), - job_name varchar(255) not null, - fire_date datetime not null, - incremental tinyint not null, - start_date datetime, - end_date datetime, - host_list varchar(500) not null, - all_hosts tinyint not null, - lang_list varchar(500) not null, - path varchar(500) not null, - path_include tinyint not null, - files_count integer not null, - pages_count integer not null, - urlmaps_count integer not null, - index_name varchar(100) not null, - primary key(job_id,fire_date) -); - -create table publishing_bundle( - id varchar(36) NOT NULL primary key, - name varchar(255) NOT NULL, - publish_date DATETIME, - expire_date DATETIME, - owner varchar(100), - force_push tinyint(1), - filter_key varchar(100) -); - -ALTER TABLE publishing_bundle ADD CONSTRAINT FK_publishing_bundle_owner FOREIGN KEY (owner) REFERENCES user_(userid); - -create table publishing_bundle_environment(id varchar(36) NOT NULL primary key,bundle_id varchar(36) NOT NULL, environment_id varchar(36) NOT NULL); - -alter table publishing_bundle_environment add constraint FK_bundle_id foreign key (bundle_id) references publishing_bundle(id); -alter table publishing_bundle_environment add constraint FK_environment_id foreign key (environment_id) references publishing_environment(id); - -create table publishing_pushed_assets( - bundle_id varchar(36) NOT NULL, - asset_id varchar(36) NOT NULL, - asset_type varchar(255) NOT NULL, - push_date DATETIME, - environment_id varchar(36) NOT NULL, - endpoint_ids longtext, - publisher longtext -); - -CREATE INDEX idx_pushed_assets_1 ON publishing_pushed_assets (bundle_id); -CREATE INDEX idx_pushed_assets_2 ON publishing_pushed_assets (environment_id); -CREATE INDEX idx_pushed_assets_3 ON publishing_pushed_assets (asset_id, environment_id); - -CREATE INDEX idx_pub_qa_1 ON publishing_queue_audit (status); - --- Cluster Tables - -CREATE TABLE dot_cluster(cluster_id varchar(36), cluster_salt VARCHAR(256), PRIMARY KEY (cluster_id) ); -CREATE TABLE cluster_server(server_id varchar(36), cluster_id varchar(36) NOT NULL, name varchar(100), ip_address varchar(39) NOT NULL, host varchar(255), cache_port SMALLINT, es_transport_tcp_port SMALLINT, es_network_port SMALLINT, es_http_port SMALLINT, key_ varchar(100), PRIMARY KEY (server_id) ); -ALTER TABLE cluster_server add constraint fk_cluster_id foreign key (cluster_id) REFERENCES dot_cluster(cluster_id); -CREATE TABLE cluster_server_uptime(id varchar(36),server_id varchar(36) NOT NULL, startup datetime, heartbeat datetime, PRIMARY KEY (id)) ; -ALTER TABLE cluster_server_uptime add constraint fk_cluster_server_id foreign key (server_id) REFERENCES cluster_server(server_id); - - --- Notifications Table -CREATE TABLE notification ( - group_id VARCHAR(36) NOT NULL, - user_id VARCHAR(255) NOT NULL, - message TEXT NOT NULL, - notification_type VARCHAR(100), - notification_level VARCHAR(100), - time_sent DATETIME NOT NULL, - was_read BIT -); -ALTER TABLE notification ADD CONSTRAINT PK_notification PRIMARY KEY (group_id, user_id); -ALTER TABLE notification MODIFY was_read BIT DEFAULT 0; -CREATE INDEX idx_not_read ON notification (was_read); - --- indices for version_info tables on version_ts -create index idx_contentlet_vi_version_ts on contentlet_version_info(version_ts); -create index idx_container_vi_version_ts on container_version_info(version_ts); -create index idx_template_vi_version_ts on template_version_info(version_ts); -create index idx_link_vi_version_ts on link_version_info(version_ts); - --- container multiple structures -create index idx_container_id on container_structures(container_id); -alter table container_structures add constraint FK_cs_container_id foreign key (container_id) references identifier(id); -alter table container_structures add constraint FK_cs_inode foreign key (container_inode) references inode(inode); - --- license repo -create table sitelic(id varchar(36) primary key, serverid varchar(100), license longtext not null, lastping datetime not null, startup_time bigint); - --- Integrity Checker -create table folders_ir(folder varchar(255), local_inode varchar(36), remote_inode varchar(36), local_identifier varchar(36), remote_identifier varchar(36), endpoint_id varchar(40), PRIMARY KEY (local_inode, endpoint_id)); -create table hosts_ir(local_identifier varchar(36), remote_identifier varchar(36), endpoint_id varchar(40), local_working_inode varchar(36), local_live_inode varchar(36), remote_working_inode varchar(36), remote_live_inode varchar(36), language_id bigint, host varchar(255), PRIMARY KEY (local_working_inode, language_id, endpoint_id)); -create table structures_ir(velocity_name varchar(255), local_inode varchar(36), remote_inode varchar(36), endpoint_id varchar(40), PRIMARY KEY (local_inode, endpoint_id)); -create table schemes_ir(name varchar(255), local_inode varchar(36), remote_inode varchar(36), endpoint_id varchar(40), PRIMARY KEY (local_inode, endpoint_id)); -create table htmlpages_ir(html_page varchar(255), local_working_inode varchar(36), local_live_inode varchar(36), remote_working_inode varchar(36), remote_live_inode varchar(36),local_identifier varchar(36), remote_identifier varchar(36), endpoint_id varchar(40), language_id bigint, PRIMARY KEY (local_working_inode, language_id, endpoint_id)); -create table fileassets_ir(file_name varchar(255), local_working_inode varchar(36), local_live_inode varchar(36), remote_working_inode varchar(36), remote_live_inode varchar(36),local_identifier varchar(36), remote_identifier varchar(36), endpoint_id varchar(40), language_id bigint, PRIMARY KEY (local_working_inode, language_id, endpoint_id)); -create table cms_roles_ir(name varchar(1000), role_key varchar(255), local_role_id varchar(36), remote_role_id varchar(36), local_role_fqn varchar(1000), remote_role_fqn varchar(1000), endpoint_id varchar(40), PRIMARY KEY (local_role_id, endpoint_id)); - ----Server Action -create table cluster_server_action( - server_action_id varchar(36) not null, - originator_id varchar(36) not null, - server_id varchar(36) not null, - failed boolean default false, - response varchar(2048), - action_id varchar(1024) not null, - completed boolean default false, - entered_date datetime not null, - time_out_seconds bigint not null, - PRIMARY KEY (server_action_id) -); - --- Rules Engine -create table dot_rule(id varchar(36) primary key,name varchar(255) not null,fire_on varchar(20),short_circuit boolean,parent_id varchar(36) not null,folder varchar(36) not null,priority int default 0,enabled boolean default false,mod_date datetime); -create table rule_condition_group(id varchar(36) primary key,rule_id varchar(36) references dot_rule(id),operator varchar(10) not null,priority int default 0,mod_date datetime); -create table rule_condition(id varchar(36) primary key,conditionlet text not null,condition_group varchar(36) references rule_condition_group(id),comparison varchar(36) not null,operator varchar(10) not null,priority int default 0,mod_date datetime); -create table rule_condition_value (id varchar(36) primary key, - condition_id varchar(36) references rule_condition(id),paramkey VARCHAR(255) NOT NULL,value text,priority int default 0); -create table rule_action (id varchar(36) primary key,rule_id varchar(36) references dot_rule(id),priority int default 0,actionlet text not null,mod_date datetime); -create table rule_action_pars(id varchar(36) primary key,rule_action_id varchar(36) references rule_action(id), paramkey varchar(255) not null,value text); -create index idx_rules_fire_on on dot_rule (fire_on); - -CREATE TABLE system_event ( - identifier VARCHAR(36) NOT NULL, - event_type VARCHAR(50) NOT NULL, - payload LONGTEXT NOT NULL, - created BIGINT NOT NULL, - server_id varchar(36) NOT NULL -); -ALTER TABLE system_event ADD CONSTRAINT PK_system_event PRIMARY KEY (identifier); -CREATE INDEX idx_system_event ON system_event (created); - -CREATE TABLE api_token_issued( - token_id varchar(255) NOT NULL, - token_userid varchar(255) NOT NULL, - issue_date TIMESTAMP NOT NULL default CURRENT_TIMESTAMP, - expire_date TIMESTAMP NOT NULL default CURRENT_TIMESTAMP, - requested_by_userid varchar(255) NOT NULL, - requested_by_ip varchar(255) NOT NULL, - revoke_date TIMESTAMP NULL DEFAULT NULL, - allowed_from varchar(255) , - issuer varchar(255) , - claims text , - mod_date TIMESTAMP NOT NULL default CURRENT_TIMESTAMP, - PRIMARY KEY (token_id) - ); - -create index idx_api_token_issued_user ON api_token_issued (token_userid); - -CREATE UNIQUE INDEX idx_ident_uniq_asset_name on identifier (full_path_lc,host_inode); - -create table storage_group ( - group_name varchar(255) not null, - mod_date TIMESTAMP NOT NULL default CURRENT_TIMESTAMP, - PRIMARY KEY (group_name) -); - -create table storage ( - path varchar(255) not null, - group_name varchar(255) not null, - hash varchar(64) not null, - mod_date TIMESTAMP NOT NULL default CURRENT_TIMESTAMP, - hash_ref varchar(64), - PRIMARY KEY (path, group_name), - FOREIGN KEY (group_name) REFERENCES storage_group (group_name) -); - -CREATE INDEX idx_storage_hash ON storage (hash); - -create table storage_data ( - hash_id varchar(64) not null, - data MEDIUMBLOB not null, - mod_date TIMESTAMP NOT NULL default CURRENT_TIMESTAMP, - PRIMARY KEY (hash_id) -); - -create table storage_x_data ( - storage_hash varchar(64) not null, - data_hash varchar(64) not null, - data_order integer not null, - mod_date TIMESTAMP NOT NULL default CURRENT_TIMESTAMP, - PRIMARY KEY (storage_hash, data_hash), - FOREIGN KEY (data_hash) REFERENCES storage_data (hash_id) -); - --- https://github.com/lukas-krecan/ShedLock -CREATE TABLE shedlock(name VARCHAR(64) NOT NULL, lock_until datetime2 NOT NULL, - locked_at datetime2 NOT NULL, locked_by VARCHAR(255) NOT NULL, PRIMARY KEY (name)); diff --git a/dotCMS/src/main/resources/oracle.sql b/dotCMS/src/main/resources/oracle.sql deleted file mode 100644 index 1384446c1d42..000000000000 --- a/dotCMS/src/main/resources/oracle.sql +++ /dev/null @@ -1,2517 +0,0 @@ -create table Address ( - addressId varchar2(100) not null primary key, - companyId varchar2(100) not null, - userId varchar2(100) not null, - userName varchar2(100) null, - createDate date null, - modifiedDate date null, - className varchar2(100) null, - classPK varchar2(100) null, - description varchar2(100) null, - street1 varchar2(100) null, - street2 varchar2(100) null, - city varchar2(100) null, - state varchar2(100) null, - zip varchar2(100) null, - country varchar2(100) null, - phone varchar2(100) null, - fax varchar2(100) null, - cell varchar2(100) null, - priority number(30,0) -); - -create table AdminConfig ( - configId varchar2(100) not null primary key, - companyId varchar2(100) not null, - type_ varchar2(100) null, - name varchar2(100) null, - config long varchar null -); - -create table Company ( - companyId varchar2(100) not null primary key, - key_ long varchar null, - portalURL varchar2(100) not null, - homeURL varchar2(100) not null, - mx varchar2(100) default 'dotcms.com', - name varchar2(100) not null, - shortName varchar2(100) not null, - type_ varchar2(100) null, - size_ varchar2(100) null, - street varchar2(100) null, - city varchar2(100) null, - state varchar2(100) null, - zip varchar2(100) null, - phone varchar2(100) null, - fax varchar2(100) null, - emailAddress varchar2(100) null, - authType varchar2(100) null, - autoLogin number(1, 0), - strangers number(1, 0), - default_language_id number(19,0) null -); - -create table Counter ( - name varchar2(100) not null primary key, - currentId number(30,0) -); - -create table Image ( - imageId varchar2(200) not null primary key, - text_ long varchar not null -); - -create table PasswordTracker ( - passwordTrackerId varchar2(100) not null primary key, - userId varchar2(100) not null, - createDate date not null, - password_ varchar2(100) not null -); - -create table PollsChoice ( - choiceId varchar2(100) not null, - questionId varchar2(100) not null, - description varchar2(4000) null, - primary key (choiceId, questionId) -); - -create table PollsDisplay ( - layoutId varchar2(100) not null, - userId varchar2(100) not null, - portletId varchar2(100) not null, - questionId varchar2(100) not null, - primary key (layoutId, userId, portletId) -); - -create table PollsQuestion ( - questionId varchar2(100) not null primary key, - portletId varchar2(100) not null, - groupId varchar2(100) not null, - companyId varchar2(100) not null, - userId varchar2(100) not null, - userName varchar2(100) null, - createDate date null, - modifiedDate date null, - title varchar2(100) null, - description varchar2(4000) null, - expirationDate date null, - lastVoteDate date null -); - -create table PollsVote ( - questionId varchar2(100) not null, - userId varchar2(100) not null, - choiceId varchar2(100) not null, - voteDate date null, - primary key (questionId, userId) -); - -create table Portlet ( - portletId varchar2(100) not null, - groupId varchar2(100) not null, - companyId varchar2(100) not null, - defaultPreferences nclob null, - narrow number(1, 0), - roles varchar2(4000) null, - active_ number(1, 0), - primary key (portletId, groupId, companyId) -); - -create table PortletPreferences ( - portletId varchar2(100) not null, - userId varchar2(100) not null, - layoutId varchar2(100) not null, - preferences long varchar null, - primary key (portletId, userId, layoutId) -); - -create table User_ ( - userId varchar2(100) not null primary key, - companyId varchar2(100) not null, - createDate date null, - mod_date date null, - password_ nclob null, - passwordEncrypted number(1, 0), - passwordExpirationDate date null, - passwordReset number(1, 0), - firstName varchar2(100) null, - middleName varchar2(100) null, - lastName varchar2(100) null, - nickName varchar2(100) null, - male number(1, 0), - birthday date null, - emailAddress varchar2(100) null, - smsId varchar2(100) null, - aimId varchar2(100) null, - icqId varchar2(100) null, - msnId varchar2(100) null, - ymId varchar2(100) null, - favoriteActivity varchar2(100) null, - favoriteBibleVerse varchar2(100) null, - favoriteFood varchar2(100) null, - favoriteMovie varchar2(100) null, - favoriteMusic varchar2(100) null, - languageId varchar2(100) null, - timeZoneId varchar2(100) null, - skinId varchar2(100) null, - dottedSkins number(1, 0), - roundedSkins number(1, 0), - greeting varchar2(100) null, - resolution varchar2(100) null, - refreshRate varchar2(100) null, - layoutIds varchar2(100) null, - comments varchar2(4000) null, - loginDate date null, - loginIP varchar2(100) null, - lastLoginDate date null, - lastLoginIP varchar2(100) null, - failedLoginAttempts number(30,0), - agreedToTermsOfUse number(1, 0), - active_ number(1, 0), - delete_in_progress number(1,0) default 0, - delete_date DATE, - additional_info NCLOB NULL -); - -create table UserTracker ( - userTrackerId varchar2(100) not null primary key, - companyId varchar2(100) not null, - userId varchar2(100) not null, - modifiedDate date null, - remoteAddr varchar2(100) null, - remoteHost varchar2(100) null, - userAgent varchar2(100) null -); - -create table UserTrackerPath ( - userTrackerPathId varchar2(100) not null primary key, - userTrackerId varchar2(100) not null, - path varchar2(4000) not null, - pathDate date not null -); - --- --- Global --- - -insert into Counter values ('com.liferay.portal.model.Address', 10); -insert into Counter values ('com.liferay.portal.model.Role', 100); -insert into Counter values ('com.liferay.portal.model.User.liferay.com', 10); -insert into Counter values ('com.liferay.portlet.polls.model.PollsQuestion', 10); - --- --- Liferay, LLC --- - -insert into Company (companyId, portalURL, homeURL, mx, name, shortName, type_, size_, emailAddress, authType, autoLogin, strangers) values ('liferay.com', 'localhost', 'localhost', 'liferay.com', 'Liferay, LLC', 'Liferay', 'biz', '', 'test@liferay.com', 'emailAddress', '1', '1'); -update Company set street = '1220 Brea Canyon Rd.', city = 'Diamond Bar', state = 'CA', zip = '91789' where companyId = 'liferay.com'; - -insert into PollsDisplay (layoutId, userId, portletId, questionId) values ('1.1', 'group.1', '59', '1'); -insert into PollsChoice (choiceId, questionId, description) values ('a', '1', 'Chocolate'); -insert into PollsChoice (choiceId, questionId, description) values ('b', '1', 'Strawberry'); -insert into PollsChoice (choiceId, questionId, description) values ('c', '1', 'Vanilla'); -insert into PollsQuestion (questionId, portletId, groupId, companyId, userId, userName, createDate, modifiedDate, title, description) values ('1', '25', '-1', 'liferay.com', 'liferay.com.1', 'John Wayne', sysdate, sysdate, 'What is your favorite ice cream flavor?', 'What is your favorite ice cream flavor?'); - --- --- Default User --- - -insert into User_ (userId, companyId, createDate, password_, passwordEncrypted, passwordReset, firstName, middleName, lastName, male, birthday, emailAddress, skinId, dottedSkins, roundedSkins, greeting, layoutIds, loginDate, failedLoginAttempts, agreedToTermsOfUse, active_) values ('liferay.com.default', 'default', sysdate, 'password', '0', '0', '', '', '', '1', to_date('1970-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS'), 'default@liferay.com', '01', '0', '0', 'Welcome!', '', sysdate, 0, '0', '1'); - --- --- Test User --- - -insert into User_ (userId, companyId, createDate, password_, passwordEncrypted, passwordReset, firstName, middleName, lastName, nickName, male, birthday, emailAddress, skinId, dottedSkins, roundedSkins, greeting, layoutIds, loginDate, failedLoginAttempts, agreedToTermsOfUse, active_) values ('liferay.com.1', 'liferay.com', sysdate, 'test', '0', '0', 'John', '', 'Wayne', 'Duke', '1', to_date('1970-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS'), 'test@liferay.com', '01', '0', '1', 'Welcome John Wayne!', '1,', sysdate, 0, '1', '1'); -CREATE TABLE qrtz_job_details - ( - JOB_NAME VARCHAR2(80) NOT NULL, - JOB_GROUP VARCHAR2(80) NOT NULL, - DESCRIPTION VARCHAR2(120) NULL, - JOB_CLASS_NAME VARCHAR2(128) NOT NULL, - IS_DURABLE VARCHAR2(1) NOT NULL, - IS_VOLATILE VARCHAR2(1) NOT NULL, - IS_STATEFUL VARCHAR2(1) NOT NULL, - REQUESTS_RECOVERY VARCHAR2(1) NOT NULL, - JOB_DATA BLOB NULL, - PRIMARY KEY (JOB_NAME,JOB_GROUP) -); -CREATE TABLE qrtz_job_listeners - ( - JOB_NAME VARCHAR2(80) NOT NULL, - JOB_GROUP VARCHAR2(80) NOT NULL, - JOB_LISTENER VARCHAR2(80) NOT NULL, - PRIMARY KEY (JOB_NAME,JOB_GROUP,JOB_LISTENER), - FOREIGN KEY (JOB_NAME,JOB_GROUP) - REFERENCES QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP) -); -CREATE TABLE qrtz_triggers - ( - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - JOB_NAME VARCHAR2(80) NOT NULL, - JOB_GROUP VARCHAR2(80) NOT NULL, - IS_VOLATILE VARCHAR2(1) NOT NULL, - DESCRIPTION VARCHAR2(120) NULL, - NEXT_FIRE_TIME NUMBER(13) NULL, - PREV_FIRE_TIME NUMBER(13) NULL, - PRIORITY NUMBER(13) NULL, - TRIGGER_STATE VARCHAR2(16) NOT NULL, - TRIGGER_TYPE VARCHAR2(8) NOT NULL, - START_TIME NUMBER(13) NOT NULL, - END_TIME NUMBER(13) NULL, - CALENDAR_NAME VARCHAR2(80) NULL, - MISFIRE_INSTR NUMBER(2) NULL, - JOB_DATA BLOB NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (JOB_NAME,JOB_GROUP) - REFERENCES QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP) -); -CREATE TABLE qrtz_simple_triggers - ( - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - REPEAT_COUNT NUMBER(7) NOT NULL, - REPEAT_INTERVAL NUMBER(12) NOT NULL, - TIMES_TRIGGERED NUMBER(7) NOT NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); -CREATE TABLE qrtz_cron_triggers - ( - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - CRON_EXPRESSION VARCHAR2(80) NOT NULL, - TIME_ZONE_ID VARCHAR2(80), - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); -CREATE TABLE qrtz_blob_triggers - ( - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - BLOB_DATA BLOB NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); -CREATE TABLE qrtz_trigger_listeners - ( - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - TRIGGER_LISTENER VARCHAR2(80) NOT NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_LISTENER), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); -CREATE TABLE qrtz_calendars - ( - CALENDAR_NAME VARCHAR2(80) NOT NULL, - CALENDAR BLOB NOT NULL, - PRIMARY KEY (CALENDAR_NAME) -); -CREATE TABLE qrtz_paused_trigger_grps - ( - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - PRIMARY KEY (TRIGGER_GROUP) -); -CREATE TABLE qrtz_fired_triggers - ( - ENTRY_ID VARCHAR2(95) NOT NULL, - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - IS_VOLATILE VARCHAR2(1) NOT NULL, - INSTANCE_NAME VARCHAR2(80) NOT NULL, - FIRED_TIME NUMBER(13) NOT NULL, - PRIORITY NUMBER(13) NOT NULL, - STATE VARCHAR2(16) NOT NULL, - JOB_NAME VARCHAR2(80) NULL, - JOB_GROUP VARCHAR2(80) NULL, - IS_STATEFUL VARCHAR2(1) NULL, - REQUESTS_RECOVERY VARCHAR2(1) NULL, - PRIMARY KEY (ENTRY_ID) -); -CREATE TABLE qrtz_scheduler_state - ( - INSTANCE_NAME VARCHAR2(80) NOT NULL, - LAST_CHECKIN_TIME NUMBER(13) NOT NULL, - CHECKIN_INTERVAL NUMBER(13) NOT NULL, - PRIMARY KEY (INSTANCE_NAME) -); -CREATE TABLE qrtz_locks - ( - LOCK_NAME VARCHAR2(40) NOT NULL, - PRIMARY KEY (LOCK_NAME) -); -INSERT INTO qrtz_locks values('TRIGGER_ACCESS'); -INSERT INTO qrtz_locks values('JOB_ACCESS'); -INSERT INTO qrtz_locks values('CALENDAR_ACCESS'); -INSERT INTO qrtz_locks values('STATE_ACCESS'); -INSERT INTO qrtz_locks values('MISFIRE_ACCESS'); -create index idx_qrtz_j_req_recovery on qrtz_job_details(REQUESTS_RECOVERY); -create index idx_qrtz_t_next_fire_time on qrtz_triggers(NEXT_FIRE_TIME); -create index idx_qrtz_t_state on qrtz_triggers(TRIGGER_STATE); -create index idx_qrtz_t_nft_st on qrtz_triggers(NEXT_FIRE_TIME,TRIGGER_STATE); -create index idx_qrtz_t_volatile on qrtz_triggers(IS_VOLATILE); -create index idx_qrtz_ft_trig_name on qrtz_fired_triggers(TRIGGER_NAME); -create index idx_qrtz_ft_trig_group on qrtz_fired_triggers(TRIGGER_GROUP); -create index idx_qrtz_ft_trig_nm_gp on qrtz_fired_triggers(TRIGGER_NAME,TRIGGER_GROUP); -create index idx_qrtz_ft_trig_volatile on qrtz_fired_triggers(IS_VOLATILE); -create index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers(INSTANCE_NAME); -create index idx_qrtz_ft_job_name on qrtz_fired_triggers(JOB_NAME); -create index idx_qrtz_ft_job_group on qrtz_fired_triggers(JOB_GROUP); -create index idx_qrtz_ft_job_stateful on qrtz_fired_triggers(IS_STATEFUL); -create index idx_qrtz_ft_job_req_recovery on qrtz_fired_triggers(REQUESTS_RECOVERY); - - -CREATE TABLE qrtz_excl_job_details - ( - JOB_NAME VARCHAR2(80) NOT NULL, - JOB_GROUP VARCHAR2(80) NOT NULL, - DESCRIPTION VARCHAR2(120) NULL, - JOB_CLASS_NAME VARCHAR2(128) NOT NULL, - IS_DURABLE VARCHAR2(1) NOT NULL, - IS_VOLATILE VARCHAR2(1) NOT NULL, - IS_STATEFUL VARCHAR2(1) NOT NULL, - REQUESTS_RECOVERY VARCHAR2(1) NOT NULL, - JOB_DATA BLOB NULL, - PRIMARY KEY (JOB_NAME,JOB_GROUP) -); -CREATE TABLE qrtz_excl_job_listeners - ( - JOB_NAME VARCHAR2(80) NOT NULL, - JOB_GROUP VARCHAR2(80) NOT NULL, - JOB_LISTENER VARCHAR2(80) NOT NULL, - PRIMARY KEY (JOB_NAME,JOB_GROUP,JOB_LISTENER), - FOREIGN KEY (JOB_NAME,JOB_GROUP) - REFERENCES QRTZ_EXCL_JOB_DETAILS(JOB_NAME,JOB_GROUP) -); -CREATE TABLE qrtz_excl_triggers - ( - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - JOB_NAME VARCHAR2(80) NOT NULL, - JOB_GROUP VARCHAR2(80) NOT NULL, - IS_VOLATILE VARCHAR2(1) NOT NULL, - DESCRIPTION VARCHAR2(120) NULL, - NEXT_FIRE_TIME NUMBER(13) NULL, - PREV_FIRE_TIME NUMBER(13) NULL, - PRIORITY NUMBER(13) NULL, - TRIGGER_STATE VARCHAR2(16) NOT NULL, - TRIGGER_TYPE VARCHAR2(8) NOT NULL, - START_TIME NUMBER(13) NOT NULL, - END_TIME NUMBER(13) NULL, - CALENDAR_NAME VARCHAR2(80) NULL, - MISFIRE_INSTR NUMBER(2) NULL, - JOB_DATA BLOB NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (JOB_NAME,JOB_GROUP) - REFERENCES QRTZ_EXCL_JOB_DETAILS(JOB_NAME,JOB_GROUP) -); -CREATE TABLE qrtz_excl_simple_triggers - ( - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - REPEAT_COUNT NUMBER(7) NOT NULL, - REPEAT_INTERVAL NUMBER(12) NOT NULL, - TIMES_TRIGGERED NUMBER(7) NOT NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_EXCL_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); -CREATE TABLE qrtz_excl_cron_triggers - ( - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - CRON_EXPRESSION VARCHAR2(80) NOT NULL, - TIME_ZONE_ID VARCHAR2(80), - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_EXCL_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); -CREATE TABLE qrtz_excl_blob_triggers - ( - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - BLOB_DATA BLOB NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_EXCL_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); -CREATE TABLE qrtz_excl_trigger_listeners - ( - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - TRIGGER_LISTENER VARCHAR2(80) NOT NULL, - PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_LISTENER), - FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) - REFERENCES QRTZ_EXCL_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP) -); -CREATE TABLE qrtz_excl_calendars - ( - CALENDAR_NAME VARCHAR2(80) NOT NULL, - CALENDAR BLOB NOT NULL, - PRIMARY KEY (CALENDAR_NAME) -); -CREATE TABLE qrtz_excl_paused_trigger_grps - ( - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - PRIMARY KEY (TRIGGER_GROUP) -); -CREATE TABLE qrtz_excl_fired_triggers - ( - ENTRY_ID VARCHAR2(95) NOT NULL, - TRIGGER_NAME VARCHAR2(80) NOT NULL, - TRIGGER_GROUP VARCHAR2(80) NOT NULL, - IS_VOLATILE VARCHAR2(1) NOT NULL, - INSTANCE_NAME VARCHAR2(80) NOT NULL, - FIRED_TIME NUMBER(13) NOT NULL, - PRIORITY NUMBER(13) NOT NULL, - STATE VARCHAR2(16) NOT NULL, - JOB_NAME VARCHAR2(80) NULL, - JOB_GROUP VARCHAR2(80) NULL, - IS_STATEFUL VARCHAR2(1) NULL, - REQUESTS_RECOVERY VARCHAR2(1) NULL, - PRIMARY KEY (ENTRY_ID) -); -CREATE TABLE qrtz_excl_scheduler_state - ( - INSTANCE_NAME VARCHAR2(80) NOT NULL, - LAST_CHECKIN_TIME NUMBER(13) NOT NULL, - CHECKIN_INTERVAL NUMBER(13) NOT NULL, - PRIMARY KEY (INSTANCE_NAME) -); -CREATE TABLE qrtz_excl_locks - ( - LOCK_NAME VARCHAR2(40) NOT NULL, - PRIMARY KEY (LOCK_NAME) -); -INSERT INTO qrtz_excl_locks values('TRIGGER_ACCESS'); -INSERT INTO qrtz_excl_locks values('JOB_ACCESS'); -INSERT INTO qrtz_excl_locks values('CALENDAR_ACCESS'); -INSERT INTO qrtz_excl_locks values('STATE_ACCESS'); -INSERT INTO qrtz_excl_locks values('MISFIRE_ACCESS'); -create index idx_qrtz_excl_j_req_recovery on qrtz_excl_job_details(REQUESTS_RECOVERY); -create index idx_qrtz_excl_t_next_fire_time on qrtz_excl_triggers(NEXT_FIRE_TIME); -create index idx_qrtz_excl_t_state on qrtz_excl_triggers(TRIGGER_STATE); -create index idx_qrtz_excl_t_nft_st on qrtz_excl_triggers(NEXT_FIRE_TIME,TRIGGER_STATE); -create index idx_qrtz_excl_t_volatile on qrtz_excl_triggers(IS_VOLATILE); -create index idx_qrtz_excl_ft_trig_name on qrtz_excl_fired_triggers(TRIGGER_NAME); -create index idx_qrtz_excl_ft_trig_group on qrtz_excl_fired_triggers(TRIGGER_GROUP); -create index idx_qrtz_excl_ft_trig_nm_gp on qrtz_excl_fired_triggers(TRIGGER_NAME,TRIGGER_GROUP); -create index idx_qrtz_excl_ft_trig_volatile on qrtz_excl_fired_triggers(IS_VOLATILE); -create index idx_qrtz_excl_fttriginstname on qrtz_excl_fired_triggers(INSTANCE_NAME); -create index idx_qrtz_excl_ft_jobname on qrtz_excl_fired_triggers(JOB_NAME); -create index idx_qrtz_excl_ft_jobgroup on qrtz_excl_fired_triggers(JOB_GROUP); -create index idx_qrtz_excl_ft_jobstateful on qrtz_excl_fired_triggers(IS_STATEFUL); -create index idx_qrtzexclftjobreqrec on qrtz_excl_fired_triggers(REQUESTS_RECOVERY); - -create table analytic_summary_pages ( - id number(19,0) not null, - summary_id number(19,0) not null, - inode varchar2(255), - hits number(19,0), - uri varchar2(255), - primary key (id) -); -create table tag ( - tag_id varchar2(100) not null, - tagname varchar2(255) not null, - host_id varchar2(255), - user_id varchar2(255), - persona number(1,0) default 0, - mod_date date, - primary key (tag_id) -); -create table user_comments ( - inode varchar2(36) not null, - user_id varchar2(255), - cdate date, - comment_user_id varchar2(100), - type varchar2(255), - method varchar2(255), - subject varchar2(255), - ucomment nclob, - communication_id varchar2(36), - primary key (inode) -); -create table permission_reference ( - id number(19,0) not null, - asset_id varchar2(36), - reference_id varchar2(36), - permission_type varchar2(100), - primary key (id), - unique (asset_id) -); -create table contentlet_version_info ( - identifier varchar2(36) not null, - lang number(19,0) not null, - working_inode varchar2(36) not null, - live_inode varchar2(36), - deleted number(1,0) not null, - locked_by varchar2(100), - locked_on date, - version_ts date not null, - primary key (identifier, lang) -); -create table fixes_audit ( - id varchar2(36) not null, - table_name varchar2(255), - action varchar2(255), - records_altered number(10,0), - datetime date, - primary key (id) -); -create table container_version_info ( - identifier varchar2(36) not null, - working_inode varchar2(36) not null, - live_inode varchar2(36), - deleted number(1,0) not null, - locked_by varchar2(100), - locked_on date, - version_ts date not null, - primary key (identifier) -); -create table trackback ( - id number(19,0) not null, - asset_identifier varchar2(36), - title varchar2(255), - excerpt varchar2(255), - url varchar2(255), - blog_name varchar2(255), - track_date date not null, - primary key (id) -); -create table plugin ( - id varchar2(255) not null, - plugin_name varchar2(255) not null, - plugin_version varchar2(255) not null, - author varchar2(255) not null, - first_deployed_date date not null, - last_deployed_date date not null, - primary key (id) -); -create table mailing_list ( - inode varchar2(36) not null, - title varchar2(255), - public_list number(1,0), - user_id varchar2(255), - primary key (inode) -); -create table recipient ( - inode varchar2(36) not null, - name varchar2(255), - lastname varchar2(255), - email varchar2(255), - sent date, - opened date, - last_result number(10,0), - last_message varchar2(255), - user_id varchar2(100), - primary key (inode) -); -create table web_form ( - web_form_id varchar2(36) not null, - form_type varchar2(255), - submit_date date, - prefix varchar2(255), - first_name varchar2(255), - middle_initial varchar2(255), - middle_name varchar2(255), - full_name varchar2(255), - organization varchar2(255), - title varchar2(255), - last_name varchar2(255), - address varchar2(255), - address1 varchar2(255), - address2 varchar2(255), - city varchar2(255), - state varchar2(255), - zip varchar2(255), - country varchar2(255), - phone varchar2(255), - email varchar2(255), - custom_fields nclob, - user_inode varchar2(100), - categories varchar2(255), - primary key (web_form_id) -); -create table analytic_summary_period ( - id number(19,0) not null, - full_date date, - day number(10,0), - week number(10,0), - month number(10,0), - year varchar2(255), - dayname varchar2(50) not null, - monthname varchar2(50) not null, - primary key (id), - unique (full_date) -); -create table tree ( - child varchar2(36) not null, - parent varchar2(36) not null, - relation_type varchar2(64) not null, - tree_order number(10,0), - primary key (child, parent, relation_type) -); -create table analytic_summary ( - id number(19,0) not null, - summary_period_id number(19,0) not null, - host_id varchar2(36) not null, - visits number(19,0), - page_views number(19,0), - unique_visits number(19,0), - new_visits number(19,0), - direct_traffic number(19,0), - referring_sites number(19,0), - search_engines number(19,0), - bounce_rate number(10,0), - avg_time_on_site date, - primary key (id), - unique (summary_period_id, host_id) -); -create table users_cms_roles ( - id varchar2(36) not null, - user_id varchar2(100) not null, - role_id varchar2(36) not null, - primary key (id) -); -create table template ( - inode varchar2(36) not null, - show_on_menu number(1,0), - title varchar2(255), - mod_date date, - mod_user varchar2(100), - sort_order number(10,0), - friendly_name varchar2(255), - body nclob, - header nclob, - footer nclob, - image varchar2(36), - identifier varchar2(36), - drawed number(1,0), - drawed_body nclob, - add_container_links number(10,0), - containers_added number(10,0), - head_code nclob, - theme varchar2(255), - primary key (inode) -); -create table analytic_summary_content ( - id number(19,0) not null, - summary_id number(19,0) not null, - inode varchar2(255), - hits number(19,0), - uri varchar2(255), - title varchar2(255), - primary key (id) -); -create table structure ( - inode varchar2(36) not null, - name varchar2(255), - description varchar2(255), - default_structure number(1,0), - review_interval varchar2(255), - reviewer_role varchar2(255), - page_detail varchar2(36), - structuretype number(10,0), - system number(1,0), - fixed number(1,0) not null, - velocity_var_name varchar2(255), - url_map_pattern varchar2(512), - host varchar2(36) not null, - folder varchar2(36) not null, - expire_date_var varchar2(255), - publish_date_var varchar2(255), - mod_date date, - sort_order number(10,0), - icon varchar2(255), - primary key (inode) -); -create table cms_role ( - id varchar2(36) not null, - role_name varchar2(255) not null, - description nclob, - role_key varchar2(255), - db_fqn varchar2(1000) not null, - parent varchar2(36) not null, - edit_permissions number(1,0), - edit_users number(1,0), - edit_layouts number(1,0), - locked number(1,0), - system number(1,0), - primary key (id) -); -create table container_structures ( - id varchar2(36) not null, - container_id varchar2(36) not null, - container_inode varchar2(36) not null, - structure_id varchar2(36) not null, - code nclob, - primary key (id) -); -create table permission ( - id number(19,0) not null, - permission_type varchar2(500), - inode_id varchar2(36), - roleid varchar2(36), - permission number(10,0), - primary key (id), - unique (permission_type, inode_id, roleid) -); - create table contentlet (inode varchar2(36) not null, - show_on_menu number(1,0), - title varchar2(255), - mod_date date, - mod_user varchar2(100), - sort_order number(10,0), - friendly_name varchar2(255), - structure_inode varchar2(36), - disabled_wysiwyg varchar2(255), - identifier varchar2(36), - language_id number(19,0), - contentlet_as_json nclob, - date1 date, - date2 date, - date3 date, - date4 date, - date5 date, - date6 date, - date7 date, - date8 date, - date9 date, - date10 date, - date11 date, - date12 date, - date13 date, - date14 date, - date15 date, - date16 date, - date17 date, - date18 date, - date19 date, - date20 date, - date21 date, - date22 date, - date23 date, - date24 date, - date25 date, - text1 varchar2(255), - text2 varchar2(255), - text3 varchar2(255), - text4 varchar2(255), - text5 varchar2(255), - text6 varchar2(255), - text7 varchar2(255), - text8 varchar2(255), - text9 varchar2(255), - text10 varchar2(255), - text11 varchar2(255), - text12 varchar2(255), - text13 varchar2(255), - text14 varchar2(255), - text15 varchar2(255), - text16 varchar2(255), - text17 varchar2(255), - text18 varchar2(255), - text19 varchar2(255), - text20 varchar2(255), - text21 varchar2(255), - text22 varchar2(255), - text23 varchar2(255), - text24 varchar2(255), - text25 varchar2(255), - text_area1 nclob, - text_area2 nclob, - text_area3 nclob, - text_area4 nclob, - text_area5 nclob, - text_area6 nclob, - text_area7 nclob, - text_area8 nclob, - text_area9 nclob, - text_area10 nclob, - text_area11 nclob, - text_area12 nclob, - text_area13 nclob, - text_area14 nclob, - text_area15 nclob, - text_area16 nclob, - text_area17 nclob, - text_area18 nclob, - text_area19 nclob, - text_area20 nclob, - text_area21 nclob, - text_area22 nclob, - text_area23 nclob, - text_area24 nclob, - text_area25 nclob, - integer1 number(19,0), - integer2 number(19,0), - integer3 number(19,0), - integer4 number(19,0), - integer5 number(19,0), - integer6 number(19,0), - integer7 number(19,0), - integer8 number(19,0), - integer9 number(19,0), - integer10 number(19,0), - integer11 number(19,0), - integer12 number(19,0), - integer13 number(19,0), - integer14 number(19,0), - integer15 number(19,0), - integer16 number(19,0), - integer17 number(19,0), - integer18 number(19,0), - integer19 number(19,0), - integer20 number(19,0), - integer21 number(19,0), - integer22 number(19,0), - integer23 number(19,0), - integer24 number(19,0), - integer25 number(19,0), - "float1" float, - "float2" float, - "float3" float, - "float4" float, - "float5" float, - "float6" float, - "float7" float, - "float8" float, - "float9" float, - "float10" float, - "float11" float, - "float12" float, - "float13" float, - "float14" float, - "float15" float, - "float16" float, - "float17" float, - "float18" float, - "float19" float, - "float20" float, - "float21" float, - "float22" float, - "float23" float, - "float24" float, - "float25" float, - bool1 number(1,0), - bool2 number(1,0), - bool3 number(1,0), - bool4 number(1,0), - bool5 number(1,0), - bool6 number(1,0), - bool7 number(1,0), - bool8 number(1,0), - bool9 number(1,0), - bool10 number(1,0), - bool11 number(1,0), - bool12 number(1,0), - bool13 number(1,0), - bool14 number(1,0), - bool15 number(1,0), - bool16 number(1,0), - bool17 number(1,0), - bool18 number(1,0), - bool19 number(1,0), - bool20 number(1,0), - bool21 number(1,0), - bool22 number(1,0), - bool23 number(1,0), - bool24 number(1,0), - bool25 number(1,0), - primary key (inode)); -create table analytic_summary_404 ( - id number(19,0) not null, - summary_period_id number(19,0) not null, - host_id varchar2(36), - uri varchar2(255), - referer_uri varchar2(255), - primary key (id) -); -create table cms_layouts_portlets ( - id varchar2(36) not null, - layout_id varchar2(36) not null, - portlet_id varchar2(100) not null, - portlet_order number(10,0), - primary key (id) -); -create table report_asset ( - inode varchar2(36) not null, - report_name varchar2(255) not null, - report_description varchar2(1000) not null, - requires_input number(1,0), - ds varchar2(100) not null, - web_form_report number(1,0), - primary key (inode) -); -create table workflow_comment ( - id varchar2(36) not null, - creation_date date, - posted_by varchar2(255), - wf_comment nclob, - workflowtask_id varchar2(36), - primary key (id) -); -create table category ( - inode varchar2(36) not null, - category_name varchar2(255), - category_key varchar2(255), - sort_order number(10,0), - active number(1,0), - keywords nclob, - category_velocity_var_name varchar2(255), - mod_date date, - primary key (inode) -); -create table chain_link_code ( - id number(19,0) not null, - class_name varchar2(255) unique, - code nclob not null, - last_mod_date date not null, - language varchar2(255) not null, - primary key (id) -); -create table analytic_summary_visits ( - id number(19,0) not null, - summary_period_id number(19,0) not null, - host_id varchar2(36), - visit_time date, - visits number(19,0), - primary key (id) -); -create table template_version_info ( - identifier varchar2(36) not null, - working_inode varchar2(36) not null, - live_inode varchar2(36), - deleted number(1,0) not null, - locked_by varchar2(100), - locked_on date, - version_ts date not null, - primary key (identifier) -); -create table user_preferences ( - id number(19,0) not null, - user_id varchar2(100) not null, - preference varchar2(255), - pref_value nclob, - primary key (id) -); -create table language ( - id number(19,0) not null, - language_code varchar2(5), - country_code varchar2(255), - language varchar2(255), - country varchar2(255), - primary key (id) -); -create table users_to_delete ( - id number(19,0) not null, - user_id varchar2(255), - primary key (id) -); -create table identifier ( - id varchar2(36) not null, - parent_path varchar2(255), - asset_name varchar2(255), - host_inode varchar2(36), - asset_type varchar2(64), - syspublish_date date, - sysexpire_date date, - full_path_lc as ( CASE WHEN parent_path = 'System folder' THEN '/' ELSE lower(concat(parent_path, asset_name)) END), - owner varchar2(255), - create_date date, - asset_subtype varchar2(255), - primary key (id), - unique (parent_path, asset_name, host_inode) -); -create table clickstream ( - clickstream_id number(19,0) not null, - cookie_id varchar2(255), - user_id varchar2(255), - start_date date, - end_date date, - referer varchar2(255), - remote_address varchar2(255), - remote_hostname varchar2(255), - user_agent varchar2(255), - bot number(1,0), - host_id varchar2(36), - last_page_id varchar2(50), - first_page_id varchar2(50), - operating_system varchar2(50), - browser_name varchar2(50), - browser_version varchar2(50), - mobile_device number(1,0), - number_of_requests number(10,0), - primary key (clickstream_id) -); -create table multi_tree ( - child varchar2(36) not null, - parent1 varchar2(36) not null, - parent2 varchar2(36) not null, - relation_type varchar2(64) not null, - tree_order number(10,0), - personalization varchar2(255) default 'dot:default' not null, - primary key (child, parent1, parent2, relation_type, personalization) -); -create table workflow_task ( - id varchar2(36) not null, - creation_date date, - mod_date date, - due_date date, - created_by varchar2(255), - assigned_to varchar2(255), - belongs_to varchar2(255), - title varchar2(255), - description nclob, - status varchar2(255), - webasset varchar2(255), - language_id number(19,0), - primary key (id) -); - -create table workflow_action_mappings ( - id varchar2(36) not null primary key , - action varchar2(36) not null, - workflow_action varchar2(255) not null, - scheme_or_content_type varchar2(255) not null -); - -CREATE UNIQUE INDEX idx_workflow_action_mappings ON workflow_action_mappings (action, workflow_action, scheme_or_content_type); - -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('3d6be719-6b61-4ef8-a594-a9764e461597','NEW' ,'ceca71a0-deee-4999-bd47-b01baa1bcfc8','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('63865890-c863-43a1-ab61-4b495dba5eb5','EDIT' ,'ceca71a0-deee-4999-bd47-b01baa1bcfc8','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('2016a72e-85c7-4ee0-936f-36ce52df355e','PUBLISH' ,'000ec468-0a63-4283-beb7-fcb36c107b2f','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('3ec446c8-a9b6-47fe-830f-1e623493090c','UNPUBLISH','38efc763-d78f-4e4b-b092-59cd8c579b93','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('e7b8c8a3-e605-473c-8680-6d95cac15c9b','ARCHIVE' ,'4da13a42-5d59-480c-ad8f-94a3adf809fe','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('99019118-df2c-4297-a5aa-2fe3fe0f52ce','UNARCHIVE','c92f9aa1-9503-4567-ac30-d3242b54d02d','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('d073436e-3c10-4e4c-8c97-225e9cddf320','DELETE' ,'777f1c6b-c877-4a37-ba4b-10627316c2cc','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); -insert into workflow_action_mappings(id, action, workflow_action, scheme_or_content_type) -values ('3d73437e-3f1c-8e5c-ac97-a25e9cddf320','DESTROY' ,'1e0f1c6b-b67f-4c99-983d-db2b4bfa88b2','d61a59e1-a49c-46f2-a929-db2b4bfa88b2'); - - -create table tag_inode ( - tag_id varchar2(100) not null, - inode varchar2(100) not null, - field_var_name varchar2(255), - mod_date date, - primary key (tag_id, inode) -); -create table click ( - inode varchar2(36) not null, - link varchar2(255), - click_count number(10,0), - primary key (inode) -); -create table challenge_question ( - cquestionid number(19,0) not null, - cqtext varchar2(255), - primary key (cquestionid) -); -create table layouts_cms_roles ( - id varchar2(36) not null, - layout_id varchar2(36) not null, - role_id varchar2(36) not null, - primary key (id) -); -create table clickstream_request ( - clickstream_request_id number(19,0) not null, - clickstream_id number(19,0), - server_name varchar2(255), - protocol varchar2(255), - server_port number(10,0), - request_uri varchar2(255), - request_order number(10,0), - query_string nclob, - language_id number(19,0), - timestampper date, - host_id varchar2(36), - associated_identifier varchar2(36), - primary key (clickstream_request_id) -); -create table content_rating ( - id number(19,0) not null, - rating float, - user_id varchar2(255), - session_id varchar2(255), - identifier varchar2(36), - rating_date date, - user_ip varchar2(255), - long_live_cookie_id varchar2(255), - primary key (id) -); -create table chain_state ( - id number(19,0) not null, - chain_id number(19,0) not null, - link_code_id number(19,0) not null, - state_order number(19,0) not null, - primary key (id) -); -create table analytic_summary_workstream ( - id number(19,0) not null, - inode varchar2(255), - asset_type varchar2(255), - mod_user_id varchar2(255), - host_id varchar2(36), - mod_date date, - action varchar2(255), - name varchar2(255), - primary key (id) -); -create table dashboard_user_preferences ( - id number(19,0) not null, - summary_404_id number(19,0), - user_id varchar2(255), - ignored number(1,0), - mod_date date, - primary key (id) -); -create table campaign ( - inode varchar2(36) not null, - title varchar2(255), - from_email varchar2(255), - from_name varchar2(255), - subject varchar2(255), - message nclob, - user_id varchar2(255), - start_date date, - completed_date date, - active number(1,0), - locked number(1,0), - sends_per_hour varchar2(15), - sendemail number(1,0), - communicationinode varchar2(36), - userfilterinode varchar2(36), - sendto varchar2(15), - isrecurrent number(1,0), - wassent number(1,0), - expiration_date date, - parent_campaign varchar2(36), - primary key (inode) -); -create table workflowtask_files ( - id varchar2(36) not null, - workflowtask_id varchar2(36) not null, - file_inode varchar2(36) not null, - primary key (id) -); -create table analytic_summary_referer ( - id number(19,0) not null, - summary_id number(19,0) not null, - hits number(19,0), - uri varchar2(255), - primary key (id) -); -create table dot_containers ( - inode varchar2(36) not null, - code nclob, - pre_loop nclob, - post_loop nclob, - show_on_menu number(1,0), - title varchar2(255), - mod_date date, - mod_user varchar2(100), - sort_order number(10,0), - friendly_name varchar2(255), - max_contentlets number(10,0), - use_div number(1,0), - staticify number(1,0), - sort_contentlets_by varchar2(255), - lucene_query nclob, - notes varchar2(255), - identifier varchar2(36), - primary key (inode) -); -create table communication ( - inode varchar2(36) not null, - title varchar2(255), - trackback_link_inode varchar2(36), - communication_type varchar2(255), - from_name varchar2(255), - from_email varchar2(255), - email_subject varchar2(255), - html_page_inode varchar2(36), - text_message nclob, - mod_date date, - modified_by varchar2(255), - ext_comm_id varchar2(255), - primary key (inode) -); -create table workflow_history ( - id varchar2(36) not null, - creation_date date, - made_by varchar2(255), - change_desc nclob, - workflowtask_id varchar2(36), - workflow_action_id varchar2(36), - workflow_step_id varchar2(36), - primary key (id) -); -create table host_variable ( - id varchar2(36) not null, - host_id varchar2(36), - variable_name varchar2(255), - variable_key varchar2(255), - variable_value varchar2(255), - user_id varchar2(255), - last_mod_date date, - primary key (id) -); -create table links ( - inode varchar2(36) not null, - show_on_menu number(1,0), - title varchar2(255), - mod_date date, - mod_user varchar2(100), - sort_order number(10,0), - friendly_name varchar2(255), - identifier varchar2(36), - protocal varchar2(100), - url varchar2(255), - target varchar2(100), - internal_link_identifier varchar2(36), - link_type varchar2(255), - link_code nclob, - primary key (inode) -); -create table chain_state_parameter ( - id number(19,0) not null, - chain_state_id number(19,0) not null, - name varchar2(255) not null, - value varchar2(255) not null, - primary key (id) -); -create table field ( - inode varchar2(36) not null, - structure_inode varchar2(255), - field_name varchar2(255), - field_type varchar2(255), - field_relation_type varchar2(255), - field_contentlet varchar2(255), - required number(1,0), - indexed number(1,0), - listed number(1,0), - velocity_var_name varchar2(255), - sort_order number(10,0), - field_values nclob, - regex_check varchar2(255), - hint varchar2(255), - default_value varchar2(255), - fixed number(1,0), - read_only number(1,0), - searchable number(1,0), - unique_ number(1,0), - mod_date date, - primary key (inode) -); -create table relationship ( - inode varchar2(36) not null, - parent_structure_inode varchar2(255), - child_structure_inode varchar2(255), - parent_relation_name varchar2(255), - child_relation_name varchar2(255), - relation_type_value varchar2(255), - cardinality number(10,0), - parent_required number(1,0), - child_required number(1,0), - fixed number(1,0), - mod_date date, - primary key (inode), - unique (relation_type_value) -); -create table folder ( - inode varchar2(36) not null, - name varchar2(255), - title varchar2(255) not null, - show_on_menu number(1,0), - sort_order number(10,0), - files_masks varchar2(255), - identifier varchar2(36), - default_file_type varchar2(36), - mod_date date, - owner varchar2(255), - idate date, - primary key (inode) -); -create table clickstream_404 ( - clickstream_404_id number(19,0) not null, - referer_uri varchar2(255), - query_string nclob, - request_uri varchar2(255), - user_id varchar2(255), - host_id varchar2(36), - timestampper date, - primary key (clickstream_404_id) -); -create table cms_layout ( - id varchar2(36) not null, - layout_name varchar2(255) not null, - description varchar2(255), - tab_order number(10,0), - primary key (id) -); -create table field_variable ( - id varchar2(36) not null, - field_id varchar2(36), - variable_name varchar2(255), - variable_key varchar2(255), - variable_value nclob, - user_id varchar2(255), - last_mod_date date, - primary key (id) -); -create table report_parameter ( - inode varchar2(36) not null, - report_inode varchar2(36), - parameter_description varchar2(1000), - parameter_name varchar2(255), - class_type varchar2(250), - default_value varchar2(4000), - primary key (inode), - unique (report_inode, parameter_name) -); -create table chain ( - id number(19,0) not null, - key_name varchar2(255) unique, - name varchar2(255) not null, - success_value varchar2(255) not null, - failure_value varchar2(255) not null, - primary key (id) -); -create table link_version_info ( - identifier varchar2(36) not null, - working_inode varchar2(36) not null, - live_inode varchar2(36), - deleted number(1,0) not null, - locked_by varchar2(100), - locked_on date, - version_ts date not null, - primary key (identifier) -); -create table template_containers ( - id varchar2(36) not null, - template_id varchar2(36) not null, - container_id varchar2(36) not null, - primary key (id) -); -create table user_filter ( - inode varchar2(36) not null, - title varchar2(255), - firstname varchar2(100), - middlename varchar2(100), - lastname varchar2(100), - emailaddress varchar2(100), - birthdaytypesearch varchar2(100), - birthday date, - birthdayfrom date, - birthdayto date, - lastlogintypesearch varchar2(100), - lastloginsince varchar2(100), - loginfrom date, - loginto date, - createdtypesearch varchar2(100), - createdsince varchar2(100), - createdfrom date, - createdto date, - lastvisittypesearch varchar2(100), - lastvisitsince varchar2(100), - lastvisitfrom date, - lastvisitto date, - city varchar2(100), - state varchar2(100), - country varchar2(100), - zip varchar2(100), - cell varchar2(100), - phone varchar2(100), - fax varchar2(100), - active_ varchar2(255), - tagname varchar2(255), - var1 varchar2(255), - var2 varchar2(255), - var3 varchar2(255), - var4 varchar2(255), - var5 varchar2(255), - var6 varchar2(255), - var7 varchar2(255), - var8 varchar2(255), - var9 varchar2(255), - var10 varchar2(255), - var11 varchar2(255), - var12 varchar2(255), - var13 varchar2(255), - var14 varchar2(255), - var15 varchar2(255), - var16 varchar2(255), - var17 varchar2(255), - var18 varchar2(255), - var19 varchar2(255), - var20 varchar2(255), - var21 varchar2(255), - var22 varchar2(255), - var23 varchar2(255), - var24 varchar2(255), - var25 varchar2(255), - categories varchar2(255), - primary key (inode) -); -create table inode ( - inode varchar2(36) not null, - owner varchar2(255), - idate date, - type varchar2(64), - primary key (inode) -); -alter table analytic_summary_pages add constraint fka1ad33b9ed30e054 foreign key (summary_id) references analytic_summary; -create index idx_user_comments_1 on user_comments (user_id); -alter table user_comments add constraint fkdf1b37e85fb51eb foreign key (inode) references inode; -create index idx_trackback_2 on trackback (url); -create index idx_trackback_1 on trackback (asset_identifier); -create index idx_mailinglist_1 on mailing_list (user_id); -alter table mailing_list add constraint fk7bc2cd925fb51eb foreign key (inode) references inode; -create index idx_communication_user_id on recipient (user_id); -create index idx_recipiets_1 on recipient (email); -create index idx_recipiets_2 on recipient (sent); -alter table recipient add constraint fk30e172195fb51eb foreign key (inode) references inode; -create index idx_user_webform_1 on web_form (form_type); -create index idx_analytic_summary_period_4 on analytic_summary_period (month); -create index idx_analytic_summary_period_3 on analytic_summary_period (week); -create index idx_analytic_summary_period_2 on analytic_summary_period (day); -create index idx_analytic_summary_period_5 on analytic_summary_period (year); -create index idx_analytic_summary_1 on analytic_summary (host_id); -create index idx_analytic_summary_2 on analytic_summary (visits); -create index idx_analytic_summary_3 on analytic_summary (page_views); -alter table analytic_summary add constraint fk9e1a7f4b7b46300 foreign key (summary_period_id) references analytic_summary_period; -alter table template add constraint fkb13acc7a5fb51eb foreign key (inode) references inode; -alter table analytic_summary_content add constraint fk53cb4f2eed30e054 foreign key (summary_id) references analytic_summary; -alter table structure add constraint fk89d2d735fb51eb foreign key (inode) references inode; -create index idx_permission_2 on permission (permission_type, inode_id); -create index idx_permission_3 on permission (roleid); -alter table contentlet add constraint fkfc4ef025fb51eb foreign key (inode) references inode; -create index idx_analytic_summary_404_1 on analytic_summary_404 (host_id); -alter table analytic_summary_404 add constraint fk7050866db7b46300 foreign key (summary_period_id) references analytic_summary_period; -alter table report_asset add constraint fk3765ec255fb51eb foreign key (inode) references inode; -create index idx_category_1 on category (category_name); -create index idx_category_2 on category (category_key); -alter table category add constraint fk302bcfe5fb51eb foreign key (inode) references inode; -create index idx_analytic_summary_visits_2 on analytic_summary_visits (visit_time); -create index idx_analytic_summary_visits_1 on analytic_summary_visits (host_id); -alter table analytic_summary_visits add constraint fk9eac9733b7b46300 foreign key (summary_period_id) references analytic_summary_period; -create index idx_preference_1 on user_preferences (preference); -create index idx_identifier_pub on identifier (syspublish_date); -create index idx_identifier_exp on identifier (sysexpire_date); -create index idx_identifier_asset_subtype on identifier (asset_subtype); -create index idx_user_clickstream11 on clickstream (host_id); -create index idx_user_clickstream12 on clickstream (last_page_id); -create index idx_user_clickstream15 on clickstream (browser_name); -create index idx_user_clickstream_2 on clickstream (user_id); -create index idx_user_clickstream16 on clickstream (browser_version); -create index idx_user_clickstream_1 on clickstream (cookie_id); -create index idx_user_clickstream13 on clickstream (first_page_id); -create index idx_user_clickstream14 on clickstream (operating_system); -create index idx_user_clickstream17 on clickstream (remote_address); -create index idx_multitree_1 on multi_tree (relation_type); -create index idx_workflow_6 on workflow_task (language_id); -create index idx_workflow_4 on workflow_task (webasset); -create index idx_workflow_5 on workflow_task (created_by); -create index idx_workflow_2 on workflow_task (belongs_to); -create index idx_workflow_3 on workflow_task (status); -create index idx_workflow_1 on workflow_task (assigned_to); -create index idx_click_1 on click (link); -alter table click add constraint fk5a5c5885fb51eb foreign key (inode) references inode; -create index idx_user_clickstream_request_2 on clickstream_request (request_uri); -create index idx_user_clickstream_request_1 on clickstream_request (clickstream_id); -create index idx_user_clickstream_request_4 on clickstream_request (timestampper); -create index idx_user_clickstream_request_3 on clickstream_request (associated_identifier); -create index idx_dashboard_workstream_2 on analytic_summary_workstream (host_id); -create index idx_dashboard_workstream_1 on analytic_summary_workstream (mod_user_id); -create index idx_dashboard_workstream_3 on analytic_summary_workstream (mod_date); -create index idx_dashboard_prefs_2 on dashboard_user_preferences (user_id); -alter table dashboard_user_preferences add constraint fk496242cfd12c0c3b foreign key (summary_404_id) references analytic_summary_404; -create index idx_campaign_4 on campaign (expiration_date); -create index idx_campaign_3 on campaign (completed_date); -create index idx_campaign_2 on campaign (start_date); -create index idx_campaign_1 on campaign (user_id); -alter table campaign add constraint fkf7a901105fb51eb foreign key (inode) references inode; -alter table analytic_summary_referer add constraint fk5bc0f3e2ed30e054 foreign key (summary_id) references analytic_summary; -alter table dot_containers add constraint fk8a844125fb51eb foreign key (inode) references inode; -alter table communication add constraint fkc24acfd65fb51eb foreign key (inode) references inode; -alter table links add constraint fk6234fb95fb51eb foreign key (inode) references inode; -create index idx_field_1 on field (structure_inode); -alter table field add constraint fk5cea0fa5fb51eb foreign key (inode) references inode; -create index idx_relationship_1 on relationship (parent_structure_inode); -create index idx_relationship_2 on relationship (child_structure_inode); -create index idx_folder_1 on folder (name); -create index idx_user_clickstream_404_2 on clickstream_404 (user_id); -create index idx_user_clickstream_404_3 on clickstream_404 (host_id); -create index idx_user_clickstream_404_1 on clickstream_404 (request_uri); -alter table report_parameter add constraint fk22da125e5fb51eb foreign key (inode) references inode; -alter table user_filter add constraint fke042126c5fb51eb foreign key (inode) references inode; -create index idx_index_1 on inode (type); -create sequence summary_seq; -create sequence user_preferences_seq; -create sequence dashboard_usrpref_seq; -create sequence chain_state_seq; -create sequence trackback_sequence; -create sequence permission_reference_seq; -create sequence summary_visits_seq; -create sequence chain_link_code_seq; -create sequence clickstream_seq; -create sequence summary_404_seq; -create sequence content_rating_sequence; -create sequence chain_seq; -create sequence summary_content_seq; -create sequence summary_pages_seq; -create sequence summary_referer_seq; -create sequence summary_period_seq; -create sequence workstream_seq; -create sequence clickstream_request_seq; -create sequence clickstream_404_seq; -create sequence user_to_delete_seq; -create sequence chain_state_parameter_seq; -create sequence permission_seq; ---oracle -CREATE INDEX idx_tree_1 ON tree (parent); -CREATE INDEX idx_tree_2 ON tree (child); -CREATE INDEX idx_tree_3 ON tree (relation_type); -CREATE INDEX idx_tree_4 ON tree (parent, child, relation_type); -CREATE INDEX idx_tree_5 ON tree (parent, relation_type); -CREATE INDEX idx_tree_6 ON tree (child, relation_type); - -CREATE INDEX idx_permisision_4 ON permission (permission_type); - -CREATE INDEX idx_permission_reference_2 ON permission_reference (reference_id); -CREATE INDEX idx_permission_reference_3 ON permission_reference (reference_id,permission_type); -CREATE INDEX idx_permission_reference_4 ON permission_reference (asset_id,permission_type); -CREATE INDEX idx_permission_reference_5 ON permission_reference (asset_id,reference_id,permission_type); -CREATE INDEX idx_permission_reference_6 ON permission_reference (permission_type); - -CREATE UNIQUE INDEX idx_field_velocity_structure ON field (velocity_var_name,structure_inode); - -alter table chain_state add constraint fk_state_chain foreign key (chain_id) references chain(id); -alter table chain_state add constraint fk_state_code foreign key (link_code_id) references chain_link_code(id); -alter table chain_state_parameter add constraint fk_parameter_state foreign key (chain_state_id) references chain_state(id); - -alter table permission add constraint permission_role_fk foreign key (roleid) references cms_role(id); - -alter table contentlet add constraint FK_structure_inode foreign key (structure_inode) references structure(inode); - -ALTER TABLE structure MODIFY fixed DEFAULT 0; - -ALTER TABLE field MODIFY fixed DEFAULT 0; -ALTER TABLE field MODIFY read_only DEFAULT 0; - -ALTER TABLE campaign MODIFY active DEFAULT 0; - -insert into User_ (userId, companyId, createDate, password_, passwordEncrypted, passwordReset, firstName, middleName, lastName, male, birthday, emailAddress, skinId, dottedSkins, roundedSkins, greeting, layoutIds, loginDate, failedLoginAttempts, agreedToTermsOfUse, active_) values ('dotcms.org.default', 'default', sysdate, 'password', '0', '0', '', '', '', '1', to_date('1970-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS'), 'default@dotcms.org', '01', '0', '0', 'Welcome!', '', sysdate, 0, '0', '1'); - -create index addres_userid_index on address(userid); -create index tag_user_id_index on tag(user_id); -create index tag_is_persona_index on tag(persona); -create index tag_inode_tagid on tag_inode(tag_id); -create index tag_inode_inode on tag_inode(inode); -CREATE TABLE "DIST_JOURNAL" ( "ID" INTEGER NOT NULL , -"OBJECT_TO_INDEX" VARCHAR2(255), "SERVERID" VARCHAR2(64), -"JOURNAL_TYPE" INTEGER, "TIME_ENTERED" TIMESTAMP, PRIMARY KEY ("ID") -VALIDATE , UNIQUE ("OBJECT_TO_INDEX", "SERVERID", "JOURNAL_TYPE") -VALIDATE ); -CREATE SEQUENCE dist_journal_id_seq -START WITH 1 -INCREMENT BY 1; -create trigger DIST_JOURNAL_trg -before insert on DIST_JOURNAL -for each row -when (new.id is null) -begin - select dist_journal_id_seq.nextval into :new.id from dual; -end; -/ - -CREATE TABLE dist_process ( ID INTEGER NOT NULL , OBJECT_TO_INDEX VARCHAR2(255), SERVERID VARCHAR2(64), JOURNAL_TYPE INTEGER, TIME_ENTERED TIMESTAMP, PRIMARY KEY (ID) VALIDATE ); -CREATE SEQUENCE dist_process_id_seq START WITH 1 INCREMENT BY 1; -create trigger dist_process_trg -before insert on dist_process -for each row -when (new.id is null) -begin -select dist_process_id_seq.nextval into :new.id from dual; -end; -/ - -CREATE INDEX dist_process_index on dist_process (object_to_index, serverid,journal_type); - - -CREATE TABLE dist_reindex_journal ( - ID INTEGER NOT NULL , - INODE_TO_INDEX varchar2(100), - IDENT_TO_INDEX varchar2(100), - SERVERID VARCHAR2(64), - priority INTEGER, - TIME_ENTERED TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - index_val varchar2(325) , - dist_action INTEGER DEFAULT 1 NOT NULL, - PRIMARY KEY (ID) VALIDATE); - -CREATE INDEX dist_reindex_index1 on dist_reindex_journal (inode_to_index); -CREATE INDEX dist_reindex_index2 on dist_reindex_journal (dist_action); -CREATE INDEX dist_reindex_index3 on dist_reindex_journal (serverid); -CREATE INDEX dist_reindex_index4 on dist_reindex_journal (ident_to_index,serverid); -CREATE INDEX dist_reindex_index on dist_reindex_journal (serverid,dist_action); -CREATE INDEX dist_reindex_index5 ON dist_reindex_journal (priority, time_entered); -CREATE INDEX dist_reindex_index6 ON dist_reindex_journal (priority); - -CREATE SEQUENCE dist_reindex_id_seq START WITH 1 INCREMENT BY 1; - -create trigger dist_reindex_journal_trg - before insert on dist_reindex_journal - for each row - when (new.id is null) - begin - select dist_reindex_id_seq.nextval into :new.id from dual; - end; -/ - - -CREATE TABLE quartz_log ( ID INTEGER NOT NULL , JOB_NAME VARCHAR2(255), SERVERID VARCHAR2(64), TIME_STARTED TIMESTAMP, PRIMARY KEY (ID) VALIDATE ); - -create table plugin_property ( - plugin_id varchar2(255) not null, - propkey varchar2(255) not null, - original_value varchar2(255) not null, - current_value varchar2(255) not null, - primary key (plugin_id, propkey) -); - -alter table plugin_property add constraint fk_plugin_plugin_property foreign key (plugin_id) references plugin(id); - -CREATE SEQUENCE quartz_log_id_seq START WITH 1 INCREMENT BY 1; -create trigger quartz_log_trg -before insert on quartz_log -for each row -when (new.id is null) -begin -select quartz_log_id_seq.nextval into :new.id from dual; -end; -/ - -CREATE OR REPLACE TRIGGER check_identifier_host_inode -BEFORE INSERT OR UPDATE ON identifier -FOR EACH ROW -DECLARE -BEGIN - dbms_output.put_line('asset_type: ' || SUBSTR(:new.asset_type,0,7)); - dbms_output.put_line('host_inode: ' || :new.host_inode); - IF SUBSTR(:new.asset_type,0,7) <> 'content' AND (:new.host_inode is NULL OR :new.host_inode = '') THEN - RAISE_APPLICATION_ERROR(-20000, 'Cannot insert/update a null or empty host inode for this kind of identifier'); - END IF; -END; -/ - -ALTER TABLE cms_role ADD CONSTRAINT cms_role2_unique UNIQUE (role_key); -ALTER TABLE cms_role ADD CONSTRAINT cms_role3_unique UNIQUE (db_fqn); -alter table cms_role add constraint fkcms_role_parent foreign key (parent) references cms_role; - -ALTER TABLE cms_layout ADD CONSTRAINT cms_layout_unique_1 UNIQUE (layout_name); - -ALTER TABLE portlet ADD CONSTRAINT portlet_unique_1 UNIQUE (portletid); -ALTER TABLE cms_layouts_portlets ADD CONSTRAINT cms_layouts_portlets_unq_1 UNIQUE (portlet_id, layout_id); -alter table cms_layouts_portlets add constraint fkcms_layouts_portlets foreign key (layout_id) references cms_layout; - -ALTER TABLE users_cms_roles ADD CONSTRAINT users_cms_roles1_unique UNIQUE (role_id, user_id); -alter table users_cms_roles add constraint fkusers_cms_roles1 foreign key (role_id) references cms_role; -alter table users_cms_roles add constraint fkusers_cms_roles2 foreign key (user_id) references user_; - -ALTER TABLE layouts_cms_roles ADD CONSTRAINT layouts_cms_roles1_unique UNIQUE (role_id, layout_id); -alter table layouts_cms_roles add constraint fklayouts_cms_roles1 foreign key (role_id) references cms_role; -alter table layouts_cms_roles add constraint fklayouts_cms_roles2 foreign key (layout_id) references cms_layout; - -ALTER TABLE dot_containers add constraint containers_identifier_fk foreign key (identifier) references identifier(id); -ALTER TABLE template add constraint template_identifier_fk foreign key (identifier) references identifier(id); -ALTER TABLE contentlet add constraint content_identifier_fk foreign key (identifier) references identifier(id); -ALTER TABLE links add constraint links_identifier_fk foreign key (identifier) references identifier(id); - -create table import_audit ( - id integer not null, - start_date timestamp, - userid varchar(255), - filename varchar(512), - status integer, - last_inode varchar(100), - records_to_import integer, - serverid varchar(255), - primary key (id) - ); - -alter table category modify (category_velocity_var_name varchar2(255) not null); - -alter table import_audit add( warnings nclob, - errors nclob, - results nclob, - messages nclob); - -alter table structure modify host default 'SYSTEM_HOST'; -alter table structure modify folder default 'SYSTEM_FOLDER'; -alter table structure modify (velocity_var_name varchar2(255) not null); -alter table structure add constraint unique_struct_vel_var_name unique (velocity_var_name); - - -CREATE OR REPLACE TRIGGER structure_host_folder_trigger -BEFORE INSERT OR UPDATE ON structure -FOR EACH ROW -DECLARE - folderInode varchar2(100); - hostInode varchar2(100); -BEGIN - IF (:NEW.host <> 'SYSTEM_HOST' AND :NEW.folder <> 'SYSTEM_FOLDER') THEN - select host_inode, folder.inode INTO hostInode, folderInode from folder,identifier where folder.identifier = identifier.id and folder.inode = :NEW.folder; - IF (:NEW.host <> hostInode) THEN - RAISE_APPLICATION_ERROR(-20000, 'Cannot assign host/folder to structure, folder does not belong to given host'); - END IF; - ELSE - IF(:NEW.host IS NULL OR :NEW.host = '' OR :NEW.host = 'SYSTEM_HOST' OR :NEW.folder IS NULL OR :NEW.folder = '' OR :NEW.folder = 'SYSTEM_FOLDER') THEN - IF(:NEW.host = 'SYSTEM_HOST' OR :NEW.host IS NULL OR :NEW.host = '') THEN - :NEW.host := 'SYSTEM_HOST'; - :NEW.folder := 'SYSTEM_FOLDER'; - END IF; - IF(:NEW.folder = 'SYSTEM_FOLDER' OR :NEW.folder IS NULL OR :NEW.folder = '') THEN - :NEW.folder := 'SYSTEM_FOLDER'; - END IF; - END IF; - END IF; -END; -/ -create or replace - PACKAGE types -AS -TYPE ref_cursor IS REF CURSOR; -END; -/ -CREATE OR REPLACE TYPE reindex_record AS OBJECT ( - ID INTEGER, - INODE_TO_INDEX varchar2(36), - IDENT_TO_INDEX varchar2(36), - priority INTEGER, - dist_action INTEGER -); -/ -CREATE OR REPLACE TYPE reindex_record_list IS TABLE OF reindex_record; -/ -CREATE OR REPLACE PACKAGE check_parent_path_pkg as - type ridArray is table of rowid index by binary_integer; - newRows ridArray; - empty ridArray; -END; -/ -CREATE OR REPLACE TRIGGER check_parent_path_bi -BEFORE INSERT OR UPDATE ON identifier -BEGIN - check_parent_path_pkg.newRows := check_parent_path_pkg.empty; -END; -/ -CREATE OR REPLACE TRIGGER check_parent_path_aifer -AFTER INSERT OR UPDATE ON identifier -FOR EACH ROW -BEGIN - check_parent_path_pkg.newRows(check_parent_path_pkg.newRows.count+1) := :new.rowid; -END; -/ -CREATE OR REPLACE TRIGGER identifier_parent_path_check -AFTER INSERT OR UPDATE ON identifier -DECLARE - rowcount varchar2(100); - assetIdentifier varchar2(100); - parentPath varchar2(255); - hostInode varchar2(100); -BEGIN - for i in 1 .. check_parent_path_pkg.newRows.count LOOP - select id,parent_path,host_inode into assetIdentifier,parentPath,hostInode from identifier where rowid = check_parent_path_pkg.newRows(i); - IF(parentPath='/' OR parentPath='/System folder') THEN - return; - ELSE - select count(*) into rowcount from identifier where asset_type='folder' and host_inode = hostInode and parent_path||asset_name||'/' = parentPath and id <> assetIdentifier; - IF (rowcount = 0) THEN - RAISE_APPLICATION_ERROR(-20000, 'Cannot insert/update for this path does not exist for the given host'); - END IF; - END IF; -END LOOP; -END; -/ -CREATE OR REPLACE PACKAGE content_pkg as - type array is table of contentlet%rowtype index by binary_integer; - oldvals array; - empty array; -END; -/ -CREATE OR REPLACE TRIGGER content_versions_bd -BEFORE DELETE ON contentlet -BEGIN - content_pkg.oldvals := content_pkg.empty; -END; -/ -CREATE OR REPLACE TRIGGER content_versions_bdfer -BEFORE DELETE ON contentlet -FOR EACH ROW -BEGIN - content_pkg.oldvals(content_pkg.oldvals.count+1).identifier := :old.identifier; -END; -/ -CREATE OR REPLACE TRIGGER content_versions_trigger -AFTER DELETE ON contentlet -DECLARE - versionsCount integer; -BEGIN - for i in 1 .. content_pkg.oldvals.count LOOP - select count(*) into versionsCount from contentlet where identifier = content_pkg.oldvals(i).identifier; - IF (versionsCount = 0)THEN - DELETE from identifier where id = content_pkg.oldvals(i).identifier; - END IF; - END LOOP; -END; -/ -CREATE OR REPLACE PACKAGE link_pkg as - type array is table of links%rowtype index by binary_integer; - oldvals array; - empty array; -END; -/ -CREATE OR REPLACE TRIGGER link_versions_bd -BEFORE DELETE ON links -BEGIN - link_pkg.oldvals := link_pkg.empty; -END; -/ -CREATE OR REPLACE TRIGGER link_versions_bdfer -BEFORE DELETE ON links -FOR EACH ROW -BEGIN - link_pkg.oldvals(link_pkg.oldvals.count+1).identifier := :old.identifier; -END; -/ -CREATE OR REPLACE TRIGGER link_versions_trigger -AFTER DELETE ON links -DECLARE - versionsCount integer; -BEGIN - for i in 1 .. link_pkg.oldvals.count LOOP - select count(*) into versionsCount from links where identifier = link_pkg.oldvals(i).identifier; - IF (versionsCount = 0)THEN - DELETE from identifier where id = link_pkg.oldvals(i).identifier; - END IF; -END LOOP; -END; -/ -CREATE OR REPLACE PACKAGE container_pkg as - type array is table of dot_containers%rowtype index by binary_integer; - oldvals array; - empty array; -END; -/ -CREATE OR REPLACE TRIGGER container_versions_bd -BEFORE DELETE ON dot_containers -BEGIN - container_pkg.oldvals := container_pkg.empty; -END; -/ -CREATE OR REPLACE TRIGGER container_versions_bdfer -BEFORE DELETE ON dot_containers -FOR EACH ROW -BEGIN - container_pkg.oldvals(container_pkg.oldvals.count+1).identifier := :old.identifier; -END; -/ -CREATE OR REPLACE TRIGGER container_versions_trigger -AFTER DELETE ON dot_containers -DECLARE - versionsCount integer; -BEGIN - for i in 1 .. container_pkg.oldvals.count LOOP - select count(*) into versionsCount from dot_containers where identifier = container_pkg.oldvals(i).identifier; - IF (versionsCount = 0)THEN - DELETE from identifier where id = container_pkg.oldvals(i).identifier; - END IF; - END LOOP; -END; -/ -CREATE OR REPLACE PACKAGE template_pkg as - type array is table of template%rowtype index by binary_integer; - oldvals array; - empty array; -END; -/ -CREATE OR REPLACE TRIGGER template_versions_bd -BEFORE DELETE ON template -BEGIN - template_pkg.oldvals := template_pkg.empty; -END; -/ -CREATE OR REPLACE TRIGGER template_versions_bdfer -BEFORE DELETE ON template -FOR EACH ROW -BEGIN - template_pkg.oldvals(template_pkg.oldvals.count+1).identifier := :old.identifier; -END; -/ -CREATE OR REPLACE TRIGGER template_versions_trigger -AFTER DELETE ON template -DECLARE - versionsCount integer; -BEGIN - for i in 1 .. template_pkg.oldvals.count LOOP - select count(*) into versionsCount from template where identifier = template_pkg.oldvals(i).identifier; - IF (versionsCount = 0)THEN - DELETE from identifier where id = template_pkg.oldvals(i).identifier; - END IF; - END LOOP; -END; -/ - - -ALTER TABLE clickstream MODIFY start_date TIMESTAMP; -ALTER TABLE clickstream MODIFY end_date TIMESTAMP; -ALTER TABLE clickstream_request MODIFY timestampper TIMESTAMP; -ALTER TABLE clickstream_404 MODIFY timestampper TIMESTAMP; -ALTER TABLE analytic_summary_period MODIFY full_date TIMESTAMP; -ALTER TABLE analytic_summary MODIFY avg_time_on_site TIMESTAMP; -ALTER TABLE analytic_summary_workstream MODIFY mod_date TIMESTAMP; -ALTER TABLE analytic_summary_visits MODIFY visit_time TIMESTAMP; -ALTER TABLE dashboard_user_preferences MODIFY mod_date TIMESTAMP; -alter table structure add constraint fk_structure_host foreign key (host) references identifier(id); - -create index idx_template3 on template (lower(title)); - -CREATE INDEX idx_contentlet_4 ON contentlet (structure_inode); - -CREATE INDEX idx_contentlet_identifier ON contentlet (identifier); - -ALTER TABLE Folder add constraint folder_identifier_fk foreign key (identifier) references identifier(id); ---ALTER TABLE dot_containers add constraint structure_fk foreign key (structure_inode) references structure(inode); - -CREATE OR REPLACE PACKAGE folder_pkg as - type array is table of folder%rowtype index by binary_integer; - oldvals array; - empty array; -END; -/ -CREATE OR REPLACE trigger folder_identifier_bd -BEFORE DELETE ON folder -BEGIN -folder_pkg.oldvals := folder_pkg.empty; -END; -/ -CREATE OR REPLACE TRIGGER folder_identifier_bdfer -BEFORE DELETE ON folder -FOR EACH ROW -BEGIN - folder_pkg.oldvals(folder_pkg.oldvals.count+1).identifier := :old.identifier; -END; -/ -CREATE OR REPLACE TRIGGER folder_identifier_trigger -AFTER DELETE ON folder -DECLARE - versionsCount integer; -BEGIN - for i in 1 .. folder_pkg.oldvals.count LOOP - select count(*) into versionsCount from folder where identifier = folder_pkg.oldvals(i).identifier; - IF (versionsCount = 0)THEN - DELETE from identifier where id = folder_pkg.oldvals(i).identifier; - END IF; - END LOOP; -END; -/ -alter table contentlet add constraint fk_user_contentlet foreign key (mod_user) references user_(userid); -alter table dot_containers add constraint fk_user_containers foreign key (mod_user) references user_(userid); -alter table template add constraint fk_user_template foreign key (mod_user) references user_(userid); -alter table links add constraint fk_user_links foreign key (mod_user) references user_(userid); - -create index idx_template_id on template_containers(template_id); -alter table template_containers add constraint FK_template_id foreign key (template_id) references identifier(id); -alter table template_containers add constraint FK_container_id foreign key (container_id) references identifier(id); - -CREATE OR REPLACE PACKAGE child_assets_pkg as - type array is table of identifier%rowtype index by binary_integer; - oldvals array; - empty array; -END; -/ -CREATE OR REPLACE trigger check_child_assets_bd -BEFORE DELETE ON identifier -BEGIN -child_assets_pkg.oldvals := child_assets_pkg.empty; -END; -/ -CREATE OR REPLACE TRIGGER check_child_assets_bdfer -BEFORE DELETE ON identifier -FOR EACH ROW -Declare - i number default child_assets_pkg.oldvals.count+1; -BEGIN - child_assets_pkg.oldvals(i).id := :old.id; - child_assets_pkg.oldvals(i).asset_type := :old.asset_type; - child_assets_pkg.oldvals(i).asset_name:= :old.asset_name; - child_assets_pkg.oldvals(i).parent_path:= :old.parent_path; - child_assets_pkg.oldvals(i).host_inode:= :old.host_inode; -END; -/ -CREATE OR REPLACE TRIGGER check_child_assets_trigger -AFTER DELETE ON identifier -DECLARE - pathCount integer; -BEGIN - for i in 1 .. child_assets_pkg.oldvals.count LOOP - IF(child_assets_pkg.oldvals(i).asset_type='folder')THEN - select count(*) into pathCount from identifier where parent_path = child_assets_pkg.oldvals(i).parent_path||child_assets_pkg.oldvals(i).asset_name||'/' and host_inode = child_assets_pkg.oldvals(i).host_inode; - END IF; - IF(child_assets_pkg.oldvals(i).asset_type='contentlet')THEN - select count(*) into pathCount from identifier where host_inode = child_assets_pkg.oldvals(i).id; - END IF; - IF (pathCount > 0 )THEN - RAISE_APPLICATION_ERROR(-20000, 'Cannot delete as this path has children'); - END IF; - END LOOP; -END; -/ -CREATE OR REPLACE PROCEDURE renameFolderChildren(oldPath IN varchar2,newPath IN varchar2,hostInode IN varchar2) IS - newFolderPath varchar2(255); - oldFolderPath varchar2(255); -BEGIN - UPDATE identifier SET parent_path = newPath where parent_path = oldPath and host_inode = hostInode; - FOR i in (select * from identifier where asset_type='folder' and parent_path = newPath and host_inode = hostInode) - LOOP - newFolderPath := newPath || i.asset_name || '/'; - oldFolderPath := oldPath || i.asset_name || '/'; - renameFolderChildren(oldFolderPath,newFolderPath,hostInode); - END LOOP; -END; -/ -CREATE OR REPLACE TRIGGER rename_folder_assets_trigger -AFTER UPDATE ON Folder -FOR EACH ROW -DECLARE - oldPath varchar2(255); - newPath varchar2(255); - hostInode varchar2(100); -BEGIN - IF :NEW.name <> :OLD.name THEN - SELECT parent_path||asset_name||'/',parent_path ||:NEW.name||'/',host_inode INTO oldPath,newPath,hostInode from identifier where id = :NEW.identifier; - UPDATE identifier SET asset_name = :NEW.name where id = :NEW.identifier; - renameFolderChildren(oldPath,newPath,hostInode); - END IF; -END; -/ -CREATE OR REPLACE FUNCTION dotFolderPath(parent_path IN varchar2, asset_name IN varchar2) RETURN varchar2 IS -BEGIN - IF parent_path='/System folder' THEN - RETURN '/'; - ELSE - RETURN parent_path || asset_name || '/'; - END IF; -END; -/ -alter table contentlet_version_info add constraint fk_con_ver_info_ident foreign key (identifier) references identifier(id) on delete cascade; -alter table container_version_info add constraint fk_container_ver_info_ident foreign key (identifier) references identifier(id); -alter table template_version_info add constraint fk_template_ver_info_ident foreign key (identifier) references identifier(id); -alter table link_version_info add constraint fk_link_ver_info_ident foreign key (identifier) references identifier(id); - -alter table contentlet_version_info add constraint fk_con_ver_info_working foreign key (working_inode) references contentlet(inode); -alter table container_version_info add constraint fk_container_ver_info_working foreign key (working_inode) references dot_containers(inode); -alter table template_version_info add constraint fk_template_ver_info_working foreign key (working_inode) references template(inode); -alter table link_version_info add constraint fk_link_version_info_working foreign key (working_inode) references links(inode); - -alter table contentlet_version_info add constraint fk_con_ver_info_live foreign key (live_inode) references contentlet(inode); -alter table container_version_info add constraint fk_container_ver_info_live foreign key (live_inode) references dot_containers(inode); -alter table template_version_info add constraint fk_template_ver_info_live foreign key (live_inode) references template(inode); -alter table link_version_info add constraint fk_link_version_info_live foreign key (live_inode) references links(inode); - -alter table contentlet_version_info add constraint fk_con_lang_ver_info_lang foreign key (lang) references language(id); - -alter table folder add constraint fk_folder_file_structure_type foreign key(default_file_type) references structure(inode); - -alter table workflowtask_files add constraint FK_workflow_id foreign key (workflowtask_id) references workflow_task(id); -alter table workflow_comment add constraint wf_id_comment_FK foreign key (workflowtask_id) references workflow_task(id); -alter table workflow_history add constraint wf_id_history_FK foreign key (workflowtask_id) references workflow_task(id); - -alter table contentlet add constraint fk_contentlet_lang foreign key (language_id) references language(id); - -alter table company add constraint fk_default_lang_id foreign key (default_language_id) references language(id); - -create table workflow_scheme( - id varchar2(36) primary key, - name varchar2(255) not null, - description varchar2(255), - archived number(1,0) default 0, - mandatory number(1,0) default 0, - default_scheme number(1,0) default 0, - entry_action_id varchar2(36), - mod_date timestamp -); - -create table workflow_step( - id varchar2(36) primary key, - name varchar2(255) not null, - scheme_id varchar2(36) not null references workflow_scheme(id), - my_order number(10,0) default 0, - resolved number(1,0) default 0, - escalation_enable number(1,0) default 0, - escalation_action varchar(36), - escalation_time number(10,0) default 0 -); -create index wk_idx_step_scheme on workflow_step(scheme_id); - --- Permissionable --- -create table workflow_action( - id varchar2(36) primary key, - step_id varchar2(36), - name varchar2(255) not null, - condition_to_progress nclob, - next_step_id varchar2(36), - next_assign varchar2(36) not null references cms_role(id), - my_order number(10,0) default 0, - assignable number(1,0) default 0, - commentable number(1,0) default 0, - requires_checkout number(1,0) default 0, - icon varchar2(255) default 'defaultWfIcon', - show_on varchar2(255) default 'LOCKED,UNLOCKED', - use_role_hierarchy_assign number(1,0) default 0, - scheme_id varchar2(36) NOT NULL -); - -CREATE TABLE workflow_action_step ( action_id varchar2(36) NOT NULL, step_id varchar2(36) NOT NULL, action_order number(10,0) default 0, CONSTRAINT pk_workflow_action_step PRIMARY KEY (action_id, step_id) ); -ALTER TABLE workflow_action_step ADD CONSTRAINT fk_w_action_step_action_id foreign key (action_id) references workflow_action(id); -ALTER TABLE workflow_action_step ADD CONSTRAINT fk_w_action_step_step_id foreign key (step_id) references workflow_step (id); - -create table workflow_action_class( - id varchar2(36) primary key, - action_id varchar2(36) not null references workflow_action(id), - name varchar2(255) not null, - my_order number(10,0) default 0, - clazz nclob -); -create index wk_idx_act_class_act on workflow_action_class(action_id); - -create table workflow_action_class_pars( - id varchar2(36) primary key, - workflow_action_class_id varchar2(36) not null references workflow_action_class(id), - key varchar2(255) not null, - value nclob -); -create index wk_idx_actclassparamact on - workflow_action_class_pars(workflow_action_class_id); - - -create table workflow_scheme_x_structure( - id varchar2(36) primary key, - scheme_id varchar2(36) not null references workflow_scheme(id), - structure_id varchar2(36) not null references structure(inode) -); - - - - -delete from workflow_history; -delete from workflow_comment; -delete from workflowtask_files; -delete from workflow_task; -alter table workflow_task add constraint FK_workflow_task_language foreign key (language_id) references language(id); -alter table workflow_task add constraint FK_workflow_assign foreign key (assigned_to) references cms_role(id); -alter table workflow_task add constraint FK_workflow_step foreign key (status) references workflow_step(id); -alter table workflow_task add constraint unique_workflow_task unique (webasset,language_id); -alter table workflow_step add constraint fk_escalation_action foreign key (escalation_action) references workflow_action(id); - -alter table contentlet_version_info add constraint FK_con_ver_lockedby foreign key (locked_by) references user_(userid); -alter table container_version_info add constraint FK_tainer_ver_info_lockedby foreign key (locked_by) references user_(userid); -alter table template_version_info add constraint FK_temp_ver_info_lockedby foreign key (locked_by) references user_(userid); -alter table link_version_info add constraint FK_link_ver_info_lockedby foreign key (locked_by) references user_(userid); - -ALTER table tag MODIFY host_id default 'SYSTEM_HOST'; -alter table tag add constraint tag_tagname_host unique (tagname, host_id); -alter table tag_inode add constraint fk_tag_inode_tagid foreign key (tag_id) references tag (tag_id); - -drop index tag_user_id_index; -alter table tag modify user_id long; -alter table tag modify user_id CLOB; -create index tag_user_id_index on tag(user_id) indextype is ctxsys.context; - - --- ****** Indicies Data Storage ******* -create table indicies ( - index_name varchar2(100) primary key, - index_type varchar2(16) not null unique -); - -- ****** Log Console Table ******* - create table log_mapper ( - enabled number(1,0) not null, - log_name varchar2(30) not null, - description varchar2(50) not null, - primary key (log_name) - ); - - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-userActivity.log','Log Users action on pages, structures, documents.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-security.log','Log users login activity into dotCMS.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-adminaudit.log','Log Admin activity on dotCMS.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','dotcms-pushpublish.log','Log Push Publishing activity on dotCMS.'); - insert into log_mapper (ENABLED,LOG_NAME,DESCRIPTION) values ('1','visitor-v3.log','Log Visitor Filter activity on dotCMS.'); - -create index idx_identifier_perm on identifier (asset_type,host_inode); - - -CREATE TABLE broken_link ( - id VARCHAR(36) PRIMARY KEY, - inode VARCHAR2(36) NOT NULL, - field VARCHAR2(36) NOT NULL, - link VARCHAR2(255) NOT NULL, - title VARCHAR2(255) NOT NULL, - status_code integer NOT NULL -); - -alter table broken_link add CONSTRAINT fk_brokenl_content - FOREIGN KEY (inode) REFERENCES contentlet(inode) ON DELETE CASCADE; - -alter table broken_link add CONSTRAINT fk_brokenl_field - FOREIGN KEY (field) REFERENCES field(inode) ON DELETE CASCADE; - --- ****** Content Publishing Framework ******* -CREATE SEQUENCE PUBLISHING_QUEUE_SEQ START WITH 1 INCREMENT BY 1; - -CREATE TABLE publishing_queue ( - id INTEGER PRIMARY KEY NOT NULL, - operation NUMBER(19,0), - asset VARCHAR2(2000) NOT NULL, - language_id NUMBER(19,0) NOT NULL, - entered_date TIMESTAMP, - publish_date TIMESTAMP, - type VARCHAR2(256), - bundle_id VARCHAR2(256) -); - -CREATE OR REPLACE TRIGGER PUBLISHING_QUEUE_TRIGGER before -insert on publishing_queue for each row -begin select PUBLISHING_QUEUE_SEQ.nextval into :new.id from dual; -end; -/ - -CREATE TABLE publishing_queue_audit -(bundle_id VARCHAR2(256) PRIMARY KEY NOT NULL, -status INTEGER, -status_pojo nclob, -status_updated TIMESTAMP, -create_date TIMESTAMP); - --- ****** Content Publishing Framework - End Point Management ******* -CREATE TABLE publishing_end_point ( - id VARCHAR2(36) PRIMARY KEY, - group_id VARCHAR2(700), - server_name VARCHAR2(700) unique, - address VARCHAR2(250), - port VARCHAR2(10), - protocol VARCHAR2(10), - enabled number(1,0) DEFAULT 0, - auth_key nclob, - sending number(1,0) DEFAULT 0); - -create table publishing_environment( - id varchar2(36) NOT NULL primary key, - name varchar2(255) NOT NULL unique, - push_to_all number(1,0) DEFAULT 0 NOT NULL -); - -create table sitesearch_audit ( - job_id varchar2(36), - job_name varchar2(255) not null, - fire_date timestamp not null, - incremental number(1,0) not null, - start_date timestamp, - end_date timestamp, - host_list varchar2(500) not null, - all_hosts number(1,0) not null, - lang_list varchar2(500) not null, - path varchar2(500) not null, - path_include number(1,0) not null, - files_count number(10,0) not null, - pages_count number(10,0) not null, - urlmaps_count number(10,0) not null, - index_name varchar2(100) not null, - primary key(job_id,fire_date) -); - -create table publishing_bundle( - id varchar2(36) NOT NULL primary key, - name varchar2(255) NOT NULL, - publish_date TIMESTAMP, - expire_date TIMESTAMP, - owner varchar2(100), - force_push number(1,0), - filter_key varchar2(100) -); - -ALTER TABLE publishing_bundle ADD CONSTRAINT FK_publishing_bundle_owner FOREIGN KEY (owner) REFERENCES user_(userid); - -create table publishing_bundle_environment( - id varchar2(36) NOT NULL primary key, - bundle_id varchar2(36) NOT NULL, - environment_id varchar2(36) NOT NULL -); - -alter table publishing_bundle_environment add constraint FK_bundle_id foreign key (bundle_id) references publishing_bundle(id); -alter table publishing_bundle_environment add constraint FK_environment_id foreign key (environment_id) references publishing_environment(id); - -create table publishing_pushed_assets( - bundle_id varchar2(36) NOT NULL, - asset_id varchar2(36) NOT NULL, - asset_type varchar2(255) NOT NULL, - push_date TIMESTAMP, - environment_id varchar2(36) NOT NULL, - endpoint_ids nclob, - publisher nclob -); - -CREATE INDEX idx_pushed_assets_1 ON publishing_pushed_assets (bundle_id); -CREATE INDEX idx_pushed_assets_2 ON publishing_pushed_assets (environment_id); -CREATE INDEX idx_pushed_assets_3 ON publishing_pushed_assets (asset_id, environment_id); - -CREATE INDEX idx_pub_qa_1 ON publishing_queue_audit (status); - --- Cluster Tables -CREATE TABLE dot_cluster(cluster_id varchar2(36), cluster_salt VARCHAR(256), PRIMARY KEY (cluster_id) ); -CREATE TABLE cluster_server(server_id varchar2(36) NOT NULL, cluster_id varchar2(36) NOT NULL, name varchar2(100), ip_address varchar2(39) NOT NULL, host varchar2(255), cache_port SMALLINT, es_transport_tcp_port SMALLINT, es_network_port SMALLINT, es_http_port SMALLINT, key_ varchar2(100), PRIMARY KEY (server_id) ); -ALTER TABLE cluster_server add constraint fk_cluster_id foreign key (cluster_id) REFERENCES dot_cluster(cluster_id); -CREATE TABLE cluster_server_uptime(id varchar2(36) NOT NULL,server_id varchar2(36) NOT NULL, startup TIMESTAMP, heartbeat TIMESTAMP, PRIMARY KEY (id)); -ALTER TABLE cluster_server_uptime add constraint fk_cluster_server_id foreign key (server_id) REFERENCES cluster_server(server_id); - --- Notifications Table -CREATE TABLE notification ( - group_id VARCHAR2(36) NOT NULL, - user_id VARCHAR2(255) NOT NULL, - message NCLOB NOT NULL, - notification_type VARCHAR2(100), - notification_level VARCHAR2(100), - time_sent TIMESTAMP NOT NULL, - was_read NUMBER(1, 0) -); -ALTER TABLE notification ADD CONSTRAINT PK_notification PRIMARY KEY (group_id, user_id); -ALTER TABLE notification MODIFY was_read DEFAULT 0; -CREATE INDEX idx_not_read ON notification (was_read); - --- indices for version_info tables on version_ts -create index idx_contentlet_vi_version_ts on contentlet_version_info(version_ts); -create index idx_container_vi_version_ts on container_version_info(version_ts); -create index idx_template_vi_version_ts on template_version_info(version_ts); -create index idx_link_vi_version_ts on link_version_info(version_ts); - --- container multiple structures -create index idx_container_id on container_structures(container_id); -alter table container_structures add constraint FK_cs_container_id foreign key (container_id) references identifier(id); -alter table container_structures add constraint FK_cs_inode foreign key (container_inode) references inode(inode); - - --- license repo -create table sitelic(id varchar(36) primary key, serverid varchar(100), license nclob not null, lastping date not null, startup_time number(19,0)); - -create table folders_ir(folder varchar2(255), local_inode varchar2(36), remote_inode varchar2(36), local_identifier varchar2(36), remote_identifier varchar2(36), endpoint_id varchar2(40), PRIMARY KEY (local_inode, endpoint_id)); -create table hosts_ir(local_identifier varchar2(36), remote_identifier varchar2(36), endpoint_id varchar2(40), local_working_inode varchar2(36), local_live_inode varchar2(36), remote_working_inode varchar2(36), remote_live_inode varchar2(36), language_id number(19,0), host varchar2(255), PRIMARY KEY (local_working_inode, language_id, endpoint_id)); -create table structures_ir(velocity_name varchar2(255), local_inode varchar2(36), remote_inode varchar2(36), endpoint_id varchar2(40), PRIMARY KEY (local_inode, endpoint_id)); -create table schemes_ir(name varchar2(255), local_inode varchar2(36), remote_inode varchar2(36), endpoint_id varchar2(40), PRIMARY KEY (local_inode, endpoint_id)); -create table htmlpages_ir(html_page varchar2(255), local_working_inode varchar2(36), local_live_inode varchar2(36), remote_working_inode varchar2(36), remote_live_inode varchar2(36),local_identifier varchar2(36), remote_identifier varchar2(36), endpoint_id varchar2(40), language_id number(19,0), PRIMARY KEY (local_working_inode, language_id, endpoint_id)); -create table fileassets_ir(file_name varchar2(255), local_working_inode varchar2(36), local_live_inode varchar2(36), remote_working_inode varchar2(36), remote_live_inode varchar2(36),local_identifier varchar2(36), remote_identifier varchar2(36), endpoint_id varchar2(40), language_id number(19,0), PRIMARY KEY (local_working_inode, language_id, endpoint_id)); -create table cms_roles_ir(name varchar2(1000), role_key varchar2(255), local_role_id varchar2(36), remote_role_id varchar2(36), local_role_fqn varchar2(1000), remote_role_fqn varchar2(1000), endpoint_id varchar2(40), PRIMARY KEY (local_role_id, endpoint_id)); - ----Server Action -create table cluster_server_action( - server_action_id varchar2(36) not null, - originator_id varchar2(36) not null, - server_id varchar2(36) not null, - failed number(1, 0), - response varchar2(2048), - action_id varchar2(1024) not null, - completed number(1, 0), - entered_date date not null, - time_out_seconds number(13) not null, - PRIMARY KEY (server_action_id) -); - --- Rules Engine -create table dot_rule(id varchar2(36),name varchar2(255) not null,fire_on varchar2(20),short_circuit number(1,0) default 0,parent_id varchar2(36) not null,folder varchar2(36) not null,priority number(10,0) default 0,enabled number(1,0) default 0,mod_date timestamp,primary key (id)); -create table rule_condition_group(id varchar2(36) primary key,rule_id varchar2(36) references dot_rule(id),operator varchar2(10) not null,priority number(10,0) default 0,mod_date timestamp); -create table rule_condition(id varchar2(36) primary key,conditionlet nclob not null,condition_group varchar(36) references rule_condition_group(id),comparison varchar2(36) not null,operator varchar2(10) not null,priority number(10,0) default 0,mod_date timestamp); -create table rule_condition_value (id varchar2(36) primary key,condition_id varchar2(36) references rule_condition(id), paramkey varchar2(255) not null, value nclob,priority number(10,0) default 0); -create table rule_action (id varchar2(36) primary key,rule_id varchar2(36) references dot_rule(id),priority number(10,0) default 0,actionlet nclob not null,mod_date timestamp); -create table rule_action_pars(id varchar2(36) primary key,rule_action_id varchar2(36) references rule_action(id), paramkey varchar2(255) not null,value nclob); -create index idx_rules_fire_on on dot_rule (fire_on); - -CREATE TABLE system_event ( - identifier VARCHAR(36) NOT NULL, - event_type VARCHAR(50) NOT NULL, - payload NCLOB NOT NULL, - created NUMBER(19, 0) NOT NULL, - server_id varchar2(36) NOT NULL -); -ALTER TABLE system_event ADD CONSTRAINT PK_system_event PRIMARY KEY (identifier); -CREATE INDEX idx_system_event ON system_event (created); - ---Content Types improvement -CREATE INDEX idx_lower_structure_name ON structure (LOWER(velocity_var_name)); - - -CREATE TABLE api_token_issued( - token_id varchar(255) NOT NULL, - token_userid varchar(255) NOT NULL, - issue_date TIMESTAMP NOT NULL, - expire_date TIMESTAMP NOT NULL, - requested_by_userid varchar(255) NOT NULL, - requested_by_ip varchar(255) NOT NULL, - revoke_date TIMESTAMP DEFAULT NULL, - allowed_from varchar(255) , - issuer varchar(255) , - claims NCLOB , - mod_date TIMESTAMP NOT NULL, - PRIMARY KEY (token_id) - ); - -create index idx_api_token_issued_user ON api_token_issued (token_userid); - --- Case sensitive unique asset-name,parent_path for a given host -CREATE UNIQUE INDEX idx_ident_uniq_asset_name on identifier (full_path_lc,host_inode); - -CREATE TABLE storage_group ( - group_name varchar(255) NOT NULL, - mod_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, - PRIMARY KEY (group_name) -); - -CREATE TABLE storage ( - path varchar(255) NOT NULL, - group_name varchar(255) NOT NULL, - hash varchar(64) NOT NULL, - mod_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, - hash_ref varchar(64), - PRIMARY KEY (path, group_name), - FOREIGN KEY (group_name) REFERENCES storage_group (group_name) -); - -CREATE INDEX idx_storage_hash ON storage (hash); - -CREATE TABLE storage_data ( - hash_id varchar(64) NOT NULL, - data BLOB NOT NULL, - mod_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL , - PRIMARY KEY (hash_id) -); - -CREATE TABLE storage_x_data ( - storage_hash varchar(64) NOT NULL, - data_hash varchar(64) NOT NULL, - data_order INTEGER NOT NULL, - mod_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, - PRIMARY KEY (storage_hash, data_hash), - FOREIGN KEY (data_hash) REFERENCES storage_data (hash_id) -); \ No newline at end of file diff --git a/dotCMS/src/main/webapp/html/portlet/ext/contentlet/publishing/view_publish_tool.jsp b/dotCMS/src/main/webapp/html/portlet/ext/contentlet/publishing/view_publish_tool.jsp index 7f37c13109b0..7c845cf2874c 100644 --- a/dotCMS/src/main/webapp/html/portlet/ext/contentlet/publishing/view_publish_tool.jsp +++ b/dotCMS/src/main/webapp/html/portlet/ext/contentlet/publishing/view_publish_tool.jsp @@ -248,37 +248,58 @@ } - dojo.require("dojo.io.iframe"); + + function doBundleUpload() { + var suffix = ".tar.gz"; var filename = dojo.byId("uploadBundleFile").value; - if (filename.indexOf(suffix) == -1 || (filename.length - suffix.length != filename.indexOf(suffix))) { alert("<%= UtilMethods.escapeSingleQuotes(LanguageUtil.get(pageContext, "publisher_please_upload_bundle_ending_with_targz")) %>"); return false; } + dijit.byId("uploadBundleBtn").setDisabled(true); - var td = dojo.io.iframe.send({ - url: "/DotAjaxDirector/com.dotcms.publisher.ajax.RemotePublishAjaxAction/cmd/uploadBundle", - form: "uploadBundleForm", - method: "post", - content: {fnx: 1}, - timeoutSeconds: 5, - preventCache: true, - handleAs: "text", - load: dojo.hitch(this, function (response) { - if (response.status == 'error') { - alert("Error Uploading the Bundle"); - } else { - backToBundleList(); - } - }) + + const fileInput = document.getElementById('uploadBundleFile'); + const file = fileInput.files[0]; + const formData = new FormData(); + formData.append('file', file); + + fetch('/api/bundle/sync', { // Replace with your actual upload endpoint + method: 'POST', + body: formData, + headers: { + + } + }) + .then(response => { + dijit.byId("uploadBundleBtn").setDisabled(false); + backToBundleList(); + if (!response.ok) { + throw new Error('Network response was not ok'); + } + + + return response.json(); + }) + .then(data => { + + console.log('Upload successful:', data); + + }) + .catch(error => { + console.error('Error:', error); + alert('Upload failed: ' + error.message); }); + + } function backToBundleList() { + dojo.byId("uploadBundleFile").value=""; dijit.byId("uploadBundleDiv").hide(); refreshAuditList(""); } @@ -359,7 +380,7 @@ <%= LanguageUtil.get(pageContext, "File") %> :
-