1
0

AssetStore.migrations 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. :VERSION 1
  2. CREATE TABLE assets (
  3. "id" varchar(36) NOT NULL PRIMARY KEY,
  4. "name" varchar(64) NOT NULL,
  5. "description" varchar(64) NOT NULL,
  6. "assetType" smallint NOT NULL,
  7. "local" smallint NOT NULL,
  8. "temporary" smallint NOT NULL,
  9. "data" bytea NOT NULL
  10. ) ;
  11. :VERSION 2
  12. BEGIN TRANSACTION;
  13. CREATE TABLE Tmp_assets
  14. (
  15. "id" varchar(36) NOT NULL,
  16. "name" varchar(64) NOT NULL,
  17. "description" varchar(64) NOT NULL,
  18. "assetType" smallint NOT NULL,
  19. "local" boolean NOT NULL,
  20. "temporary" boolean NOT NULL,
  21. "data" bytea NOT NULL
  22. ) ;
  23. INSERT INTO Tmp_assets ("id", "name", "description", "assetType", "local", "temporary", "data")
  24. SELECT "id", "name", "description", "assetType", case when "local" = 1 then true else false end, case when "temporary" = 1 then true else false end, "data"
  25. FROM assets ;
  26. DROP TABLE assets;
  27. Alter table Tmp_assets
  28. rename to assets;
  29. ALTER TABLE assets ADD PRIMARY KEY ("id");
  30. COMMIT;
  31. :VERSION 3
  32. BEGIN TRANSACTION;
  33. ALTER TABLE assets add "create_time" integer default 0;
  34. ALTER TABLE assets add "access_time" integer default 0;
  35. COMMIT;
  36. :VERSION 4
  37. BEGIN TRANSACTION;
  38. CREATE TABLE Tmp_assets
  39. (
  40. "id" uuid NOT NULL,
  41. "name" varchar(64) NOT NULL,
  42. "description" varchar(64) NOT NULL,
  43. "assetType" smallint NOT NULL,
  44. "local" boolean NOT NULL,
  45. "temporary" boolean NOT NULL,
  46. "data" bytea NOT NULL,
  47. "create_time" int NULL,
  48. "access_time" int NULL
  49. ) ;
  50. INSERT INTO Tmp_assets ("id", "name", "description", "assetType", "local", "temporary", "data", "create_time", "access_time")
  51. SELECT cast("id" as uuid), "name", "description", "assetType", "local", "temporary", "data", "create_time", "access_time"
  52. FROM assets ;
  53. DROP TABLE assets;
  54. Alter table Tmp_assets
  55. rename to assets;
  56. ALTER TABLE assets ADD PRIMARY KEY ("id");
  57. COMMIT;
  58. :VERSION 5
  59. DELETE FROM assets WHERE "id" = 'dc4b9f0b-d008-45c6-96a4-01dd947ac621';
  60. :VERSION 6
  61. ALTER TABLE assets ADD "asset_flags" INTEGER NOT NULL DEFAULT 0;
  62. :VERSION 7
  63. alter table assets add "creatorid" varchar(36) not null default '';