1
0

InventoryStore.migrations 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. :VERSION 1
  2. BEGIN TRANSACTION;
  3. CREATE TABLE inventoryfolders (
  4. "folderID" varchar(36) NOT NULL default '' PRIMARY KEY,
  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. );
  11. CREATE INDEX owner ON inventoryfolders
  12. (
  13. "agentID" ASC
  14. );
  15. CREATE INDEX parent ON inventoryfolders
  16. (
  17. "parentFolderID" ASC
  18. );
  19. CREATE TABLE inventoryitems (
  20. "inventoryID" varchar(36) NOT NULL default '' Primary Key,
  21. "assetID" varchar(36) default NULL,
  22. "assetType" int default NULL,
  23. "parentFolderID" varchar(36) default NULL,
  24. "avatarID" varchar(36) default NULL,
  25. "inventoryName" varchar(64) default NULL,
  26. "inventoryDescription" varchar(128) default NULL,
  27. "inventoryNextPermissions" int default NULL,
  28. "inventoryCurrentPermissions" int default NULL,
  29. "invType" int default NULL,
  30. "creatorID" varchar(36) default NULL,
  31. "inventoryBasePermissions" int NOT NULL default 0,
  32. "inventoryEveryOnePermissions" int NOT NULL default 0,
  33. "salePrice" int default NULL,
  34. "saleType" smallint default NULL,
  35. "creationDate" int default NULL,
  36. "groupID" varchar(36) default NULL,
  37. "groupOwned" boolean default NULL,
  38. "flags" int default NULL
  39. );
  40. CREATE INDEX ii_owner ON inventoryitems
  41. (
  42. "avatarID" ASC
  43. );
  44. CREATE INDEX ii_folder ON inventoryitems
  45. (
  46. "parentFolderID" ASC
  47. );
  48. COMMIT;
  49. :VERSION 2
  50. BEGIN TRANSACTION;
  51. ALTER TABLE inventoryitems ADD "inventoryGroupPermissions" INTEGER NOT NULL default 0;
  52. COMMIT;
  53. :VERSION 3
  54. /* To prevent any potential data loss issues, you should review this script in detail before running it outside the cotext of the database designer.*/
  55. BEGIN TRANSACTION;
  56. CREATE TABLE Tmp_inventoryfolders
  57. (
  58. "folderID" uuid NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
  59. "agentID" uuid NULL DEFAULT (NULL),
  60. "parentFolderID" uuid NULL DEFAULT (NULL),
  61. "folderName" varchar(64) NULL DEFAULT (NULL),
  62. "type" smallint NOT NULL DEFAULT ((0)),
  63. "version" int NOT NULL DEFAULT ((0))
  64. );
  65. INSERT INTO Tmp_inventoryfolders ("folderID", "agentID", "parentFolderID", "folderName", type, version)
  66. SELECT cast("folderID" as uuid), cast("agentID" as uuid), cast("parentFolderID" as uuid), "folderName", "type", "version"
  67. FROM inventoryfolders;
  68. DROP TABLE inventoryfolders;
  69. alter table Tmp_inventoryfolders rename to inventoryfolders;
  70. ALTER TABLE inventoryfolders ADD CONSTRAINT
  71. PK__inventor__C2FABFB3173876EA PRIMARY KEY
  72. (
  73. "folderID"
  74. );
  75. CREATE INDEX owner ON inventoryfolders
  76. (
  77. "agentID"
  78. );
  79. CREATE INDEX parent ON inventoryfolders
  80. (
  81. "parentFolderID"
  82. );
  83. COMMIT;
  84. :VERSION 4
  85. BEGIN TRANSACTION;
  86. CREATE TABLE Tmp_inventoryitems
  87. (
  88. "inventoryID" uuid NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
  89. "assetID" uuid NULL DEFAULT (NULL),
  90. "assetType" int NULL DEFAULT (NULL),
  91. "parentFolderID" uuid NULL DEFAULT (NULL),
  92. "avatarID" uuid NULL DEFAULT (NULL),
  93. "inventoryName" varchar(64) NULL DEFAULT (NULL),
  94. "inventoryDescription" varchar(128) NULL DEFAULT (NULL),
  95. "inventoryNextPermissions" int NULL DEFAULT (NULL),
  96. "inventoryCurrentPermissions" int NULL DEFAULT (NULL),
  97. "invType" int NULL DEFAULT (NULL),
  98. "creatorID" uuid NULL DEFAULT (NULL),
  99. "inventoryBasePermissions" int NOT NULL DEFAULT ((0)),
  100. "inventoryEveryOnePermissions" int NOT NULL DEFAULT ((0)),
  101. "salePrice" int NULL DEFAULT (NULL),
  102. "SaleType" smallint NULL DEFAULT (NULL),
  103. "creationDate" int NULL DEFAULT (NULL),
  104. "groupID" uuid NULL DEFAULT (NULL),
  105. "groupOwned" boolean NULL DEFAULT (NULL),
  106. "flags" int NULL DEFAULT (NULL),
  107. "inventoryGroupPermissions" int NOT NULL DEFAULT ((0))
  108. );
  109. INSERT INTO Tmp_inventoryitems ("inventoryID", "assetID", "assetType", "parentFolderID", "avatarID", "inventoryName", "inventoryDescription", "inventoryNextPermissions", "inventoryCurrentPermissions", "invType", "creatorID", "inventoryBasePermissions", "inventoryEveryOnePermissions", "salePrice", "SaleType", "creationDate", "groupID", "groupOwned", "flags", "inventoryGroupPermissions")
  110. SELECT cast("inventoryID" as uuid), cast("assetID" as uuid), "assetType", cast("parentFolderID" as uuid), cast("avatarID" as uuid), "inventoryName", "inventoryDescription", "inventoryNextPermissions", "inventoryCurrentPermissions", "invType", cast("creatorID" as uuid), "inventoryBasePermissions", "inventoryEveryOnePermissions", "salePrice", "SaleType", "creationDate", cast("groupID" as uuid), "groupOwned", "flags", "inventoryGroupPermissions"
  111. FROM inventoryitems ;
  112. DROP TABLE inventoryitems;
  113. alter table Tmp_inventoryitems rename to inventoryitems;
  114. ALTER TABLE inventoryitems ADD CONSTRAINT
  115. PK__inventor__C4B7BC2220C1E124 PRIMARY KEY
  116. (
  117. "inventoryID"
  118. );
  119. CREATE INDEX ii2_owner ON inventoryitems
  120. (
  121. "avatarID"
  122. );
  123. CREATE INDEX ii2_folder ON inventoryitems
  124. (
  125. "parentFolderID"
  126. );
  127. COMMIT;
  128. :VERSION 5
  129. BEGIN TRANSACTION;
  130. -- # Restoring defaults:
  131. -- # NOTE: "inventoryID" does NOT need one: it's NOT NULL PK and a unique Guid must be provided every time anyway!
  132. alter table inventoryitems
  133. alter column "inventoryBasePermissions" set default 0;
  134. alter table inventoryitems
  135. alter column "inventoryEveryOnePermissions" set default 0;
  136. alter table inventoryitems
  137. alter column "inventoryGroupPermissions" set default 0 ;
  138. COMMIT ;
  139. :VERSION 7
  140. BEGIN TRANSACTION;
  141. -- # "creatorID" goes back to VARCHAR(36) (???)
  142. alter table inventoryitems
  143. alter column "creatorID" type varchar(36);
  144. COMMIT ;
  145. :VERSION 8
  146. ALTER TABLE inventoryitems
  147. alter column "creatorID" set DEFAULT '00000000-0000-0000-0000-000000000000';
  148. :VERSION 9
  149. BEGIN TRANSACTION;
  150. --# "creatorID" goes up to VARCHAR(255)
  151. alter table inventoryitems
  152. alter column "creatorID" type varchar(255);
  153. Commit;
  154. :VERSION 10
  155. BEGIN TRANSACTION;
  156. Alter table inventoryitems Rename Column "SaleType" to "saleType";
  157. Commit;