UserStore.migrations 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. :VERSION 1
  2. CREATE TABLE users (
  3. "UUID" varchar(36) NOT NULL default '' Primary Key,
  4. "username" varchar(32) NOT NULL,
  5. "lastname" varchar(32) NOT NULL,
  6. "passwordHash" varchar(32) NOT NULL,
  7. "passwordSalt" varchar(32) NOT NULL,
  8. "homeRegion" bigint default NULL,
  9. "homeLocationX" double precision default NULL,
  10. "homeLocationY" double precision default NULL,
  11. "homeLocationZ" double precision default NULL,
  12. "homeLookAtX" double precision default NULL,
  13. "homeLookAtY" double precision default NULL,
  14. "homeLookAtZ" double precision default NULL,
  15. "created" int NOT NULL,
  16. "lastLogin" int NOT NULL,
  17. "userInventoryURI" varchar(255) default NULL,
  18. "userAssetURI" varchar(255) default NULL,
  19. "profileCanDoMask" int default NULL,
  20. "profileWantDoMask" int default NULL,
  21. "profileAboutText" text,
  22. "profileFirstText" text,
  23. "profileImage" varchar(36) default NULL,
  24. "profileFirstImage" varchar(36) default NULL,
  25. "webLoginKey" varchar(36) default NULL
  26. );
  27. CREATE INDEX "usernames" ON users
  28. (
  29. "username" ASC,
  30. "lastname" ASC
  31. );
  32. CREATE TABLE agents (
  33. "UUID" varchar(36) NOT NULL Primary Key,
  34. "sessionID" varchar(36) NOT NULL,
  35. "secureSessionID" varchar(36) NOT NULL,
  36. "agentIP" varchar(16) NOT NULL,
  37. "agentPort" int NOT NULL,
  38. "agentOnline" smallint NOT NULL,
  39. "loginTime" int NOT NULL,
  40. "logoutTime" int NOT NULL,
  41. "currentRegion" varchar(36) NOT NULL,
  42. "currentHandle" bigint NOT NULL,
  43. "currentPos" varchar(64) NOT NULL
  44. );
  45. CREATE INDEX session ON agents
  46. (
  47. "sessionID" ASC
  48. );
  49. CREATE INDEX ssession ON agents
  50. (
  51. "secureSessionID" ASC
  52. );
  53. CREATE TABLE userfriends(
  54. "ownerID" varchar(50) NOT NULL,
  55. "friendID" varchar(50) NOT NULL,
  56. "friendPerms" varchar(50) NOT NULL,
  57. "datetimestamp" varchar(50) NOT NULL
  58. );
  59. CREATE TABLE avatarappearance (
  60. "Owner" varchar(36) NOT NULL primary key,
  61. "Serial" int NOT NULL,
  62. "Visual_Params" bytea NOT NULL,
  63. "Texture" bytea NOT NULL,
  64. "Avatar_Height" double precision NOT NULL,
  65. "Body_Item" varchar(36) NOT NULL,
  66. "Body_Asset" varchar(36) NOT NULL,
  67. "Skin_Item" varchar(36) NOT NULL,
  68. "Skin_Asset" varchar(36) NOT NULL,
  69. "Hair_Item" varchar(36) NOT NULL,
  70. "Hair_Asset" varchar(36) NOT NULL,
  71. "Eyes_Item" varchar(36) NOT NULL,
  72. "Eyes_Asset" varchar(36) NOT NULL,
  73. "Shirt_Item" varchar(36) NOT NULL,
  74. "Shirt_Asset" varchar(36) NOT NULL,
  75. "Pants_Item" varchar(36) NOT NULL,
  76. "Pants_Asset" varchar(36) NOT NULL,
  77. "Shoes_Item" varchar(36) NOT NULL,
  78. "Shoes_Asset" varchar(36) NOT NULL,
  79. "Socks_Item" varchar(36) NOT NULL,
  80. "Socks_Asset" varchar(36) NOT NULL,
  81. "Jacket_Item" varchar(36) NOT NULL,
  82. "Jacket_Asset" varchar(36) NOT NULL,
  83. "Gloves_Item" varchar(36) NOT NULL,
  84. "Gloves_Asset" varchar(36) NOT NULL,
  85. "Undershirt_Item" varchar(36) NOT NULL,
  86. "Undershirt_Asset" varchar(36) NOT NULL,
  87. "Underpants_Item" varchar(36) NOT NULL,
  88. "Underpants_Asset" varchar(36) NOT NULL,
  89. "Skirt_Item" varchar(36) NOT NULL,
  90. "Skirt_Asset" varchar(36) NOT NULL
  91. );
  92. :VERSION 2
  93. BEGIN TRANSACTION;
  94. ALTER TABLE users ADD "homeRegionID" varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
  95. ALTER TABLE users ADD "userFlags" int NOT NULL default 0;
  96. ALTER TABLE users ADD "godLevel" int NOT NULL default 0;
  97. ALTER TABLE users ADD "customType" varchar(32) not null default '';
  98. ALTER TABLE users ADD "partner" varchar(36) not null default '00000000-0000-0000-0000-000000000000';
  99. COMMIT;
  100. :VERSION 3
  101. BEGIN TRANSACTION;
  102. CREATE TABLE avatarattachments (
  103. "UUID" varchar(36) NOT NULL
  104. , "attachpoint" int NOT NULL
  105. , item varchar(36) NOT NULL
  106. , asset varchar(36) NOT NULL);
  107. CREATE INDEX IX_avatarattachments ON avatarattachments
  108. (
  109. "UUID"
  110. );
  111. COMMIT;
  112. :VERSION 4
  113. BEGIN TRANSACTION;
  114. CREATE TABLE Tmp_userfriends
  115. (
  116. "ownerID" varchar(36) NOT NULL,
  117. "friendID" varchar(36) NOT NULL,
  118. "friendPerms" int NOT NULL,
  119. "datetimestamp" int NOT NULL
  120. );
  121. INSERT INTO Tmp_userfriends ("ownerID", "friendID", "friendPerms", "datetimestamp")
  122. SELECT cast("ownerID" as varchar(36)), cast("friendID" as varchar(36)), cast("friendPerms" as int), cast("datetimestamp" as int)
  123. FROM userfriends;
  124. DROP TABLE userfriends;
  125. alter table Tmp_userfriends rename to userfriends;
  126. CREATE INDEX IX_userfriends_ownerID ON userfriends
  127. (
  128. "ownerID"
  129. );
  130. CREATE INDEX IX_userfriends_friendID ON userfriends
  131. (
  132. "friendID"
  133. );
  134. COMMIT;
  135. :VERSION 5
  136. BEGIN TRANSACTION;
  137. ALTER TABLE users add "email" varchar(250);
  138. COMMIT;
  139. :VERSION 6
  140. BEGIN TRANSACTION;
  141. CREATE TABLE Tmp_users
  142. (
  143. "UUID" uuid NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
  144. "username" varchar(32) NOT NULL,
  145. "lastname" varchar(32) NOT NULL,
  146. "passwordHash" varchar(32) NOT NULL,
  147. "passwordSalt" varchar(32) NOT NULL,
  148. "homeRegion" bigint NULL DEFAULT (NULL),
  149. "homeLocationX" double precision NULL DEFAULT (NULL),
  150. "homeLocationY" double precision NULL DEFAULT (NULL),
  151. "homeLocationZ" double precision NULL DEFAULT (NULL),
  152. "homeLookAtX" double precision NULL DEFAULT (NULL),
  153. "homeLookAtY" double precision NULL DEFAULT (NULL),
  154. "homeLookAtZ" double precision NULL DEFAULT (NULL),
  155. "created" int NOT NULL,
  156. "lastLogin" int NOT NULL,
  157. "userInventoryURI" varchar(255) NULL DEFAULT (NULL),
  158. "userAssetURI" varchar(255) NULL DEFAULT (NULL),
  159. "profileCanDoMask" int NULL DEFAULT (NULL),
  160. "profileWantDoMask" int NULL DEFAULT (NULL),
  161. "profileAboutText" text NULL,
  162. "profileFirstText" text NULL,
  163. "profileImage" uuid NULL DEFAULT (NULL),
  164. "profileFirstImage" uuid NULL DEFAULT (NULL),
  165. "webLoginKey" uuid NULL DEFAULT (NULL),
  166. "homeRegionID" uuid NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
  167. "userFlags" int NOT NULL DEFAULT ((0)),
  168. "godLevel" int NOT NULL DEFAULT ((0)),
  169. "customType" varchar(32) NOT NULL DEFAULT (''),
  170. "partner" uuid NOT NULL DEFAULT ('00000000-0000-0000-0000-000000000000'),
  171. email varchar(250) NULL
  172. );
  173. INSERT INTO Tmp_users ("UUID", "username", "lastname", "passwordHash", "passwordSalt", "homeRegion", "homeLocationX", "homeLocationY", "homeLocationZ", "homeLookAtX", "homeLookAtY", "homeLookAtZ", "created", "lastLogin", "userInventoryURI", "userAssetURI", "profileCanDoMask", "profileWantDoMask", "profileAboutText", "profileFirstText", "profileImage", "profileFirstImage", "webLoginKey", "homeRegionID", "userFlags", "godLevel", "customType", "partner", email)
  174. SELECT cast("UUID" as uuid), "username", "lastname", "passwordHash", "passwordSalt", "homeRegion", "homeLocationX", "homeLocationY", "homeLocationZ", "homeLookAtX", "homeLookAtY", "homeLookAtZ", "created", "lastLogin", "userInventoryURI", "userAssetURI", "profileCanDoMask", "profileWantDoMask", "profileAboutText", "profileFirstText", cast("profileImage" as uuid), cast("profileFirstImage" as uuid), cast("webLoginKey" as uuid), cast("homeRegionID" as uuid), "userFlags", "godLevel", "customType", cast("partner" as uuid), email
  175. FROM users ;
  176. DROP TABLE users;
  177. alter table Tmp_users rename to users;
  178. ALTER TABLE users ADD CONSTRAINT
  179. PK__users__65A475E737A5467C PRIMARY KEY
  180. (
  181. "UUID"
  182. );
  183. CREATE INDEX "usernames" ON users
  184. (
  185. "username",
  186. "lastname"
  187. );
  188. COMMIT;
  189. :VERSION 7
  190. BEGIN TRANSACTION;
  191. CREATE TABLE Tmp_agents
  192. (
  193. "UUID" uuid NOT NULL,
  194. "sessionID" uuid NOT NULL,
  195. "secureSessionID" uuid NOT NULL,
  196. "agentIP" varchar(16) NOT NULL,
  197. "agentPort" int NOT NULL,
  198. "agentOnline" smallint NOT NULL,
  199. "loginTime" int NOT NULL,
  200. "logoutTime" int NOT NULL,
  201. "currentRegion" uuid NOT NULL,
  202. "currentHandle" bigint NOT NULL,
  203. "currentPos" varchar(64) NOT NULL
  204. );
  205. INSERT INTO Tmp_agents ("UUID", "sessionID", "secureSessionID", "agentIP", "agentPort", "agentOnline", "loginTime", "logoutTime", "currentRegion", "currentHandle", "currentPos")
  206. SELECT cast("UUID" as uuid), cast("sessionID" as uuid), cast("secureSessionID" as uuid), "agentIP", "agentPort", "agentOnline", "loginTime", "logoutTime", cast("currentRegion" as uuid), "currentHandle", "currentPos"
  207. FROM agents ;
  208. DROP TABLE agents;
  209. alter table Tmp_agents rename to agents;
  210. ALTER TABLE agents ADD CONSTRAINT
  211. PK__agents__65A475E749C3F6B7 PRIMARY KEY
  212. (
  213. "UUID"
  214. ) ;
  215. CREATE INDEX session ON agents
  216. (
  217. "sessionID"
  218. );
  219. CREATE INDEX ssession ON agents
  220. (
  221. "secureSessionID"
  222. );
  223. COMMIT;
  224. :VERSION 8
  225. BEGIN TRANSACTION;
  226. CREATE TABLE Tmp_userfriends
  227. (
  228. "ownerID" uuid NOT NULL,
  229. "friendID" uuid NOT NULL,
  230. "friendPerms" int NOT NULL,
  231. "datetimestamp" int NOT NULL
  232. );
  233. INSERT INTO Tmp_userfriends ("ownerID", "friendID", "friendPerms", "datetimestamp")
  234. SELECT cast("ownerID" as uuid), cast( "friendID" as uuid), "friendPerms", "datetimestamp"
  235. FROM userfriends;
  236. DROP TABLE userfriends;
  237. alter table Tmp_userfriends rename to userfriends;
  238. CREATE INDEX IX_userfriends_ownerID ON userfriends
  239. (
  240. "ownerID"
  241. );
  242. CREATE INDEX IX_userfriends_friendID ON userfriends
  243. (
  244. "friendID"
  245. );
  246. COMMIT;
  247. :VERSION 9
  248. BEGIN TRANSACTION;
  249. CREATE TABLE Tmp_avatarappearance
  250. (
  251. "Owner" uuid NOT NULL,
  252. "Serial" int NOT NULL,
  253. "Visual_Params" bytea NOT NULL,
  254. "Texture" bytea NOT NULL,
  255. "Avatar_Height" double precision NOT NULL,
  256. "Body_Item" uuid NOT NULL,
  257. "Body_Asset" uuid NOT NULL,
  258. "Skin_Item" uuid NOT NULL,
  259. "Skin_Asset" uuid NOT NULL,
  260. "Hair_Item" uuid NOT NULL,
  261. "Hair_Asset" uuid NOT NULL,
  262. "Eyes_Item" uuid NOT NULL,
  263. "Eyes_Asset" uuid NOT NULL,
  264. "Shirt_Item" uuid NOT NULL,
  265. "Shirt_Asset" uuid NOT NULL,
  266. "Pants_Item" uuid NOT NULL,
  267. "Pants_Asset" uuid NOT NULL,
  268. "Shoes_Item" uuid NOT NULL,
  269. "Shoes_Asset" uuid NOT NULL,
  270. "Socks_Item" uuid NOT NULL,
  271. "Socks_Asset" uuid NOT NULL,
  272. "Jacket_Item" uuid NOT NULL,
  273. "Jacket_Asset" uuid NOT NULL,
  274. "Gloves_Item" uuid NOT NULL,
  275. "Gloves_Asset" uuid NOT NULL,
  276. "Undershirt_Item" uuid NOT NULL,
  277. "Undershirt_Asset" uuid NOT NULL,
  278. "Underpants_Item" uuid NOT NULL,
  279. "Underpants_Asset" uuid NOT NULL,
  280. "Skirt_Item" uuid NOT NULL,
  281. "Skirt_Asset" uuid NOT NULL
  282. );
  283. INSERT INTO Tmp_avatarappearance ("Owner", "Serial", "Visual_Params", "Texture", "Avatar_Height", "Body_Item", "Body_Asset", "Skin_Item", "Skin_Asset", "Hair_Item", "Hair_Asset", "Eyes_Item", "Eyes_Asset", "Shirt_Item", "Shirt_Asset", "Pants_Item", "Pants_Asset", "Shoes_Item", "Shoes_Asset", "Socks_Item", "Socks_Asset", "Jacket_Item", "Jacket_Asset", "Gloves_Item", "Gloves_Asset", "Undershirt_Item", "Undershirt_Asset", "Underpants_Item", "Underpants_Asset", "Skirt_Item", "Skirt_Asset")
  284. SELECT cast("Owner" as uuid), "Serial", "Visual_Params", "Texture", "Avatar_Height", cast("Body_Item" as uuid), cast("Body_Asset" as uuid), cast("Skin_Item" as uuid), cast("Skin_Asset" as uuid), cast("Hair_Item" as uuid), cast("Hair_Asset" as uuid), cast("Eyes_Item" as uuid), cast("Eyes_Asset" as uuid), cast("Shirt_Item" as uuid), cast("Shirt_Asset" as uuid), cast("Pants_Item" as uuid), cast("Pants_Asset" as uuid), cast("Shoes_Item" as uuid), cast("Shoes_Asset" as uuid), cast("Socks_Item" as uuid), cast("Socks_Asset" as uuid), cast("Jacket_Item" as uuid), cast("Jacket_Asset" as uuid), cast("Gloves_Item" as uuid), cast("Gloves_Asset" as uuid), cast("Undershirt_Item" as uuid), cast("Undershirt_Asset" as uuid), cast("Underpants_Item" as uuid), cast("Underpants_Asset" as uuid), cast("Skirt_Item" as uuid), cast("Skirt_Asset" as uuid)
  285. FROM avatarappearance ;
  286. DROP TABLE avatarappearance;
  287. alter table Tmp_avatarappearance rename to avatarappearance;
  288. ALTER TABLE avatarappearance ADD CONSTRAINT
  289. PK__avatarap__7DD115CC4E88ABD4 PRIMARY KEY
  290. (
  291. "Owner"
  292. );
  293. COMMIT;
  294. :VERSION 10
  295. BEGIN TRANSACTION;
  296. CREATE TABLE Tmp_avatarattachments
  297. (
  298. "UUID" uuid NOT NULL,
  299. "attachpoint" int NOT NULL,
  300. item uuid NOT NULL,
  301. asset uuid NOT NULL
  302. );
  303. INSERT INTO Tmp_avatarattachments ("UUID", "attachpoint", item, asset)
  304. SELECT cast("UUID" as uuid), "attachpoint", cast(item as uuid), cast(asset as uuid)
  305. FROM avatarattachments ;
  306. DROP TABLE avatarattachments;
  307. alter table Tmp_avatarattachments rename to avatarattachments;
  308. CREATE INDEX IX_avatarattachments ON avatarattachments
  309. (
  310. "UUID"
  311. );
  312. COMMIT;
  313. :VERSION 11
  314. BEGIN TRANSACTION;
  315. ALTER TABLE users ADD "scopeID" uuid not null default '00000000-0000-0000-0000-000000000000';
  316. COMMIT;