1
SET client_min_messages=ERROR;
5
ALTER TABLE Ticket RENAME TO Question;
6
ALTER TABLE TicketBug RENAME TO QuestionBug;
7
ALTER TABLE TicketMessage RENAME TO QuestionMessage;
8
ALTER TABLE TicketReopening RENAME TO QuestionReopening;
9
ALTER TABLE TicketSubscription RENAME TO QuestionSubscription;
11
ALTER TABLE SupportContact RENAME TO AnswerContact;
13
-- Update the fticache table so the full text indexes don't get rebuilt
14
UPDATE FtiCache SET tablename='question' WHERE tablename='ticket';
18
ALTER TABLE ticket_id_seq RENAME TO question_id_seq;
19
ALTER TABLE ticketbug_id_seq RENAME TO questionbug_id_seq;
20
ALTER TABLE ticketmessage_id_seq RENAME TO questionmessage_id_seq;
21
ALTER TABLE ticketreopening_id_seq RENAME TO questionreopening_id_seq;
22
ALTER TABLE ticketsubscription_id_seq RENAME TO questionsubscription_id_seq;
24
ALTER TABLE supportcontact_id_seq RENAME TO answercontact_id_seq;
26
-- And ensure SERIAL columns use the renamed sequences
27
-- Yay - PostgreSQL 8.2 now does this automatically for us.
31
ALTER INDEX ticket_answerer_idx RENAME TO question__answerer__idx;
32
ALTER INDEX ticket_assignee_idx RENAME TO question__assignee__idx;
33
ALTER INDEX ticket_distribution_sourcepackagename_idx
34
RENAME TO question__distribution__sourcepackagename__idx;
35
ALTER INDEX ticket_distro_datecreated_idx
36
RENAME TO question__distro__datecreated__idx;
37
ALTER INDEX ticket_fti RENAME TO question__fti;
38
ALTER INDEX ticket_owner_idx RENAME TO question__owner__idx;
39
ALTER INDEX ticket_pkey RENAME TO question_pkey;
40
ALTER INDEX ticket_product_datecreated_idx
41
RENAME TO question__product__datecreated__idx;
42
ALTER INDEX ticket_product_idx RENAME TO question__product__idx;
43
ALTER INDEX ticketbug_bug_ticket_uniq
44
RENAME TO questionbug__bug__question__uniq;
45
ALTER INDEX ticketbug_pkey RENAME TO questionbug_pkey;
46
ALTER INDEX ticketbug_ticket_idx RENAME TO questionbug__question__idx;
47
ALTER INDEX ticketmessage_message_ticket_uniq
48
RENAME TO questionmessage__message__question__uniq;
49
ALTER INDEX ticketmessage_pkey RENAME TO questionmessage_pkey;
50
ALTER INDEX ticketmessage_ticket_idx RENAME TO questionmessage__question__idx;
51
ALTER INDEX ticketreopening_answerer_idx
52
RENAME TO questionreopening__answerer__idx;
53
ALTER INDEX ticketreopening_datecreated_idx
54
RENAME TO questionreopening__datecreated__idx;
55
ALTER INDEX ticketreopening_pkey RENAME TO questionreopening_pkey;
56
ALTER INDEX ticketreopening_reopener_idx
57
RENAME TO questionreopening__reopener__idx ;
58
ALTER INDEX ticketreopening_ticket_idx
59
RENAME TO questionreopening__question__idx;
60
ALTER INDEX ticketsubscription_pkey RENAME TO questionsubscription_pkey;
61
ALTER INDEX ticketsubscription_subscriber_idx
62
RENAME TO questionsubscription__subscriber__idx;
63
ALTER INDEX ticketsubscription_ticket_person_uniq
64
RENAME TO questionsubscription__question__person__uniq;
66
ALTER INDEX supportcontact__distribution__person__key
67
RENAME TO answercontact__distribution__person__key;
68
ALTER INDEX supportcontact__distribution__sourcepackagename__person__key
69
RENAME TO answercontact__distribution__sourcepackagename__person__key;
70
ALTER INDEX supportcontact__person__idx
71
RENAME TO answercontact__person__idx;
72
ALTER INDEX supportcontact__product__person__key
73
RENAME TO answercontact__product__person__key;
74
ALTER INDEX supportcontact_pkey
75
RENAME TO answercontact_pkey;
79
ALTER TABLE QuestionBug RENAME COLUMN ticket TO question;
80
ALTER TABLE QuestionMessage RENAME COLUMN ticket TO question;
81
ALTER TABLE QuestionReopening RENAME COLUMN ticket TO question;
82
ALTER TABLE QuestionSubscription RENAME COLUMN ticket TO question;
84
-- Rename constraints on Question.
87
DROP CONSTRAINT ticket__answer__fk;
89
ADD CONSTRAINT question__answer__fk
90
FOREIGN KEY (answer) REFERENCES questionmessage(id);
93
DROP CONSTRAINT ticket_answerer_fk;
95
ADD CONSTRAINT question__answerer__fk
96
FOREIGN KEY (answerer) REFERENCES person(id);
99
DROP CONSTRAINT ticket_assignee_fk;
101
ADD CONSTRAINT question__assignee__fk
102
FOREIGN KEY (assignee) REFERENCES person(id);
105
DROP CONSTRAINT ticket_distribution_fk;
107
ADD CONSTRAINT question__distribution__fk
108
FOREIGN KEY (distribution) REFERENCES distribution(id);
111
DROP CONSTRAINT ticket_language_fkey;
113
ADD CONSTRAINT question__language__fkey
114
FOREIGN KEY ("language") REFERENCES "language"(id);
117
DROP CONSTRAINT ticket_owner_fk;
119
ADD CONSTRAINT question__owner__fk
120
FOREIGN KEY ("owner") REFERENCES person(id);
123
DROP CONSTRAINT ticket_product_fk;
125
ADD CONSTRAINT question__product__fk
126
FOREIGN KEY (product) REFERENCES product(id);
129
DROP CONSTRAINT ticket_sourcepackagename_fk;
131
ADD CONSTRAINT question__sourcepackagename__fk
132
FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
134
-- Rename constraints on QuestionBug.
136
ALTER TABLE QuestionBug
137
DROP CONSTRAINT ticketbug_bug_fk;
138
ALTER TABLE QuestionBug
139
ADD CONSTRAINT questionbug__bug__fk
140
FOREIGN KEY (bug) REFERENCES bug(id);
142
ALTER TABLE QuestionBug
143
DROP CONSTRAINT ticketbug_ticket_fk;
144
ALTER TABLE QuestionBug
145
ADD CONSTRAINT questionbug__question__fk
146
FOREIGN KEY (question) REFERENCES question(id);
148
-- Rename constraints on QuestionMessage.
149
ALTER TABLE QuestionMessage
150
DROP CONSTRAINT ticketmessage_message_fk;
151
ALTER TABLE QuestionMessage
152
ADD CONSTRAINT questionmessage__message__fk
153
FOREIGN KEY (message) REFERENCES message(id);
155
ALTER TABLE QuestionMessage
156
DROP CONSTRAINT ticketmessage_ticket_fk;
157
ALTER TABLE QuestionMessage
158
ADD CONSTRAINT questionmessage__question__fk
159
FOREIGN KEY (question) REFERENCES question(id);
161
-- Rename constraints on QuestionReopening
162
ALTER TABLE QuestionReopening
163
DROP CONSTRAINT ticketreopening_answerer_fk;
164
ALTER TABLE QuestionReopening
165
ADD CONSTRAINT questionreopening__answerer__fk
166
FOREIGN KEY (answerer) REFERENCES person(id);
168
ALTER TABLE QuestionReopening
169
DROP CONSTRAINT ticketreopening_reopener_fk;
170
ALTER TABLE QuestionReopening
171
ADD CONSTRAINT questionreopening__reopener__fk
172
FOREIGN KEY (reopener) REFERENCES person(id);
174
ALTER TABLE QuestionReopening
175
DROP CONSTRAINT ticketreopening_ticket_fk;
176
ALTER TABLE QuestionReopening
177
ADD CONSTRAINT questionreopening__question__fk
178
FOREIGN KEY (question) REFERENCES question(id);
180
-- Rename constraints on QuestionSubscription
181
ALTER TABLE QuestionSubscription
182
DROP CONSTRAINT ticketsubscription_person_fk;
183
ALTER TABLE QuestionSubscription
184
ADD CONSTRAINT questionsubscription__person__fk
185
FOREIGN KEY (person) REFERENCES person(id);
187
ALTER TABLE QuestionSubscription
188
DROP CONSTRAINT ticketsubscription_ticket_fk;
189
ALTER TABLE QuestionSubscription
190
ADD CONSTRAINT questionsubscription__question__fk
191
FOREIGN KEY (question) REFERENCES question(id);
193
-- Rename constraints on AnswerContact
195
ALTER TABLE AnswerContact
196
DROP CONSTRAINT supportcontact_distribution_fkey;
197
ALTER TABLE AnswerContact
198
ADD CONSTRAINT answercontact__distribution__fkey
199
FOREIGN KEY (distribution) REFERENCES distribution(id);
201
ALTER TABLE AnswerContact
202
DROP CONSTRAINT supportcontact_person_fkey;
203
ALTER TABLE AnswerContact
204
ADD CONSTRAINT answercontact__person__fkey
205
FOREIGN KEY (person) REFERENCES person(id);
207
ALTER TABLE AnswerContact
208
DROP CONSTRAINT supportcontact_product_fkey;
209
ALTER TABLE AnswerContact
210
ADD CONSTRAINT answercontact__product__fkey
211
FOREIGN KEY (product) REFERENCES product(id);
213
ALTER TABLE AnswerContact
214
DROP CONSTRAINT supportcontact_sourcepackagename_fkey;
215
ALTER TABLE AnswerContact
216
ADD CONSTRAINT answercontact__sourcepackagename__fkey
217
FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
219
-- Rename the janitor.
221
UPDATE Person SET name = 'answer-tracker-janitor',
222
displayname = 'Launchpad Answers Janitor'
223
WHERE name = 'support-tracker-janitor';
226
-- Rename KarmaAction.
228
UPDATE KarmaAction SET
229
name = 'questioncommentadded',
230
title = 'Comment made on a question',
231
summary = 'User made a comment on a question in the Answer Tracker'
232
WHERE name = 'ticketcommentadded';
234
UPDATE KarmaAction SET
235
name = 'questiontitlechanged',
236
title = 'Question title changed',
237
summary = 'User changed the title of a question in the Answer Tracker'
238
WHERE name = 'tickettitlechanged';
240
UPDATE KarmaAction SET
241
name = 'questiondescriptionchanged',
242
title = 'Question description changed',
243
summary = 'User changed the description of a question in the Answer Tracker'
244
WHERE name = 'ticketdescriptionchanged';
246
UPDATE KarmaAction SET
247
name = 'questionlinkedtobug',
248
title = 'Question linked to a bug',
249
summary = 'User linked a question in the Answer Tracker to a bug.'
250
WHERE name = 'ticketlinkedtobug';
252
UPDATE KarmaAction SET
253
name = 'questionansweraccepted',
254
title = 'Question owner accepted answer',
255
summary = 'User accepted one of the message as the actual answer to his question.'
256
WHERE name = 'ticketansweraccepted';
258
UPDATE KarmaAction SET
259
name = 'questionanswered',
260
title = 'Answered question',
261
summary = 'User posed a message that was accepted by the question owner as answering the question.'
262
WHERE name = 'ticketanswered';
264
UPDATE KarmaAction SET
265
name = 'questionrequestedinfo',
266
title = 'Requested for information on a question',
267
summary = 'User post a message requesting for more information from a question owner in the Answer Tracker.'
268
WHERE name = 'ticketrequestedinfo';
270
UPDATE KarmaAction SET
271
name = 'questiongaveinfo',
272
title = 'Gave more information on a question',
273
summary = 'User replied to a message asking for more information on a question in the Answer Tracker.'
274
WHERE name = 'ticketgaveinfo';
276
UPDATE KarmaAction SET
277
name = 'questiongaveanswer',
278
title = 'Gave answer on a question',
279
summary = 'User post a message containing an answer to a question in the Answer Tracker. This is distinct from having that message confirmed as solving the problem.'
280
WHERE name = 'ticketgaveanswer';
282
UPDATE KarmaAction SET
283
name = 'questionrejected',
284
title = 'Rejected question',
285
summary = 'User rejected a question in the Answer Tracker.'
286
WHERE name = 'ticketrejected';
288
UPDATE KarmaAction SET
289
name = 'questionownersolved',
290
title = 'Solved own question',
291
summary = 'User post a message explaining how he solved his own problem.'
292
WHERE name = 'ticketownersolved';
294
UPDATE KarmaAction SET
295
name = 'questionreopened',
296
title = 'Reopened question',
297
summary = 'User posed a message to reopen his question in the Answer Tracker.'
298
WHERE name = 'ticketreopened';
300
UPDATE KarmaAction SET
301
name = 'questionasked',
302
title = 'Asked question',
303
summary = 'User asked a question in the Answer Tracker.'
304
WHERE name = 'ticketcreated';
308
UPDATE KarmaCategory SET
310
title = 'Answer Tracker',
311
summary = 'This is the category for all karma associated with helping with users questions in the Launchpad Answer Tracker. Help solve users problems to earn this karma.'
312
WHERE name = 'support';
314
INSERT INTO LaunchpadDatabaseRevision VALUES (79, 15, 0);