InventoryStore.migrations 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. :VERSION 1 # ------------
  2. BEGIN;
  3. CREATE TABLE `inventoryfolders` (
  4. `folderID` varchar(36) NOT NULL default '',
  5. `agentID` varchar(36) default NULL,
  6. `parentFolderID` varchar(36) default NULL,
  7. `folderName` varchar(64) default NULL,
  8. `type` smallint NOT NULL default 0,
  9. `version` int NOT NULL default 0,
  10. PRIMARY KEY (`folderID`),
  11. KEY `owner` (`agentID`),
  12. KEY `parent` (`parentFolderID`)
  13. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  14. CREATE TABLE `inventoryitems` (
  15. `inventoryID` varchar(36) NOT NULL default '',
  16. `assetID` varchar(36) default NULL,
  17. `assetType` int(11) default NULL,
  18. `parentFolderID` varchar(36) default NULL,
  19. `avatarID` varchar(36) default NULL,
  20. `inventoryName` varchar(64) default NULL,
  21. `inventoryDescription` varchar(128) default NULL,
  22. `inventoryNextPermissions` int(10) unsigned default NULL,
  23. `inventoryCurrentPermissions` int(10) unsigned default NULL,
  24. `invType` int(11) default NULL,
  25. `creatorID` varchar(36) default NULL,
  26. `inventoryBasePermissions` int(10) unsigned NOT NULL default 0,
  27. `inventoryEveryOnePermissions` int(10) unsigned NOT NULL default 0,
  28. `salePrice` int(11) NOT NULL default 0,
  29. `saleType` tinyint(4) NOT NULL default 0,
  30. `creationDate` int(11) NOT NULL default 0,
  31. `groupID` varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
  32. `groupOwned` tinyint(4) NOT NULL default 0,
  33. `flags` int(11) unsigned NOT NULL default 0,
  34. PRIMARY KEY (`inventoryID`),
  35. KEY `owner` (`avatarID`),
  36. KEY `folder` (`parentFolderID`)
  37. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  38. COMMIT;
  39. :VERSION 2 # ------------
  40. BEGIN;
  41. ALTER TABLE inventoryfolders change folderID folderIDold varchar(36);
  42. ALTER TABLE inventoryfolders change agentID agentIDold varchar(36);
  43. ALTER TABLE inventoryfolders change parentFolderID parentFolderIDold varchar(36);
  44. ALTER TABLE inventoryfolders add folderID char(36) not null default '00000000-0000-0000-0000-000000000000';
  45. ALTER TABLE inventoryfolders add agentID char(36) default NULL;
  46. ALTER TABLE inventoryfolders add parentFolderID char(36) default NULL;
  47. UPDATE inventoryfolders set folderID = folderIDold, agentID = agentIDold, parentFolderID = parentFolderIDold;
  48. ALTER TABLE inventoryfolders drop folderIDold;
  49. ALTER TABLE inventoryfolders drop agentIDold;
  50. ALTER TABLE inventoryfolders drop parentFolderIDold;
  51. ALTER TABLE inventoryfolders add constraint primary key(folderID);
  52. ALTER TABLE inventoryfolders add index inventoryfolders_agentid(agentID);
  53. ALTER TABLE inventoryfolders add index inventoryfolders_parentFolderid(parentFolderID);
  54. ALTER TABLE inventoryitems change inventoryID inventoryIDold varchar(36);
  55. ALTER TABLE inventoryitems change avatarID avatarIDold varchar(36);
  56. ALTER TABLE inventoryitems change parentFolderID parentFolderIDold varchar(36);
  57. ALTER TABLE inventoryitems add inventoryID char(36) not null default '00000000-0000-0000-0000-000000000000';
  58. ALTER TABLE inventoryitems add avatarID char(36) default NULL;
  59. ALTER TABLE inventoryitems add parentFolderID char(36) default NULL;
  60. UPDATE inventoryitems set inventoryID = inventoryIDold, avatarID = avatarIDold, parentFolderID = parentFolderIDold;
  61. ALTER TABLE inventoryitems drop inventoryIDold;
  62. ALTER TABLE inventoryitems drop avatarIDold;
  63. ALTER TABLE inventoryitems drop parentFolderIDold;
  64. ALTER TABLE inventoryitems add constraint primary key(inventoryID);
  65. ALTER TABLE inventoryitems add index inventoryitems_avatarid(avatarID);
  66. ALTER TABLE inventoryitems add index inventoryitems_parentFolderid(parentFolderID);
  67. COMMIT;
  68. :VERSION 3 # ------------
  69. BEGIN;
  70. alter table inventoryitems add column inventoryGroupPermissions integer unsigned not null default 0;
  71. COMMIT;
  72. :VERSION 4 # ------------
  73. BEGIN;
  74. update inventoryitems set creatorID = '00000000-0000-0000-0000-000000000000' where creatorID is NULL;
  75. update inventoryitems set creatorID = '00000000-0000-0000-0000-000000000000' where creatorID = '';
  76. alter table inventoryitems modify column creatorID varchar(36) not NULL default '00000000-0000-0000-0000-000000000000';
  77. COMMIT;
  78. :VERSION 5 # ------------
  79. BEGIN;
  80. alter table inventoryitems modify column creatorID varchar(128) not NULL default '00000000-0000-0000-0000-000000000000';
  81. COMMIT;
  82. :VERSION 6 # ------------
  83. BEGIN;
  84. alter table inventoryitems modify column creatorID varchar(255) not NULL default '00000000-0000-0000-0000-000000000000';
  85. COMMIT;