~launchpad-pqm/launchpad/devel

8687.15.9 by Karl Fogel
Add the copyright header block to more files (everything under database/).
1
-- Copyright 2009 Canonical Ltd.  This software is licensed under the
2
-- GNU Affero General Public License version 3 (see the file LICENSE).
3
6609.7.2 by Curtis Hovey
Added a SQL script to pending that can be used to fix accounts with broken email addresses.
4
-- Fix the missing account on validated and preferred email addresses.
5
-- Launchpad must be restarted; Storm will not see the changes.
6
7
SET client_min_messages=ERROR;
8
9
UPDATE
10
    EmailAddress
11
SET
12
    account = Person.account
13
FROM
14
    Person
15
WHERE
16
    Person.id = EmailAddress.person
17
    AND Person.account IS NOT NULL
18
    AND EmailAddress.status in (2, 4)
19
    AND EmailAddress.account IS NULL;
20
21
22
/*
23
24
-- Select all preferred email addresses for active accounts that
25
-- are missing their account.
26
SELECT
27
    Account.id AS account_id,
28
    Account.status AS account_status,
29
    Account.displayname AS account_displayname,
30
    EmailAddress.*
31
FROM
32
    Account,
33
    EmailAddress,
34
    Person
35
WHERE
36
    Account.id = Person.account
37
    AND Person.id = EmailAddress.person
38
    AND Account.status = 20
6609.7.4 by Curtis Hovey
Updated script
39
    AND EmailAddress.Status in (2, 4)
6609.7.2 by Curtis Hovey
Added a SQL script to pending that can be used to fix accounts with broken email addresses.
40
    AND EmailAddress.account is NULL;
41
42
*/