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