based on positive feedback on performance of making keys fixed length

for assets, make all the indexed columns in the inventory fixed length
via migration.
0.6.0-stable
Sean Dague 2008-06-24 18:01:28 +00:00
parent 385620e97d
commit c0a083ad38
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
BEGIN;
ALTER TABLE inventoryfolders change folderID folderIDold varchar(36);
ALTER TABLE inventoryfolders change agentID agentIDold varchar(36);
ALTER TABLE inventoryfolders change parentFolderID parentFolderIDold varchar(36);
ALTER TABLE inventoryfolders add folderID char(36) not null default '00000000-0000-0000-0000-000000000000';
ALTER TABLE inventoryfolders add agentID char(36) default NULL;
ALTER TABLE inventoryfolders add parentFolderID char(36) default NULL;
UPDATE inventoryfolders set folderID = folderIDold, agentID = agentIDold, parentFolderID = parentFolderIDold;
ALTER TABLE inventoryfolders drop folderIDold;
ALTER TABLE inventoryfolders drop agentIDold;
ALTER TABLE inventoryfolders drop parentFolderIDold;
ALTER TABLE inventoryfolders add constraint primary key(folderID);
ALTER TABLE inventoryfolders add index inventoryfolders_agentid(agentID);
ALTER TABLE inventoryfolders add index inventoryfolders_parentFolderid(parentFolderID);
ALTER TABLE inventoryitems change inventoryID inventoryIDold varchar(36);
ALTER TABLE inventoryitems change avatarID avatarIDold varchar(36);
ALTER TABLE inventoryitems change parentFolderID parentFolderIDold varchar(36);
ALTER TABLE inventoryitems add inventoryID char(36) not null default '00000000-0000-0000-0000-000000000000';
ALTER TABLE inventoryitems add avatarID char(36) default NULL;
ALTER TABLE inventoryitems add parentFolderID char(36) default NULL;
UPDATE inventoryitems set inventoryID = inventoryIDold, avatarID = avatarIDold, parentFolderID = parentFolderIDold;
ALTER TABLE inventoryitems drop inventoryIDold;
ALTER TABLE inventoryitems drop avatarIDold;
ALTER TABLE inventoryitems drop parentFolderIDold;
ALTER TABLE inventoryitems add constraint primary key(inventoryID);
ALTER TABLE inventoryitems add index inventoryitems_avatarid(avatarID);
ALTER TABLE inventoryitems add index inventoryitems_parentFolderid(parentFolderID);
COMMIT;