Skip to content

Instantly share code, notes, and snippets.

@eballisty
Created November 14, 2017 18:15
Show Gist options
  • Save eballisty/44badfa4db760cff3424cc4bdcfe05fa to your computer and use it in GitHub Desktop.
Save eballisty/44badfa4db760cff3424cc4bdcfe05fa to your computer and use it in GitHub Desktop.
Rebuild Mura's default database indexes
<cfscript>
dbUtility.setTable('tcontent')
.addPrimaryKey('TContent_ID')
.addIndex('ContentID')
.addIndex('ContentHistID')
.addIndex('SiteID')
.addIndex('ParentID')
.addIndex('RemoteID')
.addIndex('ModuleID')
.addIndex('changesetID')
.addIndex('mobileExclude')
dbUtility.setTable('tcontentstats')
.addPrimaryKey('contentID,siteID')
dbUtility.setTable('tcontentassignments')
.addPrimaryKey('contentID,contentHistID,siteID,userID')
dbUtility.setTable('tcontentcategories')
.addPrimaryKey('categoryID')
.addIndex('siteID')
dbUtility.setTable('tcontentcategoryassign')
.addPrimaryKey('contentHistID,categoryID')
dbUtility.setTable('tcontentcomments')
.addPrimaryKey('commentid')
.addIndex('contentid')
dbUtility.setTable('tcontentfeedadvancedparams')
.addPrimaryKey('paramID')
dbUtility.setTable('tcontentfeeds')
.addPrimaryKey('feedID')
.addIndex('siteID')
dbUtility.setTable('tcontentobjects')
.addPrimaryKey('ContentHistID,ObjectID,Object,ColumnID')
.addIndex('SiteID')
dbUtility.setTable('tcontentratings')
.addPrimaryKey('contentID,userID,siteID')
.addIndex('entered')
dbUtility.setTable('tcontentrelated')
.addPrimaryKey('contentHistID,relatedID,contentID,siteID')
dbUtility.setTable('temails')
.addPrimaryKey('EmailID')
.addIndex('siteid')
dbUtility.setTable('tfiles')
.addPrimaryKey('fileID')
dbUtility.setTable('tformresponsepackets')
.addPrimaryKey('ResponseID')
.addIndex('FormID,SiteID')
dbUtility.setTable('tredirects')
.addPrimaryKey('redirectID')
dbUtility.setTable('tsessiontracking')
.addPrimaryKey('trackingID')
.addIndex('entered')
.addIndex('siteID')
.addIndex('contentID')
.addIndex('urlToken')
.addIndex('userID')
dbUtility.setTable('tuseraddresses')
.addPrimaryKey('addressID')
.addIndex('longitude')
.addIndex('latitude')
.addIndex('userID')
dbUtility.setTable('tusers')
.addPrimaryKey('userID')
dbUtility.setTable('tusersfavorites')
.addPrimaryKey('favoriteID')
dbUtility.setTable('tusersinterests')
.addPrimaryKey('userID,categoryID')
dbUtility.setTable('tusersmemb')
.addPrimaryKey('UserID,GroupID')
dbUtility.setTable('tcontentpublicsubmissionapprovals')
.addPrimaryKey('contentID,siteID')
dbUtility.setTable('tcontenttags')
.addPrimaryKey('tagID')
.addIndex('contentHistID')
.addIndex('siteID')
.addIndex('contentID')
.addIndex('tag')
dbUtility.setTable('tuserstags')
.addPrimaryKey('tagID')
.addIndex('userID')
.addIndex('siteID')
.addIndex('tag')
dbUtility.setTable('tclassextenddatauseractivity')
.addPrimaryKey('dataID')
.addIndex('baseID')
.addIndex('attributeID')
dbUtility.setTable('tclassextenddata')
.addPrimaryKey('dataID')
.addIndex('baseID')
.addIndex('attributeID')
dbUtility.setTable('tclassextend')
.addPrimaryKey('subTypeID')
dbUtility.setTable('tclassextendattributes')
.addPrimaryKey('attributeID')
.addIndex('extendSetID')
dbUtility.setTable('tclassextendsets')
.addPrimaryKey('extendSetID')
.addIndex('subTypeID')
</cfscript>
@mattlevine
Copy link

mattlevine commented May 15, 2018

FYI, I forked this and created added this to it:

dbUtility.setTable('tcontentfeeditems')
	.addPrimaryKey('feedID,itemID');

dbUtility.setTable('tformresponsequestions')
	.addPrimaryKey('responseID,formID,formfield');

dbUtility.setTable('tpermissions')
	.addPrimaryKey('ContentID,GroupID,SiteID,Type');

However, I don't think you can actually do a pull request for gists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment