]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - db/08to09.sql
Add request_queue table and user_group.join_policy column, for upcoming join & subscr...
[quix0rs-gnu-social.git] / db / 08to09.sql
1 alter table notice
2      modify column content text comment 'update content',
3      add column lat decimal(10,7) comment 'latitude',
4      add column lon decimal(10,7) comment 'longitude',
5      add column location_id integer comment 'location id if possible',
6      add column location_ns integer comment 'namespace for location',
7      add column repeat_of integer comment 'notice this is a repeat of' references notice (id),
8      drop index notice_profile_id_idx,
9      add index notice_profile_id_idx (profile_id,created,id),
10      add index notice_repeatof_idx (repeat_of);
11
12 alter table message
13      modify column content text comment 'message content';
14
15 alter table profile
16      modify column bio text comment 'descriptive biography',
17      add column lat decimal(10,7) comment 'latitude',
18      add column lon decimal(10,7) comment 'longitude',
19      add column location_id integer comment 'location id if possible',
20      add column location_ns integer comment 'namespace for location';
21
22 alter table user_group
23      modify column description text comment 'group description';
24
25 alter table file_oembed
26      add column mimetype varchar(50) comment 'mime type of resource';
27
28 alter table fave
29     drop index fave_user_id_idx,
30     add index fave_user_id_idx (user_id,modified);
31
32 alter table subscription
33     drop index subscription_subscriber_idx,
34     add index subscription_subscriber_idx (subscriber,created),
35     drop index subscription_subscribed_idx,
36     add index subscription_subscribed_idx (subscribed,created);
37
38 create table deleted_notice (
39
40     id integer primary key comment 'identity of notice',
41     profile_id integer not null comment 'author of the notice',
42     uri varchar(255) unique key comment 'universally unique identifier, usually a tag URI',
43     created datetime not null comment 'date the notice record was created',
44     deleted datetime not null comment 'date the notice record was created',
45
46     index deleted_notice_profile_id_idx (profile_id)
47
48 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
49
50 create table config (
51
52     section varchar(32) comment 'configuration section',
53     setting varchar(32) comment 'configuration setting',
54     value varchar(255) comment 'configuration value',
55
56     constraint primary key (section, setting)
57
58 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
59
60 create table profile_role (
61
62     profile_id integer not null comment 'account having the role' references profile (id),
63     role    varchar(32) not null comment 'string representing the role',
64     created datetime not null comment 'date the role was granted',
65
66     constraint primary key (profile_id, role)
67
68 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
69
70 create table location_namespace (
71
72     id integer primary key comment 'identity for this namespace',
73     description varchar(255) comment 'description of the namespace',
74     created datetime not null comment 'date the record was created',
75     modified timestamp comment 'date this record was modified'
76
77 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
78
79 create table login_token (
80     user_id integer not null comment 'user owning this token' references user (id),
81     token char(32) not null comment 'token useable for logging in',
82     created datetime not null comment 'date this record was created',
83     modified timestamp comment 'date this record was modified',
84
85     constraint primary key (user_id)
86 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
87
88 create table user_location_prefs (
89     user_id integer not null comment 'user who has the preference' references user (id),
90     share_location tinyint default 1 comment 'Whether to share location data',
91     created datetime not null comment 'date this record was created',
92     modified timestamp comment 'date this record was modified',
93
94     constraint primary key (user_id)
95 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
96
97 create table queue_item_new (
98     id integer auto_increment primary key comment 'unique identifier',
99     frame blob not null comment 'data: object reference or opaque string',
100     transport varchar(8) not null comment 'queue for what? "email", "jabber", "sms", "irc", ...',
101     created datetime not null comment 'date this record was created',
102     claimed datetime comment 'date this item was claimed',
103
104     index queue_item_created_idx (created)
105
106 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
107
108 insert into queue_item_new (frame,transport,created,claimed)
109     select notice_id,transport,created,claimed from queue_item;
110 alter table queue_item rename to queue_item_old;
111 alter table queue_item_new rename to queue_item;
112
113 alter table consumer
114     add consumer_secret varchar(255) not null comment 'secret value';
115
116 alter table token
117     add verifier varchar(255) comment 'verifier string for OAuth 1.0a',
118     add verified_callback varchar(255) comment 'verified callback URL for OAuth 1.0a';
119
120 create table oauth_application (
121     id integer auto_increment primary key comment 'unique identifier',
122     owner integer not null comment 'owner of the application' references profile (id),
123     consumer_key varchar(255) not null comment 'application consumer key' references consumer (consumer_key),
124     name varchar(255) not null comment 'name of the application',
125     description varchar(255) comment 'description of the application',
126     icon varchar(255) not null comment 'application icon',
127     source_url varchar(255) comment 'application homepage - used for source link',
128     organization varchar(255) comment 'name of the organization running the application',
129     homepage varchar(255) comment 'homepage for the organization',
130     callback_url varchar(255) comment 'url to redirect to after authentication',
131     type tinyint default 0 comment 'type of app, 1 = browser, 2 = desktop',
132     access_type tinyint default 0 comment 'default access type, bit 1 = read, bit 2 = write',
133     created datetime not null comment 'date this record was created',
134     modified timestamp comment 'date this record was modified'
135 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
136
137 create table oauth_application_user (
138     profile_id integer not null comment 'user of the application' references profile (id),
139     application_id integer not null comment 'id of the application' references oauth_application (id),
140     access_type tinyint default 0 comment 'access type, bit 1 = read, bit 2 = write, bit 3 = revoked',
141     token varchar(255) comment 'request or access token',
142     created datetime not null comment 'date this record was created',
143     modified timestamp comment 'date this record was modified',
144     constraint primary key (profile_id, application_id)
145 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
146
147 create table inbox (
148
149     user_id integer not null comment 'user receiving the notice' references user (id),
150     notice_ids blob comment 'packed list of notice ids',
151
152     constraint primary key (user_id)
153
154 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
155
156 create table conversation (
157     id integer auto_increment primary key comment 'unique identifier',
158     uri varchar(225) unique comment 'URI of the conversation',
159     created datetime not null comment 'date this record was created',
160     modified timestamp comment 'date this record was modified'
161 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
162
163 -- stub entry to push the autoincrement past existing notice ids
164 insert into conversation (id,created)
165     select max(id)+1, now() from notice;
166
167 alter table user_group
168     add uri varchar(255) unique key comment 'universal identifier',
169     add mainpage varchar(255) comment 'page for group info to link to',
170     drop index nickname;
171
172 create table local_group (
173
174    group_id integer primary key comment 'group represented' references user_group (id),
175    nickname varchar(64) unique key comment 'group represented',
176
177    created datetime not null comment 'date this record was created',
178    modified timestamp comment 'date this record was modified'
179
180 ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
181
182 insert into local_group (group_id, nickname, created)
183     select id, nickname, created from user_group;
184
185 alter table file_to_post
186     add index post_id_idx (post_id);
187
188 alter table group_inbox
189     add index group_inbox_notice_id_idx (notice_id);
190