From 02bf537fdce525f11802b4e3e8f7bdc21cef9559 Mon Sep 17 00:00:00 2001 From: kevin_fourie Date: Thu, 11 Oct 2007 21:13:30 +0000 Subject: [PATCH] Merged in from DEV trunk... --- bin/recreateIndexes.php | 46 +++++++++++++++++++++++++++++++--------------- docs/VERSION-NAME.txt | 2 +- lib/authentication/authenticationutil.inc.php | 4 ++++ lib/session/Session.inc | 6 +++--- lib/session/SiteMap.inc | 4 ++-- lib/subscriptions/subscriptions.inc.php | 4 ++-- lib/triggers/triggerregistry.inc.php | 14 ++++++++++++++ lib/util/ktutil.inc | 45 ++++++++++++++++++++++++++++++++++++++++++--- plugins/ktcore/KTCorePlugin.php | 29 +++++++++++++++++------------ plugins/search2/ExternalDashlet.php | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/search2/IndexingStatusDashlet.php | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/search2/LuceneStatisticsDashlet.php | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/search2/MigrationDashlet.php | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/search2/searchPlugin.php | 33 --------------------------------- search2.php | 13 +++++++++++++ search2/indexing/indexerCore.inc.php | 23 ++++++++++++++++++++++- search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php | 48 ++++++++++++++++++++++++++++++++++++++++++------ search2/indexing/indexers/PHPLuceneIndexer.inc.php | 28 +++++++++++++++++++++++++++- search2/search/search.inc.php | 16 ++++++++++++++++ sql/mysql/install/data.sql | 32 ++++++++++++++++++++------------ sql/mysql/install/dump.sh | 5 +++-- sql/mysql/install/structure.sql | 581 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- sql/mysql/upgrade/3.5.0/relation_friendly.sql | 13 ++++++++++++- 23 files changed, 1075 insertions(+), 319 deletions(-) create mode 100644 plugins/search2/ExternalDashlet.php create mode 100644 plugins/search2/IndexingStatusDashlet.php create mode 100644 plugins/search2/LuceneStatisticsDashlet.php create mode 100644 plugins/search2/MigrationDashlet.php delete mode 100644 plugins/search2/searchPlugin.php diff --git a/bin/recreateIndexes.php b/bin/recreateIndexes.php index 437872e..445b803 100644 --- a/bin/recreateIndexes.php +++ b/bin/recreateIndexes.php @@ -145,6 +145,9 @@ class IndexRecreator $this->addForeignKey('discussion_comments', 'in_reply_to', 'discussion_comments', 'id'); $this->addForeignKey('discussion_threads', 'document_id', 'documents', 'id'); + $this->addForeignKey('discussion_threads', 'first_comment_id', 'discussion_comments', 'id'); + $this->addForeignKey('discussion_threads', 'last_comment_id', 'discussion_comments', 'id'); + $this->addForeignKey('discussion_threads', 'creator_id', 'users', 'id'); $this->addForeignKey('document_archiving_link', 'document_id', 'documents', 'id'); $this->addForeignKey('document_archiving_link', 'archiving_settings_id', 'archiving_settings', 'id'); @@ -185,9 +188,6 @@ class IndexRecreator $this->addForeignKey('document_transaction_text','document_id','documents','id'); - $this->addForeignKey('document_transactions','document_id','documents','id', 'SET NULL', 'SET NULL'); - $this->addForeignKey('document_transactions','user_id','users','id', 'SET NULL', 'SET NULL'); - $this->addForeignKey('document_type_fields_link','document_type_id', 'document_types_lookup','id'); $this->addForeignKey('document_type_fields_link','field_id','document_fields','id'); @@ -221,6 +221,9 @@ class IndexRecreator $this->addForeignKey('fieldsets','master_field','document_fields','id'); + $this->addForeignKey('folder_descendants','parent_id','folders','id'); + $this->addForeignKey('folder_descendants','folder_id','folders','id'); + $this->addForeignKey('folder_doctypes_link','folder_id','folders','id'); $this->addForeignKey('folder_doctypes_link','document_type_id','document_types_lookup','id'); @@ -229,16 +232,13 @@ class IndexRecreator $this->addForeignKey('folder_subscriptions','user_id','users','id'); $this->addForeignKey('folder_subscriptions','folder_id','folders','id'); - $this->addForeignKey('folder_transactions','folder_id','folders','id', 'SET NULL', 'SET NULL'); - $this->addForeignKey('folder_transactions','user_id','users','id', 'SET NULL', 'SET NULL'); - $this->addForeignKey('folder_workflow_map','folder_id', 'folders','id'); $this->addForeignKey('folder_workflow_map','workflow_id', 'workflows','id'); $this->addForeignKey('folders','creator_id','users','id'); $this->addForeignKey('folders','permission_object_id','permission_objects','id'); $this->addForeignKey('folders','permission_lookup_id','permission_lookups','id'); -// $this->addForeignKey('folders','parent_id','folders','id'); // cant do this because of root that is 0... need to make it null! + $this->addForeignKey('folders','parent_id','folders','id'); $this->addForeignKey('folders_users_roles_link','user_id','users','id'); $this->addForeignKey('folders_users_roles_link','document_id','documents','id'); @@ -318,6 +318,12 @@ class IndexRecreator $this->addForeignKey('user_history','user_id','users','id'); + $this->addForeignKey('user_history_documents','document_id','documents','id'); + $this->addForeignKey('user_history_documents','user_id','users','id'); + + $this->addForeignKey('user_history_folders','folder_id','folders','id'); + $this->addForeignKey('user_history_folders','user_id','users','id'); + $this->addForeignKey('users','authentication_source_id','authentication_sources','id'); $this->addForeignKey('users_groups_link', 'user_id','users','id'); @@ -386,6 +392,7 @@ class IndexRecreator $this->addIndex('document_transaction_types_lookup','namespace', 'UNIQUE'); $this->addIndex('document_transactions','session_id'); + $this->addIndex('document_transactions','document_id'); $this->addIndex('document_types_lookup','name'); //$this->addIndex('document_types_lookup','disabled'); ? used @@ -400,14 +407,17 @@ class IndexRecreator $this->addIndex('fieldsets','is_complete'); $this->addIndex('fieldsets','is_system'); + $this->addIndex('field_orders','child_field_id', 'UNIQUE'); + $this->addIndex('folder_searchable_text','folder_text' ,'FULLTEXT'); + $this->addIndex('folder_transactions','folder_id'); $this->addIndex('folder_transactions','session_id'); - $this->addIndex('folders','name'); +// $this->addIndex('folders','name'); $this->addIndex('folders', array('parent_id','name')); - $this->addIndex('groups_lookup','name'); + $this->addIndex('groups_lookup','name', 'UNIQUE'); $this->addIndex('groups_lookup', array('authentication_source_id','authentication_details_s1')); $this->addIndex('interceptor_instances','interceptor_namespace'); // unique? @@ -417,7 +427,7 @@ class IndexRecreator $this->addIndex('metadata_lookup_tree','metadata_lookup_tree_parent'); - $this->addIndex('mime_types','filetypes'); // should be unique... + $this->addIndex('mime_types','filetypes'); $this->addIndex('mime_types','mimetypes'); $this->addIndex('notifications','data_int_1'); // document id seems to be stored in this. used by clearnotifications. @@ -437,9 +447,9 @@ class IndexRecreator //$this->dropIndex('permission_descriptor_users','descriptor_id'); // in primary $this->addIndex('permission_descriptor_users','user_id'); - $this->addIndex('permission_descriptors','descriptor'); + $this->addIndex('permission_descriptors','descriptor','UNIQUE'); - $this->addIndex('permission_lookup_assignments', array('permission_lookup_id', 'permission_id')); + $this->addIndex('permission_lookup_assignments', array('permission_lookup_id', 'permission_id'), 'UNIQUE'); //$this->dropIndex('permission_lookup_assignments','permission_lookup_id'); // in composite $this->addIndex('permissions','name', 'UNIQUE'); @@ -455,7 +465,7 @@ class IndexRecreator $this->addIndex('system_settings','name', 'UNIQUE'); $this->addIndex('units_lookup','name' ,'UNIQUE'); - $this->dropIndex('units_lookup','folder_id'); +// $this->dropIndex('units_lookup','folder_id'); $this->addIndex('units_lookup','folder_id' ,'UNIQUE'); $this->addIndex('upgrades','descriptor'); @@ -488,7 +498,7 @@ class IndexRecreator $this->addIndex('workflow_trigger_instances','namespace'); - $this->addIndex('workflows','name'); + $this->addIndex('workflows','name', 'UNIQUE'); } @@ -518,6 +528,9 @@ class IndexRecreator function addForeignKey($table, $field, $othertable, $otherfield, $ondelete='cascade', $onupdate='cascade') { + if (!in_array($table, $this->tables)) continue; + if (!in_array($othertable, $this->tables)) continue; + $sql = "alter table $table add foreign key ($field) references $othertable ($otherfield) "; if ($ondelete != '') $sql .= " on delete $ondelete"; @@ -555,7 +568,6 @@ class IndexRecreator $this->addPrimaryKey('document_text', 'document_id'); $this->addPrimaryKey('document_transaction_types_lookup', 'id'); $this->addPrimaryKey('document_transaction_text', 'document_id'); - $this->addPrimaryKey('document_transaction_types_lookup','id'); $this->addPrimaryKey('document_transactions','id'); $this->addPrimaryKey('document_type_fields_link','id'); $this->addPrimaryKey('document_type_fieldsets_link','id'); @@ -576,6 +588,7 @@ class IndexRecreator $this->addPrimaryKey('groups_lookup','id'); $this->addPrimaryKey('help','id'); $this->addPrimaryKey('help_replacement','id'); + $this->addPrimaryKey('index_files','document_id'); $this->addPrimaryKey('interceptor_instances','id'); $this->addPrimaryKey('links','id'); $this->addPrimaryKey('metadata_lookup','id'); @@ -625,6 +638,7 @@ class IndexRecreator $this->addPrimaryKey('workflow_documents','document_id'); $this->addPrimaryKey('workflow_state_permission_assignments','id'); $this->addPrimaryKey('workflow_states','id'); + $this->addPrimaryKey('workflow_state_transitions',array('state_id','transition_id')); $this->addPrimaryKey('workflow_transitions','id'); $this->addPrimaryKey('workflow_trigger_instances','id'); $this->addPrimaryKey('workflows','id'); @@ -652,6 +666,7 @@ class IndexRecreator { $result = DBUtil::getResultArray("show tables"); $tables=array(); + $this->tables = array(); foreach($result as $table) { @@ -664,6 +679,7 @@ class IndexRecreator } $stmt = DBUtil::getResultArray("show create table $tablename"); + $this->tables[] = $tablename; $keys = array_keys($stmt[0]); diff --git a/docs/VERSION-NAME.txt b/docs/VERSION-NAME.txt index 264634a..07ac187 100644 --- a/docs/VERSION-NAME.txt +++ b/docs/VERSION-NAME.txt @@ -1 +1 @@ -OSS 3.5 +OSS DEV 3.5 diff --git a/lib/authentication/authenticationutil.inc.php b/lib/authentication/authenticationutil.inc.php index c538b65..89d119f 100644 --- a/lib/authentication/authenticationutil.inc.php +++ b/lib/authentication/authenticationutil.inc.php @@ -36,6 +36,10 @@ require_once(KT_LIB_DIR . '/authentication/authenticationproviderregistry.inc.p class KTAuthenticationUtil { function checkPassword ($oUser, $sPassword) { $oUser =& KTUtil::getObject('User', $oUser); + if ($oUser->getDisabled() == 2) + { + return false; + } $oAuthenticator =& KTAuthenticationUtil::getAuthenticatorForUser($oUser); return $oAuthenticator->checkPassword($oUser, $sPassword); } diff --git a/lib/session/Session.inc b/lib/session/Session.inc index 028811a..54c6ee7 100644 --- a/lib/session/Session.inc +++ b/lib/session/Session.inc @@ -187,12 +187,12 @@ class Session { $version = KTUtil::getSystemSetting('databaseVersion'); if ($default->systemVersion != $version) { - $default->log->info("Session::verify : Database not upgraded"); + if (KTLOG_CACHE) $default->log->info("Session::verify : Database not upgraded"); return PEAR::raiseError(sprintf(_kt('Incompatible database version (%s, expected version %s) - contact the administrator'), $version, $default->systemVersion)); } if (empty($sessionID)) { - $default->log->info("Session::verify session not in db"); + if (KTLOG_CACHE) $default->log->info("Session::verify session not in db"); return PEAR::raiseError(_kt('You need to login to access this page')); } @@ -204,7 +204,7 @@ class Session { // FIXME: if there aren't more rows that the max sessions for this user if ($numrows < 1) { // the session doesn't exist in the db - $default->log->info("Session::verify sessionID=$sessionID, not in db"); + if (KTLOG_CACHE) $default->log->info("Session::verify sessionID=$sessionID, not in db"); return PEAR::raiseError(_kt('You need to login to access this page')); return false; } diff --git a/lib/session/SiteMap.inc b/lib/session/SiteMap.inc index 2e3a3ff..d92f640 100644 --- a/lib/session/SiteMap.inc +++ b/lib/session/SiteMap.inc @@ -353,7 +353,7 @@ class SiteMap { function getPageArray($action) { global $default; - $default->log->info("SiteMap::getPage: checking ($action, " . (isset($_SESSION["userID"]) ? $_SESSION["userID"] : "") . ")"); + if (KTLOG_CACHE) $default->log->info("SiteMap::getPage: checking ($action, " . (isset($_SESSION["userID"]) ? $_SESSION["userID"] : "") . ")"); $groupIDs = array(); // for each section @@ -377,7 +377,7 @@ class SiteMap { } // if the function hasn't returned already then the current // user does not have access to the action - $default->log->info("Sitemap::getPage: access denied for ($action, " . $_SESSION["userID"] . ")"); + if (KTLOG_CACHE) $default->log->info("Sitemap::getPage: access denied for ($action, " . $_SESSION["userID"] . ")"); return false; } diff --git a/lib/subscriptions/subscriptions.inc.php b/lib/subscriptions/subscriptions.inc.php index 6497b90..45c7139 100644 --- a/lib/subscriptions/subscriptions.inc.php +++ b/lib/subscriptions/subscriptions.inc.php @@ -684,7 +684,7 @@ class SubscriptionEvent { // based on the old SubscriptionEngine::retrieveSubscribers. function _getSubscribers($iObjectId, $iSubType) { global $default; // for the logging. - $default->log->debug("_getSubscribers(id=$iObjectId, type=$iSubType); table=" .Subscription::getTableName($iSubType). "; id=" .Subscription::getIdFieldName($iSubType)); + if (KTLOG_CACHE) $default->log->debug("_getSubscribers(id=$iObjectId, type=$iSubType); table=" .Subscription::getTableName($iSubType). "; id=" .Subscription::getIdFieldName($iSubType)); $aUsers = array(); $sQuery = "SELECT user_id FROM " . Subscription::getTableName($iSubType) . " WHERE " . Subscription::getIdFieldName($iSubType) . " = ?"; @@ -708,7 +708,7 @@ class SubscriptionEvent { } } - $default->log->debug('retrieveSubscribers found count=' . count($aUsers)); + if (KTLOG_CACHE) $default->log->debug('retrieveSubscribers found count=' . count($aUsers)); return $aUsers; } } diff --git a/lib/triggers/triggerregistry.inc.php b/lib/triggers/triggerregistry.inc.php index 0654518..d2ce4e9 100644 --- a/lib/triggers/triggerregistry.inc.php +++ b/lib/triggers/triggerregistry.inc.php @@ -63,6 +63,20 @@ class KTTriggerRegistry { if (empty($ret)) { return array(); } + + foreach($ret as $trigger) + { + if (!class_exists($trigger[0])) + { + require_once($trigger[1]); + if (!class_exists($trigger[0])) + { + global $default; + $defailt->log->error(sprintf(_kt('Cannot locate trigger class \'%s\' for action \'%s\' slot \'%s\'.'), $trigger[0], $action, $slot)); + } + } + } + return $ret; } // }}} diff --git a/lib/util/ktutil.inc b/lib/util/ktutil.inc index 43c8202..e83114b 100644 --- a/lib/util/ktutil.inc +++ b/lib/util/ktutil.inc @@ -33,6 +33,45 @@ require_once(KT_LIB_DIR . '/util/KTStopwords.php'); class KTUtil { + + const MIN_IN_SECS = 60; + const HOUR_IN_SECS = 3600; + const DAY_IN_SECS = 86400; + + static function computePeriodToDate($start, $suffix = null, $returnArray=false) + { + if (is_null($suffix)) + { + $suffix = _kt('ago'); + } + $diff = time() - $start; + + $days = floor($diff / KTUtil::DAY_IN_SECS); + $hours = floor(($diff - $days * KTUtil::DAY_IN_SECS) / KTUtil::HOUR_IN_SECS); + $mins = floor(($diff - $days * KTUtil::DAY_IN_SECS - $hours * KTUtil::HOUR_IN_SECS) / KTUtil::MIN_IN_SECS); + $secs = $diff % KTUtil::MIN_IN_SECS; + + $str = ''; + if ($days > 0) $str .= sprintf(_kt(' %d day(s)'), $days); + if ($hours > 0) $str .= sprintf(_kt(' %d hour(s)'), $hours); + if ($mins > 0) $str .= sprintf(_kt(' %d minute(s)'), $mins); + if ($secs > 0) $str .= sprintf(_kt(' %d second(s)'), $secs); + + $str .= " $suffix"; + + if ($returnArray) + { + return array( + 'str'=>$str, + 'days'=>$days, + 'mins'=>$mins, + 'secs'=>$secs + ); + } + + return $str; + } + function extractGPC () { foreach (func_get_args() as $var) { if (array_key_exists($var, $_REQUEST)) { @@ -96,13 +135,13 @@ class KTUtil { } return $sString; } - + //this function fudges the strlen. It returns a ? when the character is a multi-byte character. //str len is therefore measured correctly. //http://www.phpwact.org/php/i18n/charsets function utf8_strlen($string){ return strlen(utf8_decode($str)); - } + } static function &arrayGet($aArray, $sKey, $mDefault = null, $bDefaultIfEmpty = true) { if (!is_array($aArray)) { @@ -668,7 +707,7 @@ class KTUtil { return null; } - function getSystemSetting($name, $default = null) { + static function getSystemSetting($name, $default = null) { // XXX make this use a cache layer? $sTable = KTUtil::getTableName('system_settings'); $aQuery = array( diff --git a/plugins/ktcore/KTCorePlugin.php b/plugins/ktcore/KTCorePlugin.php index f9fd421..24bc338 100644 --- a/plugins/ktcore/KTCorePlugin.php +++ b/plugins/ktcore/KTCorePlugin.php @@ -56,6 +56,7 @@ class KTCorePlugin extends KTPlugin { $this->registerAction('documentaction', 'KTDocumentMoveAction', 'ktcore.actions.document.move', 'KTDocumentActions.php'); $this->registerAction('documentaction', 'KTDocumentCopyAction', 'ktcore.actions.document.copy', 'KTDocumentActions.php'); $this->registerAction('documentaction', 'KTDocumentRenameAction', 'ktcore.actions.document.rename', 'document/Rename.php'); + $this->registerAction('documentaction', 'DocumentIndexAction', 'ktcore.search2.index.action', KT_DIR . '/plugins/search2/DocumentIndexAction.php'); $this->registerAction('documentinfo', 'KTDocumentTransactionHistoryAction', 'ktcore.actions.document.transactionhistory', 'KTDocumentActions.php'); $this->registerAction('documentinfo', 'KTDocumentVersionHistoryAction', 'ktcore.actions.document.versionhistory', 'KTDocumentActions.php'); $this->registerAction('documentaction', 'KTDocumentArchiveAction', 'ktcore.actions.document.archive', 'KTDocumentActions.php'); @@ -97,17 +98,22 @@ class KTCorePlugin extends KTPlugin { $this->registerDashlet('KTInfoDashlet', 'ktcore.dashlet.info', 'KTDashlets.php'); $this->registerDashlet('KTNotificationDashlet', 'ktcore.dashlet.notifications', 'KTDashlets.php'); $this->registerDashlet('KTCheckoutDashlet', 'ktcore.dashlet.checkout', 'KTDashlets.php'); - $this->registerDashlet('KTIndexerStatusDashlet', 'ktcore.dashlet.indexer_status', 'KTDashlets.php'); $this->registerDashlet('KTMailServerDashlet', 'ktcore.dashlet.mail_server', 'KTDashlets.php'); + $this->registerDashlet('ExternalResourceStatusDashlet', 'ktcore.dashlet.resource_status', KT_DIR . '/plugins/search2/ExternalDashlet.php'); + $this->registerDashlet('LuceneMigrationDashlet', 'ktcore.dashlet.lucene_migration', KT_DIR . '/plugins/search2/MigrationDashlet.php'); + $this->registerDashlet('IndexingStatusDashlet', 'ktcore.dashlet.indexing_status', KT_DIR . '/plugins/search2/IndexingStatusDashlet.php'); + $this->registerDashlet('LuceneStatisticsDashlet', 'ktcore.dashlet.indexing_statss', KT_DIR . '/plugins/search2/LuceneStatisticsDashlet.php'); $this->registerAdminPage('authentication', 'KTAuthenticationAdminPage', 'principals', _kt('Authentication'), sprintf(_kt('By default, %s controls its own users and groups and stores all information about them inside the database. In many situations, an organisation will already have a list of users and groups, and needs to use that existing information to allow access to the DMS. These Authentication Sources allow the system administrator to specify additional sources of authentication data.'), APP_NAME), 'authentication/authenticationadminpage.inc.php'); + $this->registerPortlet(array('browse', 'dashboard'), + 'Search2Portlet', 'ktcore.search2.portlet', + KT_DIR . '/plugins/search2/Search2Portlet.php'); + $this->registerPortlet(array('browse'), 'KTAdminModePortlet', 'ktcore.portlets.admin_mode', 'KTPortlets.php'); - /* NEW SEARCH $this->registerPortlet(array('browse', 'dashboard'), - 'KTSearchPortlet', 'ktcore.portlets.search', - 'KTPortlets.php');*/ + $this->registerPortlet(array('browse'), 'KTBrowseModePortlet', 'ktcore.portlets.browsemodes', 'KTPortlets.php'); @@ -140,6 +146,11 @@ class KTCorePlugin extends KTPlugin { $this->registerWorkflowTrigger('ktcore.workflowtriggers.copyaction', 'CopyActionTrigger', 'KTWorkflowTriggers.inc.php'); $this->registerWorkflowTrigger('ktcore.workflowtriggers.moveaction', 'MoveActionTrigger', 'KTWorkflowTriggers.inc.php'); + // search triggers + $this->registerTrigger('edit', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.edit', KT_DIR . '/plugins/search2/Search2Triggers.php'); + $this->registerTrigger('add', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.add', KT_DIR . '/plugins/search2/Search2Triggers.php'); + $this->registerTrigger('discussion', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.discussion', KT_DIR . '/plugins/search2/Search2Triggers.php'); + // widgets $this->registerWidget('KTCoreHiddenWidget', 'ktcore.widgets.hidden', 'KTWidgets.php'); $this->registerWidget('KTCoreStringWidget', 'ktcore.widgets.string', 'KTWidgets.php'); @@ -183,11 +194,7 @@ class KTCorePlugin extends KTPlugin { $this->registerCriterion('DocumentTypeCriterion', 'ktcore.criteria.documenttype', KT_LIB_DIR . '/browse/Criteria.inc'); $this->registerCriterion('DateModifiedCriterion', 'ktcore.criteria.datemodified', KT_LIB_DIR . '/browse/Criteria.inc'); $this->registerCriterion('SizeCriterion', 'ktcore.criteria.size', KT_LIB_DIR . '/browse/Criteria.inc'); - // NEW SEARCH $this->registerCriterion('ContentCriterion', 'ktcore.criteria.content', KT_LIB_DIR . '/browse/Criteria.inc'); $this->registerCriterion('WorkflowStateCriterion', 'ktcore.criteria.workflowstate', KT_LIB_DIR . '/browse/Criteria.inc'); - // NEW SEARCH $this->registerCriterion('DiscussionTextCriterion', 'ktcore.criteria.discussiontext', KT_LIB_DIR . '/browse/Criteria.inc'); - // NEW SEARCH $this->registerCriterion('SearchableTextCriterion', 'ktcore.criteria.searchabletext', KT_LIB_DIR . '/browse/Criteria.inc'); - // NEW SEARCH $this->registerCriterion('TransactionTextCriterion', 'ktcore.criteria.transactiontext', KT_LIB_DIR . '/browse/Criteria.inc'); $this->registerCriterion('DateCreatedDeltaCriterion', 'ktcore.criteria.datecreateddelta', KT_LIB_DIR . '/browse/Criteria.inc'); $this->registerCriterion('DateModifiedDeltaCriterion', 'ktcore.criteria.datemodifieddelta', KT_LIB_DIR . '/browse/Criteria.inc'); $this->registerCriterion('GeneralMetadataCriterion', 'ktcore.criteria.generalmetadata', KT_LIB_DIR . '/browse/Criteria.inc'); @@ -265,14 +272,12 @@ class KTCorePlugin extends KTPlugin { _kt('Restore or Expunge Deleted Documents'), _kt('Restore previously deleted documents, or permanently expunge them.'), 'admin/deletedDocuments.php', null); + + // misc $this->registerAdminPage('helpmanagement', 'ManageHelpDispatcher', 'misc', _kt('Edit Help files'), _kt('Change the help files that are displayed to users.'), 'admin/manageHelp.php', null); - /* NEW SEARCH $this->registerAdminPage('savedsearch', 'KTSavedSearchDispatcher', 'misc', - _kt('Saved searches'), - _kt('Manage saved searches - searches available by default to all users.'), - 'admin/savedSearch.php', null); */ $this->registerAdminPage('plugins', 'KTPluginDispatcher', 'misc', _kt('Manage plugins'), _kt('Register new plugins, disable plugins, and so forth'), 'admin/plugins.php', null); diff --git a/plugins/search2/ExternalDashlet.php b/plugins/search2/ExternalDashlet.php new file mode 100644 index 0000000..8a010eb --- /dev/null +++ b/plugins/search2/ExternalDashlet.php @@ -0,0 +1,122 @@ +sTitle = _kt('External Resource Dependancy Status'); + $this->sClass = 'ktError'; + } + + function addIssue($resource, $status) + { + $this->resources[] = array( + 'name'=>$resource, + 'status'=>str_replace( + + array("\n",_kt('Administrator Guide')), + array('
', sprintf("%s", _kt('Administrator Guide'))), $status)); + } + + function checkResources() + { + $check = true; + // check if we have a cached result + if (isset($_SESSION['ExternalResourceStatus'])) + { + // we will only do the check every 5 minutes + if (time() - $_SESSION['ExternalResourceStatus']['time'] < 5 * 60) + { + $check = false; + $this->resources = $_SESSION['ExternalResourceStatus']['resources']; + } + } + + // we will only check if the result is not cached, or after 5 minutes + if ($check) + { + $this->checkOpenOffice(); + $this->checkLucene(); + $_SESSION['ExternalResourceStatus']['time'] = time(); + $_SESSION['ExternalResourceStatus']['resources'] = $this->resources; + } + + return (count($this->resources) > 0); + } + + function checkOpenOffice() + { + $diagnose = SearchHelper::checkOpenOfficeAvailablity(); + if (!is_null($diagnose)) + { + $this->addIssue(_kt('Open Office Server'), $diagnose); + } + } + + function checkLucene() + { + $indexer = Indexer::get(); + $diagnose = $indexer->diagnose(); + if (!is_null($diagnose)) + { + $this->addIssue(_kt('Lucene Indexer'), $diagnose); + } + } + + function is_active($oUser) + { + if (!Permission::userIsSystemAdministrator($oUser)) + { + return false; + } + + return $this->checkResources() > 0; + } + + function render() + { + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('ktcore/search2/external_resources'); + + $aTemplateData = array( + 'context' => $this, + 'resources' => $this->resources + ); + + return $oTemplate->render($aTemplateData); + } +} + +?> diff --git a/plugins/search2/IndexingStatusDashlet.php b/plugins/search2/IndexingStatusDashlet.php new file mode 100644 index 0000000..9962b08 --- /dev/null +++ b/plugins/search2/IndexingStatusDashlet.php @@ -0,0 +1,109 @@ +sTitle = _kt('Indexing Status'); + $this->sClass = 'ktError'; + } + + function is_active($oUser) + { + if (!Permission::userIsSystemAdministrator($oUser)) + { + return false; + } + + if (isset($_SESSION['IndexingStatus'])) + { + $this->indexerName = $_SESSION['IndexingStatus']['indexerName']; + $this->indexerDiagnosis = $_SESSION['IndexingStatus']['indexerDiagnosis']; + $this->extractorDiagnosis = $_SESSION['IndexingStatus']['extractorDiagnosis']; + } + else + { + $indexer = Indexer::get(); + $this->indexerName = $indexer->getDisplayName(); + $this->indexerDiagnosis = $indexer->diagnose(); + $this->extractorDiagnosis = array(); + $extractorDiagnosis = $indexer->diagnoseExtractors(); + + + $result = array(); + foreach($extractorDiagnosis as $class=>$diagnosis) + { + $name=$diagnosis['name']; + $diag = $diagnosis['diagnosis']; + $result[$diag][] = $name; + } + + foreach($result as $problem=>$indexers) + { + if (empty($problem)) continue; + $this->extractorDiagnosis[] = array('problem'=>$problem, 'indexers'=>$indexers); + } + + $this->indexerDiagnosis = str_replace( + + array("\n",_kt('Administrator Guide')), + array('
', sprintf("%s", _kt('Administrator Guide'))), $this->indexerDiagnosis); + + $_SESSION['IndexingStatus']['indexerName'] = $this->indexerName; + $_SESSION['IndexingStatus']['indexerDiagnosis'] = $this->indexerDiagnosis; + $_SESSION['IndexingStatus']['extractorDiagnosis'] = $this->extractorDiagnosis; + } + + + return true; + } + + function render() + { + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('ktcore/search2/indexing_status'); + + $aTemplateData = array( + 'context' => $this, + 'indexerName' => $this->indexerName, + 'indexerDiagnosis' => $this->indexerDiagnosis, + 'extractorDiagnosis' => $this->extractorDiagnosis + ); + + return $oTemplate->render($aTemplateData); + } +} + +?> diff --git a/plugins/search2/LuceneStatisticsDashlet.php b/plugins/search2/LuceneStatisticsDashlet.php new file mode 100644 index 0000000..6b6347b --- /dev/null +++ b/plugins/search2/LuceneStatisticsDashlet.php @@ -0,0 +1,154 @@ +sTitle = _kt('Lucene Statistics'); + } + + function is_active($oUser) + { + return Permission::userIsSystemAdministrator($oUser); + } + + function render() + { + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_statistics'); + + + $check = true; + // check if we have a cached result + if (isset($_SESSION['LuceneStats'])) + { + // we will only do the check every 5 minutes + if (time() - $_SESSION['LuceneStats']['time'] < 5 * 60) + { + $check = false; + $stats = $_SESSION['LuceneStats']['stats']; + } + } + + // we will only check if the result is not cached, or after 5 minutes + if ($check) + { + $optimisationDate = KTUtil::getSystemSetting('luceneOptimisationDate', ''); + + $noOptimisation = false; + if ($optimisationDate == '') + { + $optimisationDate = _kt('N/A'); + $optimisationPeriod = $optimisationDate; + } + else + { + $optimisationPeriod = KTUtil::computePeriodToDate($optimisationDate, null, true); + $noOptimisation = $optimisationPeriod['days'] > 2; + $optimisationPeriod = $optimisationPeriod['str']; + $optimisationDate = date('Y-m-d H:i:s', $optimisationDate); + } + + $indexingDate = KTUtil::getSystemSetting('luceneIndexingDate', ''); + if ($indexingDate == '') + { + $indexingDate = _kt('N/A'); + $indexingPeriod = $indexingDate; + } + else + { + $indexingPeriod = KTUtil::computePeriodToDate($indexingDate); + $indexingDate = date('Y-m-d H:i:s', $indexingDate); + } + + $index = Indexer::get(); + $docsInIndex = $index->getDocumentsInIndex(); + + $sql = "SELECT count(*) as docsInQueue FROM index_files"; + $docsInQueue = DBUtil::getOneResultKey($sql, 'docsInQueue'); + + $sql = "SELECT count(*) as docsInRepository FROM documents"; + $docsInRepository = DBUtil::getOneResultKey($sql, 'docsInRepository'); + + if ($docsInRepository == 0) + { + $indexingCoverage = '0.00%'; + $queueCoverage = $indexingCoverage; + } + else + { + // compute indexing coverage + $indexingCoverage = _kt('Not Available'); + if (is_numeric($docsInIndex)) + { + $indexingCoverage = ($docsInIndex * 100) / $docsInRepository; + $indexingCoverage = number_format($indexingCoverage, 2, '.',',') . '%'; + } + + // compute queue coverage + $queueCoverage = _kt('Not Available'); + if (is_numeric($docsInQueue)) + { + $queueCoverage = ($docsInQueue * 100) / $docsInRepository; + $queueCoverage = number_format($queueCoverage, 2, '.',',') . '%'; + } + } + + $stats = array( + 'optimisationDate'=>$optimisationDate, + 'optimisationPeriod'=>$optimisationPeriod, + 'indexingDate'=>$indexingDate, + 'indexingPeriod'=>$indexingPeriod, + 'docsInIndex'=>$docsInIndex, + 'docsInQueue'=>$docsInQueue, + 'docsInRepository'=>$docsInRepository, + 'indexingCoverage'=>$indexingCoverage, + 'queueCoverage'=>$queueCoverage, + 'noOptimisation'=>$noOptimisation + ); + + $_SESSION['LuceneStats']['time'] = time(); + $_SESSION['LuceneStats']['stats'] = $stats; + } + + $aTemplateData = array( + 'context' => $this, + 'stats'=>$stats + + ); + + return $oTemplate->render($aTemplateData); + } +} + +?> diff --git a/plugins/search2/MigrationDashlet.php b/plugins/search2/MigrationDashlet.php new file mode 100644 index 0000000..b5c6bdd --- /dev/null +++ b/plugins/search2/MigrationDashlet.php @@ -0,0 +1,63 @@ +sTitle = _kt('Lucene Migration Status'); + } + + function is_active($oUser) + { + if (!Permission::userIsSystemAdministrator($oUser)) + { + return false; + } + + return true; + } + + function render() + { + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_migration'); + + $aTemplateData = array( + 'context' => $this + ); + + return $oTemplate->render($aTemplateData); + } +} + +?> diff --git a/plugins/search2/searchPlugin.php b/plugins/search2/searchPlugin.php deleted file mode 100644 index 70990f6..0000000 --- a/plugins/search2/searchPlugin.php +++ /dev/null @@ -1,33 +0,0 @@ -sFriendlyName = _kt('Search2 Plugin'); - return $res; - } - - function setup() - { - $this->registerAction('documentaction', 'DocumentIndexAction', 'ktcore.search2.index.action', 'DocumentIndexAction.php'); - $this->registerTrigger('edit', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.edit', 'Search2Triggers.php'); - $this->registerTrigger('add', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.add', 'Search2Triggers.php'); - $this->registerTrigger('discussion', 'postValidate', 'SavedSearchSubscriptionTrigger', 'ktcore.search2.savedsearch.subscription.discussion', 'Search2Triggers.php'); - $this->registerPortlet(array('browse', 'dashboard'), - 'Search2Portlet', 'ktcore.search2.portlet', - 'Search2Portlet.php'); - } - } - -$oPluginRegistry =& KTPluginRegistry::getSingleton(); -$oPluginRegistry->registerPlugin('Search2Plugin', 'ktcore.search2.plugin', __FILE__); -?> \ No newline at end of file diff --git a/search2.php b/search2.php index 53d0e8a..13a3899 100644 --- a/search2.php +++ b/search2.php @@ -66,6 +66,19 @@ class SearchDispatcher extends KTStandardDispatcher { } } + function do_refreshLuceneStats() + { + session_unregister('LuceneStats'); + redirect('/dashboard.php'); + } + + function do_refreshDashboardStatus() + { + session_unregister('ExternalResourceStatus'); + session_unregister('IndexingStatus'); + redirect('/dashboard.php'); + } + /** * Processes a query sent by HTTP POST in searchQuery. * diff --git a/search2/indexing/indexerCore.inc.php b/search2/indexing/indexerCore.inc.php index 61ecf8a..ede5f4e 100644 --- a/search2/indexing/indexerCore.inc.php +++ b/search2/indexing/indexerCore.inc.php @@ -791,8 +791,13 @@ abstract class Indexer $diagnoses = array(); $dir = opendir($path); $extlen = - strlen($extension); + while (($file = readdir($dir)) !== false) { + if (substr($file,0,1) == '.') + { + continue; + } if (substr($file,$extlen) != $extension) { $default->log->error(sprintf(_kt("diagnose: '%s' does not have extension '%s'."), $file, $extension)); @@ -940,12 +945,28 @@ abstract class Indexer /** * Possibly we can optimise indexes. This method must be overriden. + * The new function must call the parent! * */ public function optimise() { - // do nothing + KTUtil::setSystemSetting('luceneOptimisationDate', time()); } + + /** + * Returns the name of the indexer. + * + * @return string + */ + public abstract function getDisplayName(); + + + /** + * Returns the number of non-deleted documents in the index. + * + * @return int + */ + public abstract function getDocumentsInIndex(); } ?> \ No newline at end of file diff --git a/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php b/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php index f05f610..9a9b296 100644 --- a/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php +++ b/search2/indexing/indexers/JavaXMLRPCLuceneIndexer.inc.php @@ -19,7 +19,7 @@ class JavaXMLRPCLuceneIndexer extends Indexer parent::__construct(); $config =& KTConfig::getSingleton(); - $javaServerUrl = $config->get('indexer/JavaLuceneURL', 'http://localhost:8875'); + $javaServerUrl = $config->get('indexer/javaLuceneURL'); $this->lucene = new XmlRpcLucene($javaServerUrl); } @@ -99,6 +99,7 @@ class JavaXMLRPCLuceneIndexer extends Indexer */ public function optimise() { + parent::optimise(); $this->lucene->optimize(); } @@ -149,22 +150,57 @@ class JavaXMLRPCLuceneIndexer extends Indexer return $results; } + /** + * Diagnose the indexer. e.g. Check that the indexing server is running. + * + */ public function diagnose() { - $config =& KTConfig::getSingleton(); + $config =& KTConfig::getSingleton(); + + $javaLuceneURL = $config->get('indexer/javaLuceneURL'); + + list($protocol, $host, $port) = explode(':', $javaLuceneURL); + if (empty($port)) $port == 8875; + if (substr($host, 0, 2) == '//') $host = substr($host, 2); - $ooHost = $config->get('openoffice/host', 'localhost'); - $ooPort = $config->get('openoffice/port', 8100); - $connection = @fsockopen($ooHost, $ooPort,$errno, $errstr, 2); + $connection = @fsockopen($host, $port, $errno, $errstr, 2); if (false === $connection) { - return _kt('Cannot connect to openoffice host'); + $indexer = $this->getDisplayName(); + return sprintf(_kt("Cannot connect to the %s on '%s'.\nPlease consult the Administrator Guide for more information on configuring the %s."), $indexer, $javaLuceneURL, $indexer); } fclose($connection); return null; + } + /** + * Returns the name of the indexer. + * + * @return string + */ + public function getDisplayName() + { + return _kt('Lucene Indexing Server'); + } + + + /** + * Returns the number of non-deleted documents in the index. + * + * @return int + */ + public function getDocumentsInIndex() + { + $stats = $this->lucene->getStatistics(); + if ($stats === false || !is_object($stats)) + { + return _kt('Not Available'); + } + return $stats->countDocuments; + } } ?> \ No newline at end of file diff --git a/search2/indexing/indexers/PHPLuceneIndexer.inc.php b/search2/indexing/indexers/PHPLuceneIndexer.inc.php index d1e2fa7..10879aa 100644 --- a/search2/indexing/indexers/PHPLuceneIndexer.inc.php +++ b/search2/indexing/indexers/PHPLuceneIndexer.inc.php @@ -131,10 +131,21 @@ class PHPLuceneIndexer extends Indexer */ public function optimise() { + parent::optimise(); $this->lucene->optimize(); } /** + * Returns the number of non-deleted documents in the index. + * + * @return int + */ + public function getDocumentsInIndex() + { + return $this->lucene->numDocs(); + } + + /** * Removes a document from the index. * * @param int $docid @@ -190,13 +201,28 @@ class PHPLuceneIndexer extends Indexer return $results; } + /** + * Diagnose the indexer. e.g. Check that the indexing server is running. + * + */ public function diagnose() { if ($this->lucene == null) { - return _kt("The lucene index has not been initialised correctly. Please review the documentation on how to setup the indexing."); + $indexer = $this->getDisplayName(); + return sprintf(_kt("The %s has not been initialised correctly. Please review the documentation on how to setup the indexing."),$indexer); } return null; } + + /** + * Returns the name of the indexer. + * + * @return string + */ + public function getDisplayName() + { + return _kt('Lucene PHP Indexer'); + } } ?> \ No newline at end of file diff --git a/search2/search/search.inc.php b/search2/search/search.inc.php index 3831779..b1b83f0 100644 --- a/search2/search/search.inc.php +++ b/search2/search/search.inc.php @@ -28,6 +28,22 @@ function search_alias_compare($a, $b) class SearchHelper { + public static function checkOpenOfficeAvailablity() + { + $config =& KTConfig::getSingleton(); + $ooHost = $config->get('openoffice/host', 'localhost'); + $ooPort = $config->get('openoffice/port', 8100); + + $connection = @fsockopen($ooHost, $ooPort,$errno, $errstr, 2); + if (false === $connection) + { + return sprintf(_kt("Cannot connect to Open Office Server on host '%s:%s'.\nPlease consult the Administrator Guide for more information on configuring Open Office Server."), $ooHost, $ooPort); + } + fclose($connection); + + return null; + } + public static function getSavedSearchEvents() { // TODO diff --git a/sql/mysql/install/data.sql b/sql/mysql/install/data.sql index df9f008..05355e8 100644 --- a/sql/mysql/install/data.sql +++ b/sql/mysql/install/data.sql @@ -1,11 +1,11 @@ -- -- $Id$ --- +-- -- The contents of this file are subject to the KnowledgeTree Public -- License Version 1.1.2 ("License"); You may not use this file except in -- compliance with the License. You may obtain a copy of the License at -- http://www.knowledgetree.com/KPL --- +-- -- Software distributed under the License is distributed on an "AS IS" -- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. -- See the License for the specific language governing rights and @@ -16,9 +16,9 @@ -- (ii) the KnowledgeTree copyright notice -- in the same form as they appear in the distribution. See the License for -- requirements. --- +-- -- The Original Code is: KnowledgeTree Open Source --- +-- -- The Initial Developer of the Original Code is The Jam Warehouse Software -- (Pty) Ltd, trading as KnowledgeTree. -- Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright @@ -30,7 +30,7 @@ -- -- Host: localhost Database: dms_clean -- ------------------------------------------------------ --- Server version 5.0.37 +-- Server version 5.0.41-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -385,12 +385,21 @@ INSERT INTO `fieldsets` VALUES (2,'Tag Cloud','tagcloud',0,0,NULL,1,0,0,0,'Tag C UNLOCK TABLES; -- +-- Dumping data for table `folder_descendants` +-- + +LOCK TABLES `folder_descendants` WRITE; +/*!40000 ALTER TABLE `folder_descendants` DISABLE KEYS */; +/*!40000 ALTER TABLE `folder_descendants` ENABLE KEYS */; +UNLOCK TABLES; + +-- -- Dumping data for table `folder_doctypes_link` -- LOCK TABLES `folder_doctypes_link` WRITE; /*!40000 ALTER TABLE `folder_doctypes_link` DISABLE KEYS */; -INSERT INTO `folder_doctypes_link` VALUES (1,1,1),(2,2,1); +INSERT INTO `folder_doctypes_link` VALUES (1,1,1); /*!40000 ALTER TABLE `folder_doctypes_link` ENABLE KEYS */; UNLOCK TABLES; @@ -437,7 +446,7 @@ UNLOCK TABLES; LOCK TABLES `folders` WRITE; /*!40000 ALTER TABLE `folders` DISABLE KEYS */; -INSERT INTO `folders` VALUES (1,'Root Folder','Root Document Folder',0,1,0,NULL,NULL,1,5,0,1); +INSERT INTO `folders` VALUES (1,'Root Folder','Root Document Folder',NULL,1,0,NULL,NULL,1,5,0,1); /*!40000 ALTER TABLE `folders` ENABLE KEYS */; UNLOCK TABLES; @@ -702,7 +711,7 @@ UNLOCK TABLES; LOCK TABLES `plugins` WRITE; /*!40000 ALTER TABLE `plugins` DISABLE KEYS */; -INSERT INTO `plugins` VALUES (49,'ktcore.generalmetadata.plugin','plugins/generalmetadata/GeneralMetadataPlugin.php',0,0,NULL,0,'General Metadata Search Plugin'),(50,'ktcore.tagcloud.plugin','plugins/tagcloud/TagCloudPlugin.php',0,0,NULL,0,'Tag Cloud Plugin'),(51,'ktcore.rss.plugin','plugins/rssplugin/RSSPlugin.php',0,0,NULL,0,'RSS Plugin'),(52,'ktcore.language.plugin','plugins/ktcore/KTCoreLanguagePlugin.php',0,0,NULL,0,'Core Language Support'),(53,'ktcore.plugin','plugins/ktcore/KTCorePlugin.php',0,0,NULL,0,'Core Application Functionality'),(54,'ktstandard.adminversion.plugin','plugins/ktstandard/AdminVersionPlugin/AdminVersionPlugin.php',0,0,NULL,0,'Admin Version Plugin'),(55,'ktstandard.ldapauthentication.plugin','plugins/ktstandard/KTLDAPAuthenticationPlugin.php',0,0,NULL,0,'LDAP Authentication Plugin'),(56,'ktstandard.pdf.plugin','plugins/ktstandard/PDFGeneratorPlugin.php',0,0,NULL,0,'PDF Generator Plugin'),(57,'ktstandard.bulkexport.plugin','plugins/ktstandard/KTBulkExportPlugin.php',0,0,NULL,0,'Bulk Export Plugin'),(58,'ktstandard.immutableaction.plugin','plugins/ktstandard/ImmutableActionPlugin.php',0,0,NULL,0,'Immutable action plugin'),(59,'ktstandard.subscriptions.plugin','plugins/ktstandard/KTSubscriptions.php',0,0,NULL,0,'Subscription Plugin'),(60,'ktstandard.discussion.plugin','plugins/ktstandard/KTDiscussion.php',0,0,NULL,0,'Document Discussions Plugin'),(61,'ktstandard.email.plugin','plugins/ktstandard/KTEmail.php',0,0,NULL,0,'Email Plugin'),(62,'ktstandard.indexer.plugin','plugins/ktstandard/KTIndexer.php',0,0,NULL,0,'Full-text Content Indexing'),(63,'ktstandard.documentlinks.plugin','plugins/ktstandard/KTDocumentLinks.php',0,0,NULL,0,'Inter-document linking'),(64,'ktstandard.workflowassociation.plugin','plugins/ktstandard/KTWorkflowAssociation.php',0,0,NULL,0,'Workflow Association Plugin'),(65,'ktstandard.workflowassociation.documenttype.plugin','plugins/ktstandard/workflow/TypeAssociator.php',0,0,NULL,0,'Workflow allocation by document type'),(66,'ktstandard.workflowassociation.folder.plugin','plugins/ktstandard/workflow/FolderAssociator.php',0,0,NULL,0,'Workflow allocation by location'),(67,'ktstandard.disclaimers.plugin','plugins/ktstandard/KTDisclaimers.php',0,0,NULL,0,'Disclaimers Plugin'),(68,'ktstandard.searchdashlet.plugin','plugins/ktstandard/SearchDashletPlugin.php',0,0,NULL,0,'Search Dashlet Plugin'),(69,'nbm.browseable.plugin','plugins/browseabledashlet/BrowseableDashletPlugin.php',0,0,NULL,0,'Orphaned Folders Plugin'),(70,'ktstandard.ktwebdavdashlet.plugin','plugins/ktstandard/KTWebDAVDashletPlugin.php',0,0,NULL,0,'WebDAV Dashlet Plugin'),(71,'ktcore.scheduler.plugin','plugins/ktcore/scheduler/KTSchedulerPlugin.php',0,0,NULL,0,'Task Scheduler Plugin'); +INSERT INTO `plugins` VALUES (50,'ktcore.tagcloud.plugin','plugins/tagcloud/TagCloudPlugin.php',0,0,NULL,0,'Tag Cloud Plugin'),(51,'ktcore.rss.plugin','plugins/rssplugin/RSSPlugin.php',0,0,NULL,0,'RSS Plugin'),(52,'ktcore.language.plugin','plugins/ktcore/KTCoreLanguagePlugin.php',0,0,NULL,0,'Core Language Support'),(53,'ktcore.plugin','plugins/ktcore/KTCorePlugin.php',0,0,NULL,0,'Core Application Functionality'),(54,'ktstandard.adminversion.plugin','plugins/ktstandard/AdminVersionPlugin/AdminVersionPlugin.php',0,0,NULL,0,'Admin Version Plugin'),(55,'ktstandard.ldapauthentication.plugin','plugins/ktstandard/KTLDAPAuthenticationPlugin.php',0,0,NULL,0,'LDAP Authentication Plugin'),(56,'ktstandard.pdf.plugin','plugins/ktstandard/PDFGeneratorPlugin.php',0,0,NULL,0,'PDF Generator Plugin'),(57,'ktstandard.bulkexport.plugin','plugins/ktstandard/KTBulkExportPlugin.php',0,0,NULL,0,'Bulk Export Plugin'),(58,'ktstandard.immutableaction.plugin','plugins/ktstandard/ImmutableActionPlugin.php',0,0,NULL,0,'Immutable action plugin'),(59,'ktstandard.subscriptions.plugin','plugins/ktstandard/KTSubscriptions.php',0,0,NULL,0,'Subscription Plugin'),(60,'ktstandard.discussion.plugin','plugins/ktstandard/KTDiscussion.php',0,0,NULL,0,'Document Discussions Plugin'),(61,'ktstandard.email.plugin','plugins/ktstandard/KTEmail.php',0,0,NULL,0,'Email Plugin'),(62,'ktstandard.indexer.plugin','plugins/ktstandard/KTIndexer.php',0,0,NULL,0,'Full-text Content Indexing'),(63,'ktstandard.documentlinks.plugin','plugins/ktstandard/KTDocumentLinks.php',0,0,NULL,0,'Inter-document linking'),(64,'ktstandard.workflowassociation.plugin','plugins/ktstandard/KTWorkflowAssociation.php',0,0,NULL,0,'Workflow Association Plugin'),(65,'ktstandard.workflowassociation.documenttype.plugin','plugins/ktstandard/workflow/TypeAssociator.php',0,0,NULL,0,'Workflow allocation by document type'),(66,'ktstandard.workflowassociation.folder.plugin','plugins/ktstandard/workflow/FolderAssociator.php',0,0,NULL,0,'Workflow allocation by location'),(67,'ktstandard.disclaimers.plugin','plugins/ktstandard/KTDisclaimers.php',0,0,NULL,0,'Disclaimers Plugin'),(68,'ktstandard.searchdashlet.plugin','plugins/ktstandard/SearchDashletPlugin.php',0,0,NULL,0,'Search Dashlet Plugin'),(69,'nbm.browseable.plugin','plugins/browseabledashlet/BrowseableDashletPlugin.php',0,0,NULL,0,'Orphaned Folders Plugin'),(70,'ktstandard.ktwebdavdashlet.plugin','plugins/ktstandard/KTWebDAVDashletPlugin.php',0,0,NULL,0,'WebDAV Dashlet Plugin'),(71,'ktcore.scheduler.plugin','plugins/ktcore/scheduler/KTSchedulerPlugin.php',0,0,NULL,0,'Task Scheduler Plugin'); /*!40000 ALTER TABLE `plugins` ENABLE KEYS */; UNLOCK TABLES; @@ -861,7 +870,6 @@ UNLOCK TABLES; LOCK TABLES `units_organisations_link` WRITE; /*!40000 ALTER TABLE `units_organisations_link` DISABLE KEYS */; -INSERT INTO `units_organisations_link` VALUES (1,1,1); /*!40000 ALTER TABLE `units_organisations_link` ENABLE KEYS */; UNLOCK TABLES; @@ -871,7 +879,7 @@ UNLOCK TABLES; LOCK TABLES `upgrades` WRITE; /*!40000 ALTER TABLE `upgrades` DISABLE KEYS */; -INSERT INTO `upgrades` VALUES (1,'sql*2.0.6*0*2.0.6/create_upgrade_table.sql','Database upgrade to version 2.0.6: Create upgrade table','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(2,'upgrade*2.0.6*0*upgrade2.0.6','Upgrade from version 2.0.2 to 2.0.6','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(3,'func*2.0.6*0*addTemplateMimeTypes','Add MIME types for Excel and Word templates','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(4,'sql*2.0.6*0*2.0.6/add_email_attachment_transaction_type.sql','Database upgrade to version 2.0.6: Add email attachment transaction type','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(5,'sql*2.0.6*0*2.0.6/create_link_type_table.sql','Database upgrade to version 2.0.6: Create link type table','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(6,'sql*2.0.6*1*2.0.6/1-update_database_version.sql','Database upgrade to version 2.0.6: Update database version','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(7,'upgrade*2.0.7*0*upgrade2.0.7','Upgrade from version 2.0.7 to 2.0.7','2005-07-21 22:35:15',1,'upgrade*2.0.7*0*upgrade2.0.7'),(8,'sql*2.0.7*0*2.0.7/document_link_update.sql','Database upgrade to version 2.0.7: Document link update','2005-07-21 22:35:16',1,'upgrade*2.0.7*0*upgrade2.0.7'),(9,'sql*2.0.8*0*2.0.8/nestedgroups.sql','Database upgrade to version 2.0.8: Nestedgroups','2005-08-02 16:02:06',1,'upgrade*2.0.8*0*upgrade2.0.8'),(10,'sql*2.0.8*0*2.0.8/help_replacement.sql','Database upgrade to version 2.0.8: Help replacement','2005-08-02 16:02:06',1,'upgrade*2.0.8*0*upgrade2.0.8'),(11,'upgrade*2.0.8*0*upgrade2.0.8','Upgrade from version 2.0.7 to 2.0.8','2005-08-02 16:02:06',1,'upgrade*2.0.8*0*upgrade2.0.8'),(12,'sql*2.0.8*0*2.0.8/permissions.sql','Database upgrade to version 2.0.8: Permissions','2005-08-02 16:02:07',1,'upgrade*2.0.8*0*upgrade2.0.8'),(13,'func*2.0.8*1*setPermissionObject','Set the permission object in charge of a document or folder','2005-08-02 16:02:07',1,'upgrade*2.0.8*0*upgrade2.0.8'),(14,'sql*2.0.8*1*2.0.8/1-metadata_versions.sql','Database upgrade to version 2.0.8: Metadata versions','2005-08-02 16:02:07',1,'upgrade*2.0.8*0*upgrade2.0.8'),(15,'sql*2.0.8*2*2.0.8/2-permissions.sql','Database upgrade to version 2.0.8: Permissions','2005-08-02 16:02:07',1,'upgrade*2.0.8*0*upgrade2.0.8'),(16,'sql*2.0.9*0*2.0.9/storagemanager.sql','','0000-00-00 00:00:00',1,NULL),(17,'sql*2.0.9*0*2.0.9/metadata_tree.sql','','0000-00-00 00:00:00',1,NULL),(18,'sql*2.0.9*0*2.0.9/document_incomplete.sql','','0000-00-00 00:00:00',1,NULL),(20,'upgrade*2.99.1*0*upgrade2.99.1','Upgrade from version 2.0.8 to 2.99.1','2005-10-07 14:26:15',1,'upgrade*2.99.1*0*upgrade2.99.1'),(21,'sql*2.99.1*0*2.99.1/workflow.sql','Database upgrade to version 2.99.1: Workflow','2005-10-07 14:26:15',1,'upgrade*2.99.1*0*upgrade2.99.1'),(22,'sql*2.99.1*0*2.99.1/fieldsets.sql','Database upgrade to version 2.99.1: Fieldsets','2005-10-07 14:26:16',1,'upgrade*2.99.1*0*upgrade2.99.1'),(23,'func*2.99.1*1*createFieldSets','Create a fieldset for each field without one','2005-10-07 14:26:16',1,'upgrade*2.99.1*0*upgrade2.99.1'),(24,'sql*2.99.2*0*2.99.2/saved_searches.sql','','0000-00-00 00:00:00',1,NULL),(25,'sql*2.99.2*0*2.99.2/transactions.sql','','0000-00-00 00:00:00',1,NULL),(26,'sql*2.99.2*0*2.99.2/field_mandatory.sql','','0000-00-00 00:00:00',1,NULL),(27,'sql*2.99.2*0*2.99.2/fieldsets_system.sql','','0000-00-00 00:00:00',1,NULL),(28,'sql*2.99.2*0*2.99.2/permission_by_user_and_roles.sql','','0000-00-00 00:00:00',1,NULL),(29,'sql*2.99.2*0*2.99.2/disabled_metadata.sql','','0000-00-00 00:00:00',1,NULL),(30,'sql*2.99.2*0*2.99.2/searchable_text.sql','','0000-00-00 00:00:00',1,NULL),(31,'sql*2.99.2*0*2.99.2/workflow.sql','','0000-00-00 00:00:00',1,NULL),(32,'sql*2.99.2*1*2.99.2/1-constraints.sql','','0000-00-00 00:00:00',1,NULL),(33,'sql*2.99.3*0*2.99.3/notifications.sql','','0000-00-00 00:00:00',1,NULL),(34,'sql*2.99.3*0*2.99.3/last_modified_user.sql','','0000-00-00 00:00:00',1,NULL),(35,'sql*2.99.3*0*2.99.3/authentication_sources.sql','','0000-00-00 00:00:00',1,NULL),(36,'sql*2.99.3*0*2.99.3/document_fields_constraints.sql','','0000-00-00 00:00:00',1,NULL),(37,'sql*2.99.5*0*2.99.5/dashlet_disabling.sql','','0000-00-00 00:00:00',1,NULL),(38,'sql*2.99.5*0*2.99.5/role_allocations.sql','','0000-00-00 00:00:00',1,NULL),(39,'sql*2.99.5*0*2.99.5/transaction_namespaces.sql','','0000-00-00 00:00:00',1,NULL),(40,'sql*2.99.5*0*2.99.5/fieldset_field_descriptions.sql','','0000-00-00 00:00:00',1,NULL),(41,'sql*2.99.5*0*2.99.5/role_changes.sql','','0000-00-00 00:00:00',1,NULL),(42,'sql*2.99.6*0*2.99.6/table_cleanup.sql','Database upgrade to version 2.99.6: Table cleanup','2006-01-20 17:04:05',1,'upgrade*2.99.7*99*upgrade2.99.7'),(43,'sql*2.99.6*0*2.99.6/plugin-registration.sql','Database upgrade to version 2.99.6: Plugin-registration','2006-01-20 17:04:05',1,'upgrade*2.99.7*99*upgrade2.99.7'),(44,'sql*2.99.7*0*2.99.7/documents_normalisation.sql','Database upgrade to version 2.99.7: Documents normalisation','2006-01-20 17:04:05',1,'upgrade*2.99.7*99*upgrade2.99.7'),(45,'sql*2.99.7*0*2.99.7/help_replacement.sql','Database upgrade to version 2.99.7: Help replacement','2006-01-20 17:04:05',1,'upgrade*2.99.7*99*upgrade2.99.7'),(46,'sql*2.99.7*0*2.99.7/table_cleanup.sql','Database upgrade to version 2.99.7: Table cleanup','2006-01-20 17:04:07',1,'upgrade*2.99.7*99*upgrade2.99.7'),(47,'func*2.99.7*1*normaliseDocuments','Normalise the documents table','2006-01-20 17:04:07',1,'upgrade*2.99.7*99*upgrade2.99.7'),(48,'sql*2.99.7*10*2.99.7/10-documents_normalisation.sql','Database upgrade to version 2.99.7: Documents normalisation','2006-01-20 17:04:07',1,'upgrade*2.99.7*99*upgrade2.99.7'),(49,'sql*2.99.7*20*2.99.7/20-fields.sql','Database upgrade to version 2.99.7: Fields','2006-01-20 17:04:07',1,'upgrade*2.99.7*99*upgrade2.99.7'),(50,'upgrade*2.99.7*99*upgrade2.99.7','Upgrade from version 2.99.5 to 2.99.7','2006-01-20 17:04:07',1,'upgrade*2.99.7*99*upgrade2.99.7'),(51,'sql*2.99.7*0*2.99.7/discussion.sql','','0000-00-00 00:00:00',1,NULL),(52,'func*2.99.7*-1*applyDiscussionUpgrade','func upgrade to version 2.99.7 phase -1','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(53,'sql*2.99.8*0*2.99.8/mime_types.sql','Database upgrade to version 2.99.8: Mime types','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(54,'sql*2.99.8*0*2.99.8/category-correction.sql','Database upgrade to version 2.99.8: Category-correction','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(55,'sql*2.99.8*0*2.99.8/trigger_selection.sql','Database upgrade to version 2.99.8: Trigger selection','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(56,'sql*2.99.8*0*2.99.8/units.sql','Database upgrade to version 2.99.8: Units','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(57,'sql*2.99.8*0*2.99.8/type_workflow_map.sql','Database upgrade to version 2.99.8: Type workflow map','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(58,'sql*2.99.8*0*2.99.8/disabled_documenttypes.sql','Database upgrade to version 2.99.8: Disabled documenttypes','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(59,'func*2.99.8*1*fixUnits','func upgrade to version 2.99.8 phase 1','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(60,'sql*2.99.8*10*2.99.8/10-units.sql','Database upgrade to version 2.99.8: Units','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(61,'sql*2.99.8*15*2.99.8/15-status.sql','Database upgrade to version 2.99.8: Status','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(62,'sql*2.99.8*20*2.99.8/20-state_permission_assignments.sql','Database upgrade to version 2.99.8: State permission assignments','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(63,'sql*2.99.8*25*2.99.8/25-authentication_details.sql','Database upgrade to version 2.99.8: Authentication details','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(64,'upgrade*2.99.8*99*upgrade2.99.8','Upgrade from version 2.99.7 to 2.99.8','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(65,'func*2.99.9*0*createSecurityDeletePermissions','Create the Core: Manage Security and Core: Delete permissions','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(66,'func*2.99.9*0*createLdapAuthenticationProvider','Create an LDAP authentication source based on your KT2 LDAP settings (must keep copy of config/environment.php to work)','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(67,'sql*2.99.9*0*2.99.9/mimetype-friendly.sql','Database upgrade to version 2.99.9: Mimetype-friendly','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(68,'sql*2.99.9*5*2.99.9/5-opendocument-mime-types.sql','Database upgrade to version 2.99.9: Opendocument-mime-types','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(69,'sql*3.0*0*3.0/zipfile-mimetype.sql','Database upgrade to version 3.0: Zipfile-mimetype','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(70,'upgrade*3.0*99*upgrade3.0','Upgrade from version 2.99.8 to 3.0','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(71,'sql*3.0.1.1*0*3.0.1.1/document_role_allocations.sql','Database upgrade to version 3.0.1.1: Document role allocations','2006-03-28 11:22:19',1,'upgrade*3.0.1.1*99*upgrade3.0.1.1'),(72,'upgrade*3.0.1.1*99*upgrade3.0.1.1','Upgrade from version 3.0 to 3.0.1.1','2006-03-28 11:22:19',1,'upgrade*3.0.1.1*99*upgrade3.0.1.1'),(73,'sql*3.0.1.2*0*3.0.1.2/user_more_authentication_details.sql','Database upgrade to version 3.0.1.2: User more authentication details','2006-04-07 16:50:28',1,'upgrade*3.0.1.2*99*upgrade3.0.1.2'),(74,'upgrade*3.0.1.2*99*upgrade3.0.1.2','Upgrade from version 3.0.1.1 to 3.0.1.2','2006-04-07 16:50:28',1,'upgrade*3.0.1.2*99*upgrade3.0.1.2'),(75,'sql*3.0.1.2*0*3.0.1.2/owner_role_move.sql','Database upgrade to version 3.0.1.2: Owner role move','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(76,'func*3.0.1.3*0*addTransactionTypes3013','Add new folder transaction types','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(77,'sql*3.0.1.3*0*3.0.1.3/user_history.sql','Database upgrade to version 3.0.1.3: User history','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(78,'sql*3.0.1.3*0*3.0.1.3/folder_transactions.sql','Database upgrade to version 3.0.1.3: Folder transactions','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(79,'sql*3.0.1.3*0*3.0.1.3/plugin-unavailable.sql','Database upgrade to version 3.0.1.3: Plugin-unavailable','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(80,'func*3.0.1.4*0*createWorkflowPermission','Create the Core: Manage Workflow','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(81,'upgrade*3.0.1.4*99*upgrade3.0.1.4','Upgrade from version 3.0.1.2 to 3.0.1.4','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(82,'sql*3.0.1.5*0*3.0.1.5/anonymous-user.sql','Database upgrade to version 3.0.1.5: Anonymous-user','2006-04-18 12:38:41',1,'upgrade*3.0.1.5*99*upgrade3.0.1.5'),(83,'upgrade*3.0.1.5*99*upgrade3.0.1.5','Upgrade from version 3.0.1.4 to 3.0.1.5','2006-04-18 12:38:41',1,'upgrade*3.0.1.5*99*upgrade3.0.1.5'),(84,'sql*3.0.1.6*0*3.0.1.6/workflow-into-metadata.sql','Database upgrade to version 3.0.1.6: Workflow-into-metadata','2006-04-20 14:22:24',1,'upgrade*3.0.1.6*99*upgrade3.0.1.6'),(85,'upgrade*3.0.1.6*99*upgrade3.0.1.6','Upgrade from version 3.0.1.5 to 3.0.1.6','2006-04-20 14:22:24',1,'upgrade*3.0.1.6*99*upgrade3.0.1.6'),(86,'sql*3.0.1.7*0*3.0.1.7/session_id.sql','Database upgrade to version 3.0.1.7: Session id','2006-04-20 17:03:55',1,'upgrade*3.0.1.7*99*upgrade3.0.1.7'),(87,'upgrade*3.0.1.7*99*upgrade3.0.1.7','Upgrade from version 3.0.1.6 to 3.0.1.7','2006-04-20 17:03:56',1,'upgrade*3.0.1.7*99*upgrade3.0.1.7'),(88,'sql*3.0.1.8*0*3.0.1.8/friendly-plugins.sql','Database upgrade to version 3.0.1.8: Friendly-plugins','2006-04-23 12:54:12',1,'upgrade*3.0.1.8*99*upgrade3.0.1.8'),(89,'sql*3.0.1.8*0*3.0.1.8/longer-text.sql','Database upgrade to version 3.0.1.8: Longer-text','2006-04-23 12:54:12',1,'upgrade*3.0.1.8*99*upgrade3.0.1.8'),(90,'sql*3.0.1.8*0*3.0.1.8/admin-mode-logging.sql','Database upgrade to version 3.0.1.8: Admin-mode-logging','2006-04-23 12:54:12',1,'upgrade*3.0.1.8*99*upgrade3.0.1.8'),(91,'upgrade*3.0.1.8*99*upgrade3.0.1.8','Upgrade from version 3.0.1.7 to 3.0.1.8','2006-04-23 12:54:12',1,'upgrade*3.0.1.8*99*upgrade3.0.1.8'),(92,'upgrade*3.0.2*99*upgrade3.0.2','Upgrade from version 3.0.1.8 to 3.0.2','2006-05-02 10:08:13',1,'upgrade*3.0.2*99*upgrade3.0.2'),(93,'sql*3.0.2.1*0*3.0.2.1/disclaimer-help-files.sql','Database upgrade to version 3.0.2.1: Disclaimer-help-files','2006-05-25 16:04:23',1,'upgrade*3.0.2.2*99*upgrade3.0.2.2'),(94,'sql*3.0.2.2*0*3.0.2.2/folder_search.sql','Database upgrade to version 3.0.2.2: Folder search','2006-05-25 16:04:23',1,'upgrade*3.0.2.2*99*upgrade3.0.2.2'),(95,'upgrade*3.0.2.2*99*upgrade3.0.2.2','Upgrade from version 3.0.2 to 3.0.2.2','2006-05-25 16:04:24',1,'upgrade*3.0.2.2*99*upgrade3.0.2.2'),(96,'sql*3.0.2.3*0*3.0.2.3/msi-filetype.sql','Database upgrade to version 3.0.2.3: Msi-filetype','2006-05-30 10:55:58',1,'upgrade*3.0.2.4*99*upgrade3.0.2.4'),(97,'sql*3.0.2.4*0*3.0.2.4/discussion-fulltext.sql','Database upgrade to version 3.0.2.4: Discussion-fulltext','2006-05-30 10:55:59',1,'upgrade*3.0.2.4*99*upgrade3.0.2.4'),(98,'upgrade*3.0.2.4*99*upgrade3.0.2.4','Upgrade from version 3.0.2.2 to 3.0.2.4','2006-05-30 10:55:59',1,'upgrade*3.0.2.4*99*upgrade3.0.2.4'),(99,'upgrade*3.0.3*99*upgrade3.0.3','Upgrade from version 3.0.2.4 to 3.0.3','2006-05-31 13:02:04',1,'upgrade*3.0.3*99*upgrade3.0.3'),(100,'sql*3.0.3.1*0*3.0.3.1/utf8.sql','Database upgrade to version 3.0.3.1: Utf8','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(101,'sql*3.0.3.1*0*3.0.3.1/document_immutable.sql','Database upgrade to version 3.0.3.1: Document immutable','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(102,'sql*3.0.3.1*0*3.0.3.1/workflow-triggers.sql','Database upgrade to version 3.0.3.1: Workflow-triggers','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(103,'func*3.0.3.2*0*createFolderDetailsPermission','Create the Core: Folder Details permission','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(104,'func*3.0.3.3*0*generateWorkflowTriggers','Migrate old in-transition guards to triggers','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(105,'sql*3.0.3.4*0*3.0.3.4/column_entries.sql','Database upgrade to version 3.0.3.4: Column entries','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(106,'sql*3.0.3.4*0*3.0.3.4/bulk_export_transaction.sql','Database upgrade to version 3.0.3.4: Bulk export transaction','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(107,'upgrade*3.0.3.4*99*upgrade3.0.3.4','Upgrade from version 3.0.3 to 3.0.3.4','2006-07-12 12:00:34',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(108,'sql*3.0.3.5*0*3.0.3.5/notifications_data_text.sql','Database upgrade to version 3.0.3.5: Notifications data text','2006-07-14 15:26:49',1,'upgrade*3.0.3.5*99*upgrade3.0.3.5'),(109,'upgrade*3.0.3.5*99*upgrade3.0.3.5','Upgrade from version 3.0.3.4 to 3.0.3.5','2006-07-14 15:26:49',1,'upgrade*3.0.3.5*99*upgrade3.0.3.5'),(110,'sql*3.0.3.6*0*3.0.3.6/document-restore.sql','Database upgrade to version 3.0.3.6: Document-restore','2006-07-26 11:48:28',1,'upgrade*3.0.3.7*99*upgrade3.0.3.7'),(111,'func*3.0.3.7*0*rebuildAllPermissions','Rebuild all permissions to ensure correct functioning of permission-definitions.','2006-07-26 11:48:28',1,'upgrade*3.0.3.7*99*upgrade3.0.3.7'),(112,'upgrade*3.0.3.7*99*upgrade3.0.3.7','Upgrade from version 3.0.3.5 to 3.0.3.7','2006-07-26 11:48:28',1,'upgrade*3.0.3.7*99*upgrade3.0.3.7'),(113,'upgrade*3.1*99*upgrade3.1','Upgrade from version 3.0.3.7 to 3.1','2006-07-31 10:41:12',1,'upgrade*3.1*99*upgrade3.1'),(114,'sql*3.1.1*0*3.1.1/parentless-documents.sql','Database upgrade to version 3.1.1: Parentless-documents','2006-08-15 11:58:07',1,'upgrade*3.1.1*99*upgrade3.1.1'),(115,'upgrade*3.1.1*99*upgrade3.1.1','Upgrade from version 3.1 to 3.1.1','2006-08-15 11:58:07',1,'upgrade*3.1.1*99*upgrade3.1.1'),(116,'sql*3.1.2*0*3.1.2/user-disable.sql','Database upgrade to version 3.1.2: User-disable','2006-09-08 17:08:26',1,'upgrade*3.1.2*99*upgrade3.1.2'),(117,'upgrade*3.1.2*99*upgrade3.1.2','Upgrade from version 3.1.1 to 3.1.2','2006-09-08 17:08:26',1,'upgrade*3.1.2*99*upgrade3.1.2'),(118,'func*3.1.5*0*upgradeSavedSearches','Upgrade saved searches to use namespaces instead of integer ids','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(119,'sql*3.1.6*0*3.1.6/interceptor_instances.sql','Database upgrade to version 3.1.6: Interceptor instances','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(120,'sql*3.1.6*0*3.1.6/workflow-sanity.sql','Database upgrade to version 3.1.6: Workflow-sanity','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(121,'sql*3.1.6.2*0*3.1.6.2/workflow_state_disabled_actions.sql','Database upgrade to version 3.1.6.2: Workflow state disabled actions','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(122,'sql*3.1.6.2*0*3.1.6.2/folder_owner_role.sql','Database upgrade to version 3.1.6.2: Folder owner role','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(123,'func*3.1.6.3*0*cleanupGroupMembership','Cleanup any old references to missing groups, etc.','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(124,'sql*3.1.6.3*0*3.1.6.3/groups-integrity.sql','Database upgrade to version 3.1.6.3: Groups-integrity','2006-10-17 12:09:46',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(125,'sql*3.1.6.5*0*3.1.6.5/workflow-state-referencefixes.sql','Database upgrade to version 3.1.6.5: Workflow-state-referencefixes','2006-10-17 12:09:46',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(126,'sql*3.1.6.6*0*3.1.6.6/copy_transaction.sql','Database upgrade to version 3.1.6.6: Copy transaction','2006-10-17 12:09:46',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(127,'sql*3.1.6.7*0*3.1.6.7/sane-names-for-stuff.sql','Database upgrade to version 3.1.6.7: Sane-names-for-stuff','2006-10-17 12:09:46',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(128,'upgrade*3.1.6.7*99*upgrade3.1.6.7','Upgrade from version 3.1.2 to 3.1.6.7','2006-10-17 12:09:46',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(129,'sql*3.3.0.1*0*3.3.0.1/system-settings-to-text.sql','Database upgrade to version 3.3.0.1: System-settings-to-text','2007-01-28 23:49:52',1,'upgrade*3.3.1*99*upgrade3.3.1'),(130,'upgrade*3.3.0.1*99*upgrade3.3.0.1','Upgrade from version 3.1.6.7 to 3.3.0.1','2006-10-30 12:49:33',1,'upgrade*3.3.0.1*99*upgrade3.3.0.1'),(131,'sql*3.3.1*0*3.3.1/rss.sql','Database upgrade to version 3.3.1: Rss','2007-01-28 23:49:52',1,'upgrade*3.3.1*99*upgrade3.3.1'),(132,'upgrade*3.3.1*99*upgrade3.3.1','Upgrade from version 3.3.0.1 to 3.3.1','2007-01-28 23:49:52',1,'upgrade*3.3.1*99*upgrade3.3.1'),(133,'sql*3.3.2*0*3.3.2/tagclouds.sql','Database upgrade to version 3.3.2: Tagclouds','2007-02-23 11:55:09',1,'upgrade*3.3.2*99*upgrade3.3.2'),(134,'upgrade*3.3.2*99*upgrade3.3.2','Upgrade from version 3.3.1 to 3.3.2','2007-02-23 11:55:09',1,'upgrade*3.3.2*99*upgrade3.3.2'),(135,'sql*3.4.0*0*3.4.0/upload_download.sql','Upgrade to version 3.4.0: Upload download','2007-04-17 00:00:00',1,'upgrade*3.4.0*99*upgrade3.4.0'),(136,'upgrade*3.4.0*99*upgrade3.4.0','Upgrade from version 3.3.2 to 3.4.0','2007-04-17 00:00:00',1,'upgrade*3.4.0*99*upgrade3.4.0'),(137,'sql*3.5.0*0*3.5.0/admin_version_path_update.sql','Update Admin Version Plugin Path','2007-08-28 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(138,'sql*3.5.0*0*3.5.0/saved_searches.sql','Database upgrade to version 3.5.0: Saved searches','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(139,'sql*3.5.0*0*3.5.0/index_files.sql','Database upgrade to version 3.5.0: Index files','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(140,'sql*3.5.0*0*3.5.0/search_ranking.sql','Database upgrade to version 3.5.0: Search ranking','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(141,'sql*3.5.0*0*3.5.0/scheduler_tables.sql','Database upgrade to version 3.5.0: Scheduler tables','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(142,'sql*3.5.0*0*3.5.0/document_checkout.sql','Database upgrade to version 3.5.0: Document checkout','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(143,'sql*3.5.0*0*3.5.0/mime_types.sql','Database upgrade to version 3.5.0: Mime types','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(144,'func*3.5.0*0*cleanupOldKTAdminVersionNotifier','Cleanup any old files from the old KTAdminVersionNotifier','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(145,'upgrade*3.5.0*99*upgrade3.5.0','Upgrade from version 3.4.0 to 3.5.0','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'); +INSERT INTO `upgrades` VALUES (1,'sql*2.0.6*0*2.0.6/create_upgrade_table.sql','Database upgrade to version 2.0.6: Create upgrade table','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(2,'upgrade*2.0.6*0*upgrade2.0.6','Upgrade from version 2.0.2 to 2.0.6','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(3,'func*2.0.6*0*addTemplateMimeTypes','Add MIME types for Excel and Word templates','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(4,'sql*2.0.6*0*2.0.6/add_email_attachment_transaction_type.sql','Database upgrade to version 2.0.6: Add email attachment transaction type','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(5,'sql*2.0.6*0*2.0.6/create_link_type_table.sql','Database upgrade to version 2.0.6: Create link type table','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(6,'sql*2.0.6*1*2.0.6/1-update_database_version.sql','Database upgrade to version 2.0.6: Update database version','2005-06-16 00:30:06',1,'upgrade*2.0.6*0*upgrade2.0.6'),(7,'upgrade*2.0.7*0*upgrade2.0.7','Upgrade from version 2.0.7 to 2.0.7','2005-07-21 22:35:15',1,'upgrade*2.0.7*0*upgrade2.0.7'),(8,'sql*2.0.7*0*2.0.7/document_link_update.sql','Database upgrade to version 2.0.7: Document link update','2005-07-21 22:35:16',1,'upgrade*2.0.7*0*upgrade2.0.7'),(9,'sql*2.0.8*0*2.0.8/nestedgroups.sql','Database upgrade to version 2.0.8: Nestedgroups','2005-08-02 16:02:06',1,'upgrade*2.0.8*0*upgrade2.0.8'),(10,'sql*2.0.8*0*2.0.8/help_replacement.sql','Database upgrade to version 2.0.8: Help replacement','2005-08-02 16:02:06',1,'upgrade*2.0.8*0*upgrade2.0.8'),(11,'upgrade*2.0.8*0*upgrade2.0.8','Upgrade from version 2.0.7 to 2.0.8','2005-08-02 16:02:06',1,'upgrade*2.0.8*0*upgrade2.0.8'),(12,'sql*2.0.8*0*2.0.8/permissions.sql','Database upgrade to version 2.0.8: Permissions','2005-08-02 16:02:07',1,'upgrade*2.0.8*0*upgrade2.0.8'),(13,'func*2.0.8*1*setPermissionObject','Set the permission object in charge of a document or folder','2005-08-02 16:02:07',1,'upgrade*2.0.8*0*upgrade2.0.8'),(14,'sql*2.0.8*1*2.0.8/1-metadata_versions.sql','Database upgrade to version 2.0.8: Metadata versions','2005-08-02 16:02:07',1,'upgrade*2.0.8*0*upgrade2.0.8'),(15,'sql*2.0.8*2*2.0.8/2-permissions.sql','Database upgrade to version 2.0.8: Permissions','2005-08-02 16:02:07',1,'upgrade*2.0.8*0*upgrade2.0.8'),(16,'sql*2.0.9*0*2.0.9/storagemanager.sql','','0000-00-00 00:00:00',1,NULL),(17,'sql*2.0.9*0*2.0.9/metadata_tree.sql','','0000-00-00 00:00:00',1,NULL),(18,'sql*2.0.9*0*2.0.9/document_incomplete.sql','','0000-00-00 00:00:00',1,NULL),(20,'upgrade*2.99.1*0*upgrade2.99.1','Upgrade from version 2.0.8 to 2.99.1','2005-10-07 14:26:15',1,'upgrade*2.99.1*0*upgrade2.99.1'),(21,'sql*2.99.1*0*2.99.1/workflow.sql','Database upgrade to version 2.99.1: Workflow','2005-10-07 14:26:15',1,'upgrade*2.99.1*0*upgrade2.99.1'),(22,'sql*2.99.1*0*2.99.1/fieldsets.sql','Database upgrade to version 2.99.1: Fieldsets','2005-10-07 14:26:16',1,'upgrade*2.99.1*0*upgrade2.99.1'),(23,'func*2.99.1*1*createFieldSets','Create a fieldset for each field without one','2005-10-07 14:26:16',1,'upgrade*2.99.1*0*upgrade2.99.1'),(24,'sql*2.99.2*0*2.99.2/saved_searches.sql','','0000-00-00 00:00:00',1,NULL),(25,'sql*2.99.2*0*2.99.2/transactions.sql','','0000-00-00 00:00:00',1,NULL),(26,'sql*2.99.2*0*2.99.2/field_mandatory.sql','','0000-00-00 00:00:00',1,NULL),(27,'sql*2.99.2*0*2.99.2/fieldsets_system.sql','','0000-00-00 00:00:00',1,NULL),(28,'sql*2.99.2*0*2.99.2/permission_by_user_and_roles.sql','','0000-00-00 00:00:00',1,NULL),(29,'sql*2.99.2*0*2.99.2/disabled_metadata.sql','','0000-00-00 00:00:00',1,NULL),(30,'sql*2.99.2*0*2.99.2/searchable_text.sql','','0000-00-00 00:00:00',1,NULL),(31,'sql*2.99.2*0*2.99.2/workflow.sql','','0000-00-00 00:00:00',1,NULL),(32,'sql*2.99.2*1*2.99.2/1-constraints.sql','','0000-00-00 00:00:00',1,NULL),(33,'sql*2.99.3*0*2.99.3/notifications.sql','','0000-00-00 00:00:00',1,NULL),(34,'sql*2.99.3*0*2.99.3/last_modified_user.sql','','0000-00-00 00:00:00',1,NULL),(35,'sql*2.99.3*0*2.99.3/authentication_sources.sql','','0000-00-00 00:00:00',1,NULL),(36,'sql*2.99.3*0*2.99.3/document_fields_constraints.sql','','0000-00-00 00:00:00',1,NULL),(37,'sql*2.99.5*0*2.99.5/dashlet_disabling.sql','','0000-00-00 00:00:00',1,NULL),(38,'sql*2.99.5*0*2.99.5/role_allocations.sql','','0000-00-00 00:00:00',1,NULL),(39,'sql*2.99.5*0*2.99.5/transaction_namespaces.sql','','0000-00-00 00:00:00',1,NULL),(40,'sql*2.99.5*0*2.99.5/fieldset_field_descriptions.sql','','0000-00-00 00:00:00',1,NULL),(41,'sql*2.99.5*0*2.99.5/role_changes.sql','','0000-00-00 00:00:00',1,NULL),(42,'sql*2.99.6*0*2.99.6/table_cleanup.sql','Database upgrade to version 2.99.6: Table cleanup','2006-01-20 17:04:05',1,'upgrade*2.99.7*99*upgrade2.99.7'),(43,'sql*2.99.6*0*2.99.6/plugin-registration.sql','Database upgrade to version 2.99.6: Plugin-registration','2006-01-20 17:04:05',1,'upgrade*2.99.7*99*upgrade2.99.7'),(44,'sql*2.99.7*0*2.99.7/documents_normalisation.sql','Database upgrade to version 2.99.7: Documents normalisation','2006-01-20 17:04:05',1,'upgrade*2.99.7*99*upgrade2.99.7'),(45,'sql*2.99.7*0*2.99.7/help_replacement.sql','Database upgrade to version 2.99.7: Help replacement','2006-01-20 17:04:05',1,'upgrade*2.99.7*99*upgrade2.99.7'),(46,'sql*2.99.7*0*2.99.7/table_cleanup.sql','Database upgrade to version 2.99.7: Table cleanup','2006-01-20 17:04:07',1,'upgrade*2.99.7*99*upgrade2.99.7'),(47,'func*2.99.7*1*normaliseDocuments','Normalise the documents table','2006-01-20 17:04:07',1,'upgrade*2.99.7*99*upgrade2.99.7'),(48,'sql*2.99.7*10*2.99.7/10-documents_normalisation.sql','Database upgrade to version 2.99.7: Documents normalisation','2006-01-20 17:04:07',1,'upgrade*2.99.7*99*upgrade2.99.7'),(49,'sql*2.99.7*20*2.99.7/20-fields.sql','Database upgrade to version 2.99.7: Fields','2006-01-20 17:04:07',1,'upgrade*2.99.7*99*upgrade2.99.7'),(50,'upgrade*2.99.7*99*upgrade2.99.7','Upgrade from version 2.99.5 to 2.99.7','2006-01-20 17:04:07',1,'upgrade*2.99.7*99*upgrade2.99.7'),(51,'sql*2.99.7*0*2.99.7/discussion.sql','','0000-00-00 00:00:00',1,NULL),(52,'func*2.99.7*-1*applyDiscussionUpgrade','func upgrade to version 2.99.7 phase -1','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(53,'sql*2.99.8*0*2.99.8/mime_types.sql','Database upgrade to version 2.99.8: Mime types','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(54,'sql*2.99.8*0*2.99.8/category-correction.sql','Database upgrade to version 2.99.8: Category-correction','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(55,'sql*2.99.8*0*2.99.8/trigger_selection.sql','Database upgrade to version 2.99.8: Trigger selection','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(56,'sql*2.99.8*0*2.99.8/units.sql','Database upgrade to version 2.99.8: Units','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(57,'sql*2.99.8*0*2.99.8/type_workflow_map.sql','Database upgrade to version 2.99.8: Type workflow map','2006-02-06 12:23:41',1,'upgrade*2.99.8*99*upgrade2.99.8'),(58,'sql*2.99.8*0*2.99.8/disabled_documenttypes.sql','Database upgrade to version 2.99.8: Disabled documenttypes','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(59,'func*2.99.8*1*fixUnits','func upgrade to version 2.99.8 phase 1','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(60,'sql*2.99.8*10*2.99.8/10-units.sql','Database upgrade to version 2.99.8: Units','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(61,'sql*2.99.8*15*2.99.8/15-status.sql','Database upgrade to version 2.99.8: Status','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(62,'sql*2.99.8*20*2.99.8/20-state_permission_assignments.sql','Database upgrade to version 2.99.8: State permission assignments','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(63,'sql*2.99.8*25*2.99.8/25-authentication_details.sql','Database upgrade to version 2.99.8: Authentication details','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(64,'upgrade*2.99.8*99*upgrade2.99.8','Upgrade from version 2.99.7 to 2.99.8','2006-02-06 12:23:42',1,'upgrade*2.99.8*99*upgrade2.99.8'),(65,'func*2.99.9*0*createSecurityDeletePermissions','Create the Core: Manage Security and Core: Delete permissions','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(66,'func*2.99.9*0*createLdapAuthenticationProvider','Create an LDAP authentication source based on your KT2 LDAP settings (must keep copy of config/environment.php to work)','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(67,'sql*2.99.9*0*2.99.9/mimetype-friendly.sql','Database upgrade to version 2.99.9: Mimetype-friendly','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(68,'sql*2.99.9*5*2.99.9/5-opendocument-mime-types.sql','Database upgrade to version 2.99.9: Opendocument-mime-types','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(69,'sql*3.0*0*3.0/zipfile-mimetype.sql','Database upgrade to version 3.0: Zipfile-mimetype','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(70,'upgrade*3.0*99*upgrade3.0','Upgrade from version 2.99.8 to 3.0','2006-02-28 09:23:21',1,'upgrade*3.0*99*upgrade3.0'),(71,'sql*3.0.1.1*0*3.0.1.1/document_role_allocations.sql','Database upgrade to version 3.0.1.1: Document role allocations','2006-03-28 11:22:19',1,'upgrade*3.0.1.1*99*upgrade3.0.1.1'),(72,'upgrade*3.0.1.1*99*upgrade3.0.1.1','Upgrade from version 3.0 to 3.0.1.1','2006-03-28 11:22:19',1,'upgrade*3.0.1.1*99*upgrade3.0.1.1'),(73,'sql*3.0.1.2*0*3.0.1.2/user_more_authentication_details.sql','Database upgrade to version 3.0.1.2: User more authentication details','2006-04-07 16:50:28',1,'upgrade*3.0.1.2*99*upgrade3.0.1.2'),(74,'upgrade*3.0.1.2*99*upgrade3.0.1.2','Upgrade from version 3.0.1.1 to 3.0.1.2','2006-04-07 16:50:28',1,'upgrade*3.0.1.2*99*upgrade3.0.1.2'),(75,'sql*3.0.1.2*0*3.0.1.2/owner_role_move.sql','Database upgrade to version 3.0.1.2: Owner role move','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(76,'func*3.0.1.3*0*addTransactionTypes3013','Add new folder transaction types','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(77,'sql*3.0.1.3*0*3.0.1.3/user_history.sql','Database upgrade to version 3.0.1.3: User history','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(78,'sql*3.0.1.3*0*3.0.1.3/folder_transactions.sql','Database upgrade to version 3.0.1.3: Folder transactions','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(79,'sql*3.0.1.3*0*3.0.1.3/plugin-unavailable.sql','Database upgrade to version 3.0.1.3: Plugin-unavailable','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(80,'func*3.0.1.4*0*createWorkflowPermission','Create the Core: Manage Workflow','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(81,'upgrade*3.0.1.4*99*upgrade3.0.1.4','Upgrade from version 3.0.1.2 to 3.0.1.4','2006-04-18 11:06:34',1,'upgrade*3.0.1.4*99*upgrade3.0.1.4'),(82,'sql*3.0.1.5*0*3.0.1.5/anonymous-user.sql','Database upgrade to version 3.0.1.5: Anonymous-user','2006-04-18 12:38:41',1,'upgrade*3.0.1.5*99*upgrade3.0.1.5'),(83,'upgrade*3.0.1.5*99*upgrade3.0.1.5','Upgrade from version 3.0.1.4 to 3.0.1.5','2006-04-18 12:38:41',1,'upgrade*3.0.1.5*99*upgrade3.0.1.5'),(84,'sql*3.0.1.6*0*3.0.1.6/workflow-into-metadata.sql','Database upgrade to version 3.0.1.6: Workflow-into-metadata','2006-04-20 14:22:24',1,'upgrade*3.0.1.6*99*upgrade3.0.1.6'),(85,'upgrade*3.0.1.6*99*upgrade3.0.1.6','Upgrade from version 3.0.1.5 to 3.0.1.6','2006-04-20 14:22:24',1,'upgrade*3.0.1.6*99*upgrade3.0.1.6'),(86,'sql*3.0.1.7*0*3.0.1.7/session_id.sql','Database upgrade to version 3.0.1.7: Session id','2006-04-20 17:03:55',1,'upgrade*3.0.1.7*99*upgrade3.0.1.7'),(87,'upgrade*3.0.1.7*99*upgrade3.0.1.7','Upgrade from version 3.0.1.6 to 3.0.1.7','2006-04-20 17:03:56',1,'upgrade*3.0.1.7*99*upgrade3.0.1.7'),(88,'sql*3.0.1.8*0*3.0.1.8/friendly-plugins.sql','Database upgrade to version 3.0.1.8: Friendly-plugins','2006-04-23 12:54:12',1,'upgrade*3.0.1.8*99*upgrade3.0.1.8'),(89,'sql*3.0.1.8*0*3.0.1.8/longer-text.sql','Database upgrade to version 3.0.1.8: Longer-text','2006-04-23 12:54:12',1,'upgrade*3.0.1.8*99*upgrade3.0.1.8'),(90,'sql*3.0.1.8*0*3.0.1.8/admin-mode-logging.sql','Database upgrade to version 3.0.1.8: Admin-mode-logging','2006-04-23 12:54:12',1,'upgrade*3.0.1.8*99*upgrade3.0.1.8'),(91,'upgrade*3.0.1.8*99*upgrade3.0.1.8','Upgrade from version 3.0.1.7 to 3.0.1.8','2006-04-23 12:54:12',1,'upgrade*3.0.1.8*99*upgrade3.0.1.8'),(92,'upgrade*3.0.2*99*upgrade3.0.2','Upgrade from version 3.0.1.8 to 3.0.2','2006-05-02 10:08:13',1,'upgrade*3.0.2*99*upgrade3.0.2'),(93,'sql*3.0.2.1*0*3.0.2.1/disclaimer-help-files.sql','Database upgrade to version 3.0.2.1: Disclaimer-help-files','2006-05-25 16:04:23',1,'upgrade*3.0.2.2*99*upgrade3.0.2.2'),(94,'sql*3.0.2.2*0*3.0.2.2/folder_search.sql','Database upgrade to version 3.0.2.2: Folder search','2006-05-25 16:04:23',1,'upgrade*3.0.2.2*99*upgrade3.0.2.2'),(95,'upgrade*3.0.2.2*99*upgrade3.0.2.2','Upgrade from version 3.0.2 to 3.0.2.2','2006-05-25 16:04:24',1,'upgrade*3.0.2.2*99*upgrade3.0.2.2'),(96,'sql*3.0.2.3*0*3.0.2.3/msi-filetype.sql','Database upgrade to version 3.0.2.3: Msi-filetype','2006-05-30 10:55:58',1,'upgrade*3.0.2.4*99*upgrade3.0.2.4'),(97,'sql*3.0.2.4*0*3.0.2.4/discussion-fulltext.sql','Database upgrade to version 3.0.2.4: Discussion-fulltext','2006-05-30 10:55:59',1,'upgrade*3.0.2.4*99*upgrade3.0.2.4'),(98,'upgrade*3.0.2.4*99*upgrade3.0.2.4','Upgrade from version 3.0.2.2 to 3.0.2.4','2006-05-30 10:55:59',1,'upgrade*3.0.2.4*99*upgrade3.0.2.4'),(99,'upgrade*3.0.3*99*upgrade3.0.3','Upgrade from version 3.0.2.4 to 3.0.3','2006-05-31 13:02:04',1,'upgrade*3.0.3*99*upgrade3.0.3'),(100,'sql*3.0.3.1*0*3.0.3.1/utf8.sql','Database upgrade to version 3.0.3.1: Utf8','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(101,'sql*3.0.3.1*0*3.0.3.1/document_immutable.sql','Database upgrade to version 3.0.3.1: Document immutable','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(102,'sql*3.0.3.1*0*3.0.3.1/workflow-triggers.sql','Database upgrade to version 3.0.3.1: Workflow-triggers','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(103,'func*3.0.3.2*0*createFolderDetailsPermission','Create the Core: Folder Details permission','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(104,'func*3.0.3.3*0*generateWorkflowTriggers','Migrate old in-transition guards to triggers','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(105,'sql*3.0.3.4*0*3.0.3.4/column_entries.sql','Database upgrade to version 3.0.3.4: Column entries','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(106,'sql*3.0.3.4*0*3.0.3.4/bulk_export_transaction.sql','Database upgrade to version 3.0.3.4: Bulk export transaction','2006-07-12 12:00:33',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(107,'upgrade*3.0.3.4*99*upgrade3.0.3.4','Upgrade from version 3.0.3 to 3.0.3.4','2006-07-12 12:00:34',1,'upgrade*3.0.3.4*99*upgrade3.0.3.4'),(108,'sql*3.0.3.5*0*3.0.3.5/notifications_data_text.sql','Database upgrade to version 3.0.3.5: Notifications data text','2006-07-14 15:26:49',1,'upgrade*3.0.3.5*99*upgrade3.0.3.5'),(109,'upgrade*3.0.3.5*99*upgrade3.0.3.5','Upgrade from version 3.0.3.4 to 3.0.3.5','2006-07-14 15:26:49',1,'upgrade*3.0.3.5*99*upgrade3.0.3.5'),(110,'sql*3.0.3.6*0*3.0.3.6/document-restore.sql','Database upgrade to version 3.0.3.6: Document-restore','2006-07-26 11:48:28',1,'upgrade*3.0.3.7*99*upgrade3.0.3.7'),(111,'func*3.0.3.7*0*rebuildAllPermissions','Rebuild all permissions to ensure correct functioning of permission-definitions.','2006-07-26 11:48:28',1,'upgrade*3.0.3.7*99*upgrade3.0.3.7'),(112,'upgrade*3.0.3.7*99*upgrade3.0.3.7','Upgrade from version 3.0.3.5 to 3.0.3.7','2006-07-26 11:48:28',1,'upgrade*3.0.3.7*99*upgrade3.0.3.7'),(113,'upgrade*3.1*99*upgrade3.1','Upgrade from version 3.0.3.7 to 3.1','2006-07-31 10:41:12',1,'upgrade*3.1*99*upgrade3.1'),(114,'sql*3.1.1*0*3.1.1/parentless-documents.sql','Database upgrade to version 3.1.1: Parentless-documents','2006-08-15 11:58:07',1,'upgrade*3.1.1*99*upgrade3.1.1'),(115,'upgrade*3.1.1*99*upgrade3.1.1','Upgrade from version 3.1 to 3.1.1','2006-08-15 11:58:07',1,'upgrade*3.1.1*99*upgrade3.1.1'),(116,'sql*3.1.2*0*3.1.2/user-disable.sql','Database upgrade to version 3.1.2: User-disable','2006-09-08 17:08:26',1,'upgrade*3.1.2*99*upgrade3.1.2'),(117,'upgrade*3.1.2*99*upgrade3.1.2','Upgrade from version 3.1.1 to 3.1.2','2006-09-08 17:08:26',1,'upgrade*3.1.2*99*upgrade3.1.2'),(118,'func*3.1.5*0*upgradeSavedSearches','Upgrade saved searches to use namespaces instead of integer ids','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(119,'sql*3.1.6*0*3.1.6/interceptor_instances.sql','Database upgrade to version 3.1.6: Interceptor instances','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(120,'sql*3.1.6*0*3.1.6/workflow-sanity.sql','Database upgrade to version 3.1.6: Workflow-sanity','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(121,'sql*3.1.6.2*0*3.1.6.2/workflow_state_disabled_actions.sql','Database upgrade to version 3.1.6.2: Workflow state disabled actions','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(122,'sql*3.1.6.2*0*3.1.6.2/folder_owner_role.sql','Database upgrade to version 3.1.6.2: Folder owner role','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(123,'func*3.1.6.3*0*cleanupGroupMembership','Cleanup any old references to missing groups, etc.','2006-10-17 12:09:45',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(124,'sql*3.1.6.3*0*3.1.6.3/groups-integrity.sql','Database upgrade to version 3.1.6.3: Groups-integrity','2006-10-17 12:09:46',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(125,'sql*3.1.6.5*0*3.1.6.5/workflow-state-referencefixes.sql','Database upgrade to version 3.1.6.5: Workflow-state-referencefixes','2006-10-17 12:09:46',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(126,'sql*3.1.6.6*0*3.1.6.6/copy_transaction.sql','Database upgrade to version 3.1.6.6: Copy transaction','2006-10-17 12:09:46',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(127,'sql*3.1.6.7*0*3.1.6.7/sane-names-for-stuff.sql','Database upgrade to version 3.1.6.7: Sane-names-for-stuff','2006-10-17 12:09:46',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(128,'upgrade*3.1.6.7*99*upgrade3.1.6.7','Upgrade from version 3.1.2 to 3.1.6.7','2006-10-17 12:09:46',1,'upgrade*3.1.6.7*99*upgrade3.1.6.7'),(129,'sql*3.3.0.1*0*3.3.0.1/system-settings-to-text.sql','Database upgrade to version 3.3.0.1: System-settings-to-text','2007-01-28 23:49:52',1,'upgrade*3.3.1*99*upgrade3.3.1'),(130,'upgrade*3.3.0.1*99*upgrade3.3.0.1','Upgrade from version 3.1.6.7 to 3.3.0.1','2006-10-30 12:49:33',1,'upgrade*3.3.0.1*99*upgrade3.3.0.1'),(131,'sql*3.3.1*0*3.3.1/rss.sql','Database upgrade to version 3.3.1: Rss','2007-01-28 23:49:52',1,'upgrade*3.3.1*99*upgrade3.3.1'),(132,'upgrade*3.3.1*99*upgrade3.3.1','Upgrade from version 3.3.0.1 to 3.3.1','2007-01-28 23:49:52',1,'upgrade*3.3.1*99*upgrade3.3.1'),(133,'sql*3.3.2*0*3.3.2/tagclouds.sql','Database upgrade to version 3.3.2: Tagclouds','2007-02-23 11:55:09',1,'upgrade*3.3.2*99*upgrade3.3.2'),(134,'upgrade*3.3.2*99*upgrade3.3.2','Upgrade from version 3.3.1 to 3.3.2','2007-02-23 11:55:09',1,'upgrade*3.3.2*99*upgrade3.3.2'),(135,'sql*3.4.0*0*3.4.0/upload_download.sql','Upgrade to version 3.4.0: Upload download','2007-04-17 00:00:00',1,'upgrade*3.4.0*99*upgrade3.4.0'),(136,'upgrade*3.4.0*99*upgrade3.4.0','Upgrade from version 3.3.2 to 3.4.0','2007-04-17 00:00:00',1,'upgrade*3.4.0*99*upgrade3.4.0'),(137,'sql*3.5.0*0*3.5.0/admin_version_path_update.sql','Update Admin Version Plugin Path','2007-08-28 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(138,'sql*3.5.0*0*3.5.0/saved_searches.sql','Database upgrade to version 3.5.0: Saved searches','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(139,'sql*3.5.0*0*3.5.0/index_files.sql','Database upgrade to version 3.5.0: Index files','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(140,'sql*3.5.0*0*3.5.0/search_ranking.sql','Database upgrade to version 3.5.0: Search ranking','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(141,'sql*3.5.0*0*3.5.0/scheduler_tables.sql','Database upgrade to version 3.5.0: Scheduler tables','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(142,'sql*3.5.0*0*3.5.0/document_checkout.sql','Database upgrade to version 3.5.0: Document checkout','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(143,'sql*3.5.0*0*3.5.0/mime_types.sql','Database upgrade to version 3.5.0: Mime types','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(144,'func*3.5.0*0*cleanupOldKTAdminVersionNotifier','Cleanup any old files from the old KTAdminVersionNotifier','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(145,'upgrade*3.5.0*99*upgrade3.5.0','Upgrade from version 3.4.0 to 3.5.0','2007-09-25 00:00:00',1,'upgrade*3.5.0*99*upgrade3.5.0'),(146,'sql*3.5.0*0*3.5.0/folder_descendants.sql','Database upgrade to version 3.5.0: Folder descendants','2007-10-11 17:41:32',1,'upgrade*3.5.0*99*upgrade3.5.0'),(147,'sql*3.5.0*0*3.5.0/relation_friendly.sql','Database upgrade to version 3.5.0: Relation friendly','2007-10-11 17:41:33',1,'upgrade*3.5.0*99*upgrade3.5.0'),(148,'sql*3.5.0*0*3.5.0/plugin_rss_engine.sql','Database upgrade to version 3.5.0: Plugin rss engine','2007-10-11 17:41:33',1,'upgrade*3.5.0*99*upgrade3.5.0'),(149,'sql*3.5.0*0*3.5.0/document_transaction_type.sql','Database upgrade to version 3.5.0: Document transaction type','2007-10-11 17:41:33',1,'upgrade*3.5.0*99*upgrade3.5.0'); /*!40000 ALTER TABLE `upgrades` ENABLE KEYS */; UNLOCK TABLES; @@ -1717,7 +1725,7 @@ UNLOCK TABLES; LOCK TABLES `zseq_upgrades` WRITE; /*!40000 ALTER TABLE `zseq_upgrades` DISABLE KEYS */; -INSERT INTO `zseq_upgrades` VALUES (145); +INSERT INTO `zseq_upgrades` VALUES (149); /*!40000 ALTER TABLE `zseq_upgrades` ENABLE KEYS */; UNLOCK TABLES; @@ -1816,4 +1824,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2007-09-25 21:55:43 +-- Dump completed on 2007-10-11 15:46:21 diff --git a/sql/mysql/install/dump.sh b/sql/mysql/install/dump.sh index df18d59..bc89ae6 100644 --- a/sql/mysql/install/dump.sh +++ b/sql/mysql/install/dump.sh @@ -8,10 +8,11 @@ case $1 in *) DB=$1 ;; esac +PATH=$PATH:../../../../mysql/bin:/usr/local/mysql/bin DATE=`date +%Y-%m-%d-%H-%M-%S` # Create the Structure Dump -../../../../mysql/bin/mysqldump -u root -p $DB --no-data --skip-add-drop-table > structure-$DATE.sql +mysqldump -u root -p $DB --no-data --skip-add-drop-table > structure-$DATE.sql # Create the Data Dump -../../../../mysql/bin/mysqldump -u root -p $DB --no-create-info > data-$DATE.sql +mysqldump -u root -p $DB --no-create-info > data-$DATE.sql diff --git a/sql/mysql/install/structure.sql b/sql/mysql/install/structure.sql index ff4e2f0..17100d7 100644 --- a/sql/mysql/install/structure.sql +++ b/sql/mysql/install/structure.sql @@ -30,7 +30,7 @@ -- -- Host: localhost Database: dms_clean -- ------------------------------------------------------ --- Server version 5.0.37 +-- Server version 5.0.41-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -53,8 +53,10 @@ CREATE TABLE `active_sessions` ( `session_id` char(255) default NULL, `lastused` datetime default NULL, `ip` char(30) default NULL, - UNIQUE KEY `id` (`id`), - KEY `session_id_idx` (`session_id`) + PRIMARY KEY (`id`), + KEY `user_id` (`user_id`), + KEY `session_id` (`session_id`), + CONSTRAINT `active_sessions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -67,7 +69,13 @@ CREATE TABLE `archive_restoration_request` ( `request_user_id` int(11) NOT NULL default '0', `admin_user_id` int(11) NOT NULL default '0', `datetime` datetime NOT NULL default '0000-00-00 00:00:00', - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `document_id` (`document_id`), + KEY `request_user_id` (`request_user_id`), + KEY `admin_user_id` (`admin_user_id`), + CONSTRAINT `archive_restoration_request_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `archive_restoration_request_ibfk_2` FOREIGN KEY (`request_user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `archive_restoration_request_ibfk_3` FOREIGN KEY (`admin_user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -80,7 +88,11 @@ CREATE TABLE `archiving_settings` ( `expiration_date` date default NULL, `document_transaction_id` int(11) default NULL, `time_period_id` int(11) default NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `archiving_type_id` (`archiving_type_id`), + KEY `time_period_id` (`time_period_id`), + CONSTRAINT `archiving_settings_ibfk_1` FOREIGN KEY (`archiving_type_id`) REFERENCES `archiving_type_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `archiving_settings_ibfk_2` FOREIGN KEY (`time_period_id`) REFERENCES `time_period` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -90,7 +102,7 @@ CREATE TABLE `archiving_settings` ( CREATE TABLE `archiving_type_lookup` ( `id` int(11) NOT NULL default '0', `name` char(100) default NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -132,8 +144,9 @@ CREATE TABLE `comment_searchable_text` ( `comment_id` int(11) NOT NULL default '0', `body` mediumtext, `document_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`comment_id`), - FULLTEXT KEY `comment_search_text` (`body`) + PRIMARY KEY (`comment_id`), + KEY `document_id` (`document_id`), + FULLTEXT KEY `body` (`body`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- @@ -144,9 +157,10 @@ CREATE TABLE `dashlet_disables` ( `id` int(11) NOT NULL default '0', `user_id` int(11) NOT NULL default '0', `dashlet_namespace` varchar(255) NOT NULL default '', - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), KEY `user_id` (`user_id`), - KEY `dashlet_namespace` (`dashlet_namespace`) + KEY `dashlet_namespace` (`dashlet_namespace`), + CONSTRAINT `dashlet_disables_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -156,7 +170,7 @@ CREATE TABLE `dashlet_disables` ( CREATE TABLE `data_types` ( `id` int(11) NOT NULL default '0', `name` char(255) NOT NULL default '', - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -171,7 +185,13 @@ CREATE TABLE `discussion_comments` ( `subject` mediumtext, `body` mediumtext, `date` datetime default NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `thread_id` (`thread_id`), + KEY `user_id` (`user_id`), + KEY `in_reply_to` (`in_reply_to`), + CONSTRAINT `discussion_comments_ibfk_1` FOREIGN KEY (`thread_id`) REFERENCES `discussion_threads` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `discussion_comments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `discussion_comments_ibfk_3` FOREIGN KEY (`in_reply_to`) REFERENCES `discussion_comments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -189,7 +209,15 @@ CREATE TABLE `discussion_threads` ( `close_reason` mediumtext NOT NULL, `close_metadata_version` int(11) NOT NULL default '0', `state` int(1) NOT NULL default '0', - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `document_id` (`document_id`), + KEY `first_comment_id` (`first_comment_id`), + KEY `last_comment_id` (`last_comment_id`), + KEY `creator_id` (`creator_id`), + CONSTRAINT `discussion_threads_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `discussion_threads_ibfk_2` FOREIGN KEY (`first_comment_id`) REFERENCES `discussion_comments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `discussion_threads_ibfk_3` FOREIGN KEY (`last_comment_id`) REFERENCES `discussion_comments` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `discussion_threads_ibfk_4` FOREIGN KEY (`creator_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -200,7 +228,11 @@ CREATE TABLE `document_archiving_link` ( `id` int(11) NOT NULL default '0', `document_id` int(11) NOT NULL default '0', `archiving_settings_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `document_id` (`document_id`), + KEY `archiving_settings_id` (`archiving_settings_id`), + CONSTRAINT `document_archiving_link_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_archiving_link_ibfk_2` FOREIGN KEY (`archiving_settings_id`) REFERENCES `archiving_settings` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -212,13 +244,16 @@ CREATE TABLE `document_content_version` ( `document_id` int(11) NOT NULL default '0', `filename` mediumtext NOT NULL, `size` bigint(20) NOT NULL default '0', - `mime_id` int(11) NOT NULL default '0', + `mime_id` int(11) default '9', `major_version` int(11) NOT NULL default '0', `minor_version` int(11) NOT NULL default '0', `storage_path` varchar(250) default NULL, - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), + KEY `document_id` (`document_id`), + KEY `mime_id` (`mime_id`), KEY `storage_path` (`storage_path`), - KEY `document_id` (`document_id`) + CONSTRAINT `document_content_version_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_content_version_ibfk_2` FOREIGN KEY (`mime_id`) REFERENCES `mime_types` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -235,9 +270,9 @@ CREATE TABLE `document_fields` ( `parent_fieldset` int(11) default NULL, `is_mandatory` tinyint(4) NOT NULL default '0', `description` mediumtext NOT NULL, - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), KEY `parent_fieldset` (`parent_fieldset`), - CONSTRAINT `document_fields_ibfk_1` FOREIGN KEY (`parent_fieldset`) REFERENCES `fieldsets` (`id`) ON DELETE CASCADE + CONSTRAINT `document_fields_ibfk_1` FOREIGN KEY (`parent_fieldset`) REFERENCES `fieldsets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -249,10 +284,11 @@ CREATE TABLE `document_fields_link` ( `document_field_id` int(11) NOT NULL default '0', `value` char(255) NOT NULL default '', `metadata_version_id` int(11) default NULL, - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), KEY `document_field_id` (`document_field_id`), KEY `metadata_version_id` (`metadata_version_id`), - CONSTRAINT `document_fields_link_ibfk_2` FOREIGN KEY (`document_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE + CONSTRAINT `document_fields_link_ibfk_1` FOREIGN KEY (`document_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_fields_link_ibfk_2` FOREIGN KEY (`metadata_version_id`) REFERENCES `document_metadata_version` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -275,7 +311,13 @@ CREATE TABLE `document_link` ( `parent_document_id` int(11) NOT NULL default '0', `child_document_id` int(11) NOT NULL default '0', `link_type_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `parent_document_id` (`parent_document_id`), + KEY `child_document_id` (`child_document_id`), + KEY `link_type_id` (`link_type_id`), + CONSTRAINT `document_link_ibfk_1` FOREIGN KEY (`parent_document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_link_ibfk_2` FOREIGN KEY (`child_document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_link_ibfk_3` FOREIGN KEY (`link_type_id`) REFERENCES `document_link_types` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -287,7 +329,7 @@ CREATE TABLE `document_link_types` ( `name` char(100) NOT NULL default '', `reverse_name` char(100) NOT NULL default '', `description` char(255) NOT NULL default '', - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -307,21 +349,22 @@ CREATE TABLE `document_metadata_version` ( `version_creator_id` int(11) NOT NULL default '0', `workflow_id` int(11) default NULL, `workflow_state_id` int(11) default NULL, - UNIQUE KEY `id` (`id`), - KEY `fk_document_type_id` (`document_type_id`), - KEY `fk_status_id` (`status_id`), + PRIMARY KEY (`id`), + KEY `document_type_id` (`document_type_id`), + KEY `status_id` (`status_id`), KEY `document_id` (`document_id`), - KEY `version_created` (`version_created`), KEY `version_creator_id` (`version_creator_id`), KEY `content_version_id` (`content_version_id`), KEY `workflow_id` (`workflow_id`), KEY `workflow_state_id` (`workflow_state_id`), - CONSTRAINT `document_metadata_version_ibfk_4` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE, - CONSTRAINT `document_metadata_version_ibfk_5` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`), - CONSTRAINT `document_metadata_version_ibfk_6` FOREIGN KEY (`status_id`) REFERENCES `status_lookup` (`id`), - CONSTRAINT `document_metadata_version_ibfk_7` FOREIGN KEY (`version_creator_id`) REFERENCES `users` (`id`), - CONSTRAINT `document_metadata_version_ibfk_8` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`), - CONSTRAINT `document_metadata_version_ibfk_9` FOREIGN KEY (`workflow_state_id`) REFERENCES `workflow_states` (`id`) + KEY `version_created` (`version_created`), + CONSTRAINT `document_metadata_version_ibfk_1` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_metadata_version_ibfk_2` FOREIGN KEY (`status_id`) REFERENCES `status_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_metadata_version_ibfk_3` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_metadata_version_ibfk_4` FOREIGN KEY (`version_creator_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_metadata_version_ibfk_5` FOREIGN KEY (`content_version_id`) REFERENCES `document_content_version` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_metadata_version_ibfk_6` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_metadata_version_ibfk_7` FOREIGN KEY (`workflow_state_id`) REFERENCES `workflow_states` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -333,8 +376,12 @@ CREATE TABLE `document_role_allocations` ( `document_id` int(11) NOT NULL default '0', `role_id` int(11) NOT NULL default '0', `permission_descriptor_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`), - KEY `document_id` (`document_id`) + PRIMARY KEY (`id`), + KEY `role_id` (`role_id`), + KEY `permission_descriptor_id` (`permission_descriptor_id`), + KEY `document_id_role_id` (`document_id`,`role_id`), + CONSTRAINT `document_role_allocations_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_role_allocations_ibfk_2` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -344,7 +391,7 @@ CREATE TABLE `document_role_allocations` ( CREATE TABLE `document_searchable_text` ( `document_id` int(11) default NULL, `document_text` longtext, - KEY `document_text_document_id_indx` (`document_id`), + KEY `document_id` (`document_id`), FULLTEXT KEY `document_text` (`document_text`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -357,7 +404,11 @@ CREATE TABLE `document_subscriptions` ( `user_id` int(11) NOT NULL default '0', `document_id` int(11) NOT NULL default '0', `is_alerted` tinyint(1) default NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `user_id` (`user_id`), + KEY `document_id` (`document_id`), + CONSTRAINT `document_subscriptions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_subscriptions_ibfk_2` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -368,9 +419,9 @@ CREATE TABLE `document_tags` ( `document_id` int(10) NOT NULL, `tag_id` int(10) NOT NULL, PRIMARY KEY (`document_id`,`tag_id`), - KEY `fk_document_tags_tag_id` (`tag_id`), - CONSTRAINT `fk_document_tags_document_id` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_document_tags_tag_id` FOREIGN KEY (`tag_id`) REFERENCES `tag_words` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + KEY `tag_id` (`tag_id`), + CONSTRAINT `document_tags_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `tag_words` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_tags_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -378,9 +429,9 @@ CREATE TABLE `document_tags` ( -- CREATE TABLE `document_text` ( - `document_id` int(11) default NULL, + `document_id` int(11) NOT NULL default '0', `document_text` longtext, - KEY `document_text_document_id_indx` (`document_id`), + PRIMARY KEY (`document_id`), FULLTEXT KEY `document_text` (`document_text`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -389,9 +440,9 @@ CREATE TABLE `document_text` ( -- CREATE TABLE `document_transaction_text` ( - `document_id` int(11) default NULL, + `document_id` int(11) NOT NULL default '0', `document_text` mediumtext, - KEY `document_text_document_id_indx` (`document_id`), + PRIMARY KEY (`document_id`), FULLTEXT KEY `document_text` (`document_text`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -403,8 +454,8 @@ CREATE TABLE `document_transaction_types_lookup` ( `id` int(11) NOT NULL default '0', `name` varchar(100) NOT NULL default '', `namespace` varchar(250) NOT NULL default '', - UNIQUE KEY `id` (`id`), - KEY `namespace` (`namespace`) + PRIMARY KEY (`id`), + UNIQUE KEY `namespace` (`namespace`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -413,9 +464,9 @@ CREATE TABLE `document_transaction_types_lookup` ( CREATE TABLE `document_transactions` ( `id` int(11) NOT NULL default '0', - `document_id` int(11) NOT NULL default '0', + `document_id` int(11) default NULL, `version` char(50) default NULL, - `user_id` int(11) NOT NULL default '0', + `user_id` int(11) default NULL, `datetime` datetime NOT NULL default '0000-00-00 00:00:00', `ip` char(30) default NULL, `filename` char(255) NOT NULL default '', @@ -423,10 +474,12 @@ CREATE TABLE `document_transactions` ( `transaction_namespace` char(255) NOT NULL default 'ktcore.transactions.event', `session_id` int(11) default NULL, `admin_mode` tinyint(1) NOT NULL default '0', - UNIQUE KEY `id` (`id`), - KEY `fk_document_id` (`document_id`), - KEY `fk_user_id` (`user_id`), - KEY `session_id` (`session_id`) + PRIMARY KEY (`id`), + KEY `document_id` (`document_id`), + KEY `user_id` (`user_id`), + KEY `session_id` (`session_id`), + CONSTRAINT `document_transactions_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE SET NULL ON UPDATE SET NULL, + CONSTRAINT `document_transactions_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -438,7 +491,11 @@ CREATE TABLE `document_type_fields_link` ( `document_type_id` int(11) NOT NULL default '0', `field_id` int(11) NOT NULL default '0', `is_mandatory` tinyint(1) NOT NULL default '0', - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `document_type_id` (`document_type_id`), + KEY `field_id` (`field_id`), + CONSTRAINT `document_type_fields_link_ibfk_1` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_type_fields_link_ibfk_2` FOREIGN KEY (`field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -449,11 +506,11 @@ CREATE TABLE `document_type_fieldsets_link` ( `id` int(11) NOT NULL default '0', `document_type_id` int(11) NOT NULL default '0', `fieldset_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), KEY `document_type_id` (`document_type_id`), KEY `fieldset_id` (`fieldset_id`), - CONSTRAINT `document_type_fieldsets_link_ibfk_1` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`) ON DELETE CASCADE, - CONSTRAINT `document_type_fieldsets_link_ibfk_2` FOREIGN KEY (`fieldset_id`) REFERENCES `fieldsets` (`id`) ON DELETE CASCADE + CONSTRAINT `document_type_fieldsets_link_ibfk_1` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `document_type_fieldsets_link_ibfk_2` FOREIGN KEY (`fieldset_id`) REFERENCES `fieldsets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -464,9 +521,8 @@ CREATE TABLE `document_types_lookup` ( `id` int(11) NOT NULL default '0', `name` char(100) default NULL, `disabled` tinyint(4) NOT NULL default '0', - UNIQUE KEY `id` (`id`), - UNIQUE KEY `name` (`name`), - KEY `disabled` (`disabled`) + PRIMARY KEY (`id`), + KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -475,7 +531,7 @@ CREATE TABLE `document_types_lookup` ( CREATE TABLE `documents` ( `id` int(11) NOT NULL default '0', - `creator_id` int(11) NOT NULL default '0', + `creator_id` int(11) default NULL, `modified` datetime NOT NULL default '0000-00-00 00:00:00', `folder_id` int(11) default NULL, `is_checked_out` tinyint(1) NOT NULL default '0', @@ -487,23 +543,31 @@ CREATE TABLE `documents` ( `permission_object_id` int(11) default NULL, `permission_lookup_id` int(11) default NULL, `metadata_version` int(11) NOT NULL default '0', - `modified_user_id` int(11) NOT NULL default '0', + `modified_user_id` int(11) default NULL, `metadata_version_id` int(11) default NULL, - `owner_id` int(11) NOT NULL default '0', + `owner_id` int(11) default NULL, `immutable` tinyint(1) NOT NULL default '0', `restore_folder_id` int(11) default NULL, `restore_folder_path` text, `checkedout` datetime default NULL, - UNIQUE KEY `id` (`id`), - KEY `fk_creator_id` (`creator_id`), - KEY `fk_folder_id` (`folder_id`), - KEY `fk_checked_out_user_id` (`checked_out_user_id`), - KEY `fk_status_id` (`status_id`), - KEY `created` (`created`), + PRIMARY KEY (`id`), + KEY `creator_id` (`creator_id`), + KEY `folder_id` (`folder_id`), + KEY `checked_out_user_id` (`checked_out_user_id`), + KEY `status_id` (`status_id`), KEY `permission_object_id` (`permission_object_id`), KEY `permission_lookup_id` (`permission_lookup_id`), KEY `modified_user_id` (`modified_user_id`), - KEY `metadata_version_id` (`metadata_version_id`) + KEY `metadata_version_id` (`metadata_version_id`), + KEY `created` (`created`), + CONSTRAINT `documents_ibfk_1` FOREIGN KEY (`creator_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE SET NULL, + CONSTRAINT `documents_ibfk_2` FOREIGN KEY (`folder_id`) REFERENCES `folders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `documents_ibfk_3` FOREIGN KEY (`checked_out_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE SET NULL, + CONSTRAINT `documents_ibfk_4` FOREIGN KEY (`status_id`) REFERENCES `status_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `documents_ibfk_5` FOREIGN KEY (`permission_object_id`) REFERENCES `permission_objects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `documents_ibfk_6` FOREIGN KEY (`permission_lookup_id`) REFERENCES `permission_lookups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `documents_ibfk_7` FOREIGN KEY (`modified_user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE SET NULL, + CONSTRAINT `documents_ibfk_8` FOREIGN KEY (`metadata_version_id`) REFERENCES `document_metadata_version` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -511,14 +575,15 @@ CREATE TABLE `documents` ( -- CREATE TABLE `download_files` ( - `document_id` int(10) unsigned NOT NULL, + `document_id` int(11) NOT NULL, `session` varchar(100) NOT NULL, `download_date` timestamp NULL default CURRENT_TIMESTAMP, `downloaded` int(10) unsigned NOT NULL default '0', `filesize` int(10) unsigned NOT NULL, `content_version` int(10) unsigned NOT NULL, `hash` varchar(100) NOT NULL, - PRIMARY KEY (`document_id`,`session`) + PRIMARY KEY (`document_id`,`session`), + CONSTRAINT `download_files_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -529,12 +594,12 @@ CREATE TABLE `field_behaviour_options` ( `behaviour_id` int(11) NOT NULL default '0', `field_id` int(11) NOT NULL default '0', `instance_id` int(11) NOT NULL default '0', - KEY `behaviour_id` (`behaviour_id`), KEY `field_id` (`field_id`), KEY `instance_id` (`instance_id`), - CONSTRAINT `field_behaviour_options_ibfk_1` FOREIGN KEY (`behaviour_id`) REFERENCES `field_behaviours` (`id`) ON DELETE CASCADE, - CONSTRAINT `field_behaviour_options_ibfk_2` FOREIGN KEY (`field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE, - CONSTRAINT `field_behaviour_options_ibfk_3` FOREIGN KEY (`instance_id`) REFERENCES `field_value_instances` (`id`) ON DELETE CASCADE + KEY `behaviour_id_field_id` (`behaviour_id`,`field_id`), + CONSTRAINT `field_behaviour_options_ibfk_1` FOREIGN KEY (`behaviour_id`) REFERENCES `field_behaviours` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `field_behaviour_options_ibfk_2` FOREIGN KEY (`field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `field_behaviour_options_ibfk_3` FOREIGN KEY (`instance_id`) REFERENCES `field_value_instances` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -549,7 +614,7 @@ CREATE TABLE `field_behaviours` ( PRIMARY KEY (`id`), KEY `field_id` (`field_id`), KEY `name` (`name`), - CONSTRAINT `field_behaviours_ibfk_1` FOREIGN KEY (`field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE + CONSTRAINT `field_behaviours_ibfk_1` FOREIGN KEY (`field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -560,12 +625,12 @@ CREATE TABLE `field_orders` ( `parent_field_id` int(11) NOT NULL default '0', `child_field_id` int(11) NOT NULL default '0', `fieldset_id` int(11) NOT NULL default '0', - UNIQUE KEY `child_field` (`child_field_id`), - KEY `parent_field` (`parent_field_id`), + UNIQUE KEY `child_field_id` (`child_field_id`), + KEY `parent_field_id` (`parent_field_id`), KEY `fieldset_id` (`fieldset_id`), - CONSTRAINT `field_orders_ibfk_1` FOREIGN KEY (`parent_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE, - CONSTRAINT `field_orders_ibfk_2` FOREIGN KEY (`child_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE, - CONSTRAINT `field_orders_ibfk_3` FOREIGN KEY (`fieldset_id`) REFERENCES `fieldsets` (`id`) ON DELETE CASCADE + CONSTRAINT `field_orders_ibfk_1` FOREIGN KEY (`child_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `field_orders_ibfk_2` FOREIGN KEY (`parent_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `field_orders_ibfk_3` FOREIGN KEY (`fieldset_id`) REFERENCES `fieldsets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -578,12 +643,12 @@ CREATE TABLE `field_value_instances` ( `field_value_id` int(11) NOT NULL default '0', `behaviour_id` int(11) default '0', PRIMARY KEY (`id`), - KEY `field_id` (`field_id`), KEY `field_value_id` (`field_value_id`), KEY `behaviour_id` (`behaviour_id`), - CONSTRAINT `field_value_instances_ibfk_1` FOREIGN KEY (`field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE, - CONSTRAINT `field_value_instances_ibfk_2` FOREIGN KEY (`field_value_id`) REFERENCES `metadata_lookup` (`id`) ON DELETE CASCADE, - CONSTRAINT `field_value_instances_ibfk_3` FOREIGN KEY (`behaviour_id`) REFERENCES `field_behaviours` (`id`) ON DELETE CASCADE + KEY `field_id` (`field_id`), + CONSTRAINT `field_value_instances_ibfk_1` FOREIGN KEY (`field_value_id`) REFERENCES `metadata_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `field_value_instances_ibfk_2` FOREIGN KEY (`behaviour_id`) REFERENCES `field_behaviours` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `field_value_instances_ibfk_3` FOREIGN KEY (`field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -603,12 +668,25 @@ CREATE TABLE `fieldsets` ( `is_system` tinyint(1) unsigned NOT NULL default '0', `description` mediumtext NOT NULL, `disabled` tinyint(4) NOT NULL default '0', - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), + KEY `master_field` (`master_field`), KEY `is_generic` (`is_generic`), KEY `is_complete` (`is_complete`), KEY `is_system` (`is_system`), - KEY `master_field` (`master_field`), - CONSTRAINT `fieldsets_ibfk_1` FOREIGN KEY (`master_field`) REFERENCES `document_fields` (`id`) ON DELETE SET NULL + CONSTRAINT `fieldsets_ibfk_1` FOREIGN KEY (`master_field`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Table structure for table `folder_descendants` +-- + +CREATE TABLE `folder_descendants` ( + `parent_id` int(11) NOT NULL, + `folder_id` int(11) NOT NULL, + KEY `parent_id` (`parent_id`), + KEY `folder_id` (`folder_id`), + CONSTRAINT `folder_descendants_ibfk_2` FOREIGN KEY (`folder_id`) REFERENCES `folders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `folder_descendants_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `folders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -619,9 +697,11 @@ CREATE TABLE `folder_doctypes_link` ( `id` int(11) NOT NULL default '0', `folder_id` int(11) NOT NULL default '0', `document_type_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`), - KEY `fk_folder_id` (`folder_id`), - KEY `fk_document_type_id` (`document_type_id`) + PRIMARY KEY (`id`), + KEY `folder_id` (`folder_id`), + KEY `document_type_id` (`document_type_id`), + CONSTRAINT `folder_doctypes_link_ibfk_1` FOREIGN KEY (`folder_id`) REFERENCES `folders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `folder_doctypes_link_ibfk_2` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -632,7 +712,6 @@ CREATE TABLE `folder_searchable_text` ( `folder_id` int(11) NOT NULL default '0', `folder_text` mediumtext, PRIMARY KEY (`folder_id`), - KEY `folder_searchable_text_folder_indx` (`folder_id`), FULLTEXT KEY `folder_text` (`folder_text`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -645,7 +724,11 @@ CREATE TABLE `folder_subscriptions` ( `user_id` int(11) NOT NULL default '0', `folder_id` int(11) NOT NULL default '0', `is_alerted` tinyint(1) default NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `user_id` (`user_id`), + KEY `folder_id` (`folder_id`), + CONSTRAINT `folder_subscriptions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `folder_subscriptions_ibfk_2` FOREIGN KEY (`folder_id`) REFERENCES `folders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -654,20 +737,20 @@ CREATE TABLE `folder_subscriptions` ( CREATE TABLE `folder_transactions` ( `id` int(11) NOT NULL default '0', - `folder_id` int(11) NOT NULL default '0', - `user_id` int(11) NOT NULL default '0', + `folder_id` int(11) default NULL, + `user_id` int(11) default NULL, `datetime` datetime NOT NULL default '0000-00-00 00:00:00', `ip` char(30) default NULL, `comment` char(255) NOT NULL default '', `transaction_namespace` char(255) NOT NULL default 'ktcore.transactions.event', `session_id` int(11) default NULL, `admin_mode` tinyint(1) NOT NULL default '0', - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), KEY `folder_id` (`folder_id`), KEY `user_id` (`user_id`), KEY `session_id` (`session_id`), - CONSTRAINT `folder_transactions_ibfk_1` FOREIGN KEY (`folder_id`) REFERENCES `folders` (`id`) ON DELETE CASCADE, - CONSTRAINT `folder_transactions_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE + CONSTRAINT `folder_transactions_ibfk_1` FOREIGN KEY (`folder_id`) REFERENCES `folders` (`id`) ON DELETE SET NULL ON UPDATE SET NULL, + CONSTRAINT `folder_transactions_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -678,7 +761,9 @@ CREATE TABLE `folder_workflow_map` ( `folder_id` int(11) NOT NULL default '0', `workflow_id` int(11) default NULL, PRIMARY KEY (`folder_id`), - UNIQUE KEY `folder_id` (`folder_id`) + KEY `workflow_id` (`workflow_id`), + CONSTRAINT `folder_workflow_map_ibfk_1` FOREIGN KEY (`folder_id`) REFERENCES `folders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `folder_workflow_map_ibfk_2` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -697,12 +782,16 @@ CREATE TABLE `folders` ( `permission_object_id` int(11) default NULL, `permission_lookup_id` int(11) default NULL, `restrict_document_types` tinyint(1) NOT NULL default '0', - `owner_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`), - KEY `fk_parent_id` (`parent_id`), - KEY `fk_creator_id` (`creator_id`), + `owner_id` int(11) default NULL, + PRIMARY KEY (`id`), + KEY `creator_id` (`creator_id`), KEY `permission_object_id` (`permission_object_id`), - KEY `permission_lookup_id` (`permission_lookup_id`) + KEY `permission_lookup_id` (`permission_lookup_id`), + KEY `parent_id_name` (`parent_id`,`name`), + CONSTRAINT `folders_ibfk_1` FOREIGN KEY (`creator_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `folders_ibfk_2` FOREIGN KEY (`permission_object_id`) REFERENCES `permission_objects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `folders_ibfk_3` FOREIGN KEY (`permission_lookup_id`) REFERENCES `permission_lookups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `folders_ibfk_4` FOREIGN KEY (`parent_id`) REFERENCES `folders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -718,7 +807,11 @@ CREATE TABLE `folders_users_roles_link` ( `done` tinyint(1) default NULL, `active` tinyint(1) default NULL, `dependant_documents_created` tinyint(1) default NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `user_id` (`user_id`), + KEY `document_id` (`document_id`), + CONSTRAINT `folders_users_roles_link_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `folders_users_roles_link_ibfk_2` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -730,10 +823,10 @@ CREATE TABLE `groups_groups_link` ( `parent_group_id` int(11) NOT NULL default '0', `member_group_id` int(11) NOT NULL default '0', PRIMARY KEY (`id`), - KEY `groups_groups_link_ibfk_1` (`parent_group_id`), - KEY `groups_groups_link_ibfk_2` (`member_group_id`), - CONSTRAINT `groups_groups_link_ibfk_1` FOREIGN KEY (`parent_group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE, - CONSTRAINT `groups_groups_link_ibfk_2` FOREIGN KEY (`member_group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE + KEY `parent_group_id` (`parent_group_id`), + KEY `member_group_id` (`member_group_id`), + CONSTRAINT `groups_groups_link_ibfk_1` FOREIGN KEY (`parent_group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `groups_groups_link_ibfk_2` FOREIGN KEY (`member_group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -749,12 +842,11 @@ CREATE TABLE `groups_lookup` ( `authentication_details_s2` varchar(255) default NULL, `authentication_details_s1` varchar(255) default NULL, `authentication_source_id` int(11) default NULL, - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `unit_id` (`unit_id`), - KEY `authentication_details_s1` (`authentication_details_s1`), - KEY `authentication_source_id` (`authentication_source_id`), - CONSTRAINT `groups_lookup_ibfk_1` FOREIGN KEY (`unit_id`) REFERENCES `units_lookup` (`id`) + KEY `authentication_source_id_authentication_details_s1` (`authentication_source_id`,`authentication_details_s1`), + CONSTRAINT `groups_lookup_ibfk_1` FOREIGN KEY (`unit_id`) REFERENCES `units_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -765,7 +857,7 @@ CREATE TABLE `help` ( `id` int(11) NOT NULL default '0', `fSection` varchar(100) NOT NULL default '', `help_info` mediumtext NOT NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -785,12 +877,15 @@ CREATE TABLE `help_replacement` ( -- CREATE TABLE `index_files` ( - `document_id` int(10) unsigned NOT NULL, - `user_id` int(10) unsigned NOT NULL, + `document_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, `indexdate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `processdate` datetime default NULL, `what` char(1) default NULL, - PRIMARY KEY (`document_id`) + PRIMARY KEY (`document_id`), + KEY `user_id` (`user_id`), + CONSTRAINT `index_files_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `index_files_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -815,7 +910,7 @@ CREATE TABLE `links` ( `name` char(100) NOT NULL default '', `url` char(100) NOT NULL default '', `rank` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -829,9 +924,10 @@ CREATE TABLE `metadata_lookup` ( `treeorg_parent` int(11) default NULL, `disabled` tinyint(3) unsigned NOT NULL default '0', `is_stuck` tinyint(1) NOT NULL default '0', - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), + KEY `document_field_id` (`document_field_id`), KEY `disabled` (`disabled`), - KEY `is_stuck` (`is_stuck`) + CONSTRAINT `metadata_lookup_ibfk_1` FOREIGN KEY (`document_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -843,9 +939,10 @@ CREATE TABLE `metadata_lookup_tree` ( `document_field_id` int(11) NOT NULL default '0', `name` char(255) default NULL, `metadata_lookup_tree_parent` int(11) default NULL, - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), + KEY `document_field_id` (`document_field_id`), KEY `metadata_lookup_tree_parent` (`metadata_lookup_tree_parent`), - KEY `document_field_id` (`document_field_id`) + CONSTRAINT `metadata_lookup_tree_ibfk_1` FOREIGN KEY (`document_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -871,7 +968,11 @@ CREATE TABLE `mime_types` ( `friendly_name` char(255) default '', `extractor` varchar(100) default NULL, `mime_document_id` int(11) default NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `mime_document_id` (`mime_document_id`), + KEY `filetypes` (`filetypes`), + KEY `mimetypes` (`mimetypes`), + CONSTRAINT `mime_types_ibfk_1` FOREIGN KEY (`mime_document_id`) REFERENCES `mime_documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -887,7 +988,9 @@ CREATE TABLE `news` ( `image_size` int(11) default NULL, `image_mime_type_id` int(11) default NULL, `active` tinyint(1) default NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `image_mime_type_id` (`image_mime_type_id`), + CONSTRAINT `news_ibfk_1` FOREIGN KEY (`image_mime_type_id`) REFERENCES `mime_types` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -905,9 +1008,10 @@ CREATE TABLE `notifications` ( `data_str_1` varchar(255) default NULL, `data_str_2` varchar(255) default NULL, `data_text_1` text, - UNIQUE KEY `id` (`id`), - KEY `type` (`type`), - KEY `user_id` (`user_id`) + PRIMARY KEY (`id`), + KEY `user_id` (`user_id`), + KEY `data_int_1` (`data_int_1`), + CONSTRAINT `notifications_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -917,7 +1021,7 @@ CREATE TABLE `notifications` ( CREATE TABLE `organisations_lookup` ( `id` int(11) NOT NULL default '0', `name` char(100) NOT NULL default '', - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -931,13 +1035,12 @@ CREATE TABLE `permission_assignments` ( `permission_object_id` int(11) NOT NULL default '0', `permission_descriptor_id` int(11) default NULL, PRIMARY KEY (`id`), - UNIQUE KEY `permission_and_object` (`permission_id`,`permission_object_id`), + UNIQUE KEY `permission_object_id_permission_id` (`permission_object_id`,`permission_id`), KEY `permission_id` (`permission_id`), - KEY `permission_object_id` (`permission_object_id`), KEY `permission_descriptor_id` (`permission_descriptor_id`), - CONSTRAINT `permission_assignments_ibfk_1` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE, - CONSTRAINT `permission_assignments_ibfk_2` FOREIGN KEY (`permission_object_id`) REFERENCES `permission_objects` (`id`) ON DELETE CASCADE, - CONSTRAINT `permission_assignments_ibfk_3` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE + CONSTRAINT `permission_assignments_ibfk_1` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `permission_assignments_ibfk_2` FOREIGN KEY (`permission_object_id`) REFERENCES `permission_objects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `permission_assignments_ibfk_3` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -947,11 +1050,10 @@ CREATE TABLE `permission_assignments` ( CREATE TABLE `permission_descriptor_groups` ( `descriptor_id` int(11) NOT NULL default '0', `group_id` int(11) NOT NULL default '0', - UNIQUE KEY `descriptor_id` (`descriptor_id`,`group_id`), - KEY `descriptor_id_2` (`descriptor_id`), + PRIMARY KEY (`descriptor_id`,`group_id`), KEY `group_id` (`group_id`), - CONSTRAINT `permission_descriptor_groups_ibfk_1` FOREIGN KEY (`descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE, - CONSTRAINT `permission_descriptor_groups_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE + CONSTRAINT `permission_descriptor_groups_ibfk_1` FOREIGN KEY (`descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `permission_descriptor_groups_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -961,11 +1063,10 @@ CREATE TABLE `permission_descriptor_groups` ( CREATE TABLE `permission_descriptor_roles` ( `descriptor_id` int(11) NOT NULL default '0', `role_id` int(11) NOT NULL default '0', - UNIQUE KEY `descriptor_id` (`descriptor_id`,`role_id`), - KEY `descriptor_id_2` (`descriptor_id`), + PRIMARY KEY (`descriptor_id`,`role_id`), KEY `role_id` (`role_id`), - CONSTRAINT `permission_descriptor_roles_ibfk_1` FOREIGN KEY (`descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE, - CONSTRAINT `permission_descriptor_roles_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE + CONSTRAINT `permission_descriptor_roles_ibfk_1` FOREIGN KEY (`descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `permission_descriptor_roles_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -975,11 +1076,10 @@ CREATE TABLE `permission_descriptor_roles` ( CREATE TABLE `permission_descriptor_users` ( `descriptor_id` int(11) NOT NULL default '0', `user_id` int(11) NOT NULL default '0', - UNIQUE KEY `descriptor_id` (`descriptor_id`,`user_id`), - KEY `descriptor_id_2` (`descriptor_id`), + PRIMARY KEY (`descriptor_id`,`user_id`), KEY `user_id` (`user_id`), - CONSTRAINT `permission_descriptor_users_ibfk_1` FOREIGN KEY (`descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE, - CONSTRAINT `permission_descriptor_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE + CONSTRAINT `permission_descriptor_users_ibfk_1` FOREIGN KEY (`descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `permission_descriptor_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -991,8 +1091,7 @@ CREATE TABLE `permission_descriptors` ( `descriptor` varchar(32) NOT NULL default '', `descriptor_text` mediumtext NOT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `descriptor_2` (`descriptor`), - KEY `descriptor` (`descriptor`) + UNIQUE KEY `descriptor` (`descriptor`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1002,10 +1101,10 @@ CREATE TABLE `permission_descriptors` ( CREATE TABLE `permission_dynamic_assignments` ( `dynamic_condition_id` int(11) NOT NULL default '0', `permission_id` int(11) NOT NULL default '0', - KEY `dynamic_conditiond_id` (`dynamic_condition_id`), + KEY `dynamic_condition_id` (`dynamic_condition_id`), KEY `permission_id` (`permission_id`), - CONSTRAINT `permission_dynamic_assignments_ibfk_2` FOREIGN KEY (`dynamic_condition_id`) REFERENCES `permission_dynamic_conditions` (`id`) ON DELETE CASCADE, - CONSTRAINT `permission_dynamic_assignments_ibfk_3` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE + CONSTRAINT `permission_dynamic_assignments_ibfk_2` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `permission_dynamic_assignments_ibfk_1` FOREIGN KEY (`dynamic_condition_id`) REFERENCES `permission_dynamic_conditions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1021,9 +1120,9 @@ CREATE TABLE `permission_dynamic_conditions` ( KEY `permission_object_id` (`permission_object_id`), KEY `group_id` (`group_id`), KEY `condition_id` (`condition_id`), - CONSTRAINT `permission_dynamic_conditions_ibfk_1` FOREIGN KEY (`permission_object_id`) REFERENCES `permission_objects` (`id`) ON DELETE CASCADE, - CONSTRAINT `permission_dynamic_conditions_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE, - CONSTRAINT `permission_dynamic_conditions_ibfk_3` FOREIGN KEY (`condition_id`) REFERENCES `saved_searches` (`id`) ON DELETE CASCADE + CONSTRAINT `permission_dynamic_conditions_ibfk_1` FOREIGN KEY (`permission_object_id`) REFERENCES `permission_objects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `permission_dynamic_conditions_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `permission_dynamic_conditions_ibfk_3` FOREIGN KEY (`condition_id`) REFERENCES `saved_searches` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1036,13 +1135,12 @@ CREATE TABLE `permission_lookup_assignments` ( `permission_lookup_id` int(11) NOT NULL default '0', `permission_descriptor_id` int(11) default NULL, PRIMARY KEY (`id`), - UNIQUE KEY `permission_and_lookup` (`permission_id`,`permission_lookup_id`), + UNIQUE KEY `permission_lookup_id_permission_id` (`permission_lookup_id`,`permission_id`), KEY `permission_id` (`permission_id`), - KEY `permission_lookup_id` (`permission_lookup_id`), KEY `permission_descriptor_id` (`permission_descriptor_id`), - CONSTRAINT `permission_lookup_assignments_ibfk_1` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE, - CONSTRAINT `permission_lookup_assignments_ibfk_2` FOREIGN KEY (`permission_lookup_id`) REFERENCES `permission_lookups` (`id`) ON DELETE CASCADE, - CONSTRAINT `permission_lookup_assignments_ibfk_3` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE + CONSTRAINT `permission_lookup_assignments_ibfk_1` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `permission_lookup_assignments_ibfk_2` FOREIGN KEY (`permission_lookup_id`) REFERENCES `permission_lookups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `permission_lookup_assignments_ibfk_3` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1085,8 +1183,10 @@ CREATE TABLE `plugin_rss` ( `user_id` int(11) NOT NULL, `url` varchar(200) NOT NULL, `title` varchar(20) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; + PRIMARY KEY (`id`), + KEY `user_id` (`user_id`), + CONSTRAINT `plugin_rss_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Table structure for table `plugins` @@ -1102,7 +1202,8 @@ CREATE TABLE `plugins` ( `unavailable` tinyint(1) NOT NULL default '0', `friendly_name` varchar(255) default '', PRIMARY KEY (`id`), - KEY `name` (`namespace`) + UNIQUE KEY `namespace` (`namespace`), + KEY `disabled` (`disabled`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1114,8 +1215,13 @@ CREATE TABLE `role_allocations` ( `folder_id` int(11) NOT NULL default '0', `role_id` int(11) NOT NULL default '0', `permission_descriptor_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`), - KEY `folder_id` (`folder_id`) + PRIMARY KEY (`id`), + KEY `folder_id` (`folder_id`), + KEY `role_id` (`role_id`), + KEY `permission_descriptor_id` (`permission_descriptor_id`), + CONSTRAINT `role_allocations_ibfk_1` FOREIGN KEY (`folder_id`) REFERENCES `folders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `role_allocations_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `role_allocations_ibfk_3` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1125,7 +1231,7 @@ CREATE TABLE `role_allocations` ( CREATE TABLE `roles` ( `id` int(11) NOT NULL default '0', `name` char(255) NOT NULL default '', - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -1142,9 +1248,7 @@ CREATE TABLE `saved_searches` ( `user_id` int(10) default NULL, `search` mediumtext NOT NULL, PRIMARY KEY (`id`), - KEY `namespace` (`namespace`), - KEY `is_condition` (`is_condition`), - KEY `is_complete` (`is_complete`), + UNIQUE KEY `namespace` (`namespace`), KEY `user_id` (`user_id`), CONSTRAINT `saved_searches_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -1162,9 +1266,10 @@ CREATE TABLE `scheduler_tasks` ( `is_background` tinyint(4) NOT NULL default '0', `is_complete` tinyint(4) NOT NULL default '0', `frequency` varchar(25) default NULL, - `run_time` datetime, - `previous_run_time` datetime, - `run_duration` float default NULL + `run_time` datetime default NULL, + `previous_run_time` datetime default NULL, + `run_duration` float default NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1174,8 +1279,10 @@ CREATE TABLE `scheduler_tasks` ( CREATE TABLE `search_document_user_link` ( `document_id` int(11) default NULL, `user_id` int(11) default NULL, - KEY `fk_user_id` (`user_id`), - KEY `fk_document_ids` (`document_id`) + KEY `document_id` (`document_id`), + KEY `user_id` (`user_id`), + CONSTRAINT `search_document_user_link_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `search_document_user_link_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1201,7 +1308,9 @@ CREATE TABLE `search_saved` ( `user_id` int(11) NOT NULL, `type` enum('S','C','W','B') NOT NULL default 'S' COMMENT 'S=saved search, C=permission, w=workflow, B=subscription', `shared` tinyint(4) NOT NULL default '0', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + KEY `user_id` (`user_id`), + CONSTRAINT `search_saved_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1209,7 +1318,9 @@ CREATE TABLE `search_saved` ( -- CREATE TABLE `search_saved_events` ( - `document_id` int(11) NOT NULL + `document_id` int(11) NOT NULL, + PRIMARY KEY (`document_id`), + CONSTRAINT `search_saved_events_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1219,7 +1330,7 @@ CREATE TABLE `search_saved_events` ( CREATE TABLE `status_lookup` ( `id` int(11) NOT NULL default '0', `name` char(255) default NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1230,7 +1341,8 @@ CREATE TABLE `system_settings` ( `id` int(11) NOT NULL default '0', `name` char(255) NOT NULL default '', `value` text NOT NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1251,7 +1363,9 @@ CREATE TABLE `time_period` ( `id` int(11) NOT NULL default '0', `time_unit_id` int(11) default NULL, `units` int(11) default NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`), + KEY `time_unit_id` (`time_unit_id`), + CONSTRAINT `time_period_ibfk_1` FOREIGN KEY (`time_unit_id`) REFERENCES `time_unit_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1261,7 +1375,7 @@ CREATE TABLE `time_period` ( CREATE TABLE `time_unit_lookup` ( `id` int(11) NOT NULL default '0', `name` char(100) default NULL, - UNIQUE KEY `id` (`id`) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1271,8 +1385,7 @@ CREATE TABLE `time_unit_lookup` ( CREATE TABLE `trigger_selection` ( `event_ns` varchar(255) NOT NULL default '', `selection_ns` varchar(255) NOT NULL default '', - PRIMARY KEY (`event_ns`), - UNIQUE KEY `event_ns` (`event_ns`) + PRIMARY KEY (`event_ns`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1281,9 +1394,11 @@ CREATE TABLE `trigger_selection` ( CREATE TABLE `type_workflow_map` ( `document_type_id` int(11) NOT NULL default '0', - `workflow_id` int(10) unsigned default NULL, + `workflow_id` int(11) default NULL, PRIMARY KEY (`document_type_id`), - UNIQUE KEY `document_type_id` (`document_type_id`) + KEY `workflow_id` (`workflow_id`), + CONSTRAINT `type_workflow_map_ibfk_1` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `type_workflow_map_ibfk_2` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1294,9 +1409,10 @@ CREATE TABLE `units_lookup` ( `id` int(11) NOT NULL default '0', `name` char(100) NOT NULL default '', `folder_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), - UNIQUE KEY `folder_id` (`folder_id`) + UNIQUE KEY `folder_id` (`folder_id`), + CONSTRAINT `units_lookup_ibfk_1` FOREIGN KEY (`folder_id`) REFERENCES `folders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1307,9 +1423,11 @@ CREATE TABLE `units_organisations_link` ( `id` int(11) NOT NULL default '0', `unit_id` int(11) NOT NULL default '0', `organisation_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`), - KEY `fk_unit_id` (`unit_id`), - KEY `fk_organisation_id` (`organisation_id`) + PRIMARY KEY (`id`), + KEY `unit_id` (`unit_id`), + KEY `organisation_id` (`organisation_id`), + CONSTRAINT `units_organisations_link_ibfk_1` FOREIGN KEY (`unit_id`) REFERENCES `units_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `units_organisations_link_ibfk_2` FOREIGN KEY (`organisation_id`) REFERENCES `organisations_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1338,7 +1456,12 @@ CREATE TABLE `uploaded_files` ( `userid` int(11) NOT NULL, `uploaddate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `action` char(1) NOT NULL COMMENT 'A = Add, C = Checkin', - `document_id` int(11) default NULL + `document_id` int(11) default NULL, + PRIMARY KEY (`tempfilename`), + KEY `userid` (`userid`), + KEY `document_id` (`document_id`), + CONSTRAINT `uploaded_files_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `uploaded_files_ibfk_2` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1357,9 +1480,10 @@ CREATE TABLE `user_history` ( KEY `action_namespace` (`action_namespace`), KEY `datetime` (`datetime`), KEY `session_id` (`session_id`), - CONSTRAINT `user_history_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE + CONSTRAINT `user_history_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- -- Table structure for table `users` -- @@ -1388,14 +1512,12 @@ CREATE TABLE `users` ( `authentication_details_b2` tinyint(1) default NULL, `last_login` datetime default NULL, `disabled` tinyint(1) NOT NULL, - UNIQUE KEY `id` (`id`), + PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`), - KEY `authentication_source` (`authentication_source_id`), - KEY `authentication_details_b1` (`authentication_details_b1`), - KEY `authentication_details_b2` (`authentication_details_b2`), + KEY `authentication_source_id` (`authentication_source_id`), KEY `last_login` (`last_login`), KEY `disabled` (`disabled`), - CONSTRAINT `users_ibfk_1` FOREIGN KEY (`authentication_source_id`) REFERENCES `authentication_sources` (`id`) ON DELETE SET NULL + CONSTRAINT `users_ibfk_1` FOREIGN KEY (`authentication_source_id`) REFERENCES `authentication_sources` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1406,11 +1528,11 @@ CREATE TABLE `users_groups_link` ( `id` int(11) NOT NULL default '0', `user_id` int(11) NOT NULL default '0', `group_id` int(11) NOT NULL default '0', - UNIQUE KEY `id` (`id`), - KEY `fk_user_id` (`user_id`), - KEY `fk_group_id` (`group_id`), - CONSTRAINT `users_groups_link_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE, - CONSTRAINT `users_groups_link_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE + PRIMARY KEY (`id`), + KEY `user_id` (`user_id`), + KEY `group_id` (`group_id`), + CONSTRAINT `users_groups_link_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `users_groups_link_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1420,8 +1542,7 @@ CREATE TABLE `users_groups_link` ( CREATE TABLE `workflow_actions` ( `workflow_id` int(11) NOT NULL default '0', `action_name` char(255) NOT NULL default '', - KEY `workflow_id` (`workflow_id`), - KEY `action_name` (`action_name`) + PRIMARY KEY (`workflow_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1434,7 +1555,10 @@ CREATE TABLE `workflow_documents` ( `state_id` int(11) NOT NULL default '0', PRIMARY KEY (`document_id`), KEY `workflow_id` (`workflow_id`), - KEY `state_id` (`state_id`) + KEY `state_id` (`state_id`), + CONSTRAINT `workflow_documents_ibfk_1` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workflow_documents_ibfk_2` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workflow_documents_ibfk_3` FOREIGN KEY (`state_id`) REFERENCES `workflow_states` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1445,7 +1569,7 @@ CREATE TABLE `workflow_state_actions` ( `state_id` int(11) NOT NULL default '0', `action_name` char(255) NOT NULL default '0', KEY `state_id` (`state_id`), - KEY `action_name` (`action_name`) + CONSTRAINT `workflow_state_actions_ibfk_1` FOREIGN KEY (`state_id`) REFERENCES `workflow_states` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1456,7 +1580,7 @@ CREATE TABLE `workflow_state_disabled_actions` ( `state_id` int(11) NOT NULL default '0', `action_name` char(255) NOT NULL default '0', KEY `state_id` (`state_id`), - KEY `action_name` (`action_name`) + CONSTRAINT `workflow_state_disabled_actions_ibfk_1` FOREIGN KEY (`state_id`) REFERENCES `workflow_states` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1472,8 +1596,9 @@ CREATE TABLE `workflow_state_permission_assignments` ( KEY `permission_id` (`permission_id`), KEY `permission_descriptor_id` (`permission_descriptor_id`), KEY `workflow_state_id` (`workflow_state_id`), - CONSTRAINT `workflow_state_permission_assignments_ibfk_7` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE, - CONSTRAINT `workflow_state_permission_assignments_ibfk_8` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE + CONSTRAINT `workflow_state_permission_assignments_ibfk_1` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workflow_state_permission_assignments_ibfk_2` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workflow_state_permission_assignments_ibfk_3` FOREIGN KEY (`workflow_state_id`) REFERENCES `workflow_states` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1482,7 +1607,11 @@ CREATE TABLE `workflow_state_permission_assignments` ( CREATE TABLE `workflow_state_transitions` ( `state_id` int(11) NOT NULL default '0', - `transition_id` int(11) NOT NULL default '0' + `transition_id` int(11) NOT NULL default '0', + PRIMARY KEY (`state_id`,`transition_id`), + KEY `transition_id` (`transition_id`), + CONSTRAINT `workflow_state_transitions_ibfk_2` FOREIGN KEY (`transition_id`) REFERENCES `workflow_transitions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workflow_state_transitions_ibfk_1` FOREIGN KEY (`state_id`) REFERENCES `workflow_states` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1501,8 +1630,8 @@ CREATE TABLE `workflow_states` ( KEY `workflow_id` (`workflow_id`), KEY `name` (`name`), KEY `inform_descriptor_id` (`inform_descriptor_id`), - CONSTRAINT `workflow_states_ibfk_1` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`), - CONSTRAINT `workflow_states_ibfk_2` FOREIGN KEY (`inform_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE SET NULL + CONSTRAINT `workflow_states_ibfk_1` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workflow_states_ibfk_2` FOREIGN KEY (`inform_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1520,20 +1649,19 @@ CREATE TABLE `workflow_transitions` ( `guard_role_id` int(11) default '0', `guard_condition_id` int(11) default NULL, PRIMARY KEY (`id`), - UNIQUE KEY `workflow_id_2` (`workflow_id`,`name`), - KEY `workflow_id` (`workflow_id`), - KEY `name` (`name`), + UNIQUE KEY `workflow_id_name` (`workflow_id`,`name`), KEY `target_state_id` (`target_state_id`), - KEY `guard_permission_id` (`guard_permission_id`), - KEY `guard_condition` (`guard_condition_id`), + KEY `guard_condition_id` (`guard_condition_id`), KEY `guard_group_id` (`guard_group_id`), KEY `guard_role_id` (`guard_role_id`), - CONSTRAINT `workflow_transitions_ibfk_45` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`) ON DELETE CASCADE, - CONSTRAINT `workflow_transitions_ibfk_46` FOREIGN KEY (`target_state_id`) REFERENCES `workflow_states` (`id`) ON DELETE CASCADE, - CONSTRAINT `workflow_transitions_ibfk_47` FOREIGN KEY (`guard_permission_id`) REFERENCES `permissions` (`id`) ON DELETE SET NULL, - CONSTRAINT `workflow_transitions_ibfk_48` FOREIGN KEY (`guard_group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE SET NULL, - CONSTRAINT `workflow_transitions_ibfk_49` FOREIGN KEY (`guard_role_id`) REFERENCES `roles` (`id`) ON DELETE SET NULL, - CONSTRAINT `workflow_transitions_ibfk_50` FOREIGN KEY (`guard_condition_id`) REFERENCES `saved_searches` (`id`) ON DELETE SET NULL + KEY `name` (`name`), + KEY `guard_permission_id` (`guard_permission_id`), + CONSTRAINT `workflow_transitions_ibfk_1` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workflow_transitions_ibfk_2` FOREIGN KEY (`target_state_id`) REFERENCES `workflow_states` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workflow_transitions_ibfk_3` FOREIGN KEY (`guard_permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workflow_transitions_ibfk_4` FOREIGN KEY (`guard_condition_id`) REFERENCES `saved_searches` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workflow_transitions_ibfk_5` FOREIGN KEY (`guard_group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workflow_transitions_ibfk_6` FOREIGN KEY (`guard_role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -1547,7 +1675,8 @@ CREATE TABLE `workflow_trigger_instances` ( `config_array` text, PRIMARY KEY (`id`), KEY `workflow_transition_id` (`workflow_transition_id`), - KEY `namespace` (`namespace`) + KEY `namespace` (`namespace`), + CONSTRAINT `workflow_trigger_instances_ibfk_1` FOREIGN KEY (`workflow_transition_id`) REFERENCES `workflow_transitions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- @@ -1563,7 +1692,7 @@ CREATE TABLE `workflows` ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `start_state_id` (`start_state_id`), - CONSTRAINT `workflows_ibfk_1` FOREIGN KEY (`start_state_id`) REFERENCES `workflow_states` (`id`) + CONSTRAINT `workflows_ibfk_1` FOREIGN KEY (`start_state_id`) REFERENCES `workflow_states` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -2094,7 +2223,9 @@ CREATE TABLE `zseq_plugin_rss` ( CREATE TABLE `zseq_plugins` ( `id` int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=72 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=82 DEFAULT CHARSET=latin1; + + -- -- Table structure for table `zseq_role_allocations` @@ -2210,7 +2341,7 @@ CREATE TABLE `zseq_units_organisations_link` ( CREATE TABLE `zseq_upgrades` ( `id` int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=146 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=150 DEFAULT CHARSET=latin1; -- -- Table structure for table `zseq_user_history` @@ -2302,4 +2433,4 @@ CREATE TABLE `zseq_workflows` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2007-09-25 21:55:41 +-- Dump completed on 2007-10-11 15:46:20 diff --git a/sql/mysql/upgrade/3.5.0/relation_friendly.sql b/sql/mysql/upgrade/3.5.0/relation_friendly.sql index bdb3099..e682449 100644 --- a/sql/mysql/upgrade/3.5.0/relation_friendly.sql +++ b/sql/mysql/upgrade/3.5.0/relation_friendly.sql @@ -3,8 +3,19 @@ alter table `folders` change `owner_id` `owner_id` int NULL; alter table `index_files` change `document_id` `document_id` int NOT NULL; alter table `index_files` change `user_id` `user_id` int NOT NULL; alter table `type_workflow_map` change `workflow_id` `workflow_id` int NULL; + alter table document_content_version change mime_id mime_id int null default 9; + alter table documents change owner_id owner_id int null; -alter table documents change parent_id parent_id int null; +alter table documents change creator_id creator_id int null; +alter table documents change modified_user_id modified_user_id int null; + +alter table document_transactions change document_id document_id int null; +alter table document_transactions change user_id user_id int null; + +alter table folder_transactions change folder_id folder_id int null; +alter table folder_transactions change user_id user_id int null; + +alter table folders change parent_id parent_id int null; update documents set owner_id=null where owner_id=0; update folders set parent_id=null where parent_id=0; -- libgit2 0.21.4