os_groups_Store.migrations 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. :VERSION 1 # --------------------------
  2. BEGIN;
  3. CREATE TABLE os_groups_groups (
  4. "GroupID" char(36) Primary Key NOT NULL default '',
  5. "Location" varchar(255) NOT NULL default '',
  6. "Name" varchar(255) NOT NULL default '',
  7. "Charter" text NOT NULL,
  8. "InsigniaID" char(36) NOT NULL default '',
  9. "FounderID" char(36) NOT NULL default '',
  10. "MembershipFee" integer NOT NULL default '0',
  11. "OpenEnrollment" varchar(255) NOT NULL default '',
  12. "ShowInList" integer NOT NULL default '0',
  13. "AllowPublish" integer NOT NULL default '0',
  14. "MaturePublish" integer NOT NULL default '0',
  15. "OwnerRoleID" char(36) NOT NULL default ''
  16. );
  17. CREATE TABLE os_groups_membership (
  18. "GroupID"char(36) NOT NULL default '',
  19. "PrincipalID" VARCHAR(255) NOT NULL default '',
  20. "SelectedRoleID" char(36) NOT NULL default '',
  21. "Contribution" integer NOT NULL default '0',
  22. "ListInProfile" integer NOT NULL default '1',
  23. "AcceptNotices" integer NOT NULL default '1',
  24. "AccessToken" char(36) NOT NULL default '',
  25. constraint os_groupmemberpk primary key ("GroupID", "PrincipalID")
  26. );
  27. CREATE TABLE os_groups_roles (
  28. "GroupID" char(36) NOT NULL default '',
  29. "RoleID" char(36) NOT NULL default '',
  30. "Name" varchar(255) NOT NULL default '',
  31. "Description" varchar(255) NOT NULL default '',
  32. "Title" varchar(255) NOT NULL default '',
  33. "Powers" bigint NOT NULL default 0,
  34. constraint os_grouprolepk PRIMARY KEY ("GroupID","RoleID")
  35. );
  36. CREATE TABLE os_groups_rolemembership (
  37. "GroupID" char(36) NOT NULL default '',
  38. "RoleID" char(36) NOT NULL default '',
  39. "PrincipalID" VARCHAR(255) NOT NULL default '',
  40. constraint os_grouprolememberpk PRIMARY KEY ("GroupID","RoleID","PrincipalID")
  41. );
  42. CREATE TABLE os_groups_invites (
  43. "InviteID" char(36) NOT NULL default '',
  44. "GroupID" char(36) NOT NULL default '',
  45. "RoleID" char(36) NOT NULL default '',
  46. "PrincipalID" VARCHAR(255) NOT NULL default '',
  47. "TMStamp" timestamp NOT NULL default now(),
  48. constraint os_groupinvitespk PRIMARY KEY ("InviteID")
  49. );
  50. -- UNIQUE KEY "PrincipalGroup" ("GroupID","PrincipalID")
  51. CREATE TABLE os_groups_notices (
  52. "GroupID" char(36) NOT NULL default '',
  53. "NoticeID" char(36) NOT NULL default '',
  54. "TMStamp" integer NOT NULL default '0',
  55. "FromName" varchar(255) NOT NULL default '',
  56. "Subject" varchar(255) NOT NULL default '',
  57. "Message" text NOT NULL,
  58. "HasAttachment" integer NOT NULL default '0',
  59. "AttachmentType" integer NOT NULL default '0',
  60. "AttachmentName" varchar(128) NOT NULL default '',
  61. "AttachmentItemID" char(36) NOT NULL default '',
  62. "AttachmentOwnerID" varchar(255) NOT NULL default '',
  63. constraint os_groupsnoticespk PRIMARY KEY ("NoticeID")
  64. );
  65. -- KEY "GroupID" ("GroupID"),
  66. -- KEY "TMStamp" ("TMStamp")
  67. CREATE TABLE os_groups_principals (
  68. "PrincipalID" VARCHAR(255) NOT NULL default '',
  69. "ActiveGroupID" char(36) NOT NULL default '',
  70. constraint os_groupprincpk PRIMARY KEY ("PrincipalID")
  71. );
  72. COMMIT;
  73. :VERSION 2 # --------------------------
  74. BEGIN;
  75. COMMIT;
  76. :VERSION 3
  77. BEGIN;
  78. -- Not a pretty way to do this, but it did not work as-is
  79. -- and nothing was found about converting between existing data
  80. -- and the new type.
  81. -- Since there should be nothing to preserve ...
  82. DROP TABLE IF EXISTS os_groups_groups CASCADE;
  83. CREATE TABLE os_groups_groups (
  84. "GroupID" uuid PRIMARY KEY NOT NULL,
  85. "Location" varchar(255) NOT NULL DEFAULT '',
  86. "Name" varchar(255) NOT NULL DEFAULT '',
  87. "Charter" text NOT NULL,
  88. "InsigniaID" uuid NOT NULL,
  89. "FounderID" uuid NOT NULL,
  90. "MembershipFee" integer NOT NULL DEFAULT '0',
  91. "OpenEnrollment" varchar(255) NOT NULL DEFAULT '',
  92. "ShowInList" integer NOT NULL DEFAULT '0',
  93. "AllowPublish" integer NOT NULL DEFAULT '0',
  94. "MaturePublish" integer NOT NULL DEFAULT '0',
  95. "OwnerRoleID" uuid NOT NULL
  96. );
  97. DROP TABLE IF EXISTS os_groups_membership;
  98. CREATE TABLE os_groups_membership (
  99. "GroupID"uuid NOT NULL,
  100. "PrincipalID" VARCHAR(255) NOT NULL DEFAULT '',
  101. "SelectedRoleID" uuid NOT NULL,
  102. "Contribution" integer NOT NULL DEFAULT '0',
  103. "ListInProfile" integer NOT NULL DEFAULT '1',
  104. "AcceptNotices" integer NOT NULL DEFAULT '1',
  105. "AccessToken" uuid NOT NULL,
  106. constraint os_groupmemberpk PRIMARY KEY ("GroupID", "PrincipalID")
  107. );
  108. DROP TABLE IF EXISTS os_groups_roles;
  109. CREATE TABLE os_groups_roles (
  110. "GroupID" uuid NOT NULL,
  111. "RoleID" uuid NOT NULL,
  112. "Name" varchar(255) NOT NULL DEFAULT '',
  113. "Description" varchar(255) NOT NULL DEFAULT '',
  114. "Title" varchar(255) NOT NULL DEFAULT '',
  115. "Powers" varchar(36) NOT NULL DEFAULT '',
  116. constraint os_grouprolepk PRIMARY KEY ("GroupID","RoleID")
  117. );
  118. DROP TABLE IF EXISTS os_groups_rolemembership;
  119. CREATE TABLE os_groups_rolemembership (
  120. "GroupID" uuid NOT NULL,
  121. "RoleID" uuid NOT NULL,
  122. "PrincipalID" VARCHAR(255) NOT NULL DEFAULT '',
  123. constraint os_grouprolememberpk PRIMARY KEY ("GroupID","RoleID","PrincipalID")
  124. );
  125. DROP TABLE IF EXISTS os_groups_invites;
  126. CREATE TABLE os_groups_invites (
  127. "InviteID" uuid NOT NULL,
  128. "GroupID" uuid NOT NULL,
  129. "RoleID" uuid NOT NULL,
  130. "PrincipalID" VARCHAR(255) NOT NULL DEFAULT '',
  131. "TMStamp" timestamp NOT NULL DEFAULT now(),
  132. constraint os_groupinvitespk PRIMARY KEY ("InviteID")
  133. );
  134. DROP TABLE IF EXISTS os_groups_notices;
  135. CREATE TABLE os_groups_notices (
  136. "GroupID" uuid NOT NULL,
  137. "NoticeID" uuid NOT NULL,
  138. "TMStamp" integer NOT NULL DEFAULT '0',
  139. "FromName" varchar(255) NOT NULL DEFAULT '',
  140. "Subject" varchar(255) NOT NULL DEFAULT '',
  141. "Message" text NOT NULL,
  142. "HasAttachment" integer NOT NULL DEFAULT '0',
  143. "AttachmentType" integer NOT NULL DEFAULT '0',
  144. "AttachmentName" varchar(128) NOT NULL DEFAULT '',
  145. "AttachmentItemID" uuid NOT NULL,
  146. "AttachmentOwnerID" varchar(255) NOT NULL DEFAULT '',
  147. constraint os_groupsnoticespk PRIMARY KEY ("NoticeID")
  148. );
  149. DROP TABLE IF EXISTS os_groups_principals;
  150. CREATE TABLE os_groups_principals (
  151. "PrincipalID" VARCHAR(255) NOT NULL DEFAULT '',
  152. "ActiveGroupID" uuid NOT NULL,
  153. constraint os_groupprincpk PRIMARY KEY ("PrincipalID")
  154. );
  155. COMMIT;
  156. :VERSION 4
  157. BEGIN;
  158. ALTER TABLE IF EXISTS os_groups_notices
  159. ALTER COLUMN "AttachmentItemID" SET DEFAULT '00000000-0000-0000-0000-000000000000'
  160. ;
  161. COMMIT;