AssetStore.migrations 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # -----------------
  2. :VERSION 1
  3. BEGIN;
  4. CREATE TABLE `assets` (
  5. `id` binary(16) NOT NULL,
  6. `name` varchar(64) NOT NULL,
  7. `description` varchar(64) NOT NULL,
  8. `assetType` tinyint(4) NOT NULL,
  9. `invType` tinyint(4) NOT NULL,
  10. `local` tinyint(1) NOT NULL,
  11. `temporary` tinyint(1) NOT NULL,
  12. `data` longblob NOT NULL,
  13. PRIMARY KEY (`id`)
  14. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
  15. COMMIT;
  16. # -----------------
  17. :VERSION 2
  18. BEGIN;
  19. ALTER TABLE assets change id oldid binary(16);
  20. ALTER TABLE assets add id varchar(36) not null default '';
  21. UPDATE assets set id = concat(substr(hex(oldid),1,8),"-",substr(hex(oldid),9,4),"-",substr(hex(oldid),13,4),"-",substr(hex(oldid),17,4),"-",substr(hex(oldid),21,12));
  22. ALTER TABLE assets drop oldid;
  23. ALTER TABLE assets add constraint primary key(id);
  24. COMMIT;
  25. # -----------------
  26. :VERSION 3
  27. BEGIN;
  28. ALTER TABLE assets change id oldid varchar(36);
  29. ALTER TABLE assets add id char(36) not null default '00000000-0000-0000-0000-000000000000';
  30. UPDATE assets set id = oldid;
  31. ALTER TABLE assets drop oldid;
  32. ALTER TABLE assets add constraint primary key(id);
  33. COMMIT;
  34. # -----------------
  35. :VERSION 4
  36. BEGIN;
  37. ALTER TABLE assets drop InvType;
  38. COMMIT;
  39. # -----------------
  40. :VERSION 5
  41. BEGIN;
  42. ALTER TABLE assets add create_time integer default 0;
  43. ALTER TABLE assets add access_time integer default 0;
  44. COMMIT;
  45. # -----------------
  46. :VERSION 6
  47. DELETE FROM assets WHERE id = 'dc4b9f0b-d008-45c6-96a4-01dd947ac621'
  48. :VERSION 7
  49. ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
  50. :VERSION 8
  51. ALTER TABLE assets ADD COLUMN CreatorID varchar(128) NOT NULL DEFAULT '';
  52. :VERSION 9
  53. BEGIN;
  54. COMMIT;