~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to database/schema/launchpad-2208-00-0.sql

  • Committer: Steve Kowalik
  • Date: 2011-08-07 04:05:52 UTC
  • mto: This revision was merged to the branch mainline in revision 13626.
  • Revision ID: stevenk@ubuntu.com-20110807040552-mwnxo0flmhvl35e8
Correct the notification based on review comments, and remove request{,ed}
from the function names, switching to create{,d}.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- Generated Tue Aug 17 10:52:11 2010 UTC
1
2
 
2
3
SET client_min_messages TO ERROR;
3
 
SET statement_timeout = 0;
 
4
 
 
5
 
4
6
SET client_encoding = 'UTF8';
5
7
SET standard_conforming_strings = off;
6
8
SET check_function_bodies = false;
7
9
SET client_min_messages = warning;
8
10
SET escape_string_warning = off;
9
11
 
10
 
CREATE SCHEMA todrop;
11
 
 
12
 
 
13
 
CREATE SCHEMA ts2;
14
 
 
15
 
 
16
 
CREATE PROCEDURAL LANGUAGE plpgsql;
17
 
 
18
 
 
19
 
CREATE PROCEDURAL LANGUAGE plpythonu;
20
 
 
21
 
 
22
12
SET search_path = public, pg_catalog;
23
13
 
24
 
CREATE TYPE debversion;
25
 
 
26
 
 
27
 
CREATE FUNCTION debversionin(cstring) RETURNS debversion
28
 
    LANGUAGE internal IMMUTABLE STRICT
29
 
    AS $$textin$$;
30
 
 
31
 
 
32
 
CREATE FUNCTION debversionout(debversion) RETURNS cstring
33
 
    LANGUAGE internal IMMUTABLE STRICT
34
 
    AS $$textout$$;
35
 
 
36
 
 
37
 
CREATE FUNCTION debversionrecv(internal) RETURNS debversion
38
 
    LANGUAGE internal STABLE STRICT
39
 
    AS $$textrecv$$;
40
 
 
41
 
 
42
 
CREATE FUNCTION debversionsend(debversion) RETURNS bytea
43
 
    LANGUAGE internal STABLE STRICT
44
 
    AS $$textsend$$;
45
 
 
46
 
 
47
 
CREATE TYPE debversion (
48
 
    INTERNALLENGTH = variable,
49
 
    INPUT = debversionin,
50
 
    OUTPUT = debversionout,
51
 
    RECEIVE = debversionrecv,
52
 
    SEND = debversionsend,
53
 
    CATEGORY = 'S',
54
 
    ALIGNMENT = int4,
55
 
    STORAGE = extended
56
 
);
57
 
 
58
 
 
59
 
COMMENT ON TYPE debversion IS 'Debian package version number';
60
 
 
61
 
 
62
14
CREATE TYPE pgstattuple_type AS (
63
15
        table_len bigint,
64
16
        tuple_count bigint,
72
23
        free_percent double precision
73
24
);
74
25
 
75
 
 
76
 
SET search_path = ts2, pg_catalog;
77
 
 
78
 
CREATE DOMAIN gtsq AS text;
79
 
 
80
 
 
81
 
CREATE DOMAIN gtsvector AS pg_catalog.gtsvector;
82
 
 
83
 
 
84
 
CREATE TYPE statinfo AS (
85
 
        word text,
86
 
        ndoc integer,
87
 
        nentry integer
88
 
);
89
 
 
90
 
 
91
 
CREATE TYPE tokenout AS (
92
 
        tokid integer,
93
 
        token text
94
 
);
95
 
 
96
 
 
97
 
CREATE TYPE tokentype AS (
98
 
        tokid integer,
99
 
        alias text,
100
 
        descr text
101
 
);
102
 
 
103
 
 
104
 
CREATE TYPE tsdebug AS (
105
 
        ts_name text,
106
 
        tok_type text,
107
 
        description text,
108
 
        token text,
109
 
        dict_name text[],
110
 
        tsvector pg_catalog.tsvector
111
 
);
112
 
 
113
 
 
114
 
CREATE DOMAIN tsquery AS pg_catalog.tsquery;
115
 
 
116
 
 
117
 
CREATE DOMAIN tsvector AS pg_catalog.tsvector;
118
 
 
119
 
 
120
 
SET search_path = public, pg_catalog;
121
 
 
122
 
CREATE FUNCTION activity() RETURNS SETOF pg_stat_activity
123
 
    LANGUAGE sql SECURITY DEFINER
124
 
    SET search_path TO public
125
 
    AS $$
126
 
    SELECT
127
 
        datid, datname, procpid, usesysid, usename,
128
 
        CASE
129
 
            WHEN current_query LIKE '<IDLE>%'
130
 
                OR current_query LIKE 'autovacuum:%'
131
 
                THEN current_query
132
 
            ELSE
133
 
                '<HIDDEN>'
134
 
        END AS current_query,
135
 
        waiting, xact_start, query_start,
136
 
        backend_start, client_addr, client_port
137
 
    FROM pg_catalog.pg_stat_activity;
138
 
$$;
139
 
 
140
 
 
141
 
COMMENT ON FUNCTION activity() IS 'SECURITY DEFINER wrapper around pg_stat_activity allowing unprivileged users to access most of its information.';
142
 
 
143
 
 
144
 
CREATE FUNCTION add_test_openid_identifier(account_ integer) RETURNS boolean
145
 
    LANGUAGE plpgsql SECURITY DEFINER
146
 
    SET search_path TO public
147
 
    AS $$
148
 
BEGIN
149
 
    -- The generated OpenIdIdentifier is not a valid OpenId Identity URL
150
 
    -- and does not match tokens generated by the Canonical SSO. They
151
 
    -- are only useful to the test suite, and access to this stored
152
 
    -- procedure on production does not allow you to compromise
153
 
    -- accounts.
154
 
    INSERT INTO OpenIdIdentifier (identifier, account)
155
 
    VALUES ('test' || CAST(account_ AS text), account_);
156
 
    RETURN TRUE;
157
 
EXCEPTION
158
 
    WHEN unique_violation THEN
159
 
        RETURN FALSE;
160
 
END;
161
 
$$;
162
 
 
163
 
 
164
 
COMMENT ON FUNCTION add_test_openid_identifier(account_ integer) IS 'Add an OpenIdIdentifier to an account that can be used to login in the test environment. These identifiers are not usable on production or staging.';
165
 
 
166
 
 
167
 
CREATE FUNCTION assert_patch_applied(major integer, minor integer, patch integer) RETURNS boolean
168
 
    LANGUAGE plpythonu STABLE
169
 
    AS $$
170
 
    rv = plpy.execute("""
171
 
        SELECT * FROM LaunchpadDatabaseRevision
172
 
        WHERE major=%d AND minor=%d AND patch=%d
173
 
        """ % (major, minor, patch))
174
 
    if len(rv) == 0:
175
 
        raise Exception(
176
 
            'patch-%d-%02d-%d not applied.' % (major, minor, patch))
177
 
    else:
178
 
        return True
179
 
$$;
180
 
 
181
 
 
182
 
COMMENT ON FUNCTION assert_patch_applied(major integer, minor integer, patch integer) IS 'Raise an exception if the given database patch has not been applied.';
183
 
 
184
 
 
185
 
CREATE FUNCTION bug_maintain_bug_summary() RETURNS trigger
186
 
    LANGUAGE plpgsql SECURITY DEFINER
187
 
    SET search_path TO public
188
 
    AS $$
189
 
BEGIN
190
 
    -- There is no INSERT logic, as a bug will not have any summary
191
 
    -- information until BugTask rows have been attached.
192
 
    IF TG_OP = 'UPDATE' THEN
193
 
        IF OLD.duplicateof IS DISTINCT FROM NEW.duplicateof
194
 
            OR OLD.private IS DISTINCT FROM NEW.private
195
 
            OR (OLD.latest_patch_uploaded IS NULL)
196
 
                <> (NEW.latest_patch_uploaded IS NULL) THEN
197
 
            PERFORM unsummarise_bug(OLD);
198
 
            PERFORM summarise_bug(NEW);
199
 
        END IF;
200
 
 
201
 
    ELSIF TG_OP = 'DELETE' THEN
202
 
        PERFORM unsummarise_bug(OLD);
203
 
    END IF;
204
 
 
205
 
    PERFORM bug_summary_flush_temp_journal();
206
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
207
 
END;
208
 
$$;
209
 
 
210
 
 
211
 
COMMENT ON FUNCTION bug_maintain_bug_summary() IS 'AFTER trigger on bug maintaining the bugs summaries in bugsummary.';
212
 
 
213
 
 
214
 
CREATE FUNCTION valid_bug_name(text) RETURNS boolean
215
 
    LANGUAGE plpythonu IMMUTABLE STRICT
216
 
    AS $_$
217
 
    import re
218
 
    name = args[0]
219
 
    pat = r"^[a-z][a-z0-9+\.\-]+$"
220
 
    if re.match(pat, name):
221
 
        return 1
222
 
    return 0
223
 
$_$;
224
 
 
225
 
 
226
 
COMMENT ON FUNCTION valid_bug_name(text) IS 'validate a bug name
227
 
 
228
 
    As per valid_name, except numeric-only names are not allowed (including
229
 
    names that look like floats).';
230
 
 
231
 
 
232
26
SET default_tablespace = '';
233
27
 
234
28
SET default_with_oids = false;
235
29
 
236
 
CREATE TABLE bug (
237
 
    id integer NOT NULL,
238
 
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
239
 
    name text,
240
 
    title text NOT NULL,
241
 
    description text NOT NULL,
242
 
    owner integer NOT NULL,
243
 
    duplicateof integer,
244
 
    fti ts2.tsvector,
245
 
    private boolean DEFAULT false NOT NULL,
246
 
    security_related boolean DEFAULT false NOT NULL,
247
 
    date_last_updated timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
248
 
    date_made_private timestamp without time zone,
249
 
    who_made_private integer,
250
 
    date_last_message timestamp without time zone,
251
 
    number_of_duplicates integer DEFAULT 0 NOT NULL,
252
 
    message_count integer DEFAULT 0 NOT NULL,
253
 
    users_affected_count integer DEFAULT 0,
254
 
    users_unaffected_count integer DEFAULT 0,
255
 
    heat integer DEFAULT 0 NOT NULL,
256
 
    heat_last_updated timestamp without time zone,
257
 
    latest_patch_uploaded timestamp without time zone,
258
 
    access_policy integer,
259
 
    CONSTRAINT notduplicateofself CHECK ((NOT (id = duplicateof))),
260
 
    CONSTRAINT sane_description CHECK (((ltrim(description) <> ''::text) AND (char_length(description) <= 50000))),
261
 
    CONSTRAINT valid_bug_name CHECK (valid_bug_name(name))
262
 
);
263
 
 
264
 
 
265
 
COMMENT ON TABLE bug IS 'A software bug that requires fixing. This particular bug may be linked to one or more products or source packages to identify the location(s) that this bug is found.';
266
 
 
267
 
 
268
 
COMMENT ON COLUMN bug.name IS 'A lowercase name uniquely identifying the bug';
269
 
 
270
 
 
271
 
COMMENT ON COLUMN bug.description IS 'A detailed description of the bug. Initially this will be set to the contents of the initial email or bug filing comment, but later it can be edited to give a more accurate description of the bug itself rather than the symptoms observed by the reporter.';
272
 
 
273
 
 
274
 
COMMENT ON COLUMN bug.private IS 'Is this bug private? If so, only explicit subscribers will be able to see it';
275
 
 
276
 
 
277
 
COMMENT ON COLUMN bug.security_related IS 'Is this bug a security issue?';
278
 
 
279
 
 
280
 
COMMENT ON COLUMN bug.date_last_message IS 'When the last BugMessage was attached to this Bug. Maintained by a trigger on the BugMessage table.';
281
 
 
282
 
 
283
 
COMMENT ON COLUMN bug.number_of_duplicates IS 'The number of bugs marked as duplicates of this bug, populated by a trigger after setting the duplicateof of bugs.';
284
 
 
285
 
 
286
 
COMMENT ON COLUMN bug.message_count IS 'The number of messages (currently just comments) on this bugbug, maintained by the set_bug_message_count_t trigger.';
287
 
 
288
 
 
289
 
COMMENT ON COLUMN bug.users_affected_count IS 'The number of users affected by this bug, maintained by the set_bug_users_affected_count_t trigger.';
290
 
 
291
 
 
292
 
COMMENT ON COLUMN bug.heat IS 'The relevance of this bug. This value is computed periodically using bug_affects_person and other bug values.';
293
 
 
294
 
 
295
 
COMMENT ON COLUMN bug.heat_last_updated IS 'The time this bug''s heat was last updated, or NULL if the heat has never yet been updated.';
296
 
 
297
 
 
298
 
COMMENT ON COLUMN bug.latest_patch_uploaded IS 'The time when the most recent patch has been attached to this bug or NULL if no patches are attached';
299
 
 
300
 
 
301
 
CREATE FUNCTION bug_row(bug_id integer) RETURNS bug
302
 
    LANGUAGE sql STABLE
303
 
    AS $_$
304
 
    SELECT * FROM Bug WHERE id=$1;
305
 
$_$;
306
 
 
307
 
 
308
 
COMMENT ON FUNCTION bug_row(bug_id integer) IS 'Helper for manually testing functions requiring a bug row as input. eg. SELECT * FROM bugsummary_tags(bug_row(1))';
309
 
 
310
 
 
311
 
CREATE TABLE bugsummary (
312
 
    id integer NOT NULL,
313
 
    count integer DEFAULT 0 NOT NULL,
314
 
    product integer,
315
 
    productseries integer,
316
 
    distribution integer,
317
 
    distroseries integer,
318
 
    sourcepackagename integer,
319
 
    viewed_by integer,
320
 
    tag text,
321
 
    status integer NOT NULL,
322
 
    milestone integer,
323
 
    importance integer NOT NULL,
324
 
    has_patch boolean NOT NULL,
325
 
    fixed_upstream boolean NOT NULL,
326
 
    CONSTRAINT bugtask_assignment_checks CHECK (CASE WHEN (product IS NOT NULL) THEN ((((productseries IS NULL) AND (distribution IS NULL)) AND (distroseries IS NULL)) AND (sourcepackagename IS NULL)) WHEN (productseries IS NOT NULL) THEN (((distribution IS NULL) AND (distroseries IS NULL)) AND (sourcepackagename IS NULL)) WHEN (distribution IS NOT NULL) THEN (distroseries IS NULL) WHEN (distroseries IS NOT NULL) THEN true ELSE false END)
327
 
);
328
 
 
329
 
 
330
 
CREATE FUNCTION bug_summary_dec(bugsummary) RETURNS void
331
 
    LANGUAGE sql
332
 
    AS $_$
333
 
    -- We own the row reference, so in the absence of bugs this cannot
334
 
    -- fail - just decrement the row.
335
 
    UPDATE BugSummary SET count = count + $1.count
336
 
    WHERE
337
 
        ((product IS NULL AND $1.product IS NULL)
338
 
            OR product = $1.product)
339
 
        AND ((productseries IS NULL AND $1.productseries IS NULL)
340
 
            OR productseries = $1.productseries)
341
 
        AND ((distribution IS NULL AND $1.distribution IS NULL)
342
 
            OR distribution = $1.distribution)
343
 
        AND ((distroseries IS NULL AND $1.distroseries IS NULL)
344
 
            OR distroseries = $1.distroseries)
345
 
        AND ((sourcepackagename IS NULL AND $1.sourcepackagename IS NULL)
346
 
            OR sourcepackagename = $1.sourcepackagename)
347
 
        AND ((viewed_by IS NULL AND $1.viewed_by IS NULL)
348
 
            OR viewed_by = $1.viewed_by)
349
 
        AND ((tag IS NULL AND $1.tag IS NULL)
350
 
            OR tag = $1.tag)
351
 
        AND status = $1.status
352
 
        AND ((milestone IS NULL AND $1.milestone IS NULL)
353
 
            OR milestone = $1.milestone)
354
 
        AND importance = $1.importance
355
 
        AND has_patch = $1.has_patch
356
 
        AND fixed_upstream = $1.fixed_upstream;
357
 
$_$;
358
 
 
359
 
 
360
 
COMMENT ON FUNCTION bug_summary_dec(bugsummary) IS 'UPSERT into bugsummary incrementing one row';
361
 
 
362
 
 
363
 
CREATE FUNCTION bug_summary_flush_temp_journal() RETURNS void
364
 
    LANGUAGE plpgsql
365
 
    AS $$
366
 
DECLARE
367
 
    d bugsummary%ROWTYPE;
368
 
BEGIN
369
 
    -- may get called even though no summaries were made (for simplicity in the
370
 
    -- callers)
371
 
    PERFORM ensure_bugsummary_temp_journal();
372
 
    FOR d IN SELECT * FROM bugsummary_temp_journal LOOP
373
 
        PERFORM bugsummary_journal_ins(d);
374
 
    END LOOP;
375
 
    TRUNCATE bugsummary_temp_journal;
376
 
END;
377
 
$$;
378
 
 
379
 
 
380
 
COMMENT ON FUNCTION bug_summary_flush_temp_journal() IS 'flush the temporary bugsummary journal into the bugsummary table';
381
 
 
382
 
 
383
 
CREATE FUNCTION bug_summary_inc(d bugsummary) RETURNS void
384
 
    LANGUAGE plpgsql
385
 
    AS $_$
386
 
BEGIN
387
 
    -- Shameless adaption from postgresql manual
388
 
    LOOP
389
 
        -- first try to update the row
390
 
        UPDATE BugSummary SET count = count + d.count
391
 
        WHERE
392
 
            ((product IS NULL AND $1.product IS NULL)
393
 
                OR product = $1.product)
394
 
            AND ((productseries IS NULL AND $1.productseries IS NULL)
395
 
                OR productseries = $1.productseries)
396
 
            AND ((distribution IS NULL AND $1.distribution IS NULL)
397
 
                OR distribution = $1.distribution)
398
 
            AND ((distroseries IS NULL AND $1.distroseries IS NULL)
399
 
                OR distroseries = $1.distroseries)
400
 
            AND ((sourcepackagename IS NULL AND $1.sourcepackagename IS NULL)
401
 
                OR sourcepackagename = $1.sourcepackagename)
402
 
            AND ((viewed_by IS NULL AND $1.viewed_by IS NULL)
403
 
                OR viewed_by = $1.viewed_by)
404
 
            AND ((tag IS NULL AND $1.tag IS NULL)
405
 
                OR tag = $1.tag)
406
 
            AND status = $1.status
407
 
            AND ((milestone IS NULL AND $1.milestone IS NULL)
408
 
                OR milestone = $1.milestone)
409
 
            AND importance = $1.importance
410
 
            AND has_patch = $1.has_patch
411
 
            AND fixed_upstream = $1.fixed_upstream;
412
 
        IF found THEN
413
 
            RETURN;
414
 
        END IF;
415
 
        -- not there, so try to insert the key
416
 
        -- if someone else inserts the same key concurrently,
417
 
        -- we could get a unique-key failure
418
 
        BEGIN
419
 
            INSERT INTO BugSummary(
420
 
                count, product, productseries, distribution,
421
 
                distroseries, sourcepackagename, viewed_by, tag,
422
 
                status, milestone,
423
 
                importance, has_patch, fixed_upstream)
424
 
            VALUES (
425
 
                d.count, d.product, d.productseries, d.distribution,
426
 
                d.distroseries, d.sourcepackagename, d.viewed_by, d.tag,
427
 
                d.status, d.milestone,
428
 
                d.importance, d.has_patch, d.fixed_upstream);
429
 
            RETURN;
430
 
        EXCEPTION WHEN unique_violation THEN
431
 
            -- do nothing, and loop to try the UPDATE again
432
 
        END;
433
 
    END LOOP;
434
 
END;
435
 
$_$;
436
 
 
437
 
 
438
 
COMMENT ON FUNCTION bug_summary_inc(d bugsummary) IS 'UPSERT into bugsummary incrementing one row';
439
 
 
440
 
 
441
 
CREATE FUNCTION bug_summary_temp_journal_ins(d bugsummary) RETURNS void
442
 
    LANGUAGE plpgsql
443
 
    AS $$
444
 
BEGIN
445
 
    INSERT INTO BugSummary_Temp_Journal(
446
 
        count, product, productseries, distribution,
447
 
        distroseries, sourcepackagename, viewed_by, tag,
448
 
        status, milestone, importance, has_patch, fixed_upstream)
449
 
    VALUES (
450
 
        d.count, d.product, d.productseries, d.distribution,
451
 
        d.distroseries, d.sourcepackagename, d.viewed_by, d.tag,
452
 
        d.status, d.milestone, d.importance, d.has_patch, d.fixed_upstream);
453
 
    RETURN;
454
 
END;
455
 
$$;
456
 
 
457
 
 
458
 
COMMENT ON FUNCTION bug_summary_temp_journal_ins(d bugsummary) IS 'Insert a BugSummary into the temporary journal';
459
 
 
460
 
 
461
 
CREATE FUNCTION bug_update_heat_copy_to_bugtask() RETURNS trigger
462
 
    LANGUAGE plpgsql SECURITY DEFINER
463
 
    SET search_path TO public
464
 
    AS $$
465
 
BEGIN
466
 
    IF NEW.heat != OLD.heat THEN
467
 
        UPDATE bugtask SET heat=NEW.heat WHERE bugtask.bug=NEW.id;
468
 
    END IF;
469
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
470
 
END;
471
 
$$;
472
 
 
473
 
 
474
 
COMMENT ON FUNCTION bug_update_heat_copy_to_bugtask() IS 'Copies bug heat to bugtasks when the bug is changed. Runs on UPDATE only because INSERTs do not have bugtasks at the point of insertion.';
475
 
 
476
 
 
477
 
CREATE FUNCTION bug_update_latest_patch_uploaded(integer) RETURNS void
478
 
    LANGUAGE plpgsql SECURITY DEFINER
479
 
    SET search_path TO public
480
 
    AS $_$
481
 
BEGIN
482
 
    UPDATE bug SET latest_patch_uploaded =
483
 
        (SELECT max(message.datecreated)
484
 
            FROM message, bugattachment
485
 
            WHERE bugattachment.message=message.id AND
486
 
                bugattachment.bug=$1 AND
487
 
                bugattachment.type=1)
488
 
        WHERE bug.id=$1;
489
 
END;
490
 
$_$;
491
 
 
492
 
 
493
 
CREATE FUNCTION bug_update_latest_patch_uploaded_on_delete() RETURNS trigger
494
 
    LANGUAGE plpgsql SECURITY DEFINER
495
 
    SET search_path TO public
496
 
    AS $$
497
 
BEGIN
498
 
    PERFORM bug_update_latest_patch_uploaded(OLD.bug);
499
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
500
 
END;
501
 
$$;
502
 
 
503
 
 
504
 
CREATE FUNCTION bug_update_latest_patch_uploaded_on_insert_update() RETURNS trigger
505
 
    LANGUAGE plpgsql SECURITY DEFINER
506
 
    SET search_path TO public
507
 
    AS $$
508
 
BEGIN
509
 
    PERFORM bug_update_latest_patch_uploaded(NEW.bug);
510
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
511
 
END;
512
 
$$;
513
 
 
514
 
 
515
 
CREATE FUNCTION bugmessage_copy_owner_from_message() RETURNS trigger
516
 
    LANGUAGE plpgsql SECURITY DEFINER
517
 
    SET search_path TO public
518
 
    AS $$
519
 
BEGIN
520
 
    IF TG_OP = 'INSERT' THEN
521
 
        IF NEW.owner is NULL THEN
522
 
            UPDATE BugMessage
523
 
            SET owner = Message.owner FROM
524
 
            Message WHERE
525
 
            Message.id = NEW.message AND
526
 
            BugMessage.id = NEW.id;
527
 
        END IF;
528
 
    ELSIF NEW.message != OLD.message THEN
529
 
        UPDATE BugMessage
530
 
        SET owner = Message.owner FROM
531
 
        Message WHERE
532
 
        Message.id = NEW.message AND
533
 
        BugMessage.id = NEW.id;
534
 
    END IF;
535
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
536
 
END;
537
 
$$;
538
 
 
539
 
 
540
 
COMMENT ON FUNCTION bugmessage_copy_owner_from_message() IS 'Copies the message owner into bugmessage when bugmessage changes.';
541
 
 
542
 
 
543
 
CREATE FUNCTION bugsubscription_maintain_bug_summary() RETURNS trigger
544
 
    LANGUAGE plpgsql SECURITY DEFINER
545
 
    SET search_path TO public
546
 
    AS $$
547
 
BEGIN
548
 
    -- This trigger only works if we are inserting, updating or deleting
549
 
    -- a single row per statement.
550
 
    IF TG_OP = 'INSERT' THEN
551
 
        IF NOT (bug_row(NEW.bug)).private THEN
552
 
            -- Public subscriptions are not aggregated.
553
 
            RETURN NEW;
554
 
        END IF;
555
 
        IF TG_WHEN = 'BEFORE' THEN
556
 
            PERFORM unsummarise_bug(bug_row(NEW.bug));
557
 
        ELSE
558
 
            PERFORM summarise_bug(bug_row(NEW.bug));
559
 
        END IF;
560
 
        PERFORM bug_summary_flush_temp_journal();
561
 
        RETURN NEW;
562
 
    ELSIF TG_OP = 'DELETE' THEN
563
 
        IF NOT (bug_row(OLD.bug)).private THEN
564
 
            -- Public subscriptions are not aggregated.
565
 
            RETURN OLD;
566
 
        END IF;
567
 
        IF TG_WHEN = 'BEFORE' THEN
568
 
            PERFORM unsummarise_bug(bug_row(OLD.bug));
569
 
        ELSE
570
 
            PERFORM summarise_bug(bug_row(OLD.bug));
571
 
        END IF;
572
 
        PERFORM bug_summary_flush_temp_journal();
573
 
        RETURN OLD;
574
 
    ELSE
575
 
        IF (OLD.person IS DISTINCT FROM NEW.person
576
 
            OR OLD.bug IS DISTINCT FROM NEW.bug) THEN
577
 
            IF TG_WHEN = 'BEFORE' THEN
578
 
                IF (bug_row(OLD.bug)).private THEN
579
 
                    -- Public subscriptions are not aggregated.
580
 
                    PERFORM unsummarise_bug(bug_row(OLD.bug));
581
 
                END IF;
582
 
                IF OLD.bug <> NEW.bug AND (bug_row(NEW.bug)).private THEN
583
 
                    -- Public subscriptions are not aggregated.
584
 
                    PERFORM unsummarise_bug(bug_row(NEW.bug));
585
 
                END IF;
586
 
            ELSE
587
 
                IF (bug_row(OLD.bug)).private THEN
588
 
                    -- Public subscriptions are not aggregated.
589
 
                    PERFORM summarise_bug(bug_row(OLD.bug));
590
 
                END IF;
591
 
                IF OLD.bug <> NEW.bug AND (bug_row(NEW.bug)).private THEN
592
 
                    -- Public subscriptions are not aggregated.
593
 
                    PERFORM summarise_bug(bug_row(NEW.bug));
594
 
                END IF;
595
 
            END IF;
596
 
        END IF;
597
 
        PERFORM bug_summary_flush_temp_journal();
598
 
        RETURN NEW;
599
 
    END IF;
600
 
END;
601
 
$$;
602
 
 
603
 
 
604
 
COMMENT ON FUNCTION bugsubscription_maintain_bug_summary() IS 'AFTER trigger on bugsubscription maintaining the bugs summaries in bugsummary.';
605
 
 
606
 
 
607
 
CREATE FUNCTION bugsummary_journal_ins(d bugsummary) RETURNS void
608
 
    LANGUAGE plpgsql
609
 
    AS $$
610
 
BEGIN
611
 
    IF d.count <> 0 THEN
612
 
        INSERT INTO BugSummaryJournal (
613
 
            count, product, productseries, distribution,
614
 
            distroseries, sourcepackagename, viewed_by, tag,
615
 
            status, milestone,
616
 
            importance, has_patch, fixed_upstream)
617
 
        VALUES (
618
 
            d.count, d.product, d.productseries, d.distribution,
619
 
            d.distroseries, d.sourcepackagename, d.viewed_by, d.tag,
620
 
            d.status, d.milestone,
621
 
            d.importance, d.has_patch, d.fixed_upstream);
622
 
    END IF;
623
 
END;
624
 
$$;
625
 
 
626
 
 
627
 
COMMENT ON FUNCTION bugsummary_journal_ins(d bugsummary) IS 'Add an entry into BugSummaryJournal';
628
 
 
629
 
 
630
 
CREATE FUNCTION bugsummary_locations(bug_row bug) RETURNS SETOF bugsummary
631
 
    LANGUAGE plpgsql
632
 
    AS $$
633
 
BEGIN
634
 
    IF BUG_ROW.duplicateof IS NOT NULL THEN
635
 
        RETURN;
636
 
    END IF;
637
 
    RETURN QUERY
638
 
        SELECT
639
 
            CAST(NULL AS integer) AS id,
640
 
            CAST(1 AS integer) AS count,
641
 
            product, productseries, distribution, distroseries,
642
 
            sourcepackagename, person AS viewed_by, tag, status, milestone,
643
 
            importance,
644
 
            BUG_ROW.latest_patch_uploaded IS NOT NULL AS has_patch,
645
 
            (EXISTS (
646
 
                SELECT TRUE FROM BugTask AS RBT
647
 
                WHERE
648
 
                    RBT.bug = tasks.bug
649
 
                    -- This would just be 'RBT.id <> tasks.id', except
650
 
                    -- that the records from tasks are summaries and not
651
 
                    -- real bugtasks, and do not have an id.
652
 
                    AND (RBT.product IS DISTINCT FROM tasks.product
653
 
                        OR RBT.productseries
654
 
                            IS DISTINCT FROM tasks.productseries
655
 
                        OR RBT.distribution IS DISTINCT FROM tasks.distribution
656
 
                        OR RBT.distroseries IS DISTINCT FROM tasks.distroseries
657
 
                        OR RBT.sourcepackagename
658
 
                            IS DISTINCT FROM tasks.sourcepackagename)
659
 
                    -- Flagged as INVALID, FIXCOMMITTED or FIXRELEASED
660
 
                    -- via a bugwatch, or FIXCOMMITTED or FIXRELEASED on
661
 
                    -- the product.
662
 
                    AND ((bugwatch IS NOT NULL AND status IN (17, 25, 30))
663
 
                        OR (bugwatch IS NULL AND product IS NOT NULL
664
 
                            AND status IN (25, 30))))
665
 
                )::boolean AS fixed_upstream
666
 
        FROM bugsummary_tasks(BUG_ROW) AS tasks
667
 
        JOIN bugsummary_tags(BUG_ROW) AS bug_tags ON TRUE
668
 
        LEFT OUTER JOIN bugsummary_viewers(BUG_ROW) AS bug_viewers ON TRUE;
669
 
END;
670
 
$$;
671
 
 
672
 
 
673
 
COMMENT ON FUNCTION bugsummary_locations(bug_row bug) IS 'Calculate what BugSummary rows should exist for a given Bug.';
674
 
 
675
 
 
676
 
CREATE FUNCTION bugsummary_rollup_journal(batchsize integer DEFAULT NULL::integer) RETURNS void
677
 
    LANGUAGE plpgsql SECURITY DEFINER
678
 
    SET search_path TO public
679
 
    AS $$
680
 
DECLARE
681
 
    d bugsummary%ROWTYPE;
682
 
    max_id integer;
683
 
BEGIN
684
 
    -- Lock so we don't content with other invokations of this
685
 
    -- function. We can happily lock the BugSummary table for writes
686
 
    -- as this function is the only thing that updates that table.
687
 
    -- BugSummaryJournal remains unlocked so nothing should be blocked.
688
 
    LOCK TABLE BugSummary IN ROW EXCLUSIVE MODE;
689
 
 
690
 
    IF batchsize IS NULL THEN
691
 
        SELECT MAX(id) INTO max_id FROM BugSummaryJournal;
692
 
    ELSE
693
 
        SELECT MAX(id) INTO max_id FROM (
694
 
            SELECT id FROM BugSummaryJournal ORDER BY id LIMIT batchsize
695
 
            ) AS Whatever;
696
 
    END IF;
697
 
 
698
 
    FOR d IN
699
 
        SELECT
700
 
            NULL as id,
701
 
            SUM(count),
702
 
            product,
703
 
            productseries,
704
 
            distribution,
705
 
            distroseries,
706
 
            sourcepackagename,
707
 
            viewed_by,
708
 
            tag,
709
 
            status,
710
 
            milestone,
711
 
            importance,
712
 
            has_patch,
713
 
            fixed_upstream
714
 
        FROM BugSummaryJournal
715
 
        WHERE id <= max_id
716
 
        GROUP BY
717
 
            product, productseries, distribution, distroseries,
718
 
            sourcepackagename, viewed_by, tag, status, milestone,
719
 
            importance, has_patch, fixed_upstream
720
 
        HAVING sum(count) <> 0
721
 
    LOOP
722
 
        IF d.count < 0 THEN
723
 
            PERFORM bug_summary_dec(d);
724
 
        ELSIF d.count > 0 THEN
725
 
            PERFORM bug_summary_inc(d);
726
 
        END IF;
727
 
    END LOOP;
728
 
 
729
 
    -- Clean out any counts we reduced to 0.
730
 
    DELETE FROM BugSummary WHERE count=0;
731
 
    -- Clean out the journal entries we have handled.
732
 
    DELETE FROM BugSummaryJournal WHERE id <= max_id;
733
 
END;
734
 
$$;
735
 
 
736
 
 
737
 
COMMENT ON FUNCTION bugsummary_rollup_journal(batchsize integer) IS 'Collate and migrate rows from BugSummaryJournal to BugSummary';
738
 
 
739
 
 
740
 
CREATE FUNCTION valid_name(text) RETURNS boolean
741
 
    LANGUAGE plpythonu IMMUTABLE STRICT
742
 
    AS $$
743
 
    import re
744
 
    name = args[0]
745
 
    pat = r"^[a-z0-9][a-z0-9\+\.\-]*\Z"
746
 
    if re.match(pat, name):
747
 
        return 1
748
 
    return 0
749
 
$$;
750
 
 
751
 
 
752
 
COMMENT ON FUNCTION valid_name(text) IS 'validate a name.
753
 
 
754
 
    Names must contain only lowercase letters, numbers, ., & -. They
755
 
    must start with an alphanumeric. They are ASCII only. Names are useful
756
 
    for mneumonic identifiers such as nicknames and as URL components.
757
 
    This specification is the same as the Debian product naming policy.
758
 
 
759
 
    Note that a valid name might be all integers, so there is a possible
760
 
    namespace conflict if URL traversal is possible by name as well as id.';
761
 
 
762
 
 
763
 
CREATE TABLE bugtag (
764
 
    id integer NOT NULL,
765
 
    bug integer NOT NULL,
766
 
    tag text NOT NULL,
767
 
    CONSTRAINT valid_tag CHECK (valid_name(tag))
768
 
);
769
 
 
770
 
 
771
 
COMMENT ON TABLE bugtag IS 'Attaches simple text tags to a bug.';
772
 
 
773
 
 
774
 
COMMENT ON COLUMN bugtag.bug IS 'The bug the tags is attached to.';
775
 
 
776
 
 
777
 
COMMENT ON COLUMN bugtag.tag IS 'The text representation of the tag.';
778
 
 
779
 
 
780
 
CREATE FUNCTION bugsummary_tags(bug_row bug) RETURNS SETOF bugtag
781
 
    LANGUAGE sql STABLE
782
 
    AS $_$
783
 
    SELECT * FROM BugTag WHERE BugTag.bug = $1.id
784
 
    UNION ALL
785
 
    SELECT NULL::integer, $1.id, NULL::text;
786
 
$_$;
787
 
 
788
 
 
789
 
COMMENT ON FUNCTION bugsummary_tags(bug_row bug) IS 'Return (bug, tag) for all tags + (bug, NULL::text)';
790
 
 
791
 
 
792
 
CREATE TABLE bugtask (
793
 
    id integer NOT NULL,
794
 
    bug integer NOT NULL,
795
 
    product integer,
796
 
    distribution integer,
797
 
    distroseries integer,
798
 
    sourcepackagename integer,
799
 
    binarypackagename integer,
800
 
    status integer NOT NULL,
801
 
    importance integer DEFAULT 5 NOT NULL,
802
 
    assignee integer,
803
 
    date_assigned timestamp without time zone,
804
 
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone),
805
 
    owner integer NOT NULL,
806
 
    milestone integer,
807
 
    bugwatch integer,
808
 
    fti ts2.tsvector,
809
 
    targetnamecache text,
810
 
    date_confirmed timestamp without time zone,
811
 
    date_inprogress timestamp without time zone,
812
 
    date_closed timestamp without time zone,
813
 
    productseries integer,
814
 
    date_incomplete timestamp without time zone,
815
 
    date_left_new timestamp without time zone,
816
 
    date_triaged timestamp without time zone,
817
 
    date_fix_committed timestamp without time zone,
818
 
    date_fix_released timestamp without time zone,
819
 
    date_left_closed timestamp without time zone,
820
 
    heat_rank integer DEFAULT 0 NOT NULL,
821
 
    date_milestone_set timestamp without time zone,
822
 
    heat integer DEFAULT 0 NOT NULL,
823
 
    CONSTRAINT bugtask_assignment_checks CHECK (CASE WHEN (product IS NOT NULL) THEN ((((productseries IS NULL) AND (distribution IS NULL)) AND (distroseries IS NULL)) AND (sourcepackagename IS NULL)) WHEN (productseries IS NOT NULL) THEN (((distribution IS NULL) AND (distroseries IS NULL)) AND (sourcepackagename IS NULL)) WHEN (distribution IS NOT NULL) THEN (distroseries IS NULL) WHEN (distroseries IS NOT NULL) THEN true ELSE false END)
824
 
);
825
 
 
826
 
 
827
 
COMMENT ON TABLE bugtask IS 'Links a given Bug to a particular (sourcepackagename, distro) or product.';
828
 
 
829
 
 
830
 
COMMENT ON COLUMN bugtask.bug IS 'The bug that is assigned to this (sourcepackagename, distro) or product.';
831
 
 
832
 
 
833
 
COMMENT ON COLUMN bugtask.product IS 'The product in which this bug shows up.';
834
 
 
835
 
 
836
 
COMMENT ON COLUMN bugtask.distribution IS 'The distro of the named sourcepackage.';
837
 
 
838
 
 
839
 
COMMENT ON COLUMN bugtask.sourcepackagename IS 'The name of the sourcepackage in which this bug shows up.';
840
 
 
841
 
 
842
 
COMMENT ON COLUMN bugtask.binarypackagename IS 'The name of the binary package built from the source package. This column may only contain a value if this bug task is linked to a sourcepackage (not a product)';
843
 
 
844
 
 
845
 
COMMENT ON COLUMN bugtask.status IS 'The general health of the bug, e.g. Accepted, Rejected, etc.';
846
 
 
847
 
 
848
 
COMMENT ON COLUMN bugtask.importance IS 'The importance of fixing the bug.';
849
 
 
850
 
 
851
 
COMMENT ON COLUMN bugtask.assignee IS 'The person who has been assigned to fix this bug in this product or (sourcepackagename, distro)';
852
 
 
853
 
 
854
 
COMMENT ON COLUMN bugtask.date_assigned IS 'The date on which the bug in this (sourcepackagename, distro) or product was assigned to someone to fix';
855
 
 
856
 
 
857
 
COMMENT ON COLUMN bugtask.datecreated IS 'A timestamp for the creation of this bug assignment. Note that this is not the date the bug was created (though it might be), it''s the date the bug was assigned to this product, which could have come later.';
858
 
 
859
 
 
860
 
COMMENT ON COLUMN bugtask.milestone IS 'A way to mark a bug for grouping purposes, e.g. to say it needs to be fixed by version 1.2';
861
 
 
862
 
 
863
 
COMMENT ON COLUMN bugtask.bugwatch IS 'This column allows us to link a bug
864
 
task to a bug watch. In other words, we are connecting the state of the task
865
 
to the state of the bug in a different bug tracking system. To the best of
866
 
our ability we''ll try and keep the bug task syncronised with the state of
867
 
the remote bug watch.';
868
 
 
869
 
 
870
 
COMMENT ON COLUMN bugtask.targetnamecache IS 'A cached value of the target name of this bugtask, to make it easier to sort and search on the target name.';
871
 
 
872
 
 
873
 
COMMENT ON COLUMN bugtask.date_confirmed IS 'The date when this bug transitioned from an unconfirmed status to a confirmed one. If the state regresses to a one that logically occurs before Confirmed, e.g., Unconfirmed, this date is cleared.';
874
 
 
875
 
 
876
 
COMMENT ON COLUMN bugtask.date_inprogress IS 'The date on which this bug transitioned from not being in progress to a state >= In Progress. If the status moves back to a pre-In Progress state, this date is cleared';
877
 
 
878
 
 
879
 
COMMENT ON COLUMN bugtask.date_closed IS 'The date when this bug transitioned to a resolved state, e.g., Rejected, Fix Released, etc. If the state changes back to a pre-closed state, this date is cleared';
880
 
 
881
 
 
882
 
COMMENT ON COLUMN bugtask.productseries IS 'The product series to which the bug is targeted';
883
 
 
884
 
 
885
 
COMMENT ON COLUMN bugtask.date_left_new IS 'The date when this bug first transitioned out of the NEW status.';
886
 
 
887
 
 
888
 
COMMENT ON COLUMN bugtask.date_triaged IS 'The date when this bug transitioned to a status >= TRIAGED.';
889
 
 
890
 
 
891
 
COMMENT ON COLUMN bugtask.date_fix_committed IS 'The date when this bug transitioned to a status >= FIXCOMMITTED.';
892
 
 
893
 
 
894
 
COMMENT ON COLUMN bugtask.date_fix_released IS 'The date when this bug transitioned to a FIXRELEASED status.';
895
 
 
896
 
 
897
 
COMMENT ON COLUMN bugtask.date_left_closed IS 'The date when this bug last transitioned out of a CLOSED status.';
898
 
 
899
 
 
900
 
COMMENT ON COLUMN bugtask.heat_rank IS 'The heat bin in which this bugtask appears, as a value from the BugTaskHeatRank enumeration.';
901
 
 
902
 
 
903
 
COMMENT ON COLUMN bugtask.date_milestone_set IS 'The date when this bug was targed to the milestone that is currently set.';
904
 
 
905
 
 
906
 
CREATE FUNCTION bugsummary_tasks(bug_row bug) RETURNS SETOF bugtask
907
 
    LANGUAGE plpgsql STABLE
908
 
    AS $$
909
 
DECLARE
910
 
    bt bugtask%ROWTYPE;
911
 
    r record;
912
 
BEGIN
913
 
    bt.bug = BUG_ROW.id;
914
 
 
915
 
    -- One row only for each target permutation - need to ignore other fields
916
 
    -- like date last modified to deal with conjoined masters and multiple
917
 
    -- sourcepackage tasks in a distro.
918
 
    FOR r IN
919
 
        SELECT
920
 
            product, productseries, distribution, distroseries,
921
 
            sourcepackagename, status, milestone, importance, bugwatch
922
 
        FROM BugTask WHERE bug=BUG_ROW.id
923
 
        UNION -- Implicit DISTINCT
924
 
        SELECT
925
 
            product, productseries, distribution, distroseries,
926
 
            NULL, status, milestone, importance, bugwatch
927
 
        FROM BugTask WHERE bug=BUG_ROW.id AND sourcepackagename IS NOT NULL
928
 
    LOOP
929
 
        bt.product = r.product;
930
 
        bt.productseries = r.productseries;
931
 
        bt.distribution = r.distribution;
932
 
        bt.distroseries = r.distroseries;
933
 
        bt.sourcepackagename = r.sourcepackagename;
934
 
        bt.status = r.status;
935
 
        bt.milestone = r.milestone;
936
 
        bt.importance = r.importance;
937
 
        bt.bugwatch = r.bugwatch;
938
 
        RETURN NEXT bt;
939
 
    END LOOP;
940
 
END;
941
 
$$;
942
 
 
943
 
 
944
 
COMMENT ON FUNCTION bugsummary_tasks(bug_row bug) IS 'Return all tasks for the bug + all sourcepackagename tasks again with the sourcepackagename squashed';
945
 
 
946
 
 
947
 
CREATE TABLE bugsubscription (
948
 
    id integer NOT NULL,
949
 
    person integer NOT NULL,
950
 
    bug integer NOT NULL,
951
 
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
952
 
    subscribed_by integer NOT NULL,
953
 
    bug_notification_level integer DEFAULT 40 NOT NULL
954
 
);
955
 
 
956
 
 
957
 
COMMENT ON TABLE bugsubscription IS 'A subscription by a Person to a bug.';
958
 
 
959
 
 
960
 
COMMENT ON COLUMN bugsubscription.bug_notification_level IS 'The level of notifications which the Person will receive from this subscription.';
961
 
 
962
 
 
963
 
CREATE FUNCTION bugsummary_viewers(bug_row bug) RETURNS SETOF bugsubscription
964
 
    LANGUAGE sql STABLE
965
 
    AS $_$
966
 
    SELECT *
967
 
    FROM BugSubscription
968
 
    WHERE
969
 
        bugsubscription.bug=$1.id
970
 
        AND $1.private IS TRUE;
971
 
$_$;
972
 
 
973
 
 
974
 
COMMENT ON FUNCTION bugsummary_viewers(bug_row bug) IS 'Return (bug, viewer) for all viewers if private, nothing otherwise';
975
 
 
976
 
 
977
 
CREATE FUNCTION bugtag_maintain_bug_summary() RETURNS trigger
978
 
    LANGUAGE plpgsql SECURITY DEFINER
979
 
    SET search_path TO public
980
 
    AS $$
981
 
BEGIN
982
 
    IF TG_OP = 'INSERT' THEN
983
 
        IF TG_WHEN = 'BEFORE' THEN
984
 
            PERFORM unsummarise_bug(bug_row(NEW.bug));
985
 
        ELSE
986
 
            PERFORM summarise_bug(bug_row(NEW.bug));
987
 
        END IF;
988
 
        PERFORM bug_summary_flush_temp_journal();
989
 
        RETURN NEW;
990
 
    ELSIF TG_OP = 'DELETE' THEN
991
 
        IF TG_WHEN = 'BEFORE' THEN
992
 
            PERFORM unsummarise_bug(bug_row(OLD.bug));
993
 
        ELSE
994
 
            PERFORM summarise_bug(bug_row(OLD.bug));
995
 
        END IF;
996
 
        PERFORM bug_summary_flush_temp_journal();
997
 
        RETURN OLD;
998
 
    ELSE
999
 
        IF TG_WHEN = 'BEFORE' THEN
1000
 
            PERFORM unsummarise_bug(bug_row(OLD.bug));
1001
 
            IF OLD.bug <> NEW.bug THEN
1002
 
                PERFORM unsummarise_bug(bug_row(NEW.bug));
1003
 
            END IF;
1004
 
        ELSE
1005
 
            PERFORM summarise_bug(bug_row(OLD.bug));
1006
 
            IF OLD.bug <> NEW.bug THEN
1007
 
                PERFORM summarise_bug(bug_row(NEW.bug));
1008
 
            END IF;
1009
 
        END IF;
1010
 
        PERFORM bug_summary_flush_temp_journal();
1011
 
        RETURN NEW;
1012
 
    END IF;
1013
 
END;
1014
 
$$;
1015
 
 
1016
 
 
1017
 
COMMENT ON FUNCTION bugtag_maintain_bug_summary() IS 'AFTER trigger on bugtag maintaining the bugs summaries in bugsummary.';
1018
 
 
1019
 
 
1020
 
CREATE FUNCTION bugtask_maintain_bug_summary() RETURNS trigger
1021
 
    LANGUAGE plpgsql SECURITY DEFINER
1022
 
    SET search_path TO public
1023
 
    AS $$
1024
 
BEGIN
1025
 
    -- This trigger only works if we are inserting, updating or deleting
1026
 
    -- a single row per statement.
1027
 
 
1028
 
    -- Unlike bug_maintain_bug_summary, this trigger does not have access
1029
 
    -- to the old bug when invoked as an AFTER trigger. To work around this
1030
 
    -- we install this trigger as both a BEFORE and an AFTER trigger.
1031
 
    IF TG_OP = 'INSERT' THEN
1032
 
        IF TG_WHEN = 'BEFORE' THEN
1033
 
            PERFORM unsummarise_bug(bug_row(NEW.bug));
1034
 
        ELSE
1035
 
            PERFORM summarise_bug(bug_row(NEW.bug));
1036
 
        END IF;
1037
 
        PERFORM bug_summary_flush_temp_journal();
1038
 
        RETURN NEW;
1039
 
 
1040
 
    ELSIF TG_OP = 'DELETE' THEN
1041
 
        IF TG_WHEN = 'BEFORE' THEN
1042
 
            PERFORM unsummarise_bug(bug_row(OLD.bug));
1043
 
        ELSE
1044
 
            PERFORM summarise_bug(bug_row(OLD.bug));
1045
 
        END IF;
1046
 
        PERFORM bug_summary_flush_temp_journal();
1047
 
        RETURN OLD;
1048
 
 
1049
 
    ELSE
1050
 
        IF (OLD.product IS DISTINCT FROM NEW.product
1051
 
            OR OLD.productseries IS DISTINCT FROM NEW.productseries
1052
 
            OR OLD.distribution IS DISTINCT FROM NEW.distribution
1053
 
            OR OLD.distroseries IS DISTINCT FROM NEW.distroseries
1054
 
            OR OLD.sourcepackagename IS DISTINCT FROM NEW.sourcepackagename
1055
 
            OR OLD.status IS DISTINCT FROM NEW.status
1056
 
            OR OLD.importance IS DISTINCT FROM NEW.importance
1057
 
            OR OLD.bugwatch IS DISTINCT FROM NEW.bugwatch
1058
 
            OR OLD.milestone IS DISTINCT FROM NEW.milestone) THEN
1059
 
 
1060
 
            IF TG_WHEN = 'BEFORE' THEN
1061
 
                PERFORM unsummarise_bug(bug_row(OLD.bug));
1062
 
                IF OLD.bug <> NEW.bug THEN
1063
 
                    PERFORM unsummarise_bug(bug_row(NEW.bug));
1064
 
                END IF;
1065
 
            ELSE
1066
 
                PERFORM summarise_bug(bug_row(OLD.bug));
1067
 
                IF OLD.bug <> NEW.bug THEN
1068
 
                    PERFORM summarise_bug(bug_row(NEW.bug));
1069
 
                END IF;
1070
 
            END IF;
1071
 
        END IF;
1072
 
        PERFORM bug_summary_flush_temp_journal();
1073
 
        RETURN NEW;
1074
 
    END IF;
1075
 
END;
1076
 
$$;
1077
 
 
1078
 
 
1079
 
COMMENT ON FUNCTION bugtask_maintain_bug_summary() IS 'Both BEFORE & AFTER trigger on bugtask maintaining the bugs summaries in bugsummary.';
1080
 
 
1081
 
 
1082
 
CREATE FUNCTION calculate_bug_heat(bug_id integer) RETURNS integer
1083
 
    LANGUAGE plpythonu STABLE STRICT
1084
 
    AS $$
1085
 
    from datetime import datetime
1086
 
 
1087
 
    class BugHeatConstants:
1088
 
        PRIVACY = 150
1089
 
        SECURITY = 250
1090
 
        DUPLICATE = 6
1091
 
        AFFECTED_USER = 4
1092
 
        SUBSCRIBER = 2
1093
 
 
1094
 
    def get_max_heat_for_bug(bug_id):
1095
 
        results = plpy.execute("""
1096
 
            SELECT MAX(
1097
 
                GREATEST(Product.max_bug_heat,
1098
 
                         DistributionSourcePackage.max_bug_heat))
1099
 
                    AS max_heat
1100
 
            FROM BugTask
1101
 
            LEFT OUTER JOIN ProductSeries ON
1102
 
                BugTask.productseries = ProductSeries.id
1103
 
            LEFT OUTER JOIN Product ON (
1104
 
                BugTask.product = Product.id
1105
 
                OR ProductSeries.product = Product.id)
1106
 
            LEFT OUTER JOIN DistroSeries ON
1107
 
                BugTask.distroseries = DistroSeries.id
1108
 
            LEFT OUTER JOIN Distribution ON (
1109
 
                BugTask.distribution = Distribution.id
1110
 
                OR DistroSeries.distribution = Distribution.id)
1111
 
            LEFT OUTER JOIN DistributionSourcePackage ON (
1112
 
                BugTask.sourcepackagename =
1113
 
                    DistributionSourcePackage.sourcepackagename)
1114
 
            WHERE
1115
 
                BugTask.bug = %s""" % bug_id)
1116
 
 
1117
 
        return results[0]['max_heat']
1118
 
 
1119
 
    # It would be nice to be able to just SELECT * here, but we need the
1120
 
    # timestamps to be in a format that datetime.fromtimestamp() will
1121
 
    # understand.
1122
 
    bug_data = plpy.execute("""
1123
 
        SELECT
1124
 
            duplicateof,
1125
 
            private,
1126
 
            security_related,
1127
 
            number_of_duplicates,
1128
 
            users_affected_count,
1129
 
            EXTRACT(epoch from datecreated)
1130
 
                AS timestamp_date_created,
1131
 
            EXTRACT(epoch from date_last_updated)
1132
 
                AS timestamp_date_last_updated,
1133
 
            EXTRACT(epoch from date_last_message)
1134
 
                AS timestamp_date_last_message
1135
 
        FROM Bug WHERE id = %s""" % bug_id)
1136
 
 
1137
 
    if bug_data.nrows() == 0:
1138
 
        raise Exception("Bug %s doesn't exist." % bug_id)
1139
 
 
1140
 
    bug = bug_data[0]
1141
 
    if bug['duplicateof'] is not None:
1142
 
        return None
1143
 
 
1144
 
    heat = {}
1145
 
    heat['dupes'] = (
1146
 
        BugHeatConstants.DUPLICATE * bug['number_of_duplicates'])
1147
 
    heat['affected_users'] = (
1148
 
        BugHeatConstants.AFFECTED_USER *
1149
 
        bug['users_affected_count'])
1150
 
 
1151
 
    if bug['private']:
1152
 
        heat['privacy'] = BugHeatConstants.PRIVACY
1153
 
    if bug['security_related']:
1154
 
        heat['security'] = BugHeatConstants.SECURITY
1155
 
 
1156
 
    # Get the heat from subscribers, both direct and via duplicates.
1157
 
    subs_from_dupes = plpy.execute("""
1158
 
        SELECT COUNT(DISTINCT BugSubscription.person) AS sub_count
1159
 
        FROM BugSubscription, Bug
1160
 
        WHERE Bug.id = BugSubscription.bug
1161
 
            AND (Bug.id = %s OR Bug.duplicateof = %s)"""
1162
 
        % (bug_id, bug_id))
1163
 
 
1164
 
    heat['subcribers'] = (
1165
 
        BugHeatConstants.SUBSCRIBER
1166
 
        * subs_from_dupes[0]['sub_count'])
1167
 
 
1168
 
    total_heat = sum(heat.values())
1169
 
 
1170
 
    # Bugs decay over time. Every day the bug isn't touched its heat
1171
 
    # decreases by 1%.
1172
 
    date_last_updated = datetime.fromtimestamp(
1173
 
        bug['timestamp_date_last_updated'])
1174
 
    days_since_last_update = (datetime.utcnow() - date_last_updated).days
1175
 
    total_heat = int(total_heat * (0.99 ** days_since_last_update))
1176
 
 
1177
 
    if days_since_last_update > 0:
1178
 
        # Bug heat increases by a quarter of the maximum bug heat
1179
 
        # divided by the number of days since the bug's creation date.
1180
 
        date_created = datetime.fromtimestamp(
1181
 
            bug['timestamp_date_created'])
1182
 
 
1183
 
        if bug['timestamp_date_last_message'] is not None:
1184
 
            date_last_message = datetime.fromtimestamp(
1185
 
                bug['timestamp_date_last_message'])
1186
 
            oldest_date = max(date_last_updated, date_last_message)
1187
 
        else:
1188
 
            date_last_message = None
1189
 
            oldest_date = date_last_updated
1190
 
 
1191
 
        days_since_last_activity = (datetime.utcnow() - oldest_date).days
1192
 
        days_since_created = (datetime.utcnow() - date_created).days
1193
 
        max_heat = get_max_heat_for_bug(bug_id)
1194
 
        if max_heat is not None and days_since_created > 0:
1195
 
            total_heat = (
1196
 
                total_heat + (max_heat * 0.25 / days_since_created))
1197
 
 
1198
 
    return int(total_heat)
1199
 
$$;
1200
 
 
1201
 
 
1202
 
CREATE FUNCTION cursor_fetch(cur refcursor, n integer) RETURNS SETOF record
1203
 
    LANGUAGE plpgsql
1204
 
    AS $$
1205
 
DECLARE
1206
 
    r record;
1207
 
    count integer;
1208
 
BEGIN
1209
 
    FOR count IN 1..n LOOP
1210
 
        FETCH FORWARD FROM cur INTO r;
1211
 
        IF NOT FOUND THEN
1212
 
            RETURN;
1213
 
        END IF;
1214
 
        RETURN NEXT r;
1215
 
    END LOOP;
1216
 
END;
1217
 
$$;
1218
 
 
1219
 
 
1220
 
COMMENT ON FUNCTION cursor_fetch(cur refcursor, n integer) IS 'Fetch the next n items from a cursor. Work around for not being able to use FETCH inside a SELECT statement.';
1221
 
 
1222
 
 
1223
 
CREATE FUNCTION debversion(character) RETURNS debversion
1224
 
    LANGUAGE internal IMMUTABLE STRICT
1225
 
    AS $$rtrim1$$;
1226
 
 
1227
 
 
1228
 
CREATE FUNCTION debversion_cmp(version1 debversion, version2 debversion) RETURNS integer
1229
 
    LANGUAGE c IMMUTABLE STRICT
1230
 
    AS '$libdir/debversion', 'debversion_cmp';
1231
 
 
1232
 
 
1233
 
COMMENT ON FUNCTION debversion_cmp(version1 debversion, version2 debversion) IS 'Compare Debian versions';
1234
 
 
1235
 
 
1236
 
CREATE FUNCTION debversion_eq(version1 debversion, version2 debversion) RETURNS boolean
1237
 
    LANGUAGE c IMMUTABLE STRICT
1238
 
    AS '$libdir/debversion', 'debversion_eq';
1239
 
 
1240
 
 
1241
 
COMMENT ON FUNCTION debversion_eq(version1 debversion, version2 debversion) IS 'debversion equal';
1242
 
 
1243
 
 
1244
 
CREATE FUNCTION debversion_ge(version1 debversion, version2 debversion) RETURNS boolean
1245
 
    LANGUAGE c IMMUTABLE STRICT
1246
 
    AS '$libdir/debversion', 'debversion_ge';
1247
 
 
1248
 
 
1249
 
COMMENT ON FUNCTION debversion_ge(version1 debversion, version2 debversion) IS 'debversion greater-than-or-equal';
1250
 
 
1251
 
 
1252
 
CREATE FUNCTION debversion_gt(version1 debversion, version2 debversion) RETURNS boolean
1253
 
    LANGUAGE c IMMUTABLE STRICT
1254
 
    AS '$libdir/debversion', 'debversion_gt';
1255
 
 
1256
 
 
1257
 
COMMENT ON FUNCTION debversion_gt(version1 debversion, version2 debversion) IS 'debversion greater-than';
1258
 
 
1259
 
 
1260
 
CREATE FUNCTION debversion_hash(debversion) RETURNS integer
1261
 
    LANGUAGE c IMMUTABLE STRICT
1262
 
    AS '$libdir/debversion', 'debversion_hash';
1263
 
 
1264
 
 
1265
 
CREATE FUNCTION debversion_larger(version1 debversion, version2 debversion) RETURNS debversion
1266
 
    LANGUAGE c IMMUTABLE STRICT
1267
 
    AS '$libdir/debversion', 'debversion_larger';
1268
 
 
1269
 
 
1270
 
CREATE FUNCTION debversion_le(version1 debversion, version2 debversion) RETURNS boolean
1271
 
    LANGUAGE c IMMUTABLE STRICT
1272
 
    AS '$libdir/debversion', 'debversion_le';
1273
 
 
1274
 
 
1275
 
COMMENT ON FUNCTION debversion_le(version1 debversion, version2 debversion) IS 'debversion less-than-or-equal';
1276
 
 
1277
 
 
1278
 
CREATE FUNCTION debversion_lt(version1 debversion, version2 debversion) RETURNS boolean
1279
 
    LANGUAGE c IMMUTABLE STRICT
1280
 
    AS '$libdir/debversion', 'debversion_lt';
1281
 
 
1282
 
 
1283
 
COMMENT ON FUNCTION debversion_lt(version1 debversion, version2 debversion) IS 'debversion less-than';
1284
 
 
1285
 
 
1286
 
CREATE FUNCTION debversion_ne(version1 debversion, version2 debversion) RETURNS boolean
1287
 
    LANGUAGE c IMMUTABLE STRICT
1288
 
    AS '$libdir/debversion', 'debversion_ne';
1289
 
 
1290
 
 
1291
 
COMMENT ON FUNCTION debversion_ne(version1 debversion, version2 debversion) IS 'debversion not equal';
1292
 
 
1293
 
 
1294
 
CREATE FUNCTION debversion_smaller(version1 debversion, version2 debversion) RETURNS debversion
1295
 
    LANGUAGE c IMMUTABLE STRICT
1296
 
    AS '$libdir/debversion', 'debversion_smaller';
1297
 
 
1298
 
 
1299
 
CREATE FUNCTION debversion_sort_key(version text) RETURNS text
1300
 
    LANGUAGE plpythonu IMMUTABLE STRICT
1301
 
    AS $_$
1302
 
    # If this method is altered, then any functional indexes using it
1303
 
    # need to be rebuilt.
1304
 
    import re
1305
 
 
1306
 
    VERRE = re.compile("(?:([0-9]+):)?(.+?)(?:-([^-]+))?$")
1307
 
 
1308
 
    MAP = "0123456789ABCDEFGHIJKLMNOPQRSTUV"
1309
 
 
1310
 
    epoch, version, release = VERRE.match(args[0]).groups()
1311
 
    key = []
1312
 
    for part, part_weight in ((epoch, 3000), (version, 2000), (release, 1000)):
1313
 
        if not part:
1314
 
            continue
1315
 
        i = 0
1316
 
        l = len(part)
1317
 
        while i != l:
1318
 
            c = part[i]
1319
 
            if c.isdigit():
1320
 
                key.append(part_weight)
1321
 
                j = i
1322
 
                while i != l and part[i].isdigit(): i += 1
1323
 
                key.append(part_weight+int(part[j:i] or "0"))
1324
 
            elif c == "~":
1325
 
                key.append(0)
1326
 
                i += 1
1327
 
            elif c.isalpha():
1328
 
                key.append(part_weight+ord(c))
1329
 
                i += 1
1330
 
            else:
1331
 
                key.append(part_weight+256+ord(c))
1332
 
                i += 1
1333
 
        if not key or key[-1] != part_weight:
1334
 
            key.append(part_weight)
1335
 
            key.append(part_weight)
1336
 
    key.append(1)
1337
 
 
1338
 
    # Encode our key and return it
1339
 
    #
1340
 
    result = []
1341
 
    for value in key:
1342
 
        if not value:
1343
 
            result.append("000")
1344
 
        else:
1345
 
            element = []
1346
 
            while value:
1347
 
                element.insert(0, MAP[value & 0x1F])
1348
 
                value >>= 5
1349
 
            element_len = len(element)
1350
 
            if element_len < 3:
1351
 
                element.insert(0, "0"*(3-element_len))
1352
 
            elif element_len == 3:
1353
 
                pass
1354
 
            elif element_len < 35:
1355
 
                element.insert(0, MAP[element_len-4])
1356
 
                element.insert(0, "X")
1357
 
            elif element_len < 1027:
1358
 
                element.insert(0, MAP[(element_len-4) & 0x1F])
1359
 
                element.insert(0, MAP[(element_len-4) & 0x3E0])
1360
 
                element.insert(0, "Y")
1361
 
            else:
1362
 
                raise ValueError("Number too large")
1363
 
            result.extend(element)
1364
 
    return "".join(result)
1365
 
$_$;
1366
 
 
1367
 
 
1368
 
COMMENT ON FUNCTION debversion_sort_key(version text) IS 'Return a string suitable for sorting debian version strings on';
1369
 
 
1370
 
 
1371
 
CREATE FUNCTION ensure_bugsummary_temp_journal() RETURNS void
1372
 
    LANGUAGE plpgsql
1373
 
    AS $$
1374
 
DECLARE
1375
 
BEGIN
1376
 
    CREATE TEMPORARY TABLE bugsummary_temp_journal (
1377
 
        LIKE bugsummary ) ON COMMIT DROP;
1378
 
    ALTER TABLE bugsummary_temp_journal ALTER COLUMN id DROP NOT NULL;
1379
 
EXCEPTION
1380
 
    WHEN duplicate_table THEN
1381
 
        NULL;
1382
 
END;
1383
 
$$;
1384
 
 
1385
 
 
1386
 
COMMENT ON FUNCTION ensure_bugsummary_temp_journal() IS 'Create a temporary table bugsummary_temp_journal if it does not exist.';
1387
 
 
1388
 
 
1389
 
CREATE FUNCTION generate_openid_identifier() RETURNS text
1390
 
    LANGUAGE plpythonu
1391
 
    AS $$
1392
 
    from random import choice
1393
 
 
1394
 
    # Non display confusing characters.
1395
 
    chars = '34678bcdefhkmnprstwxyzABCDEFGHJKLMNPQRTWXY'
1396
 
 
1397
 
    # Character length of tokens. Can be increased, decreased or even made
1398
 
    # random - Launchpad does not care. 7 means it takes 40 bytes to store
1399
 
    # a null-terminated Launchpad identity URL on the current domain name.
1400
 
    length=7
1401
 
 
1402
 
    loop_count = 0
1403
 
    while loop_count < 20000:
1404
 
        # Generate a random openid_identifier
1405
 
        oid = ''.join(choice(chars) for count in range(length))
1406
 
 
1407
 
        # Check if the oid is already in the db, although this is pretty
1408
 
        # unlikely
1409
 
        rv = plpy.execute("""
1410
 
            SELECT COUNT(*) AS num FROM Account WHERE openid_identifier = '%s'
1411
 
            """ % oid, 1)
1412
 
        if rv[0]['num'] == 0:
1413
 
            return oid
1414
 
        loop_count += 1
1415
 
        if loop_count == 1:
1416
 
            plpy.warning(
1417
 
                'Clash generating unique openid_identifier. '
1418
 
                'Increase length if you see this warning too much.')
1419
 
    plpy.error(
1420
 
        "Unable to generate unique openid_identifier. "
1421
 
        "Need to increase length of tokens.")
1422
 
$$;
1423
 
 
1424
 
 
1425
 
CREATE FUNCTION getlocalnodeid() RETURNS integer
1426
 
    LANGUAGE plpgsql STABLE SECURITY DEFINER
1427
 
    SET search_path TO public
1428
 
    AS $$
1429
 
    DECLARE
1430
 
        v_node_id integer;
1431
 
    BEGIN
1432
 
        SELECT INTO v_node_id _sl.getlocalnodeid('_sl');
1433
 
        RETURN v_node_id;
1434
 
    EXCEPTION
1435
 
        WHEN invalid_schema_name THEN
1436
 
            RETURN NULL;
1437
 
    END;
1438
 
$$;
1439
 
 
1440
 
 
1441
 
COMMENT ON FUNCTION getlocalnodeid() IS 'Return the replication node id for this node, or NULL if not a replicated installation.';
1442
 
 
1443
 
 
1444
 
CREATE FUNCTION is_blacklisted_name(text, integer) RETURNS boolean
1445
 
    LANGUAGE sql STABLE STRICT SECURITY DEFINER
1446
 
    SET search_path TO public
1447
 
    AS $_$
1448
 
    SELECT COALESCE(name_blacklist_match($1, $2)::boolean, FALSE);
1449
 
$_$;
1450
 
 
1451
 
 
1452
 
COMMENT ON FUNCTION is_blacklisted_name(text, integer) IS 'Return TRUE if any regular expressions stored in the NameBlacklist table match the givenname, otherwise return FALSE.';
1453
 
 
1454
 
 
1455
 
CREATE FUNCTION is_person(text) RETURNS boolean
1456
 
    LANGUAGE sql STABLE STRICT
1457
 
    AS $_$
1458
 
    SELECT count(*)>0 FROM Person WHERE name=$1 AND teamowner IS NULL;
1459
 
$_$;
1460
 
 
1461
 
 
1462
 
COMMENT ON FUNCTION is_person(text) IS 'True if the given name identifies a person in the Person table';
1463
 
 
1464
 
 
1465
 
CREATE FUNCTION is_printable_ascii(text) RETURNS boolean
1466
 
    LANGUAGE plpythonu IMMUTABLE STRICT
1467
 
    AS $_$
1468
 
    import re, string
1469
 
    try:
1470
 
        text = args[0].decode("ASCII")
1471
 
    except UnicodeError:
1472
 
        return False
1473
 
    if re.search(r"^[%s]*$" % re.escape(string.printable), text) is None:
1474
 
        return False
1475
 
    return True
1476
 
$_$;
1477
 
 
1478
 
 
1479
 
COMMENT ON FUNCTION is_printable_ascii(text) IS 'True if the string is pure printable US-ASCII';
1480
 
 
1481
 
 
1482
 
CREATE FUNCTION is_team(integer) RETURNS boolean
1483
 
    LANGUAGE sql STABLE STRICT
1484
 
    AS $_$
1485
 
    SELECT count(*)>0 FROM Person WHERE id=$1 AND teamowner IS NOT NULL;
1486
 
$_$;
1487
 
 
1488
 
 
1489
 
COMMENT ON FUNCTION is_team(integer) IS 'True if the given id identifies a team in the Person table';
1490
 
 
1491
 
 
1492
 
CREATE FUNCTION is_team(text) RETURNS boolean
1493
 
    LANGUAGE sql STABLE STRICT
1494
 
    AS $_$
1495
 
    SELECT count(*)>0 FROM Person WHERE name=$1 AND teamowner IS NOT NULL;
1496
 
$_$;
1497
 
 
1498
 
 
1499
 
COMMENT ON FUNCTION is_team(text) IS 'True if the given name identifies a team in the Person table';
1500
 
 
1501
 
 
1502
 
CREATE FUNCTION lp_mirror_account_ins() RETURNS trigger
1503
 
    LANGUAGE plpgsql SECURITY DEFINER
1504
 
    SET search_path TO public
1505
 
    AS $$
1506
 
BEGIN
1507
 
    INSERT INTO lp_Account (id, openid_identifier)
1508
 
    VALUES (NEW.id, NEW.openid_identifier);
1509
 
    RETURN NULL; -- Ignored for AFTER triggers.
1510
 
END;
1511
 
$$;
1512
 
 
1513
 
 
1514
 
CREATE FUNCTION lp_mirror_account_upd() RETURNS trigger
1515
 
    LANGUAGE plpgsql SECURITY DEFINER
1516
 
    SET search_path TO public
1517
 
    AS $$
1518
 
BEGIN
1519
 
    IF OLD.id <> NEW.id OR OLD.openid_identifier <> NEW.openid_identifier THEN
1520
 
        UPDATE lp_Account
1521
 
        SET id = NEW.id, openid_identifier = NEW.openid_identifier
1522
 
        WHERE id = OLD.id;
1523
 
    END IF;
1524
 
    RETURN NULL; -- Ignored for AFTER triggers.
1525
 
END;
1526
 
$$;
1527
 
 
1528
 
 
1529
 
CREATE FUNCTION lp_mirror_del() RETURNS trigger
1530
 
    LANGUAGE plpgsql SECURITY DEFINER
1531
 
    SET search_path TO public
1532
 
    AS $$
1533
 
BEGIN
1534
 
    EXECUTE 'DELETE FROM lp_' || TG_TABLE_NAME || ' WHERE id=' || OLD.id;
1535
 
    RETURN NULL; -- Ignored for AFTER triggers.
1536
 
END;
1537
 
$$;
1538
 
 
1539
 
 
1540
 
CREATE FUNCTION lp_mirror_openididentifier_del() RETURNS trigger
1541
 
    LANGUAGE plpgsql SECURITY DEFINER
1542
 
    SET search_path TO public
1543
 
    AS $$
1544
 
DECLARE
1545
 
    next_identifier text;
1546
 
BEGIN
1547
 
    SELECT INTO next_identifier identifier FROM OpenIdIdentifier
1548
 
    WHERE account = OLD.account AND identifier <> OLD.identifier
1549
 
    ORDER BY date_created DESC LIMIT 1;
1550
 
 
1551
 
    IF next_identifier IS NOT NULL THEN
1552
 
        UPDATE lp_account SET openid_identifier = next_identifier
1553
 
        WHERE openid_identifier = OLD.identifier;
1554
 
    ELSE
1555
 
        DELETE FROM lp_account WHERE openid_identifier = OLD.identifier;
1556
 
    END IF;
1557
 
 
1558
 
    DELETE FROM lp_OpenIdIdentifier WHERE identifier = OLD.identifier;
1559
 
 
1560
 
    RETURN NULL; -- Ignored for AFTER triggers.
1561
 
END;
1562
 
$$;
1563
 
 
1564
 
 
1565
 
CREATE FUNCTION lp_mirror_openididentifier_ins() RETURNS trigger
1566
 
    LANGUAGE plpgsql SECURITY DEFINER
1567
 
    SET search_path TO public
1568
 
    AS $$
1569
 
BEGIN
1570
 
    -- Support obsolete lp_Account.openid_identifier as best we can
1571
 
    -- until ISD migrates to using lp_OpenIdIdentifier.
1572
 
    UPDATE lp_account SET openid_identifier = NEW.identifier
1573
 
    WHERE id = NEW.account;
1574
 
    IF NOT found THEN
1575
 
        INSERT INTO lp_account (id, openid_identifier)
1576
 
        VALUES (NEW.account, NEW.identifier);
1577
 
    END IF;
1578
 
 
1579
 
    INSERT INTO lp_OpenIdIdentifier (identifier, account, date_created)
1580
 
    VALUES (NEW.identifier, NEW.account, NEW.date_created);
1581
 
 
1582
 
    RETURN NULL; -- Ignored for AFTER triggers.
1583
 
END;
1584
 
$$;
1585
 
 
1586
 
 
1587
 
CREATE FUNCTION lp_mirror_openididentifier_upd() RETURNS trigger
1588
 
    LANGUAGE plpgsql SECURITY DEFINER
1589
 
    SET search_path TO public
1590
 
    AS $$
1591
 
BEGIN
1592
 
    IF OLD.identifier <> NEW.identifier THEN
1593
 
        UPDATE lp_Account SET openid_identifier = NEW.identifier
1594
 
        WHERE openid_identifier = OLD.identifier;
1595
 
    END IF;
1596
 
    UPDATE lp_OpenIdIdentifier
1597
 
    SET
1598
 
        identifier = NEW.identifier,
1599
 
        account = NEW.account,
1600
 
        date_created = NEW.date_created
1601
 
    WHERE identifier = OLD.identifier;
1602
 
    RETURN NULL; -- Ignored for AFTER triggers.
1603
 
END;
1604
 
$$;
1605
 
 
1606
 
 
1607
 
CREATE FUNCTION lp_mirror_person_ins() RETURNS trigger
1608
 
    LANGUAGE plpgsql SECURITY DEFINER
1609
 
    SET search_path TO public
1610
 
    AS $$
1611
 
BEGIN
1612
 
    INSERT INTO lp_Person (
1613
 
        id, displayname, teamowner, teamdescription, name, language, fti,
1614
 
        defaultmembershipperiod, defaultrenewalperiod, subscriptionpolicy,
1615
 
        merged, datecreated, homepage_content, icon, mugshot,
1616
 
        hide_email_addresses, creation_rationale, creation_comment,
1617
 
        registrant, logo, renewal_policy, personal_standing,
1618
 
        personal_standing_reason, mail_resumption_date,
1619
 
        mailing_list_auto_subscribe_policy, mailing_list_receive_duplicates,
1620
 
        visibility, verbose_bugnotifications, account)
1621
 
    VALUES (
1622
 
        NEW.id, NEW.displayname, NEW.teamowner, NULL,
1623
 
        NEW.name, NEW.language, NEW.fti, NEW.defaultmembershipperiod,
1624
 
        NEW.defaultrenewalperiod, NEW.subscriptionpolicy,
1625
 
        NEW.merged, NEW.datecreated, NULL, NEW.icon,
1626
 
        NEW.mugshot, NEW.hide_email_addresses, NEW.creation_rationale,
1627
 
        NEW.creation_comment, NEW.registrant, NEW.logo, NEW.renewal_policy,
1628
 
        NEW.personal_standing, NEW.personal_standing_reason,
1629
 
        NEW.mail_resumption_date, NEW.mailing_list_auto_subscribe_policy,
1630
 
        NEW.mailing_list_receive_duplicates, NEW.visibility,
1631
 
        NEW.verbose_bugnotifications, NEW.account);
1632
 
    RETURN NULL; -- Ignored for AFTER triggers.
1633
 
END;
1634
 
$$;
1635
 
 
1636
 
 
1637
 
CREATE FUNCTION lp_mirror_person_upd() RETURNS trigger
1638
 
    LANGUAGE plpgsql SECURITY DEFINER
1639
 
    SET search_path TO public
1640
 
    AS $$
1641
 
BEGIN
1642
 
    UPDATE lp_Person
1643
 
    SET id = NEW.id,
1644
 
        displayname = NEW.displayname,
1645
 
        teamowner = NEW.teamowner,
1646
 
        teamdescription = NULL,
1647
 
        name = NEW.name,
1648
 
        language = NEW.language,
1649
 
        fti = NEW.fti,
1650
 
        defaultmembershipperiod = NEW.defaultmembershipperiod,
1651
 
        defaultrenewalperiod = NEW.defaultrenewalperiod,
1652
 
        subscriptionpolicy = NEW.subscriptionpolicy,
1653
 
        merged = NEW.merged,
1654
 
        datecreated = NEW.datecreated,
1655
 
        homepage_content = NULL,
1656
 
        icon = NEW.icon,
1657
 
        mugshot = NEW.mugshot,
1658
 
        hide_email_addresses = NEW.hide_email_addresses,
1659
 
        creation_rationale = NEW.creation_rationale,
1660
 
        creation_comment = NEW.creation_comment,
1661
 
        registrant = NEW.registrant,
1662
 
        logo = NEW.logo,
1663
 
        renewal_policy = NEW.renewal_policy,
1664
 
        personal_standing = NEW.personal_standing,
1665
 
        personal_standing_reason = NEW.personal_standing_reason,
1666
 
        mail_resumption_date = NEW.mail_resumption_date,
1667
 
        mailing_list_auto_subscribe_policy
1668
 
            = NEW.mailing_list_auto_subscribe_policy,
1669
 
        mailing_list_receive_duplicates = NEW.mailing_list_receive_duplicates,
1670
 
        visibility = NEW.visibility,
1671
 
        verbose_bugnotifications = NEW.verbose_bugnotifications,
1672
 
        account = NEW.account
1673
 
    WHERE id = OLD.id;
1674
 
    RETURN NULL; -- Ignored for AFTER triggers.
1675
 
END;
1676
 
$$;
1677
 
 
1678
 
 
1679
 
CREATE FUNCTION lp_mirror_personlocation_ins() RETURNS trigger
1680
 
    LANGUAGE plpgsql SECURITY DEFINER
1681
 
    SET search_path TO public
1682
 
    AS $$
1683
 
BEGIN
1684
 
    INSERT INTO lp_PersonLocation SELECT NEW.*;
1685
 
    RETURN NULL; -- Ignored for AFTER triggers.
1686
 
END;
1687
 
$$;
1688
 
 
1689
 
 
1690
 
CREATE FUNCTION lp_mirror_personlocation_upd() RETURNS trigger
1691
 
    LANGUAGE plpgsql SECURITY DEFINER
1692
 
    SET search_path TO public
1693
 
    AS $$
1694
 
BEGIN
1695
 
    UPDATE lp_PersonLocation
1696
 
    SET id = NEW.id,
1697
 
        date_created = NEW.date_created,
1698
 
        person = NEW.person,
1699
 
        latitude = NEW.latitude,
1700
 
        longitude = NEW.longitude,
1701
 
        time_zone = NEW.time_zone,
1702
 
        last_modified_by = NEW.last_modified_by,
1703
 
        date_last_modified = NEW.date_last_modified,
1704
 
        visible = NEW.visible,
1705
 
        locked = NEW.locked
1706
 
    WHERE id = OLD.id;
1707
 
    RETURN NULL; -- Ignored for AFTER triggers.
1708
 
END;
1709
 
$$;
1710
 
 
1711
 
 
1712
 
CREATE FUNCTION lp_mirror_teamparticipation_ins() RETURNS trigger
1713
 
    LANGUAGE plpgsql SECURITY DEFINER
1714
 
    SET search_path TO public
1715
 
    AS $$
1716
 
BEGIN
1717
 
    INSERT INTO lp_TeamParticipation SELECT NEW.*;
1718
 
    RETURN NULL; -- Ignored for AFTER triggers.
1719
 
END;
1720
 
$$;
1721
 
 
1722
 
 
1723
 
CREATE FUNCTION lp_mirror_teamparticipation_upd() RETURNS trigger
1724
 
    LANGUAGE plpgsql SECURITY DEFINER
1725
 
    SET search_path TO public
1726
 
    AS $$
1727
 
BEGIN
1728
 
    UPDATE lp_TeamParticipation
1729
 
    SET id = NEW.id,
1730
 
        team = NEW.team,
1731
 
        person = NEW.person
1732
 
    WHERE id = OLD.id;
1733
 
    RETURN NULL; -- Ignored for AFTER triggers.
1734
 
END;
1735
 
$$;
1736
 
 
1737
 
 
1738
 
CREATE FUNCTION maintain_transitively_private() RETURNS trigger
1739
 
    LANGUAGE plpgsql
1740
 
    AS $$
1741
 
BEGIN
1742
 
    IF TG_OP = 'UPDATE' THEN
1743
 
        IF (NEW.stacked_on IS NOT DISTINCT FROM OLD.stacked_on
1744
 
            AND NEW.private IS NOT DISTINCT FROM OLD.private) THEN
1745
 
            RETURN NULL;
1746
 
        END IF;
1747
 
    END IF;
1748
 
    PERFORM update_transitively_private(NEW.id);
1749
 
    RETURN NULL;
1750
 
END;
1751
 
$$;
1752
 
 
1753
 
 
1754
 
COMMENT ON FUNCTION maintain_transitively_private() IS 'Trigger maintaining the Branch transitively_private column';
1755
 
 
1756
 
 
1757
 
CREATE FUNCTION message_copy_owner_to_bugmessage() RETURNS trigger
1758
 
    LANGUAGE plpgsql SECURITY DEFINER
1759
 
    SET search_path TO public
1760
 
    AS $$
1761
 
BEGIN
1762
 
    IF NEW.owner != OLD.owner THEN
1763
 
        UPDATE BugMessage
1764
 
        SET owner = NEW.owner
1765
 
        WHERE
1766
 
        BugMessage.message = NEW.id;
1767
 
    END IF;
1768
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
1769
 
END;
1770
 
$$;
1771
 
 
1772
 
 
1773
 
COMMENT ON FUNCTION message_copy_owner_to_bugmessage() IS 'Copies the message owner into bugmessage when message changes.';
1774
 
 
1775
 
 
1776
 
CREATE FUNCTION message_copy_owner_to_questionmessage() RETURNS trigger
1777
 
    LANGUAGE plpgsql SECURITY DEFINER
1778
 
    SET search_path TO public
1779
 
    AS $$
1780
 
BEGIN
1781
 
    IF NEW.owner != OLD.owner THEN
1782
 
        UPDATE QuestionMessage
1783
 
        SET owner = NEW.owner
1784
 
        WHERE
1785
 
        QuestionMessage.message = NEW.id;
1786
 
    END IF;
1787
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
1788
 
END;
1789
 
$$;
1790
 
 
1791
 
 
1792
 
COMMENT ON FUNCTION message_copy_owner_to_questionmessage() IS 'Copies the message owner into questionmessage when message changes.';
1793
 
 
1794
 
 
1795
 
CREATE FUNCTION milestone_sort_key(dateexpected timestamp without time zone, name text) RETURNS text
1796
 
    LANGUAGE plpythonu IMMUTABLE
1797
 
    AS $$
1798
 
    # If this method is altered, then any functional indexes using it
1799
 
    # need to be rebuilt.
1800
 
    import re
1801
 
    import datetime
1802
 
 
1803
 
    date_expected, name = args
1804
 
 
1805
 
    def substitute_filled_numbers(match):
1806
 
        return match.group(0).zfill(5)
1807
 
 
1808
 
    name = re.sub(u'\d+', substitute_filled_numbers, name)
1809
 
    if date_expected is None:
1810
 
        # NULL dates are considered to be in the future.
1811
 
        date_expected = datetime.datetime(datetime.MAXYEAR, 1, 1)
1812
 
    return '%s %s' % (date_expected, name)
1813
 
$$;
1814
 
 
1815
 
 
1816
 
COMMENT ON FUNCTION milestone_sort_key(dateexpected timestamp without time zone, name text) IS 'Sort by the Milestone dateexpected and name. If the dateexpected is NULL, then it is converted to a date far in the future, so it will be sorted as a milestone in the future.';
1817
 
 
1818
 
 
1819
 
CREATE FUNCTION mv_branch_distribution_update() RETURNS trigger
1820
 
    LANGUAGE plpgsql
1821
 
    AS $$
1822
 
BEGIN
1823
 
    IF OLD.id != NEW.id THEN
1824
 
        RAISE EXCEPTION 'Cannot change Distribution.id';
1825
 
    END IF;
1826
 
    IF OLD.name != NEW.name THEN
1827
 
        UPDATE Branch SET unique_name = NULL
1828
 
        FROM DistroSeries
1829
 
        WHERE Branch.distroseries = Distroseries.id
1830
 
            AND Distroseries.distribution = NEW.id;
1831
 
    END IF;
1832
 
    RETURN NULL;
1833
 
END;
1834
 
$$;
1835
 
 
1836
 
 
1837
 
COMMENT ON FUNCTION mv_branch_distribution_update() IS 'Maintain Branch name cache when Distribution is modified.';
1838
 
 
1839
 
 
1840
 
CREATE FUNCTION mv_branch_distroseries_update() RETURNS trigger
1841
 
    LANGUAGE plpgsql
1842
 
    AS $$
1843
 
BEGIN
1844
 
    IF OLD.id != NEW.id THEN
1845
 
        RAISE EXCEPTION 'Cannot change Distroseries.id';
1846
 
    END IF;
1847
 
    IF OLD.name != NEW.name THEN
1848
 
        UPDATE Branch SET unique_name = NULL
1849
 
        WHERE Branch.distroseries = NEW.id;
1850
 
    END IF;
1851
 
    RETURN NULL;
1852
 
END;
1853
 
$$;
1854
 
 
1855
 
 
1856
 
COMMENT ON FUNCTION mv_branch_distroseries_update() IS 'Maintain Branch name cache when Distroseries is modified.';
1857
 
 
1858
 
 
1859
 
CREATE FUNCTION mv_branch_person_update() RETURNS trigger
1860
 
    LANGUAGE plpgsql
1861
 
    AS $$
1862
 
DECLARE
1863
 
    v_branch RECORD;
1864
 
BEGIN
1865
 
    IF OLD.id != NEW.id THEN
1866
 
        RAISE EXCEPTION 'Cannot change Person.id';
1867
 
    END IF;
1868
 
    IF OLD.name != NEW.name THEN
1869
 
        UPDATE Branch SET owner_name = NEW.name WHERE owner = NEW.id;
1870
 
    END IF;
1871
 
    RETURN NULL;
1872
 
END;
1873
 
$$;
1874
 
 
1875
 
 
1876
 
COMMENT ON FUNCTION mv_branch_person_update() IS 'Maintain Branch name cache when Person is modified.';
1877
 
 
1878
 
 
1879
 
CREATE FUNCTION mv_branch_product_update() RETURNS trigger
1880
 
    LANGUAGE plpgsql
1881
 
    AS $$
1882
 
DECLARE
1883
 
    v_branch RECORD;
1884
 
BEGIN
1885
 
    IF OLD.id != NEW.id THEN
1886
 
        RAISE EXCEPTION 'Cannot change Product.id';
1887
 
    END IF;
1888
 
    IF OLD.name != NEW.name THEN
1889
 
        UPDATE Branch SET target_suffix = NEW.name WHERE product=NEW.id;
1890
 
    END IF;
1891
 
    RETURN NULL;
1892
 
END;
1893
 
$$;
1894
 
 
1895
 
 
1896
 
COMMENT ON FUNCTION mv_branch_product_update() IS 'Maintain Branch name cache when Product is modified.';
1897
 
 
1898
 
 
1899
 
CREATE FUNCTION mv_pillarname_distribution() RETURNS trigger
1900
 
    LANGUAGE plpgsql SECURITY DEFINER
1901
 
    SET search_path TO public
1902
 
    AS $$
1903
 
BEGIN
1904
 
    IF TG_OP = 'INSERT' THEN
1905
 
        INSERT INTO PillarName (name, distribution)
1906
 
        VALUES (NEW.name, NEW.id);
1907
 
    ELSIF NEW.name != OLD.name THEN
1908
 
        UPDATE PillarName SET name=NEW.name WHERE distribution=NEW.id;
1909
 
    END IF;
1910
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
1911
 
END;
1912
 
$$;
1913
 
 
1914
 
 
1915
 
COMMENT ON FUNCTION mv_pillarname_distribution() IS 'Trigger maintaining the PillarName table';
1916
 
 
1917
 
 
1918
 
CREATE FUNCTION mv_pillarname_product() RETURNS trigger
1919
 
    LANGUAGE plpgsql SECURITY DEFINER
1920
 
    SET search_path TO public
1921
 
    AS $$
1922
 
BEGIN
1923
 
    IF TG_OP = 'INSERT' THEN
1924
 
        INSERT INTO PillarName (name, product, active)
1925
 
        VALUES (NEW.name, NEW.id, NEW.active);
1926
 
    ELSIF NEW.name != OLD.name OR NEW.active != OLD.active THEN
1927
 
        UPDATE PillarName SET name=NEW.name, active=NEW.active
1928
 
        WHERE product=NEW.id;
1929
 
    END IF;
1930
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
1931
 
END;
1932
 
$$;
1933
 
 
1934
 
 
1935
 
COMMENT ON FUNCTION mv_pillarname_product() IS 'Trigger maintaining the PillarName table';
1936
 
 
1937
 
 
1938
 
CREATE FUNCTION mv_pillarname_project() RETURNS trigger
1939
 
    LANGUAGE plpgsql SECURITY DEFINER
1940
 
    SET search_path TO public
1941
 
    AS $$
1942
 
BEGIN
1943
 
    IF TG_OP = 'INSERT' THEN
1944
 
        INSERT INTO PillarName (name, project, active)
1945
 
        VALUES (NEW.name, NEW.id, NEW.active);
1946
 
    ELSIF NEW.name != OLD.name or NEW.active != OLD.active THEN
1947
 
        UPDATE PillarName SET name=NEW.name, active=NEW.active
1948
 
        WHERE project=NEW.id;
1949
 
    END IF;
1950
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
1951
 
END;
1952
 
$$;
1953
 
 
1954
 
 
1955
 
COMMENT ON FUNCTION mv_pillarname_project() IS 'Trigger maintaining the PillarName table';
1956
 
 
1957
 
 
1958
 
CREATE FUNCTION mv_pofiletranslator_pomsgset() RETURNS trigger
1959
 
    LANGUAGE plpgsql
1960
 
    AS $$
1961
 
BEGIN
1962
 
    IF TG_OP = 'DELETE' THEN
1963
 
        RAISE EXCEPTION
1964
 
            'Deletions from POMsgSet not supported by the POFileTranslator materialized view';
1965
 
    ELSIF TG_OP = 'UPDATE' THEN
1966
 
        IF OLD.pofile != NEW.pofile THEN
1967
 
            RAISE EXCEPTION
1968
 
                'Changing POMsgSet.pofile not supported by the POFileTranslator materialized view';
1969
 
        END IF;
1970
 
    END IF;
1971
 
    RETURN NEW;
1972
 
END;
1973
 
$$;
1974
 
 
1975
 
 
1976
 
COMMENT ON FUNCTION mv_pofiletranslator_pomsgset() IS 'Trigger enforing no POMsgSet deletions or POMsgSet.pofile changes';
1977
 
 
1978
 
 
1979
 
CREATE FUNCTION mv_pofiletranslator_posubmission() RETURNS trigger
1980
 
    LANGUAGE plpgsql SECURITY DEFINER
1981
 
    AS $$
1982
 
DECLARE
1983
 
    v_pofile INTEGER;
1984
 
    v_trash_old BOOLEAN;
1985
 
BEGIN
1986
 
    -- If we are deleting a row, we need to remove the existing
1987
 
    -- POFileTranslator row and reinsert the historical data if it exists.
1988
 
    -- We also treat UPDATEs that change the key (person, pofile) the same
1989
 
    -- as deletes. UPDATEs that don't change these columns are treated like
1990
 
    -- INSERTs below.
1991
 
    IF TG_OP = 'INSERT' THEN
1992
 
        v_trash_old := FALSE;
1993
 
    ELSIF TG_OP = 'DELETE' THEN
1994
 
        v_trash_old := TRUE;
1995
 
    ELSE -- UPDATE
1996
 
        v_trash_old = (
1997
 
            OLD.person != NEW.person OR OLD.pomsgset != NEW.pomsgset
1998
 
            );
1999
 
    END IF;
2000
 
 
2001
 
    IF v_trash_old THEN
2002
 
 
2003
 
        -- Delete the old record.
2004
 
        DELETE FROM POFileTranslator USING POMsgSet
2005
 
        WHERE POFileTranslator.pofile = POMsgSet.pofile
2006
 
            AND POFileTranslator.person = OLD.person
2007
 
            AND POMsgSet.id = OLD.pomsgset;
2008
 
 
2009
 
        -- Insert a past record if there is one.
2010
 
        INSERT INTO POFileTranslator (
2011
 
            person, pofile, latest_posubmission, date_last_touched
2012
 
            )
2013
 
            SELECT DISTINCT ON (POSubmission.person, POMsgSet.pofile)
2014
 
                POSubmission.person, POMsgSet.pofile,
2015
 
                POSubmission.id, POSubmission.datecreated
2016
 
            FROM POSubmission, POMsgSet
2017
 
            WHERE POSubmission.pomsgset = POMsgSet.id
2018
 
                AND POSubmission.pomsgset = OLD.pomsgset
2019
 
                AND POSubmission.person = OLD.person
2020
 
            ORDER BY
2021
 
                POSubmission.person, POMsgSet.pofile,
2022
 
                POSubmission.datecreated DESC, POSubmission.id DESC;
2023
 
 
2024
 
        -- No NEW with DELETE, so we can short circuit and leave.
2025
 
        IF TG_OP = 'DELETE' THEN
2026
 
            RETURN NULL; -- Ignored because this is an AFTER trigger
2027
 
        END IF;
2028
 
    END IF;
2029
 
 
2030
 
    -- Get our new pofile id
2031
 
    SELECT INTO v_pofile POMsgSet.pofile FROM POMsgSet
2032
 
    WHERE POMsgSet.id = NEW.pomsgset;
2033
 
 
2034
 
    -- Standard 'upsert' loop to avoid race conditions.
2035
 
    LOOP
2036
 
        UPDATE POFileTranslator
2037
 
            SET
2038
 
                date_last_touched = CURRENT_TIMESTAMP AT TIME ZONE 'UTC',
2039
 
                latest_posubmission = NEW.id
2040
 
            WHERE
2041
 
                person = NEW.person
2042
 
                AND pofile = v_pofile;
2043
 
        IF found THEN
2044
 
            RETURN NULL; -- Return value ignored as this is an AFTER trigger
2045
 
        END IF;
2046
 
 
2047
 
        BEGIN
2048
 
            INSERT INTO POFileTranslator (person, pofile, latest_posubmission)
2049
 
            VALUES (NEW.person, v_pofile, NEW.id);
2050
 
            RETURN NULL; -- Return value ignored as this is an AFTER trigger
2051
 
        EXCEPTION WHEN unique_violation THEN
2052
 
            -- do nothing
2053
 
        END;
2054
 
    END LOOP;
2055
 
END;
2056
 
$$;
2057
 
 
2058
 
 
2059
 
COMMENT ON FUNCTION mv_pofiletranslator_posubmission() IS 'Trigger maintaining the POFileTranslator table';
2060
 
 
2061
 
 
2062
 
CREATE FUNCTION mv_pofiletranslator_translationmessage() RETURNS trigger
2063
 
    LANGUAGE plpgsql SECURITY DEFINER
2064
 
    SET search_path TO public
2065
 
    AS $$
2066
 
DECLARE
2067
 
    v_trash_old BOOLEAN;
2068
 
BEGIN
2069
 
    -- If we are deleting a row, we need to remove the existing
2070
 
    -- POFileTranslator row and reinsert the historical data if it exists.
2071
 
    -- We also treat UPDATEs that change the key (submitter) the same
2072
 
    -- as deletes. UPDATEs that don't change these columns are treated like
2073
 
    -- INSERTs below.
2074
 
    IF TG_OP = 'INSERT' THEN
2075
 
        v_trash_old := FALSE;
2076
 
    ELSIF TG_OP = 'DELETE' THEN
2077
 
        v_trash_old := TRUE;
2078
 
    ELSE -- UPDATE
2079
 
        v_trash_old = (
2080
 
            OLD.submitter != NEW.submitter
2081
 
            );
2082
 
    END IF;
2083
 
 
2084
 
    IF v_trash_old THEN
2085
 
        -- Was this somebody's most-recently-changed message?
2086
 
        -- If so, delete the entry for that change.
2087
 
        DELETE FROM POFileTranslator
2088
 
        WHERE latest_message = OLD.id;
2089
 
        IF FOUND THEN
2090
 
            -- We deleted the entry for somebody's latest contribution.
2091
 
            -- Find that person's latest remaining contribution and
2092
 
            -- create a new record for that.
2093
 
            INSERT INTO POFileTranslator (
2094
 
                person, pofile, latest_message, date_last_touched
2095
 
                )
2096
 
            SELECT DISTINCT ON (person, pofile.id)
2097
 
                new_latest_message.submitter AS person,
2098
 
                pofile.id,
2099
 
                new_latest_message.id,
2100
 
                greatest(new_latest_message.date_created,
2101
 
                         new_latest_message.date_reviewed)
2102
 
              FROM POFile
2103
 
              JOIN TranslationTemplateItem AS old_template_item
2104
 
                ON OLD.potmsgset = old_template_item.potmsgset AND
2105
 
                   old_template_item.potemplate = pofile.potemplate AND
2106
 
                   pofile.language = OLD.language
2107
 
              JOIN TranslationTemplateItem AS new_template_item
2108
 
                ON (old_template_item.potemplate =
2109
 
                     new_template_item.potemplate)
2110
 
              JOIN TranslationMessage AS new_latest_message
2111
 
                ON new_latest_message.potmsgset =
2112
 
                       new_template_item.potmsgset AND
2113
 
                   new_latest_message.language = OLD.language
2114
 
              LEFT OUTER JOIN POfileTranslator AS ExistingEntry
2115
 
                ON ExistingEntry.person = OLD.submitter AND
2116
 
                   ExistingEntry.pofile = POFile.id
2117
 
              WHERE
2118
 
                new_latest_message.submitter = OLD.submitter AND
2119
 
                ExistingEntry IS NULL
2120
 
              ORDER BY new_latest_message.submitter, pofile.id,
2121
 
                       new_latest_message.date_created DESC,
2122
 
                       new_latest_message.id DESC;
2123
 
        END IF;
2124
 
 
2125
 
        -- No NEW with DELETE, so we can short circuit and leave.
2126
 
        IF TG_OP = 'DELETE' THEN
2127
 
            RETURN NULL; -- Ignored because this is an AFTER trigger
2128
 
        END IF;
2129
 
    END IF;
2130
 
 
2131
 
    -- Standard 'upsert' loop to avoid race conditions.
2132
 
    LOOP
2133
 
        UPDATE POFileTranslator
2134
 
        SET
2135
 
            date_last_touched = CURRENT_TIMESTAMP AT TIME ZONE 'UTC',
2136
 
            latest_message = NEW.id
2137
 
        FROM POFile, TranslationTemplateItem
2138
 
        WHERE person = NEW.submitter AND
2139
 
              TranslationTemplateItem.potmsgset=NEW.potmsgset AND
2140
 
              TranslationTemplateItem.potemplate=pofile.potemplate AND
2141
 
              pofile.language=NEW.language AND
2142
 
              POFileTranslator.pofile = pofile.id;
2143
 
        IF found THEN
2144
 
            RETURN NULL; -- Return value ignored as this is an AFTER trigger
2145
 
        END IF;
2146
 
 
2147
 
        BEGIN
2148
 
            INSERT INTO POFileTranslator (person, pofile, latest_message)
2149
 
            SELECT DISTINCT ON (NEW.submitter, pofile.id)
2150
 
                NEW.submitter, pofile.id, NEW.id
2151
 
              FROM TranslationTemplateItem
2152
 
              JOIN POFile
2153
 
                ON pofile.language = NEW.language AND
2154
 
                   pofile.potemplate = translationtemplateitem.potemplate
2155
 
              WHERE
2156
 
                TranslationTemplateItem.potmsgset = NEW.potmsgset;
2157
 
            RETURN NULL; -- Return value ignored as this is an AFTER trigger
2158
 
        EXCEPTION WHEN unique_violation THEN
2159
 
            -- do nothing
2160
 
        END;
2161
 
    END LOOP;
2162
 
END;
2163
 
$$;
2164
 
 
2165
 
 
2166
 
COMMENT ON FUNCTION mv_pofiletranslator_translationmessage() IS 'Trigger maintaining the POFileTranslator table';
2167
 
 
2168
 
 
2169
 
CREATE FUNCTION mv_validpersonorteamcache_emailaddress() RETURNS trigger
2170
 
    LANGUAGE plpythonu SECURITY DEFINER
2171
 
    AS $_$
2172
 
    # This trigger function keeps the ValidPersonOrTeamCache materialized
2173
 
    # view in sync when updates are made to the EmailAddress table.
2174
 
    # Note that if the corresponding person is a team, changes to this table
2175
 
    # have no effect.
2176
 
    PREF = 4 # Constant indicating preferred email address
2177
 
 
2178
 
    if not SD.has_key("delete_plan"):
2179
 
        param_types = ["int4"]
2180
 
 
2181
 
        SD["is_team"] = plpy.prepare("""
2182
 
            SELECT teamowner IS NOT NULL AS is_team FROM Person WHERE id = $1
2183
 
            """, param_types)
2184
 
 
2185
 
        SD["delete_plan"] = plpy.prepare("""
2186
 
            DELETE FROM ValidPersonOrTeamCache WHERE id = $1
2187
 
            """, param_types)
2188
 
 
2189
 
        SD["insert_plan"] = plpy.prepare("""
2190
 
            INSERT INTO ValidPersonOrTeamCache (id) VALUES ($1)
2191
 
            """, param_types)
2192
 
 
2193
 
        SD["maybe_insert_plan"] = plpy.prepare("""
2194
 
            INSERT INTO ValidPersonOrTeamCache (id)
2195
 
            SELECT Person.id
2196
 
            FROM Person
2197
 
                JOIN EmailAddress ON Person.id = EmailAddress.person
2198
 
                LEFT OUTER JOIN ValidPersonOrTeamCache
2199
 
                    ON Person.id = ValidPersonOrTeamCache.id
2200
 
            WHERE Person.id = $1
2201
 
                AND ValidPersonOrTeamCache.id IS NULL
2202
 
                AND status = %(PREF)d
2203
 
                AND merged IS NULL
2204
 
                -- AND password IS NOT NULL
2205
 
            """ % vars(), param_types)
2206
 
 
2207
 
    def is_team(person_id):
2208
 
        """Return true if person_id corresponds to a team"""
2209
 
        if person_id is None:
2210
 
            return False
2211
 
        return plpy.execute(SD["is_team"], [person_id], 1)[0]["is_team"]
2212
 
 
2213
 
    class NoneDict:
2214
 
        def __getitem__(self, key):
2215
 
            return None
2216
 
 
2217
 
    old = TD["old"] or NoneDict()
2218
 
    new = TD["new"] or NoneDict()
2219
 
 
2220
 
    #plpy.info("old.id     == %s" % old["id"])
2221
 
    #plpy.info("old.person == %s" % old["person"])
2222
 
    #plpy.info("old.status == %s" % old["status"])
2223
 
    #plpy.info("new.id     == %s" % new["id"])
2224
 
    #plpy.info("new.person == %s" % new["person"])
2225
 
    #plpy.info("new.status == %s" % new["status"])
2226
 
 
2227
 
    # Short circuit if neither person nor status has changed
2228
 
    if old["person"] == new["person"] and old["status"] == new["status"]:
2229
 
        return
2230
 
 
2231
 
    # Short circuit if we are not mucking around with preferred email
2232
 
    # addresses
2233
 
    if old["status"] != PREF and new["status"] != PREF:
2234
 
        return
2235
 
 
2236
 
    # Note that we have a constraint ensuring that there is only one
2237
 
    # status == PREF email address per person at any point in time.
2238
 
    # This simplifies our logic, as we know that if old.status == PREF,
2239
 
    # old.person does not have any other preferred email addresses.
2240
 
    # Also if new.status == PREF, we know new.person previously did not
2241
 
    # have a preferred email address.
2242
 
 
2243
 
    if old["person"] != new["person"]:
2244
 
        if old["status"] == PREF and not is_team(old["person"]):
2245
 
            # old.person is no longer valid, unless they are a team
2246
 
            plpy.execute(SD["delete_plan"], [old["person"]])
2247
 
        if new["status"] == PREF and not is_team(new["person"]):
2248
 
            # new["person"] is now valid, or unchanged if they are a team
2249
 
            plpy.execute(SD["insert_plan"], [new["person"]])
2250
 
 
2251
 
    elif old["status"] == PREF and not is_team(old["person"]):
2252
 
        # No longer valid, or unchanged if they are a team
2253
 
        plpy.execute(SD["delete_plan"], [old["person"]])
2254
 
 
2255
 
    elif new["status"] == PREF and not is_team(new["person"]):
2256
 
        # May now be valid, or unchanged if they are a team.
2257
 
        plpy.execute(SD["maybe_insert_plan"], [new["person"]])
2258
 
$_$;
2259
 
 
2260
 
 
2261
 
COMMENT ON FUNCTION mv_validpersonorteamcache_emailaddress() IS 'A trigger for maintaining the ValidPersonOrTeamCache eager materialized view when changes are made to the EmailAddress table';
2262
 
 
2263
 
 
2264
 
CREATE FUNCTION mv_validpersonorteamcache_person() RETURNS trigger
2265
 
    LANGUAGE plpythonu SECURITY DEFINER
2266
 
    AS $_$
2267
 
    # This trigger function could be simplified by simply issuing
2268
 
    # one DELETE followed by one INSERT statement. However, we want to minimize
2269
 
    # expensive writes so we use this more complex logic.
2270
 
    PREF = 4 # Constant indicating preferred email address
2271
 
 
2272
 
    if not SD.has_key("delete_plan"):
2273
 
        param_types = ["int4"]
2274
 
 
2275
 
        SD["delete_plan"] = plpy.prepare("""
2276
 
            DELETE FROM ValidPersonOrTeamCache WHERE id = $1
2277
 
            """, param_types)
2278
 
 
2279
 
        SD["maybe_insert_plan"] = plpy.prepare("""
2280
 
            INSERT INTO ValidPersonOrTeamCache (id)
2281
 
            SELECT Person.id
2282
 
            FROM Person
2283
 
                LEFT OUTER JOIN EmailAddress
2284
 
                    ON Person.id = EmailAddress.person AND status = %(PREF)d
2285
 
                LEFT OUTER JOIN ValidPersonOrTeamCache
2286
 
                    ON Person.id = ValidPersonOrTeamCache.id
2287
 
            WHERE Person.id = $1
2288
 
                AND ValidPersonOrTeamCache.id IS NULL
2289
 
                AND merged IS NULL
2290
 
                AND (teamowner IS NOT NULL OR EmailAddress.id IS NOT NULL)
2291
 
            """ % vars(), param_types)
2292
 
 
2293
 
    new = TD["new"]
2294
 
    old = TD["old"]
2295
 
 
2296
 
    # We should always have new, as this is not a DELETE trigger
2297
 
    assert new is not None, 'New is None'
2298
 
 
2299
 
    person_id = new["id"]
2300
 
    query_params = [person_id] # All the same
2301
 
 
2302
 
    # Short circuit if this is a new person (not team), as it cannot
2303
 
    # be valid until a status == 4 EmailAddress entry has been created
2304
 
    # (unless it is a team, in which case it is valid on creation)
2305
 
    if old is None:
2306
 
        if new["teamowner"] is not None:
2307
 
            plpy.execute(SD["maybe_insert_plan"], query_params)
2308
 
        return
2309
 
 
2310
 
    # Short circuit if there are no relevant changes
2311
 
    if (new["teamowner"] == old["teamowner"]
2312
 
        and new["merged"] == old["merged"]):
2313
 
        return
2314
 
 
2315
 
    # This function is only dealing with updates to the Person table.
2316
 
    # This means we do not have to worry about EmailAddress changes here
2317
 
 
2318
 
    if (new["merged"] is not None or new["teamowner"] is None):
2319
 
        plpy.execute(SD["delete_plan"], query_params)
2320
 
    else:
2321
 
        plpy.execute(SD["maybe_insert_plan"], query_params)
2322
 
$_$;
2323
 
 
2324
 
 
2325
 
COMMENT ON FUNCTION mv_validpersonorteamcache_person() IS 'A trigger for maintaining the ValidPersonOrTeamCache eager materialized view when changes are made to the Person table';
2326
 
 
2327
 
 
2328
 
CREATE FUNCTION name_blacklist_match(text, integer) RETURNS integer
2329
 
    LANGUAGE plpythonu STABLE STRICT SECURITY DEFINER
2330
 
    SET search_path TO public
2331
 
    AS $_$
2332
 
    import re
2333
 
    name = args[0].decode("UTF-8")
2334
 
    user_id = args[1]
2335
 
 
2336
 
    # Initialize shared storage, shared between invocations.
2337
 
    if not SD.has_key("regexp_select_plan"):
2338
 
 
2339
 
        # All the blacklist regexps except the ones we are an admin
2340
 
        # for. These we do not check since they are not blacklisted to us.
2341
 
        SD["regexp_select_plan"] = plpy.prepare("""
2342
 
            SELECT id, regexp FROM NameBlacklist
2343
 
            WHERE admin IS NULL OR admin NOT IN (
2344
 
                SELECT team FROM TeamParticipation
2345
 
                WHERE person = $1)
2346
 
            ORDER BY id
2347
 
            """, ["integer"])
2348
 
 
2349
 
        # Storage for compiled regexps
2350
 
        SD["compiled"] = {}
2351
 
 
2352
 
        # admins is a celebrity and its id is immutable.
2353
 
        admins_id = plpy.execute(
2354
 
            "SELECT id FROM Person WHERE name='admins'")[0]["id"]
2355
 
 
2356
 
        SD["admin_select_plan"] = plpy.prepare("""
2357
 
            SELECT TRUE FROM TeamParticipation
2358
 
            WHERE
2359
 
                TeamParticipation.team = %d
2360
 
                AND TeamParticipation.person = $1
2361
 
            LIMIT 1
2362
 
            """ % admins_id, ["integer"])
2363
 
 
2364
 
        # All the blacklist regexps except those that have an admin because
2365
 
        # members of ~admin can use any name that any other admin can use.
2366
 
        SD["admin_regexp_select_plan"] = plpy.prepare("""
2367
 
            SELECT id, regexp FROM NameBlacklist
2368
 
            WHERE admin IS NULL
2369
 
            ORDER BY id
2370
 
            """, ["integer"])
2371
 
 
2372
 
 
2373
 
    compiled = SD["compiled"]
2374
 
 
2375
 
    # Names are never blacklisted for Lauchpad admins.
2376
 
    if user_id is not None and plpy.execute(
2377
 
        SD["admin_select_plan"], [user_id]).nrows() > 0:
2378
 
        blacklist_plan = "admin_regexp_select_plan"
2379
 
    else:
2380
 
        blacklist_plan = "regexp_select_plan"
2381
 
 
2382
 
    for row in plpy.execute(SD[blacklist_plan], [user_id]):
2383
 
        regexp_id = row["id"]
2384
 
        regexp_txt = row["regexp"]
2385
 
        if (compiled.get(regexp_id) is None
2386
 
            or compiled[regexp_id][0] != regexp_txt):
2387
 
            regexp = re.compile(
2388
 
                regexp_txt, re.IGNORECASE | re.UNICODE | re.VERBOSE
2389
 
                )
2390
 
            compiled[regexp_id] = (regexp_txt, regexp)
2391
 
        else:
2392
 
            regexp = compiled[regexp_id][1]
2393
 
        if regexp.search(name) is not None:
2394
 
            return regexp_id
2395
 
    return None
2396
 
$_$;
2397
 
 
2398
 
 
2399
 
COMMENT ON FUNCTION name_blacklist_match(text, integer) IS 'Return the id of the row in the NameBlacklist table that matches the given name, or NULL if no regexps in the NameBlacklist table match.';
2400
 
 
2401
 
 
2402
 
CREATE FUNCTION null_count(p_values anyarray) RETURNS integer
2403
 
    LANGUAGE plpgsql IMMUTABLE STRICT
2404
 
    AS $$
2405
 
DECLARE
2406
 
    v_index integer;
2407
 
    v_null_count integer := 0;
2408
 
BEGIN
2409
 
    FOR v_index IN array_lower(p_values,1)..array_upper(p_values,1) LOOP
2410
 
        IF p_values[v_index] IS NULL THEN
2411
 
            v_null_count := v_null_count + 1;
2412
 
        END IF;
2413
 
    END LOOP;
2414
 
    RETURN v_null_count;
2415
 
END;
2416
 
$$;
2417
 
 
2418
 
 
2419
 
COMMENT ON FUNCTION null_count(p_values anyarray) IS 'Return the number of NULLs in the first row of the given array.';
2420
 
 
2421
 
 
2422
 
CREATE FUNCTION packageset_deleted_trig() RETURNS trigger
2423
 
    LANGUAGE plpgsql
2424
 
    AS $$
2425
 
BEGIN
2426
 
    DELETE FROM flatpackagesetinclusion
2427
 
      WHERE parent = OLD.id AND child = OLD.id;
2428
 
 
2429
 
    -- A package set was deleted; it may have participated in package set
2430
 
    -- inclusion relations in a sub/superset role; delete all inclusion
2431
 
    -- relationships in which it participated.
2432
 
    DELETE FROM packagesetinclusion
2433
 
      WHERE parent = OLD.id OR child = OLD.id;
2434
 
    RETURN OLD;
2435
 
END;
2436
 
$$;
2437
 
 
2438
 
 
2439
 
COMMENT ON FUNCTION packageset_deleted_trig() IS 'Remove any DAG edges leading to/from the deleted package set.';
2440
 
 
2441
 
 
2442
 
CREATE FUNCTION packageset_inserted_trig() RETURNS trigger
2443
 
    LANGUAGE plpgsql
2444
 
    AS $$
2445
 
BEGIN
2446
 
    -- A new package set was inserted; make it a descendent of itself in
2447
 
    -- the flattened package set inclusion table in order to facilitate
2448
 
    -- querying.
2449
 
    INSERT INTO flatpackagesetinclusion(parent, child)
2450
 
      VALUES (NEW.id, NEW.id);
2451
 
    RETURN NULL;
2452
 
END;
2453
 
$$;
2454
 
 
2455
 
 
2456
 
COMMENT ON FUNCTION packageset_inserted_trig() IS 'Insert self-referencing DAG edge when a new package set is inserted.';
2457
 
 
2458
 
 
2459
 
CREATE FUNCTION packagesetinclusion_deleted_trig() RETURNS trigger
2460
 
    LANGUAGE plpgsql
2461
 
    AS $$
2462
 
BEGIN
2463
 
    -- A package set inclusion relationship was deleted i.e. a set M
2464
 
    -- ceases to include another set N as a subset.
2465
 
    -- For an explanation of the queries below please see page 5 of
2466
 
    -- "Maintaining Transitive Closure of Graphs in SQL"
2467
 
    -- http://www.comp.nus.edu.sg/~wongls/psZ/dlsw-ijit97-16.ps
2468
 
    CREATE TEMP TABLE tmp_fpsi_suspect(
2469
 
        parent integer NOT NULL,
2470
 
        child integer NOT NULL);
2471
 
    CREATE TEMP TABLE tmp_fpsi_trusted(
2472
 
        parent integer NOT NULL,
2473
 
        child integer NOT NULL);
2474
 
    CREATE TEMP TABLE tmp_fpsi_good(
2475
 
        parent integer NOT NULL,
2476
 
        child integer NOT NULL);
2477
 
 
2478
 
    INSERT INTO tmp_fpsi_suspect (
2479
 
        SELECT X.parent, Y.child
2480
 
        FROM flatpackagesetinclusion X, flatpackagesetinclusion Y
2481
 
        WHERE X.child = OLD.parent AND Y.parent = OLD.child
2482
 
      UNION
2483
 
        SELECT X.parent, OLD.child FROM flatpackagesetinclusion X
2484
 
        WHERE X.child = OLD.parent
2485
 
      UNION
2486
 
        SELECT OLD.parent, X.child FROM flatpackagesetinclusion X
2487
 
        WHERE X.parent = OLD.child
2488
 
      UNION
2489
 
        SELECT OLD.parent, OLD.child
2490
 
        );
2491
 
 
2492
 
    INSERT INTO tmp_fpsi_trusted (
2493
 
        SELECT parent, child FROM flatpackagesetinclusion
2494
 
        EXCEPT
2495
 
        SELECT parent, child FROM tmp_fpsi_suspect
2496
 
      UNION
2497
 
        SELECT parent, child FROM packagesetinclusion psi
2498
 
        WHERE psi.parent != OLD.parent AND psi.child != OLD.child
2499
 
        );
2500
 
 
2501
 
    INSERT INTO tmp_fpsi_good (
2502
 
        SELECT parent, child FROM tmp_fpsi_trusted
2503
 
      UNION
2504
 
        SELECT T1.parent, T2.child
2505
 
        FROM tmp_fpsi_trusted T1, tmp_fpsi_trusted T2
2506
 
        WHERE T1.child = T2.parent
2507
 
      UNION
2508
 
        SELECT T1.parent, T3.child
2509
 
        FROM tmp_fpsi_trusted T1, tmp_fpsi_trusted T2, tmp_fpsi_trusted T3
2510
 
        WHERE T1.child = T2.parent AND T2.child = T3.parent
2511
 
        );
2512
 
 
2513
 
    DELETE FROM flatpackagesetinclusion fpsi
2514
 
    WHERE NOT EXISTS (
2515
 
        SELECT * FROM tmp_fpsi_good T
2516
 
        WHERE T.parent = fpsi.parent AND T.child = fpsi.child);
2517
 
 
2518
 
    DROP TABLE tmp_fpsi_good;
2519
 
    DROP TABLE tmp_fpsi_trusted;
2520
 
    DROP TABLE tmp_fpsi_suspect;
2521
 
 
2522
 
    RETURN OLD;
2523
 
END;
2524
 
$$;
2525
 
 
2526
 
 
2527
 
COMMENT ON FUNCTION packagesetinclusion_deleted_trig() IS 'Maintain the transitive closure in the DAG when an edge leading to/from a package set is deleted.';
2528
 
 
2529
 
 
2530
 
CREATE FUNCTION packagesetinclusion_inserted_trig() RETURNS trigger
2531
 
    LANGUAGE plpgsql
2532
 
    AS $$
2533
 
BEGIN
2534
 
    DECLARE
2535
 
        parent_name text;
2536
 
        child_name text;
2537
 
        parent_distroseries text;
2538
 
        child_distroseries text;
2539
 
    BEGIN
2540
 
        -- Make sure that the package sets being associated here belong
2541
 
        -- to the same distro series.
2542
 
        IF (SELECT parent.distroseries != child.distroseries
2543
 
            FROM packageset parent, packageset child
2544
 
            WHERE parent.id = NEW.parent AND child.id = NEW.child)
2545
 
        THEN
2546
 
            SELECT name INTO parent_name FROM packageset WHERE id = NEW.parent;
2547
 
            SELECT name INTO child_name FROM packageset WHERE id = NEW.child;
2548
 
            SELECT ds.name INTO parent_distroseries FROM packageset ps, distroseries ds WHERE ps.id = NEW.parent AND ps.distroseries = ds.id;
2549
 
            SELECT ds.name INTO child_distroseries FROM packageset ps, distroseries ds WHERE ps.id = NEW.child AND ps.distroseries = ds.id;
2550
 
            RAISE EXCEPTION 'Package sets % and % belong to different distro series (to % and % respectively) and thus cannot be associated.', child_name, parent_name, child_distroseries, parent_distroseries;
2551
 
        END IF;
2552
 
 
2553
 
        IF EXISTS(
2554
 
            SELECT * FROM flatpackagesetinclusion
2555
 
            WHERE parent = NEW.child AND child = NEW.parent LIMIT 1)
2556
 
        THEN
2557
 
            SELECT name INTO parent_name FROM packageset WHERE id = NEW.parent;
2558
 
            SELECT name INTO child_name FROM packageset WHERE id = NEW.child;
2559
 
            RAISE EXCEPTION 'Package set % already includes %. Adding (% -> %) would introduce a cycle in the package set graph (DAG).', child_name, parent_name, parent_name, child_name;
2560
 
        END IF;
2561
 
    END;
2562
 
    -- A new package set inclusion relationship was inserted i.e. a set M
2563
 
    -- now includes another set N as a subset.
2564
 
    -- For an explanation of the queries below please see page 4 of
2565
 
    -- "Maintaining Transitive Closure of Graphs in SQL"
2566
 
    -- http://www.comp.nus.edu.sg/~wongls/psZ/dlsw-ijit97-16.ps
2567
 
    CREATE TEMP TABLE tmp_fpsi_new(
2568
 
        parent integer NOT NULL,
2569
 
        child integer NOT NULL);
2570
 
 
2571
 
    INSERT INTO tmp_fpsi_new (
2572
 
        SELECT
2573
 
            X.parent AS parent, NEW.child AS child
2574
 
        FROM flatpackagesetinclusion X WHERE X.child = NEW.parent
2575
 
      UNION
2576
 
        SELECT
2577
 
            NEW.parent AS parent, X.child AS child
2578
 
        FROM flatpackagesetinclusion X WHERE X.parent = NEW.child
2579
 
      UNION
2580
 
        SELECT
2581
 
            X.parent AS parent, Y.child AS child
2582
 
        FROM flatpackagesetinclusion X, flatpackagesetinclusion Y
2583
 
        WHERE X.child = NEW.parent AND Y.parent = NEW.child
2584
 
        );
2585
 
    INSERT INTO tmp_fpsi_new(parent, child) VALUES(NEW.parent, NEW.child);
2586
 
 
2587
 
    INSERT INTO flatpackagesetinclusion(parent, child) (
2588
 
        SELECT
2589
 
            parent, child FROM tmp_fpsi_new
2590
 
        EXCEPT
2591
 
        SELECT F.parent, F.child FROM flatpackagesetinclusion F
2592
 
        );
2593
 
 
2594
 
    DROP TABLE tmp_fpsi_new;
2595
 
 
2596
 
    RETURN NULL;
2597
 
END;
2598
 
$$;
2599
 
 
2600
 
 
2601
 
COMMENT ON FUNCTION packagesetinclusion_inserted_trig() IS 'Maintain the transitive closure in the DAG for a newly inserted edge leading to/from a package set.';
2602
 
 
2603
 
 
2604
 
CREATE FUNCTION person_sort_key(displayname text, name text) RETURNS text
2605
 
    LANGUAGE plpythonu IMMUTABLE STRICT
2606
 
    AS $$
2607
 
    # NB: If this implementation is changed, the person_sort_idx needs to be
2608
 
    # rebuilt along with any other indexes using it.
2609
 
    import re
2610
 
 
2611
 
    try:
2612
 
        strip_re = SD["strip_re"]
2613
 
    except KeyError:
2614
 
        strip_re = re.compile("(?:[^\w\s]|[\d_])", re.U)
2615
 
        SD["strip_re"] = strip_re
2616
 
 
2617
 
    displayname, name = args
2618
 
 
2619
 
    # Strip noise out of displayname. We do not have to bother with
2620
 
    # name, as we know it is just plain ascii.
2621
 
    displayname = strip_re.sub('', displayname.decode('UTF-8').lower())
2622
 
    return ("%s, %s" % (displayname.strip(), name)).encode('UTF-8')
2623
 
$$;
2624
 
 
2625
 
 
2626
 
COMMENT ON FUNCTION person_sort_key(displayname text, name text) IS 'Return a string suitable for sorting people on, generated by stripping noise out of displayname and concatenating name';
2627
 
 
 
30
CREATE TABLE revision (
 
31
    id integer NOT NULL,
 
32
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
 
33
    log_body text NOT NULL,
 
34
    revision_author integer NOT NULL,
 
35
    gpgkey integer,
 
36
    revision_id text NOT NULL,
 
37
    revision_date timestamp without time zone,
 
38
    karma_allocated boolean DEFAULT false
 
39
);
 
40
ALTER TABLE ONLY revision ALTER COLUMN revision_author SET STATISTICS 500;
 
41
ALTER TABLE ONLY revision ALTER COLUMN revision_date SET STATISTICS 500;
2628
42
 
2629
43
CREATE FUNCTION pgstattuple(text) RETURNS pgstattuple_type
2630
 
    LANGUAGE c STRICT
2631
 
    AS '$libdir/pgstattuple', 'pgstattuple';
2632
 
 
 
44
    AS '$libdir/pgstattuple', 'pgstattuple'
 
45
    LANGUAGE c STRICT;
2633
46
 
2634
47
CREATE FUNCTION pgstattuple(oid) RETURNS pgstattuple_type
2635
 
    LANGUAGE c STRICT
2636
 
    AS '$libdir/pgstattuple', 'pgstattuplebyid';
2637
 
 
 
48
    AS '$libdir/pgstattuple', 'pgstattuplebyid'
 
49
    LANGUAGE c STRICT;
2638
50
 
2639
51
CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
2640
 
    LANGUAGE c
2641
 
    AS '$libdir/plpgsql', 'plpgsql_call_handler';
2642
 
 
 
52
    AS '$libdir/plpgsql', 'plpgsql_call_handler'
 
53
    LANGUAGE c;
2643
54
 
2644
55
CREATE FUNCTION plpython_call_handler() RETURNS language_handler
2645
 
    LANGUAGE c
2646
 
    AS '$libdir/plpython', 'plpython_call_handler';
2647
 
 
2648
 
 
2649
 
CREATE FUNCTION questionmessage_copy_owner_from_message() RETURNS trigger
2650
 
    LANGUAGE plpgsql SECURITY DEFINER
2651
 
    SET search_path TO public
2652
 
    AS $$
2653
 
BEGIN
2654
 
    IF TG_OP = 'INSERT' THEN
2655
 
        IF NEW.owner is NULL THEN
2656
 
            UPDATE QuestionMessage
2657
 
            SET owner = Message.owner FROM
2658
 
            Message WHERE
2659
 
            Message.id = NEW.message AND
2660
 
            QuestionMessage.id = NEW.id;
2661
 
        END IF;
2662
 
    ELSIF NEW.message != OLD.message THEN
2663
 
        UPDATE QuestionMessage
2664
 
        SET owner = Message.owner FROM
2665
 
        Message WHERE
2666
 
        Message.id = NEW.message AND
2667
 
        QuestionMessage.id = NEW.id;
2668
 
    END IF;
2669
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
2670
 
END;
2671
 
$$;
2672
 
 
2673
 
 
2674
 
COMMENT ON FUNCTION questionmessage_copy_owner_from_message() IS 'Copies the message owner into QuestionMessage when QuestionMessage changes.';
2675
 
 
2676
 
 
2677
 
CREATE FUNCTION replication_lag() RETURNS interval
2678
 
    LANGUAGE plpgsql STABLE SECURITY DEFINER
2679
 
    SET search_path TO public
2680
 
    AS $$
2681
 
    DECLARE
2682
 
        v_lag interval;
2683
 
    BEGIN
2684
 
        SELECT INTO v_lag max(st_lag_time) FROM _sl.sl_status;
2685
 
        RETURN v_lag;
2686
 
    -- Slony-I not installed here - non-replicated setup.
2687
 
    EXCEPTION
2688
 
        WHEN invalid_schema_name THEN
2689
 
            RETURN NULL;
2690
 
        WHEN undefined_table THEN
2691
 
            RETURN NULL;
2692
 
    END;
2693
 
$$;
2694
 
 
2695
 
 
2696
 
COMMENT ON FUNCTION replication_lag() IS 'Returns the worst lag time in our cluster, or NULL if not a replicated installation. Only returns meaningful results on the lpmain replication set master.';
2697
 
 
2698
 
 
2699
 
CREATE FUNCTION replication_lag(node_id integer) RETURNS interval
2700
 
    LANGUAGE plpgsql STABLE SECURITY DEFINER
2701
 
    SET search_path TO public
2702
 
    AS $$
2703
 
    DECLARE
2704
 
        v_lag interval;
2705
 
    BEGIN
2706
 
        SELECT INTO v_lag st_lag_time FROM _sl.sl_status
2707
 
            WHERE st_origin = _sl.getlocalnodeid('_sl')
2708
 
                AND st_received = node_id;
2709
 
        RETURN v_lag;
2710
 
    -- Slony-I not installed here - non-replicated setup.
2711
 
    EXCEPTION
2712
 
        WHEN invalid_schema_name THEN
2713
 
            RETURN NULL;
2714
 
        WHEN undefined_table THEN
2715
 
            RETURN NULL;
2716
 
    END;
2717
 
$$;
2718
 
 
2719
 
 
2720
 
COMMENT ON FUNCTION replication_lag(node_id integer) IS 'Returns the lag time of the lpmain replication set to the given node, or NULL if not a replicated installation. The node id parameter can be obtained by calling getlocalnodeid() on the relevant database. This function only returns meaningful results on the lpmain replication set master.';
2721
 
 
2722
 
 
2723
 
CREATE FUNCTION sane_version(text) RETURNS boolean
2724
 
    LANGUAGE plpythonu IMMUTABLE STRICT
2725
 
    AS $_$
2726
 
    import re
2727
 
    if re.search("""^(?ix)
2728
 
        [0-9a-z]
2729
 
        ( [0-9a-z] | [0-9a-z.-]*[0-9a-z] )*
2730
 
        $""", args[0]):
2731
 
        return 1
2732
 
    return 0
2733
 
$_$;
2734
 
 
2735
 
 
2736
 
COMMENT ON FUNCTION sane_version(text) IS 'A sane version number for use by ProductRelease and DistroRelease. We may make it less strict if required, but it would be nice if we can enforce simple version strings because we use them in URLs';
2737
 
 
2738
 
 
2739
 
CREATE FUNCTION set_bug_date_last_message() RETURNS trigger
2740
 
    LANGUAGE plpgsql SECURITY DEFINER
2741
 
    SET search_path TO public
2742
 
    AS $$
2743
 
BEGIN
2744
 
    IF TG_OP = 'INSERT' THEN
2745
 
        UPDATE Bug
2746
 
        SET date_last_message = CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
2747
 
        WHERE Bug.id = NEW.bug;
2748
 
    ELSE
2749
 
        UPDATE Bug
2750
 
        SET date_last_message = max_datecreated
2751
 
        FROM (
2752
 
            SELECT BugMessage.bug, max(Message.datecreated) AS max_datecreated
2753
 
            FROM BugMessage, Message
2754
 
            WHERE BugMessage.id <> OLD.id
2755
 
                AND BugMessage.bug = OLD.bug
2756
 
                AND BugMessage.message = Message.id
2757
 
            GROUP BY BugMessage.bug
2758
 
            ) AS MessageSummary
2759
 
        WHERE Bug.id = MessageSummary.bug;
2760
 
    END IF;
2761
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
2762
 
END;
2763
 
$$;
2764
 
 
2765
 
 
2766
 
COMMENT ON FUNCTION set_bug_date_last_message() IS 'AFTER INSERT trigger on BugMessage maintaining the Bug.date_last_message column';
2767
 
 
2768
 
 
2769
 
CREATE FUNCTION set_bug_message_count() RETURNS trigger
2770
 
    LANGUAGE plpgsql
2771
 
    AS $$
2772
 
BEGIN
2773
 
    IF TG_OP = 'UPDATE' THEN
2774
 
        IF NEW.bug = OLD.bug THEN
2775
 
            RETURN NULL; -- Ignored - this is an AFTER trigger.
2776
 
        END IF;
2777
 
    END IF;
2778
 
 
2779
 
    IF TG_OP <> 'DELETE' THEN
2780
 
        UPDATE Bug SET message_count = message_count + 1
2781
 
        WHERE Bug.id = NEW.bug;
2782
 
    END IF;
2783
 
 
2784
 
    IF TG_OP <> 'INSERT' THEN
2785
 
        UPDATE Bug SET message_count = message_count - 1
2786
 
        WHERE Bug.id = OLD.bug;
2787
 
    END IF;
2788
 
 
2789
 
    RETURN NULL; -- Ignored - this is an AFTER trigger.
2790
 
END;
2791
 
$$;
2792
 
 
2793
 
 
2794
 
COMMENT ON FUNCTION set_bug_message_count() IS 'AFTER UPDATE trigger on BugAffectsPerson maintaining the Bug.users_affected_count column';
2795
 
 
2796
 
 
2797
 
CREATE FUNCTION set_bug_number_of_duplicates() RETURNS trigger
2798
 
    LANGUAGE plpgsql
2799
 
    AS $$
2800
 
BEGIN
2801
 
    -- Short circuit on an update that doesn't change duplicateof
2802
 
    IF TG_OP = 'UPDATE' THEN
2803
 
        IF NEW.duplicateof = OLD.duplicateof THEN
2804
 
            RETURN NULL; -- Ignored - this is an AFTER trigger
2805
 
        END IF;
2806
 
    END IF;
2807
 
 
2808
 
    -- For update or delete, possibly decrement a bug's dupe count
2809
 
    IF TG_OP <> 'INSERT' THEN
2810
 
        IF OLD.duplicateof IS NOT NULL THEN
2811
 
            UPDATE Bug SET number_of_duplicates = number_of_duplicates - 1
2812
 
                WHERE Bug.id = OLD.duplicateof;
2813
 
        END IF;
2814
 
    END IF;
2815
 
 
2816
 
    -- For update or insert, possibly increment a bug's dupe cout
2817
 
    IF TG_OP <> 'DELETE' THEN
2818
 
        IF NEW.duplicateof IS NOT NULL THEN
2819
 
            UPDATE Bug SET number_of_duplicates = number_of_duplicates + 1
2820
 
                WHERE Bug.id = NEW.duplicateof;
2821
 
        END IF;
2822
 
    END IF;
2823
 
 
2824
 
    RETURN NULL; -- Ignored - this is an AFTER trigger
2825
 
END;
2826
 
$$;
2827
 
 
2828
 
 
2829
 
COMMENT ON FUNCTION set_bug_number_of_duplicates() IS 'AFTER UPDATE trigger on Bug maintaining the Bug.number_of_duplicates column';
2830
 
 
2831
 
 
2832
 
CREATE FUNCTION set_bug_users_affected_count() RETURNS trigger
2833
 
    LANGUAGE plpgsql
2834
 
    AS $$
2835
 
BEGIN
2836
 
    IF TG_OP = 'INSERT' THEN
2837
 
        IF NEW.affected = TRUE THEN
2838
 
            UPDATE Bug
2839
 
            SET users_affected_count = users_affected_count + 1
2840
 
            WHERE Bug.id = NEW.bug;
2841
 
        ELSE
2842
 
            UPDATE Bug
2843
 
            SET users_unaffected_count = users_unaffected_count + 1
2844
 
            WHERE Bug.id = NEW.bug;
2845
 
        END IF;
2846
 
    END IF;
2847
 
 
2848
 
    IF TG_OP = 'DELETE' THEN
2849
 
        IF OLD.affected = TRUE THEN
2850
 
            UPDATE Bug
2851
 
            SET users_affected_count = users_affected_count - 1
2852
 
            WHERE Bug.id = OLD.bug;
2853
 
        ELSE
2854
 
            UPDATE Bug
2855
 
            SET users_unaffected_count = users_unaffected_count - 1
2856
 
            WHERE Bug.id = OLD.bug;
2857
 
        END IF;
2858
 
    END IF;
2859
 
 
2860
 
    IF TG_OP = 'UPDATE' THEN
2861
 
        IF OLD.affected <> NEW.affected THEN
2862
 
            IF NEW.affected THEN
2863
 
                UPDATE Bug
2864
 
                SET users_affected_count = users_affected_count + 1,
2865
 
                    users_unaffected_count = users_unaffected_count - 1
2866
 
                WHERE Bug.id = OLD.bug;
2867
 
            ELSE
2868
 
                UPDATE Bug
2869
 
                SET users_affected_count = users_affected_count - 1,
2870
 
                    users_unaffected_count = users_unaffected_count + 1
2871
 
                WHERE Bug.id = OLD.bug;
2872
 
            END IF;
2873
 
        END IF;
2874
 
    END IF;
2875
 
 
2876
 
    RETURN NULL;
2877
 
END;
2878
 
$$;
2879
 
 
2880
 
 
2881
 
CREATE FUNCTION set_bugtask_date_milestone_set() RETURNS trigger
2882
 
    LANGUAGE plpgsql
2883
 
    AS $$
2884
 
BEGIN
2885
 
    IF TG_OP = 'INSERT' THEN
2886
 
        -- If the inserted row as a milestone set, set date_milestone_set.
2887
 
        IF NEW.milestone IS NOT NULL THEN
2888
 
            UPDATE BugTask
2889
 
            SET date_milestone_set = CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
2890
 
            WHERE BugTask.id = NEW.id;
2891
 
        END IF;
2892
 
    END IF;
2893
 
 
2894
 
    IF TG_OP = 'UPDATE' THEN
2895
 
        IF OLD.milestone IS NULL THEN
2896
 
            -- If there was no milestone set, check if the new row has a
2897
 
            -- milestone set and set date_milestone_set.
2898
 
            IF NEW.milestone IS NOT NULL THEN
2899
 
                UPDATE BugTask
2900
 
                SET date_milestone_set = CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
2901
 
                WHERE BugTask.id = NEW.id;
2902
 
            END IF;
2903
 
        ELSE
2904
 
            IF NEW.milestone IS NULL THEN
2905
 
                -- If the milestone was unset, clear date_milestone_set.
2906
 
                UPDATE BugTask
2907
 
                SET date_milestone_set = NULL
2908
 
                WHERE BugTask.id = NEW.id;
2909
 
            ELSE
2910
 
                -- Update date_milestone_set if the bug task was
2911
 
                -- targeted to another milestone.
2912
 
                IF NEW.milestone != OLD.milestone THEN
2913
 
                    UPDATE BugTask
2914
 
                    SET date_milestone_set = CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
2915
 
                    WHERE BugTask.id = NEW.id;
2916
 
                END IF;
2917
 
 
2918
 
            END IF;
2919
 
        END IF;
2920
 
    END IF;
2921
 
 
2922
 
    RETURN NULL; -- Ignored - this is an AFTER trigger.
2923
 
END;
2924
 
$$;
2925
 
 
2926
 
 
2927
 
COMMENT ON FUNCTION set_bugtask_date_milestone_set() IS 'Update BugTask.date_milestone_set when BugTask.milestone is changed.';
2928
 
 
2929
 
 
2930
 
CREATE FUNCTION set_date_status_set() RETURNS trigger
2931
 
    LANGUAGE plpgsql
2932
 
    AS $$
2933
 
BEGIN
2934
 
    IF OLD.status <> NEW.status THEN
2935
 
        NEW.date_status_set = CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
2936
 
    END IF;
2937
 
    RETURN NEW;
2938
 
END;
2939
 
$$;
2940
 
 
2941
 
 
2942
 
COMMENT ON FUNCTION set_date_status_set() IS 'BEFORE UPDATE trigger on Account that maintains the Account.date_status_set column.';
2943
 
 
2944
 
 
2945
 
CREATE FUNCTION set_openid_identifier() RETURNS trigger
2946
 
    LANGUAGE plpythonu
2947
 
    AS $$
2948
 
    # If someone is trying to explicitly set the openid_identifier, let them.
2949
 
    # This also causes openid_identifiers to be left alone if this is an
2950
 
    # UPDATE trigger.
2951
 
    if TD['new']['openid_identifier'] is not None:
2952
 
        return None
2953
 
 
2954
 
    from random import choice
2955
 
 
2956
 
    # Non display confusing characters
2957
 
    chars = '34678bcdefhkmnprstwxyzABCDEFGHJKLMNPQRTWXY'
2958
 
 
2959
 
    # character length of tokens. Can be increased, decreased or even made
2960
 
    # random - Launchpad does not care. 7 means it takes 40 bytes to store
2961
 
    # a null-terminated Launchpad identity URL on the current domain name.
2962
 
    length=7
2963
 
 
2964
 
    loop_count = 0
2965
 
    while loop_count < 20000:
2966
 
        # Generate a random openid_identifier
2967
 
        oid = ''.join(choice(chars) for count in range(length))
2968
 
 
2969
 
        # Check if the oid is already in the db, although this is pretty
2970
 
        # unlikely
2971
 
        rv = plpy.execute("""
2972
 
            SELECT COUNT(*) AS num FROM Person WHERE openid_identifier = '%s'
2973
 
            """ % oid, 1)
2974
 
        if rv[0]['num'] == 0:
2975
 
            TD['new']['openid_identifier'] = oid
2976
 
            return "MODIFY"
2977
 
        loop_count += 1
2978
 
        if loop_count == 1:
2979
 
            plpy.warning(
2980
 
                'Clash generating unique openid_identifier. '
2981
 
                'Increase length if you see this warning too much.')
2982
 
    plpy.error(
2983
 
        "Unable to generate unique openid_identifier. "
2984
 
        "Need to increase length of tokens.")
2985
 
$$;
2986
 
 
2987
 
 
2988
 
CREATE FUNCTION set_shipit_normalized_address() RETURNS trigger
2989
 
    LANGUAGE plpgsql
2990
 
    AS $$
2991
 
    BEGIN
2992
 
        NEW.normalized_address =
2993
 
            lower(
2994
 
                -- Strip off everything that's not alphanumeric
2995
 
                -- characters.
2996
 
                regexp_replace(
2997
 
                    coalesce(NEW.addressline1, '') || ' ' ||
2998
 
                    coalesce(NEW.addressline2, '') || ' ' ||
2999
 
                    coalesce(NEW.city, ''),
3000
 
                    '[^a-zA-Z0-9]+', '', 'g'));
3001
 
        RETURN NEW;
3002
 
    END;
3003
 
$$;
3004
 
 
3005
 
 
3006
 
COMMENT ON FUNCTION set_shipit_normalized_address() IS 'Store a normalized concatenation of the request''s address into the normalized_address column.';
3007
 
 
3008
 
 
3009
 
CREATE FUNCTION sha1(text) RETURNS character
3010
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3011
 
    AS $$
3012
 
    import hashlib
3013
 
    return hashlib.sha1(args[0]).hexdigest()
3014
 
$$;
3015
 
 
3016
 
 
3017
 
COMMENT ON FUNCTION sha1(text) IS 'Return the SHA1 one way cryptographic hash as a string of 40 hex digits';
3018
 
 
3019
 
 
3020
 
CREATE FUNCTION summarise_bug(bug_row bug) RETURNS void
3021
 
    LANGUAGE plpgsql
3022
 
    AS $$
3023
 
DECLARE
3024
 
    d bugsummary%ROWTYPE;
3025
 
BEGIN
3026
 
    PERFORM ensure_bugsummary_temp_journal();
3027
 
    FOR d IN SELECT * FROM bugsummary_locations(BUG_ROW) LOOP
3028
 
        d.count = 1;
3029
 
        PERFORM bug_summary_temp_journal_ins(d);
3030
 
    END LOOP;
3031
 
END;
3032
 
$$;
3033
 
 
3034
 
 
3035
 
COMMENT ON FUNCTION summarise_bug(bug_row bug) IS 'AFTER summarise a bug row into bugsummary.';
3036
 
 
3037
 
 
3038
 
CREATE FUNCTION ulower(text) RETURNS text
3039
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3040
 
    AS $$
3041
 
    return args[0].decode('utf8').lower().encode('utf8')
3042
 
$$;
3043
 
 
3044
 
 
3045
 
COMMENT ON FUNCTION ulower(text) IS 'Return the lower case version of a UTF-8 encoded string.';
3046
 
 
3047
 
 
3048
 
CREATE FUNCTION unsummarise_bug(bug_row bug) RETURNS void
3049
 
    LANGUAGE plpgsql
3050
 
    AS $$
3051
 
DECLARE
3052
 
    d bugsummary%ROWTYPE;
3053
 
BEGIN
3054
 
    PERFORM ensure_bugsummary_temp_journal();
3055
 
    FOR d IN SELECT * FROM bugsummary_locations(BUG_ROW) LOOP
3056
 
        d.count = -1;
3057
 
        PERFORM bug_summary_temp_journal_ins(d);
3058
 
    END LOOP;
3059
 
END;
3060
 
$$;
3061
 
 
3062
 
 
3063
 
COMMENT ON FUNCTION unsummarise_bug(bug_row bug) IS 'AFTER unsummarise a bug row from bugsummary.';
3064
 
 
3065
 
 
3066
 
CREATE FUNCTION update_branch_name_cache() RETURNS trigger
3067
 
    LANGUAGE plpgsql
3068
 
    AS $$
3069
 
DECLARE
3070
 
    needs_update boolean := FALSE;
3071
 
BEGIN
3072
 
    IF TG_OP = 'INSERT' THEN
3073
 
        needs_update := TRUE;
3074
 
    ELSIF (NEW.owner_name IS NULL
3075
 
        OR NEW.unique_name IS NULL
3076
 
        OR OLD.owner_name <> NEW.owner_name
3077
 
        OR OLD.unique_name <> NEW.unique_name
3078
 
        OR (NEW.target_suffix IS NULL <> OLD.target_suffix IS NULL)
3079
 
        OR COALESCE(OLD.target_suffix, '') <> COALESCE(NEW.target_suffix, '')
3080
 
        OR OLD.name <> NEW.name
3081
 
        OR OLD.owner <> NEW.owner
3082
 
        OR COALESCE(OLD.product, -1) <> COALESCE(NEW.product, -1)
3083
 
        OR COALESCE(OLD.distroseries, -1) <> COALESCE(NEW.distroseries, -1)
3084
 
        OR COALESCE(OLD.sourcepackagename, -1)
3085
 
            <> COALESCE(NEW.sourcepackagename, -1)) THEN
3086
 
        needs_update := TRUE;
3087
 
    END IF;
3088
 
 
3089
 
    IF needs_update THEN
3090
 
        SELECT
3091
 
            Person.name AS owner_name,
3092
 
            COALESCE(Product.name, SPN.name) AS target_suffix,
3093
 
            '~' || Person.name || '/' || COALESCE(
3094
 
                Product.name,
3095
 
                Distribution.name || '/' || Distroseries.name
3096
 
                    || '/' || SPN.name,
3097
 
                '+junk') || '/' || NEW.name AS unique_name
3098
 
        INTO NEW.owner_name, NEW.target_suffix, NEW.unique_name
3099
 
        FROM Person
3100
 
        LEFT OUTER JOIN DistroSeries ON NEW.distroseries = DistroSeries.id
3101
 
        LEFT OUTER JOIN Product ON NEW.product = Product.id
3102
 
        LEFT OUTER JOIN Distribution
3103
 
            ON Distroseries.distribution = Distribution.id
3104
 
        LEFT OUTER JOIN SourcepackageName AS SPN
3105
 
            ON SPN.id = NEW.sourcepackagename
3106
 
        WHERE Person.id = NEW.owner;
3107
 
    END IF;
3108
 
 
3109
 
    RETURN NEW;
3110
 
END;
3111
 
$$;
3112
 
 
3113
 
 
3114
 
COMMENT ON FUNCTION update_branch_name_cache() IS 'Maintain the cached name columns in Branch.';
3115
 
 
3116
 
 
3117
 
CREATE FUNCTION update_database_disk_utilization() RETURNS void
3118
 
    LANGUAGE sql SECURITY DEFINER
3119
 
    SET search_path TO public
3120
 
    AS $$
3121
 
    INSERT INTO DatabaseDiskUtilization
3122
 
    SELECT
3123
 
        CURRENT_TIMESTAMP AT TIME ZONE 'UTC',
3124
 
        namespace, name,
3125
 
        sub_namespace, sub_name,
3126
 
        kind,
3127
 
        (namespace || '.' ||  name || COALESCE(
3128
 
                '/' || sub_namespace || '.' || sub_name, '')) AS sort,
3129
 
        (stat).table_len,
3130
 
        (stat).tuple_count,
3131
 
        (stat).tuple_len,
3132
 
        (stat).tuple_percent,
3133
 
        (stat).dead_tuple_count,
3134
 
        (stat).dead_tuple_len,
3135
 
        (stat).dead_tuple_percent,
3136
 
        (stat).free_space,
3137
 
        (stat).free_percent
3138
 
    FROM (
3139
 
        SELECT
3140
 
            pg_namespace.nspname AS namespace,
3141
 
            pg_class.relname AS name,
3142
 
            NULL AS sub_namespace,
3143
 
            NULL AS sub_name,
3144
 
            pg_class.relkind AS kind,
3145
 
            pgstattuple(pg_class.oid) AS stat
3146
 
        FROM pg_class, pg_namespace
3147
 
        WHERE
3148
 
            pg_class.relnamespace = pg_namespace.oid
3149
 
            AND pg_class.relkind = 'r'
3150
 
            AND pg_table_is_visible(pg_class.oid)
3151
 
 
3152
 
        UNION ALL
3153
 
        
3154
 
        SELECT
3155
 
            pg_namespace_table.nspname AS namespace,
3156
 
            pg_class_table.relname AS name,
3157
 
            pg_namespace_index.nspname AS sub_namespace,
3158
 
            pg_class_index.relname AS sub_name,
3159
 
            pg_class_index.relkind AS kind,
3160
 
            pgstattuple(pg_class_index.oid) AS stat
3161
 
        FROM
3162
 
            pg_namespace AS pg_namespace_table,
3163
 
            pg_namespace AS pg_namespace_index,
3164
 
            pg_class AS pg_class_table,
3165
 
            pg_class AS pg_class_index,
3166
 
            pg_index
3167
 
        WHERE
3168
 
            pg_class_index.relkind = 'i'
3169
 
            AND pg_table_is_visible(pg_class_table.oid)
3170
 
            AND pg_class_index.relnamespace = pg_namespace_index.oid
3171
 
            AND pg_class_table.relnamespace = pg_namespace_table.oid
3172
 
            AND pg_index.indexrelid = pg_class_index.oid
3173
 
            AND pg_index.indrelid = pg_class_table.oid
3174
 
 
3175
 
        UNION ALL
3176
 
 
3177
 
        -- TOAST tables
3178
 
        SELECT
3179
 
            pg_namespace_table.nspname AS namespace,
3180
 
            pg_class_table.relname AS name,
3181
 
            pg_namespace_toast.nspname AS sub_namespace,
3182
 
            pg_class_toast.relname AS sub_name,
3183
 
            pg_class_toast.relkind AS kind,
3184
 
            pgstattuple(pg_class_toast.oid) AS stat
3185
 
        FROM
3186
 
            pg_namespace AS pg_namespace_table,
3187
 
            pg_namespace AS pg_namespace_toast,
3188
 
            pg_class AS pg_class_table,
3189
 
            pg_class AS pg_class_toast
3190
 
        WHERE
3191
 
            pg_class_toast.relnamespace = pg_namespace_toast.oid
3192
 
            AND pg_table_is_visible(pg_class_table.oid)
3193
 
            AND pg_class_table.relnamespace = pg_namespace_table.oid
3194
 
            AND pg_class_toast.oid = pg_class_table.reltoastrelid
3195
 
 
3196
 
        UNION ALL
3197
 
 
3198
 
        -- TOAST indexes
3199
 
        SELECT
3200
 
            pg_namespace_table.nspname AS namespace,
3201
 
            pg_class_table.relname AS name,
3202
 
            pg_namespace_index.nspname AS sub_namespace,
3203
 
            pg_class_index.relname AS sub_name,
3204
 
            pg_class_index.relkind AS kind,
3205
 
            pgstattuple(pg_class_index.oid) AS stat
3206
 
        FROM
3207
 
            pg_namespace AS pg_namespace_table,
3208
 
            pg_namespace AS pg_namespace_index,
3209
 
            pg_class AS pg_class_table,
3210
 
            pg_class AS pg_class_index,
3211
 
            pg_class AS pg_class_toast
3212
 
        WHERE
3213
 
            pg_class_table.relnamespace = pg_namespace_table.oid
3214
 
            AND pg_table_is_visible(pg_class_table.oid)
3215
 
            AND pg_class_index.relnamespace = pg_namespace_index.oid
3216
 
            AND pg_class_table.reltoastrelid = pg_class_toast.oid
3217
 
            AND pg_class_index.oid = pg_class_toast.reltoastidxid
3218
 
        ) AS whatever;
3219
 
$$;
3220
 
 
3221
 
 
3222
 
CREATE FUNCTION update_database_stats() RETURNS void
3223
 
    LANGUAGE plpythonu SECURITY DEFINER
3224
 
    SET search_path TO public
3225
 
    AS $_$
3226
 
    import re
3227
 
    import subprocess
3228
 
 
3229
 
    # Prune DatabaseTableStats and insert current data.
3230
 
    # First, detect if the statistics have been reset.
3231
 
    stats_reset = plpy.execute("""
3232
 
        SELECT *
3233
 
        FROM
3234
 
            pg_catalog.pg_stat_user_tables AS NowStat,
3235
 
            DatabaseTableStats AS LastStat
3236
 
        WHERE
3237
 
            LastStat.date_created = (
3238
 
                SELECT max(date_created) FROM DatabaseTableStats)
3239
 
            AND NowStat.schemaname = LastStat.schemaname
3240
 
            AND NowStat.relname = LastStat.relname
3241
 
            AND (
3242
 
                NowStat.seq_scan < LastStat.seq_scan
3243
 
                OR NowStat.idx_scan < LastStat.idx_scan
3244
 
                OR NowStat.n_tup_ins < LastStat.n_tup_ins
3245
 
                OR NowStat.n_tup_upd < LastStat.n_tup_upd
3246
 
                OR NowStat.n_tup_del < LastStat.n_tup_del
3247
 
                OR NowStat.n_tup_hot_upd < LastStat.n_tup_hot_upd)
3248
 
        LIMIT 1
3249
 
        """, 1).nrows() > 0
3250
 
    if stats_reset:
3251
 
        # The database stats have been reset. We cannot calculate
3252
 
        # deltas because we do not know when this happened. So we trash
3253
 
        # our records as they are now useless to us. We could be more
3254
 
        # sophisticated about this, but this should only happen
3255
 
        # when an admin explicitly resets the statistics or if the
3256
 
        # database is rebuilt.
3257
 
        plpy.notice("Stats wraparound. Purging DatabaseTableStats")
3258
 
        plpy.execute("DELETE FROM DatabaseTableStats")
3259
 
    else:
3260
 
        plpy.execute("""
3261
 
            DELETE FROM DatabaseTableStats
3262
 
            WHERE date_created < (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
3263
 
                - CAST('21 days' AS interval));
3264
 
            """)
3265
 
    # Insert current data.
3266
 
    plpy.execute("""
3267
 
        INSERT INTO DatabaseTableStats
3268
 
            SELECT
3269
 
                CURRENT_TIMESTAMP AT TIME ZONE 'UTC',
3270
 
                schemaname, relname, seq_scan, seq_tup_read,
3271
 
                coalesce(idx_scan, 0), coalesce(idx_tup_fetch, 0),
3272
 
                n_tup_ins, n_tup_upd, n_tup_del,
3273
 
                n_tup_hot_upd, n_live_tup, n_dead_tup, last_vacuum,
3274
 
                last_autovacuum, last_analyze, last_autoanalyze
3275
 
            FROM pg_catalog.pg_stat_user_tables;
3276
 
        """)
3277
 
 
3278
 
    # Prune DatabaseCpuStats. Calculate CPU utilization information
3279
 
    # and insert current data.
3280
 
    plpy.execute("""
3281
 
        DELETE FROM DatabaseCpuStats
3282
 
        WHERE date_created < (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'
3283
 
            - CAST('21 days' AS interval));
3284
 
        """)
3285
 
    dbname = plpy.execute(
3286
 
        "SELECT current_database() AS dbname", 1)[0]['dbname']
3287
 
    ps = subprocess.Popen(
3288
 
        ["ps", "-C", "postgres", "--no-headers", "-o", "cp,args"],
3289
 
        stdin=subprocess.PIPE, stdout=subprocess.PIPE,
3290
 
        stderr=subprocess.STDOUT)
3291
 
    stdout, stderr = ps.communicate()
3292
 
    cpus = {}
3293
 
    # We make the username match non-greedy so the trailing \d eats
3294
 
    # trailing digits from the database username. This collapses
3295
 
    # lpnet1, lpnet2 etc. into just lpnet.
3296
 
    ps_re = re.compile(
3297
 
        r"(?m)^\s*(\d+)\spostgres:\s(\w+?)\d*\s%s\s" % dbname)
3298
 
    for ps_match in ps_re.finditer(stdout):
3299
 
        cpu, username = ps_match.groups()
3300
 
        cpus[username] = int(cpu) + cpus.setdefault(username, 0)
3301
 
    cpu_ins = plpy.prepare(
3302
 
        "INSERT INTO DatabaseCpuStats (username, cpu) VALUES ($1, $2)",
3303
 
        ["text", "integer"])
3304
 
    for cpu_tuple in cpus.items():
3305
 
        plpy.execute(cpu_ins, cpu_tuple)
3306
 
$_$;
3307
 
 
3308
 
 
3309
 
COMMENT ON FUNCTION update_database_stats() IS 'Copies rows from pg_stat_user_tables into DatabaseTableStats. We use a stored procedure because it is problematic for us to grant permissions on objects in the pg_catalog schema.';
3310
 
 
3311
 
 
3312
 
CREATE FUNCTION update_replication_lag_cache() RETURNS boolean
3313
 
    LANGUAGE plpgsql SECURITY DEFINER
3314
 
    SET search_path TO public
3315
 
    AS $$
3316
 
    BEGIN
3317
 
        DELETE FROM DatabaseReplicationLag;
3318
 
        INSERT INTO DatabaseReplicationLag (node, lag)
3319
 
            SELECT st_received, st_lag_time FROM _sl.sl_status
3320
 
            WHERE st_origin = _sl.getlocalnodeid('_sl');
3321
 
        RETURN TRUE;
3322
 
    -- Slony-I not installed here - non-replicated setup.
3323
 
    EXCEPTION
3324
 
        WHEN invalid_schema_name THEN
3325
 
            RETURN FALSE;
3326
 
        WHEN undefined_table THEN
3327
 
            RETURN FALSE;
3328
 
    END;
3329
 
$$;
3330
 
 
3331
 
 
3332
 
COMMENT ON FUNCTION update_replication_lag_cache() IS 'Updates the DatabaseReplicationLag materialized view.';
3333
 
 
3334
 
 
3335
 
CREATE FUNCTION update_transitively_private(start_branch integer, _root_branch integer DEFAULT NULL::integer, _root_transitively_private boolean DEFAULT NULL::boolean) RETURNS void
3336
 
    LANGUAGE plpgsql SECURITY DEFINER
3337
 
    SET search_path TO public
3338
 
    AS $$
3339
 
DECLARE
3340
 
    root_transitively_private boolean := _root_transitively_private;
3341
 
    root_branch int := _root_branch;
3342
 
BEGIN
3343
 
    IF root_transitively_private IS NULL THEN
3344
 
        -- We can't just trust the transitively_private flag of the
3345
 
        -- branch we are stacked on, as if we are updating multiple
3346
 
        -- records they will be updated in an indeterminate order.
3347
 
        -- We need a recursive query.
3348
 
        UPDATE Branch SET transitively_private = (
3349
 
            WITH RECURSIVE stacked_branches AS (
3350
 
                SELECT
3351
 
                    top_branch.id, top_branch.stacked_on, top_branch.private
3352
 
                FROM Branch AS top_branch
3353
 
                WHERE top_branch.id = start_branch
3354
 
                UNION ALL
3355
 
                SELECT
3356
 
                    sub_branch.id, sub_branch.stacked_on, sub_branch.private
3357
 
                FROM stacked_branches, Branch AS sub_branch
3358
 
                WHERE
3359
 
                    stacked_branches.stacked_on = sub_branch.id
3360
 
                    AND stacked_branches.stacked_on != start_branch
3361
 
                    -- Shortcircuit. No need to recurse if already private.
3362
 
                    AND stacked_branches.private IS FALSE
3363
 
                    )
3364
 
            SELECT COUNT(*) > 0
3365
 
            FROM stacked_branches
3366
 
            WHERE private IS TRUE)
3367
 
        WHERE Branch.id = start_branch
3368
 
        RETURNING transitively_private INTO root_transitively_private;
3369
 
        root_branch := start_branch;
3370
 
    ELSE
3371
 
        -- Now we have calculated the correct transitively_private flag
3372
 
        -- we can trust it.
3373
 
        UPDATE Branch SET
3374
 
            transitively_private = GREATEST(private, root_transitively_private)
3375
 
        WHERE id = root_branch;
3376
 
    END IF;
3377
 
 
3378
 
    -- Recurse to branches stacked on this one.
3379
 
    PERFORM update_transitively_private(
3380
 
        start_branch, id, GREATEST(private, root_transitively_private))
3381
 
    FROM Branch WHERE stacked_on = root_branch AND id != start_branch;
3382
 
END;
3383
 
$$;
3384
 
 
3385
 
 
3386
 
COMMENT ON FUNCTION update_transitively_private(start_branch integer, _root_branch integer, _root_transitively_private boolean) IS 'A branch is transitively private if it is private or is stacked on any transitively private branches.';
3387
 
 
3388
 
 
3389
 
CREATE FUNCTION valid_absolute_url(text) RETURNS boolean
3390
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3391
 
    AS $$
3392
 
    from urlparse import urlparse, uses_netloc
3393
 
    # Extend list of schemes that specify netloc. We can drop sftp
3394
 
    # with Python 2.5 in the DB.
3395
 
    if 'git' not in uses_netloc:
3396
 
        uses_netloc.insert(0, 'sftp')
3397
 
        uses_netloc.insert(0, 'bzr')
3398
 
        uses_netloc.insert(0, 'bzr+ssh')
3399
 
        uses_netloc.insert(0, 'ssh') # Mercurial
3400
 
        uses_netloc.insert(0, 'git')
3401
 
    (scheme, netloc, path, params, query, fragment) = urlparse(args[0])
3402
 
    return bool(scheme and netloc)
3403
 
$$;
3404
 
 
3405
 
 
3406
 
COMMENT ON FUNCTION valid_absolute_url(text) IS 'Ensure the given test is a valid absolute URL, containing both protocol and network location';
3407
 
 
3408
 
 
3409
 
CREATE FUNCTION valid_branch_name(text) RETURNS boolean
3410
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3411
 
    AS $$
3412
 
    import re
3413
 
    name = args[0]
3414
 
    pat = r"^(?i)[a-z0-9][a-z0-9+\.\-@_]*\Z"
3415
 
    if re.match(pat, name):
3416
 
        return 1
3417
 
    return 0
3418
 
$$;
3419
 
 
3420
 
 
3421
 
COMMENT ON FUNCTION valid_branch_name(text) IS 'validate a branch name.
3422
 
 
3423
 
    As per valid_name, except we allow uppercase and @';
3424
 
 
3425
 
 
3426
 
CREATE FUNCTION valid_cve(text) RETURNS boolean
3427
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3428
 
    AS $_$
3429
 
    import re
3430
 
    name = args[0]
3431
 
    pat = r"^(19|20)\d{2}-\d{4}$"
3432
 
    if re.match(pat, name):
3433
 
        return 1
3434
 
    return 0
3435
 
$_$;
3436
 
 
3437
 
 
3438
 
COMMENT ON FUNCTION valid_cve(text) IS 'validate a common vulnerability number as defined on www.cve.mitre.org, minus the CAN- or CVE- prefix.';
3439
 
 
3440
 
 
3441
 
CREATE FUNCTION valid_debian_version(text) RETURNS boolean
3442
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3443
 
    AS $_$
3444
 
    import re
3445
 
    m = re.search("""^(?ix)
3446
 
        ([0-9]+:)?
3447
 
        ([0-9a-z][a-z0-9+:.~-]*?)
3448
 
        (-[a-z0-9+.~]+)?
3449
 
        $""", args[0])
3450
 
    if m is None:
3451
 
        return 0
3452
 
    epoch, version, revision = m.groups()
3453
 
    if not epoch:
3454
 
        # Can''t contain : if no epoch
3455
 
        if ":" in version:
3456
 
            return 0
3457
 
    if not revision:
3458
 
        # Can''t contain - if no revision
3459
 
        if "-" in version:
3460
 
            return 0
3461
 
    return 1
3462
 
$_$;
3463
 
 
3464
 
 
3465
 
COMMENT ON FUNCTION valid_debian_version(text) IS 'validate a version number as per Debian Policy';
3466
 
 
3467
 
 
3468
 
CREATE FUNCTION valid_fingerprint(text) RETURNS boolean
3469
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3470
 
    AS $$
3471
 
    import re
3472
 
    if re.match(r"[\dA-F]{40}", args[0]) is not None:
3473
 
        return 1
3474
 
    else:
3475
 
        return 0
3476
 
$$;
3477
 
 
3478
 
 
3479
 
COMMENT ON FUNCTION valid_fingerprint(text) IS 'Returns true if passed a valid GPG fingerprint. Valid GPG fingerprints are a 40 character long hexadecimal number in uppercase.';
3480
 
 
3481
 
 
3482
 
CREATE FUNCTION valid_keyid(text) RETURNS boolean
3483
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3484
 
    AS $$
3485
 
    import re
3486
 
    if re.match(r"[\dA-F]{8}", args[0]) is not None:
3487
 
        return 1
3488
 
    else:
3489
 
        return 0
3490
 
$$;
3491
 
 
3492
 
 
3493
 
COMMENT ON FUNCTION valid_keyid(text) IS 'Returns true if passed a valid GPG keyid. Valid GPG keyids are an 8 character long hexadecimal number in uppercase (in reality, they are 16 characters long but we are using the ''common'' definition.';
3494
 
 
3495
 
 
3496
 
CREATE FUNCTION valid_regexp(text) RETURNS boolean
3497
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3498
 
    AS $$
3499
 
    import re
3500
 
    try:
3501
 
        re.compile(args[0])
3502
 
    except:
3503
 
        return False
3504
 
    else:
3505
 
        return True
3506
 
$$;
3507
 
 
3508
 
 
3509
 
COMMENT ON FUNCTION valid_regexp(text) IS 'Returns true if the input can be compiled as a regular expression.';
3510
 
 
3511
 
 
3512
 
CREATE FUNCTION version_sort_key(version text) RETURNS text
3513
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3514
 
    AS $$
3515
 
    # If this method is altered, then any functional indexes using it
3516
 
    # need to be rebuilt.
3517
 
    import re
3518
 
 
3519
 
    [version] = args
3520
 
 
3521
 
    def substitute_filled_numbers(match):
3522
 
        # Prepend "~" so that version numbers will show up first
3523
 
        # when sorted descending, i.e. [3, 2c, 2b, 1, c, b, a] instead
3524
 
        # of [c, b, a, 3, 2c, 2b, 1]. "~" has the highest ASCII value
3525
 
        # of visible ASCII characters.
3526
 
        return '~' + match.group(0).zfill(5)
3527
 
 
3528
 
    return re.sub(u'\d+', substitute_filled_numbers, version)
3529
 
$$;
3530
 
 
3531
 
 
3532
 
COMMENT ON FUNCTION version_sort_key(version text) IS 'Sort a field as version numbers that do not necessarily conform to debian package versions (For example, when "2-2" should be considered greater than "1:1"). debversion_sort_key() should be used for debian versions. Numbers will be sorted after letters unlike typical ASCII, so that a descending sort will put the latest version number that starts with a number instead of a letter will be at the top. E.g. ascending is [a, z, 1, 9] and descending is [9, 1, z, a].';
3533
 
 
3534
 
 
3535
 
CREATE FUNCTION you_are_your_own_member() RETURNS trigger
3536
 
    LANGUAGE plpgsql
3537
 
    AS $$
3538
 
    BEGIN
3539
 
        INSERT INTO TeamParticipation (person, team)
3540
 
            VALUES (NEW.id, NEW.id);
3541
 
        RETURN NULL;
3542
 
    END;
3543
 
$$;
3544
 
 
3545
 
 
3546
 
COMMENT ON FUNCTION you_are_your_own_member() IS 'Trigger function to ensure that every row added to the Person table gets a corresponding row in the TeamParticipation table, as per the TeamParticipationUsage page on the Launchpad wiki';
3547
 
 
3548
 
 
3549
 
SET search_path = ts2, pg_catalog;
3550
 
 
3551
 
CREATE FUNCTION _ftq(text) RETURNS text
3552
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3553
 
    AS $_$
3554
 
        import re
3555
 
 
3556
 
        # I think this method would be more robust if we used a real
3557
 
        # tokenizer and parser to generate the query string, but we need
3558
 
        # something suitable for use as a stored procedure which currently
3559
 
        # means no external dependancies.
3560
 
 
3561
 
        # Convert to Unicode
3562
 
        query = args[0].decode('utf8')
3563
 
        ## plpy.debug('1 query is %s' % repr(query))
3564
 
 
3565
 
        # Normalize whitespace
3566
 
        query = re.sub("(?u)\s+"," ", query)
3567
 
 
3568
 
        # Convert AND, OR, NOT and - to tsearch2 punctuation
3569
 
        query = re.sub(r"(?u)(?:^|\s)-([\w\(])", r" !\1", query)
3570
 
        query = re.sub(r"(?u)\bAND\b", "&", query)
3571
 
        query = re.sub(r"(?u)\bOR\b", "|", query)
3572
 
        query = re.sub(r"(?u)\bNOT\b", " !", query)
3573
 
        ## plpy.debug('2 query is %s' % repr(query))
3574
 
 
3575
 
        # Deal with unwanted punctuation. We convert strings of punctuation
3576
 
        # inside words to a '-' character for the hypenation handling below
3577
 
        # to deal with further. Outside of words we replace with whitespace.
3578
 
        # We don't mess with -&|!()' as they are handled later.
3579
 
        #punctuation = re.escape(r'`~@#$%^*+=[]{}:;"<>,.?\/')
3580
 
        punctuation = r"[^\w\s\-\&\|\!\(\)']"
3581
 
        query = re.sub(r"(?u)(\w)%s+(\w)" % (punctuation,), r"\1-\2", query)
3582
 
        query = re.sub(r"(?u)%s+" % (punctuation,), " ", query)
3583
 
        ## plpy.debug('3 query is %s' % repr(query))
3584
 
 
3585
 
        # Strip ! characters inside and at the end of a word
3586
 
        query = re.sub(r"(?u)(?<=\w)[\!]+", " ", query)
3587
 
 
3588
 
        # Now that we have handle case sensitive booleans, convert to lowercase
3589
 
        query = query.lower()
3590
 
 
3591
 
        # Convert foo-bar to ((foo&bar)|foobar) and foo-bar-baz to
3592
 
        # ((foo&bar&baz)|foobarbaz)
3593
 
        def hyphen_repl(match):
3594
 
            bits = match.group(0).split("-")
3595
 
            return "((%s)|%s)" % ("&".join(bits), "".join(bits))
3596
 
        query = re.sub(r"(?u)\b\w+-[\w\-]+\b", hyphen_repl, query)
3597
 
        ## plpy.debug('4 query is %s' % repr(query))
3598
 
 
3599
 
        # Any remaining - characters are spurious
3600
 
        query = query.replace('-','')
3601
 
 
3602
 
        # Remove unpartnered bracket on the left and right
3603
 
        query = re.sub(r"(?ux) ^ ( [^(]* ) \)", r"(\1)", query)
3604
 
        query = re.sub(r"(?ux) \( ( [^)]* ) $", r"(\1)", query)
3605
 
 
3606
 
        # Remove spurious brackets
3607
 
        query = re.sub(r"(?u)\(([^\&\|]*?)\)", r" \1 ", query)
3608
 
        ## plpy.debug('5 query is %s' % repr(query))
3609
 
 
3610
 
        # Insert & between tokens without an existing boolean operator
3611
 
        # ( not proceeded by (|&!
3612
 
        query = re.sub(r"(?u)(?<![\(\|\&\!])\s*\(", "&(", query)
3613
 
        ## plpy.debug('6 query is %s' % repr(query))
3614
 
        # ) not followed by )|&
3615
 
        query = re.sub(r"(?u)\)(?!\s*(\)|\||\&|\s*$))", ")&", query)
3616
 
        ## plpy.debug('6.1 query is %s' % repr(query))
3617
 
        # Whitespace not proceded by (|&! not followed by &|
3618
 
        query = re.sub(r"(?u)(?<![\(\|\&\!\s])\s+(?![\&\|\s])", "&", query)
3619
 
        ## plpy.debug('7 query is %s' % repr(query))
3620
 
 
3621
 
        # Detect and repair syntax errors - we are lenient because
3622
 
        # this input is generally from users.
3623
 
 
3624
 
        # Fix unbalanced brackets
3625
 
        openings = query.count("(")
3626
 
        closings = query.count(")")
3627
 
        if openings > closings:
3628
 
            query = query + " ) "*(openings-closings)
3629
 
        elif closings > openings:
3630
 
            query = " ( "*(closings-openings) + query
3631
 
        ## plpy.debug('8 query is %s' % repr(query))
3632
 
 
3633
 
        # Strip ' character that do not have letters on both sides
3634
 
        query = re.sub(r"(?u)((?<!\w)'|'(?!\w))", "", query)
3635
 
 
3636
 
        # Brackets containing nothing but whitespace and booleans, recursive
3637
 
        last = ""
3638
 
        while last != query:
3639
 
            last = query
3640
 
            query = re.sub(r"(?u)\([\s\&\|\!]*\)", "", query)
3641
 
        ## plpy.debug('9 query is %s' % repr(query))
3642
 
 
3643
 
        # An & or | following a (
3644
 
        query = re.sub(r"(?u)(?<=\()[\&\|\s]+", "", query)
3645
 
        ## plpy.debug('10 query is %s' % repr(query))
3646
 
 
3647
 
        # An &, | or ! immediatly before a )
3648
 
        query = re.sub(r"(?u)[\&\|\!\s]*[\&\|\!]+\s*(?=\))", "", query)
3649
 
        ## plpy.debug('11 query is %s' % repr(query))
3650
 
 
3651
 
        # An &,| or ! followed by another boolean.
3652
 
        query = re.sub(r"(?ux) \s* ( [\&\|\!] ) [\s\&\|]+", r"\1", query)
3653
 
        ## plpy.debug('12 query is %s' % repr(query))
3654
 
 
3655
 
        # Leading & or |
3656
 
        query = re.sub(r"(?u)^[\s\&\|]+", "", query)
3657
 
        ## plpy.debug('13 query is %s' % repr(query))
3658
 
 
3659
 
        # Trailing &, | or !
3660
 
        query = re.sub(r"(?u)[\&\|\!\s]+$", "", query)
3661
 
        ## plpy.debug('14 query is %s' % repr(query))
3662
 
 
3663
 
        # If we have nothing but whitespace and tsearch2 operators,
3664
 
        # return NULL.
3665
 
        if re.search(r"(?u)^[\&\|\!\s\(\)]*$", query) is not None:
3666
 
            return None
3667
 
 
3668
 
        # Convert back to UTF-8
3669
 
        query = query.encode('utf8')
3670
 
        ## plpy.debug('15 query is %s' % repr(query))
3671
 
        
3672
 
        return query or None
3673
 
        $_$;
3674
 
 
3675
 
 
3676
 
CREATE FUNCTION _get_parser_from_curcfg() RETURNS text
3677
 
    LANGUAGE sql IMMUTABLE STRICT
3678
 
    AS $$select prsname::text from pg_catalog.pg_ts_parser p join pg_ts_config c on cfgparser = p.oid where c.oid = show_curcfg();$$;
3679
 
 
3680
 
 
3681
 
CREATE FUNCTION concat(pg_catalog.tsvector, pg_catalog.tsvector) RETURNS pg_catalog.tsvector
3682
 
    LANGUAGE internal IMMUTABLE STRICT
3683
 
    AS $$tsvector_concat$$;
3684
 
 
3685
 
 
3686
 
CREATE FUNCTION dex_init(internal) RETURNS internal
3687
 
    LANGUAGE c
3688
 
    AS '$libdir/tsearch2', 'tsa_dex_init';
3689
 
 
3690
 
 
3691
 
CREATE FUNCTION dex_lexize(internal, internal, integer) RETURNS internal
3692
 
    LANGUAGE c STRICT
3693
 
    AS '$libdir/tsearch2', 'tsa_dex_lexize';
3694
 
 
3695
 
 
3696
 
CREATE FUNCTION ftiupdate() RETURNS trigger
3697
 
    LANGUAGE plpythonu
3698
 
    AS $_$
3699
 
    new = TD["new"]
3700
 
    args = TD["args"][:]
3701
 
 
3702
 
    # Short circuit if none of the relevant columns have been
3703
 
    # modified and fti is not being set to NULL (setting the fti
3704
 
    # column to NULL is thus how we can force a rebuild of the fti
3705
 
    # column).
3706
 
    if TD["event"] == "UPDATE" and new["fti"] != None:
3707
 
        old = TD["old"]
3708
 
        relevant_modification = False
3709
 
        for column_name in args[::2]:
3710
 
            if new[column_name] != old[column_name]:
3711
 
                relevant_modification = True
3712
 
                break
3713
 
        if not relevant_modification:
3714
 
            return "OK"
3715
 
 
3716
 
    # Generate an SQL statement that turns the requested
3717
 
    # column values into a weighted tsvector
3718
 
    sql = []
3719
 
    for i in range(0, len(args), 2):
3720
 
        sql.append(
3721
 
                "ts2.setweight(ts2.to_tsvector('default', coalesce("
3722
 
                "substring(ltrim($%d) from 1 for 2500),'')),"
3723
 
                "CAST($%d AS \"char\"))" % (i + 1, i + 2))
3724
 
        args[i] = new[args[i]]
3725
 
 
3726
 
    sql = "SELECT %s AS fti" % "||".join(sql)
3727
 
 
3728
 
    # Execute and store in the fti column
3729
 
    plan = plpy.prepare(sql, ["text", "char"] * (len(args)/2))
3730
 
    new["fti"] = plpy.execute(plan, args, 1)[0]["fti"]
3731
 
 
3732
 
    # Tell PostgreSQL we have modified the data
3733
 
    return "MODIFY"
3734
 
$_$;
3735
 
 
3736
 
 
3737
 
COMMENT ON FUNCTION ftiupdate() IS 'Trigger function that keeps the fti tsvector column up to date.';
3738
 
 
3739
 
 
3740
 
CREATE FUNCTION ftq(text) RETURNS pg_catalog.tsquery
3741
 
    LANGUAGE plpythonu IMMUTABLE STRICT
3742
 
    AS $_$
3743
 
        import re
3744
 
 
3745
 
        # I think this method would be more robust if we used a real
3746
 
        # tokenizer and parser to generate the query string, but we need
3747
 
        # something suitable for use as a stored procedure which currently
3748
 
        # means no external dependancies.
3749
 
 
3750
 
        # Convert to Unicode
3751
 
        query = args[0].decode('utf8')
3752
 
        ## plpy.debug('1 query is %s' % repr(query))
3753
 
 
3754
 
        # Normalize whitespace
3755
 
        query = re.sub("(?u)\s+"," ", query)
3756
 
 
3757
 
        # Convert AND, OR, NOT and - to tsearch2 punctuation
3758
 
        query = re.sub(r"(?u)(?:^|\s)-([\w\(])", r" !\1", query)
3759
 
        query = re.sub(r"(?u)\bAND\b", "&", query)
3760
 
        query = re.sub(r"(?u)\bOR\b", "|", query)
3761
 
        query = re.sub(r"(?u)\bNOT\b", " !", query)
3762
 
        ## plpy.debug('2 query is %s' % repr(query))
3763
 
 
3764
 
        # Deal with unwanted punctuation. We convert strings of punctuation
3765
 
        # inside words to a '-' character for the hypenation handling below
3766
 
        # to deal with further. Outside of words we replace with whitespace.
3767
 
        # We don't mess with -&|!()' as they are handled later.
3768
 
        #punctuation = re.escape(r'`~@#$%^*+=[]{}:;"<>,.?\/')
3769
 
        punctuation = r"[^\w\s\-\&\|\!\(\)']"
3770
 
        query = re.sub(r"(?u)(\w)%s+(\w)" % (punctuation,), r"\1-\2", query)
3771
 
        query = re.sub(r"(?u)%s+" % (punctuation,), " ", query)
3772
 
        ## plpy.debug('3 query is %s' % repr(query))
3773
 
 
3774
 
        # Strip ! characters inside and at the end of a word
3775
 
        query = re.sub(r"(?u)(?<=\w)[\!]+", " ", query)
3776
 
 
3777
 
        # Now that we have handle case sensitive booleans, convert to lowercase
3778
 
        query = query.lower()
3779
 
 
3780
 
        # Convert foo-bar to ((foo&bar)|foobar) and foo-bar-baz to
3781
 
        # ((foo&bar&baz)|foobarbaz)
3782
 
        def hyphen_repl(match):
3783
 
            bits = match.group(0).split("-")
3784
 
            return "((%s)|%s)" % ("&".join(bits), "".join(bits))
3785
 
        query = re.sub(r"(?u)\b\w+-[\w\-]+\b", hyphen_repl, query)
3786
 
        ## plpy.debug('4 query is %s' % repr(query))
3787
 
 
3788
 
        # Any remaining - characters are spurious
3789
 
        query = query.replace('-','')
3790
 
 
3791
 
        # Remove unpartnered bracket on the left and right
3792
 
        query = re.sub(r"(?ux) ^ ( [^(]* ) \)", r"(\1)", query)
3793
 
        query = re.sub(r"(?ux) \( ( [^)]* ) $", r"(\1)", query)
3794
 
 
3795
 
        # Remove spurious brackets
3796
 
        query = re.sub(r"(?u)\(([^\&\|]*?)\)", r" \1 ", query)
3797
 
        ## plpy.debug('5 query is %s' % repr(query))
3798
 
 
3799
 
        # Insert & between tokens without an existing boolean operator
3800
 
        # ( not proceeded by (|&!
3801
 
        query = re.sub(r"(?u)(?<![\(\|\&\!])\s*\(", "&(", query)
3802
 
        ## plpy.debug('6 query is %s' % repr(query))
3803
 
        # ) not followed by )|&
3804
 
        query = re.sub(r"(?u)\)(?!\s*(\)|\||\&|\s*$))", ")&", query)
3805
 
        ## plpy.debug('6.1 query is %s' % repr(query))
3806
 
        # Whitespace not proceded by (|&! not followed by &|
3807
 
        query = re.sub(r"(?u)(?<![\(\|\&\!\s])\s+(?![\&\|\s])", "&", query)
3808
 
        ## plpy.debug('7 query is %s' % repr(query))
3809
 
 
3810
 
        # Detect and repair syntax errors - we are lenient because
3811
 
        # this input is generally from users.
3812
 
 
3813
 
        # Fix unbalanced brackets
3814
 
        openings = query.count("(")
3815
 
        closings = query.count(")")
3816
 
        if openings > closings:
3817
 
            query = query + " ) "*(openings-closings)
3818
 
        elif closings > openings:
3819
 
            query = " ( "*(closings-openings) + query
3820
 
        ## plpy.debug('8 query is %s' % repr(query))
3821
 
 
3822
 
        # Strip ' character that do not have letters on both sides
3823
 
        query = re.sub(r"(?u)((?<!\w)'|'(?!\w))", "", query)
3824
 
 
3825
 
        # Brackets containing nothing but whitespace and booleans, recursive
3826
 
        last = ""
3827
 
        while last != query:
3828
 
            last = query
3829
 
            query = re.sub(r"(?u)\([\s\&\|\!]*\)", "", query)
3830
 
        ## plpy.debug('9 query is %s' % repr(query))
3831
 
 
3832
 
        # An & or | following a (
3833
 
        query = re.sub(r"(?u)(?<=\()[\&\|\s]+", "", query)
3834
 
        ## plpy.debug('10 query is %s' % repr(query))
3835
 
 
3836
 
        # An &, | or ! immediatly before a )
3837
 
        query = re.sub(r"(?u)[\&\|\!\s]*[\&\|\!]+\s*(?=\))", "", query)
3838
 
        ## plpy.debug('11 query is %s' % repr(query))
3839
 
 
3840
 
        # An &,| or ! followed by another boolean.
3841
 
        query = re.sub(r"(?ux) \s* ( [\&\|\!] ) [\s\&\|]+", r"\1", query)
3842
 
        ## plpy.debug('12 query is %s' % repr(query))
3843
 
 
3844
 
        # Leading & or |
3845
 
        query = re.sub(r"(?u)^[\s\&\|]+", "", query)
3846
 
        ## plpy.debug('13 query is %s' % repr(query))
3847
 
 
3848
 
        # Trailing &, | or !
3849
 
        query = re.sub(r"(?u)[\&\|\!\s]+$", "", query)
3850
 
        ## plpy.debug('14 query is %s' % repr(query))
3851
 
 
3852
 
        # If we have nothing but whitespace and tsearch2 operators,
3853
 
        # return NULL.
3854
 
        if re.search(r"(?u)^[\&\|\!\s\(\)]*$", query) is not None:
3855
 
            return None
3856
 
 
3857
 
        # Convert back to UTF-8
3858
 
        query = query.encode('utf8')
3859
 
        ## plpy.debug('15 query is %s' % repr(query))
3860
 
        
3861
 
        p = plpy.prepare("SELECT to_tsquery('default', $1) AS x", ["text"])
3862
 
        query = plpy.execute(p, [query], 1)[0]["x"]
3863
 
        return query or None
3864
 
        $_$;
3865
 
 
3866
 
 
3867
 
COMMENT ON FUNCTION ftq(text) IS 'Convert a string to an unparsed tsearch2 query';
3868
 
 
3869
 
 
3870
 
CREATE FUNCTION get_covers(pg_catalog.tsvector, pg_catalog.tsquery) RETURNS text
3871
 
    LANGUAGE c STRICT
3872
 
    AS '$libdir/tsearch2', 'tsa_get_covers';
3873
 
 
3874
 
 
3875
 
CREATE FUNCTION headline(oid, text, pg_catalog.tsquery, text) RETURNS text
3876
 
    LANGUAGE internal IMMUTABLE STRICT
3877
 
    AS $$ts_headline_byid_opt$$;
3878
 
 
3879
 
 
3880
 
CREATE FUNCTION headline(oid, text, pg_catalog.tsquery) RETURNS text
3881
 
    LANGUAGE internal IMMUTABLE STRICT
3882
 
    AS $$ts_headline_byid$$;
3883
 
 
3884
 
 
3885
 
CREATE FUNCTION headline(text, text, pg_catalog.tsquery, text) RETURNS text
3886
 
    LANGUAGE c IMMUTABLE STRICT
3887
 
    AS '$libdir/tsearch2', 'tsa_headline_byname';
3888
 
 
3889
 
 
3890
 
CREATE FUNCTION headline(text, text, pg_catalog.tsquery) RETURNS text
3891
 
    LANGUAGE c IMMUTABLE STRICT
3892
 
    AS '$libdir/tsearch2', 'tsa_headline_byname';
3893
 
 
3894
 
 
3895
 
CREATE FUNCTION headline(text, pg_catalog.tsquery, text) RETURNS text
3896
 
    LANGUAGE internal IMMUTABLE STRICT
3897
 
    AS $$ts_headline_opt$$;
3898
 
 
3899
 
 
3900
 
CREATE FUNCTION headline(text, pg_catalog.tsquery) RETURNS text
3901
 
    LANGUAGE internal IMMUTABLE STRICT
3902
 
    AS $$ts_headline$$;
3903
 
 
3904
 
 
3905
 
CREATE FUNCTION length(pg_catalog.tsvector) RETURNS integer
3906
 
    LANGUAGE internal IMMUTABLE STRICT
3907
 
    AS $$tsvector_length$$;
3908
 
 
3909
 
 
3910
 
CREATE FUNCTION lexize(oid, text) RETURNS text[]
3911
 
    LANGUAGE internal STRICT
3912
 
    AS $$ts_lexize$$;
3913
 
 
3914
 
 
3915
 
CREATE FUNCTION lexize(text, text) RETURNS text[]
3916
 
    LANGUAGE c STRICT
3917
 
    AS '$libdir/tsearch2', 'tsa_lexize_byname';
3918
 
 
3919
 
 
3920
 
CREATE FUNCTION lexize(text) RETURNS text[]
3921
 
    LANGUAGE c STRICT
3922
 
    AS '$libdir/tsearch2', 'tsa_lexize_bycurrent';
3923
 
 
3924
 
 
3925
 
CREATE FUNCTION numnode(pg_catalog.tsquery) RETURNS integer
3926
 
    LANGUAGE internal IMMUTABLE STRICT
3927
 
    AS $$tsquery_numnode$$;
3928
 
 
3929
 
 
3930
 
CREATE FUNCTION parse(oid, text) RETURNS SETOF tokenout
3931
 
    LANGUAGE internal STRICT
3932
 
    AS $$ts_parse_byid$$;
3933
 
 
3934
 
 
3935
 
CREATE FUNCTION parse(text, text) RETURNS SETOF tokenout
3936
 
    LANGUAGE internal STRICT
3937
 
    AS $$ts_parse_byname$$;
3938
 
 
3939
 
 
3940
 
CREATE FUNCTION parse(text) RETURNS SETOF tokenout
3941
 
    LANGUAGE c STRICT
3942
 
    AS '$libdir/tsearch2', 'tsa_parse_current';
3943
 
 
3944
 
 
3945
 
CREATE FUNCTION plainto_tsquery(oid, text) RETURNS pg_catalog.tsquery
3946
 
    LANGUAGE internal IMMUTABLE STRICT
3947
 
    AS $$plainto_tsquery_byid$$;
3948
 
 
3949
 
 
3950
 
CREATE FUNCTION plainto_tsquery(text, text) RETURNS pg_catalog.tsquery
3951
 
    LANGUAGE c IMMUTABLE STRICT
3952
 
    AS '$libdir/tsearch2', 'tsa_plainto_tsquery_name';
3953
 
 
3954
 
 
3955
 
CREATE FUNCTION plainto_tsquery(text) RETURNS pg_catalog.tsquery
3956
 
    LANGUAGE internal IMMUTABLE STRICT
3957
 
    AS $$plainto_tsquery$$;
3958
 
 
3959
 
 
3960
 
CREATE FUNCTION prsd_end(internal) RETURNS void
3961
 
    LANGUAGE c
3962
 
    AS '$libdir/tsearch2', 'tsa_prsd_end';
3963
 
 
3964
 
 
3965
 
CREATE FUNCTION prsd_getlexeme(internal, internal, internal) RETURNS integer
3966
 
    LANGUAGE c
3967
 
    AS '$libdir/tsearch2', 'tsa_prsd_getlexeme';
3968
 
 
3969
 
 
3970
 
CREATE FUNCTION prsd_headline(internal, internal, internal) RETURNS internal
3971
 
    LANGUAGE c
3972
 
    AS '$libdir/tsearch2', 'tsa_prsd_headline';
3973
 
 
3974
 
 
3975
 
CREATE FUNCTION prsd_lextype(internal) RETURNS internal
3976
 
    LANGUAGE c
3977
 
    AS '$libdir/tsearch2', 'tsa_prsd_lextype';
3978
 
 
3979
 
 
3980
 
CREATE FUNCTION prsd_start(internal, integer) RETURNS internal
3981
 
    LANGUAGE c
3982
 
    AS '$libdir/tsearch2', 'tsa_prsd_start';
3983
 
 
3984
 
 
3985
 
CREATE FUNCTION querytree(pg_catalog.tsquery) RETURNS text
3986
 
    LANGUAGE internal STRICT
3987
 
    AS $$tsquerytree$$;
3988
 
 
3989
 
 
3990
 
CREATE FUNCTION rank(real[], pg_catalog.tsvector, pg_catalog.tsquery) RETURNS real
3991
 
    LANGUAGE internal IMMUTABLE STRICT
3992
 
    AS $$ts_rank_wtt$$;
3993
 
 
3994
 
 
3995
 
CREATE FUNCTION rank(real[], pg_catalog.tsvector, pg_catalog.tsquery, integer) RETURNS real
3996
 
    LANGUAGE internal IMMUTABLE STRICT
3997
 
    AS $$ts_rank_wttf$$;
3998
 
 
3999
 
 
4000
 
CREATE FUNCTION rank(pg_catalog.tsvector, pg_catalog.tsquery) RETURNS real
4001
 
    LANGUAGE internal IMMUTABLE STRICT
4002
 
    AS $$ts_rank_tt$$;
4003
 
 
4004
 
 
4005
 
CREATE FUNCTION rank(pg_catalog.tsvector, pg_catalog.tsquery, integer) RETURNS real
4006
 
    LANGUAGE internal IMMUTABLE STRICT
4007
 
    AS $$ts_rank_ttf$$;
4008
 
 
4009
 
 
4010
 
CREATE FUNCTION rank_cd(real[], pg_catalog.tsvector, pg_catalog.tsquery) RETURNS real
4011
 
    LANGUAGE internal IMMUTABLE STRICT
4012
 
    AS $$ts_rankcd_wtt$$;
4013
 
 
4014
 
 
4015
 
CREATE FUNCTION rank_cd(real[], pg_catalog.tsvector, pg_catalog.tsquery, integer) RETURNS real
4016
 
    LANGUAGE internal IMMUTABLE STRICT
4017
 
    AS $$ts_rankcd_wttf$$;
4018
 
 
4019
 
 
4020
 
CREATE FUNCTION rank_cd(pg_catalog.tsvector, pg_catalog.tsquery) RETURNS real
4021
 
    LANGUAGE internal IMMUTABLE STRICT
4022
 
    AS $$ts_rankcd_tt$$;
4023
 
 
4024
 
 
4025
 
CREATE FUNCTION rank_cd(pg_catalog.tsvector, pg_catalog.tsquery, integer) RETURNS real
4026
 
    LANGUAGE internal IMMUTABLE STRICT
4027
 
    AS $$ts_rankcd_ttf$$;
4028
 
 
4029
 
 
4030
 
CREATE FUNCTION reset_tsearch() RETURNS void
4031
 
    LANGUAGE c STRICT
4032
 
    AS '$libdir/tsearch2', 'tsa_reset_tsearch';
4033
 
 
4034
 
 
4035
 
CREATE FUNCTION rewrite(pg_catalog.tsquery, text) RETURNS pg_catalog.tsquery
4036
 
    LANGUAGE internal IMMUTABLE STRICT
4037
 
    AS $$tsquery_rewrite_query$$;
4038
 
 
4039
 
 
4040
 
CREATE FUNCTION rewrite(pg_catalog.tsquery, pg_catalog.tsquery, pg_catalog.tsquery) RETURNS pg_catalog.tsquery
4041
 
    LANGUAGE internal IMMUTABLE STRICT
4042
 
    AS $$tsquery_rewrite$$;
4043
 
 
4044
 
 
4045
 
CREATE FUNCTION rewrite_accum(pg_catalog.tsquery, pg_catalog.tsquery[]) RETURNS pg_catalog.tsquery
4046
 
    LANGUAGE c
4047
 
    AS '$libdir/tsearch2', 'tsa_rewrite_accum';
4048
 
 
4049
 
 
4050
 
CREATE FUNCTION rewrite_finish(pg_catalog.tsquery) RETURNS pg_catalog.tsquery
4051
 
    LANGUAGE c
4052
 
    AS '$libdir/tsearch2', 'tsa_rewrite_finish';
4053
 
 
4054
 
 
4055
 
CREATE FUNCTION set_curcfg(integer) RETURNS void
4056
 
    LANGUAGE c STRICT
4057
 
    AS '$libdir/tsearch2', 'tsa_set_curcfg';
4058
 
 
4059
 
 
4060
 
CREATE FUNCTION set_curcfg(text) RETURNS void
4061
 
    LANGUAGE c STRICT
4062
 
    AS '$libdir/tsearch2', 'tsa_set_curcfg_byname';
4063
 
 
4064
 
 
4065
 
CREATE FUNCTION set_curdict(integer) RETURNS void
4066
 
    LANGUAGE c STRICT
4067
 
    AS '$libdir/tsearch2', 'tsa_set_curdict';
4068
 
 
4069
 
 
4070
 
CREATE FUNCTION set_curdict(text) RETURNS void
4071
 
    LANGUAGE c STRICT
4072
 
    AS '$libdir/tsearch2', 'tsa_set_curdict_byname';
4073
 
 
4074
 
 
4075
 
CREATE FUNCTION set_curprs(integer) RETURNS void
4076
 
    LANGUAGE c STRICT
4077
 
    AS '$libdir/tsearch2', 'tsa_set_curprs';
4078
 
 
4079
 
 
4080
 
CREATE FUNCTION set_curprs(text) RETURNS void
4081
 
    LANGUAGE c STRICT
4082
 
    AS '$libdir/tsearch2', 'tsa_set_curprs_byname';
4083
 
 
4084
 
 
4085
 
CREATE FUNCTION setweight(pg_catalog.tsvector, "char") RETURNS pg_catalog.tsvector
4086
 
    LANGUAGE internal IMMUTABLE STRICT
4087
 
    AS $$tsvector_setweight$$;
4088
 
 
4089
 
 
4090
 
CREATE FUNCTION show_curcfg() RETURNS oid
4091
 
    LANGUAGE internal STABLE STRICT
4092
 
    AS $$get_current_ts_config$$;
4093
 
 
4094
 
 
4095
 
CREATE FUNCTION snb_en_init(internal) RETURNS internal
4096
 
    LANGUAGE c
4097
 
    AS '$libdir/tsearch2', 'tsa_snb_en_init';
4098
 
 
4099
 
 
4100
 
CREATE FUNCTION snb_lexize(internal, internal, integer) RETURNS internal
4101
 
    LANGUAGE c STRICT
4102
 
    AS '$libdir/tsearch2', 'tsa_snb_lexize';
4103
 
 
4104
 
 
4105
 
CREATE FUNCTION snb_ru_init(internal) RETURNS internal
4106
 
    LANGUAGE c
4107
 
    AS '$libdir/tsearch2', 'tsa_snb_ru_init';
4108
 
 
4109
 
 
4110
 
CREATE FUNCTION snb_ru_init_koi8(internal) RETURNS internal
4111
 
    LANGUAGE c
4112
 
    AS '$libdir/tsearch2', 'tsa_snb_ru_init_koi8';
4113
 
 
4114
 
 
4115
 
CREATE FUNCTION snb_ru_init_utf8(internal) RETURNS internal
4116
 
    LANGUAGE c
4117
 
    AS '$libdir/tsearch2', 'tsa_snb_ru_init_utf8';
4118
 
 
4119
 
 
4120
 
CREATE FUNCTION spell_init(internal) RETURNS internal
4121
 
    LANGUAGE c
4122
 
    AS '$libdir/tsearch2', 'tsa_spell_init';
4123
 
 
4124
 
 
4125
 
CREATE FUNCTION spell_lexize(internal, internal, integer) RETURNS internal
4126
 
    LANGUAGE c STRICT
4127
 
    AS '$libdir/tsearch2', 'tsa_spell_lexize';
4128
 
 
4129
 
 
4130
 
CREATE FUNCTION stat(text) RETURNS SETOF statinfo
4131
 
    LANGUAGE internal STRICT
4132
 
    AS $$ts_stat1$$;
4133
 
 
4134
 
 
4135
 
CREATE FUNCTION stat(text, text) RETURNS SETOF statinfo
4136
 
    LANGUAGE internal STRICT
4137
 
    AS $$ts_stat2$$;
4138
 
 
4139
 
 
4140
 
CREATE FUNCTION strip(pg_catalog.tsvector) RETURNS pg_catalog.tsvector
4141
 
    LANGUAGE internal IMMUTABLE STRICT
4142
 
    AS $$tsvector_strip$$;
4143
 
 
4144
 
 
4145
 
CREATE FUNCTION syn_init(internal) RETURNS internal
4146
 
    LANGUAGE c
4147
 
    AS '$libdir/tsearch2', 'tsa_syn_init';
4148
 
 
4149
 
 
4150
 
CREATE FUNCTION syn_lexize(internal, internal, integer) RETURNS internal
4151
 
    LANGUAGE c STRICT
4152
 
    AS '$libdir/tsearch2', 'tsa_syn_lexize';
4153
 
 
4154
 
 
4155
 
CREATE FUNCTION thesaurus_init(internal) RETURNS internal
4156
 
    LANGUAGE c
4157
 
    AS '$libdir/tsearch2', 'tsa_thesaurus_init';
4158
 
 
4159
 
 
4160
 
CREATE FUNCTION thesaurus_lexize(internal, internal, integer, internal) RETURNS internal
4161
 
    LANGUAGE c STRICT
4162
 
    AS '$libdir/tsearch2', 'tsa_thesaurus_lexize';
4163
 
 
4164
 
 
4165
 
CREATE FUNCTION to_tsquery(oid, text) RETURNS pg_catalog.tsquery
4166
 
    LANGUAGE internal IMMUTABLE STRICT
4167
 
    AS $$to_tsquery_byid$$;
4168
 
 
4169
 
 
4170
 
CREATE FUNCTION to_tsquery(text, text) RETURNS pg_catalog.tsquery
4171
 
    LANGUAGE c IMMUTABLE STRICT
4172
 
    AS '$libdir/tsearch2', 'tsa_to_tsquery_name';
4173
 
 
4174
 
 
4175
 
CREATE FUNCTION to_tsquery(text) RETURNS pg_catalog.tsquery
4176
 
    LANGUAGE internal IMMUTABLE STRICT
4177
 
    AS $$to_tsquery$$;
4178
 
 
4179
 
 
4180
 
CREATE FUNCTION to_tsvector(oid, text) RETURNS pg_catalog.tsvector
4181
 
    LANGUAGE internal IMMUTABLE STRICT
4182
 
    AS $$to_tsvector_byid$$;
4183
 
 
4184
 
 
4185
 
CREATE FUNCTION to_tsvector(text, text) RETURNS pg_catalog.tsvector
4186
 
    LANGUAGE c IMMUTABLE STRICT
4187
 
    AS '$libdir/tsearch2', 'tsa_to_tsvector_name';
4188
 
 
4189
 
 
4190
 
CREATE FUNCTION to_tsvector(text) RETURNS pg_catalog.tsvector
4191
 
    LANGUAGE internal IMMUTABLE STRICT
4192
 
    AS $$to_tsvector$$;
4193
 
 
4194
 
 
4195
 
CREATE FUNCTION token_type(integer) RETURNS SETOF tokentype
4196
 
    LANGUAGE internal STRICT ROWS 16
4197
 
    AS $$ts_token_type_byid$$;
4198
 
 
4199
 
 
4200
 
CREATE FUNCTION token_type(text) RETURNS SETOF tokentype
4201
 
    LANGUAGE internal STRICT ROWS 16
4202
 
    AS $$ts_token_type_byname$$;
4203
 
 
4204
 
 
4205
 
CREATE FUNCTION token_type() RETURNS SETOF tokentype
4206
 
    LANGUAGE c STRICT ROWS 16
4207
 
    AS '$libdir/tsearch2', 'tsa_token_type_current';
4208
 
 
4209
 
 
4210
 
CREATE FUNCTION ts_debug(text) RETURNS SETOF tsdebug
4211
 
    LANGUAGE sql STRICT
4212
 
    AS $_$
4213
 
select
4214
 
        (select c.cfgname::text from pg_catalog.pg_ts_config as c
4215
 
         where c.oid = show_curcfg()),
4216
 
        t.alias as tok_type,
4217
 
        t.descr as description,
4218
 
        p.token,
4219
 
        ARRAY ( SELECT m.mapdict::pg_catalog.regdictionary::pg_catalog.text
4220
 
                FROM pg_catalog.pg_ts_config_map AS m
4221
 
                WHERE m.mapcfg = show_curcfg() AND m.maptokentype = p.tokid
4222
 
                ORDER BY m.mapseqno )
4223
 
        AS dict_name,
4224
 
        strip(to_tsvector(p.token)) as tsvector
4225
 
from
4226
 
        parse( _get_parser_from_curcfg(), $1 ) as p,
4227
 
        token_type() as t
4228
 
where
4229
 
        t.tokid = p.tokid
4230
 
$_$;
4231
 
 
4232
 
 
4233
 
CREATE FUNCTION tsearch2() RETURNS trigger
4234
 
    LANGUAGE c
4235
 
    AS '$libdir/tsearch2', 'tsa_tsearch2';
4236
 
 
4237
 
 
4238
 
CREATE FUNCTION tsq_mcontained(pg_catalog.tsquery, pg_catalog.tsquery) RETURNS boolean
4239
 
    LANGUAGE internal IMMUTABLE STRICT
4240
 
    AS $$tsq_mcontained$$;
4241
 
 
4242
 
 
4243
 
CREATE FUNCTION tsq_mcontains(pg_catalog.tsquery, pg_catalog.tsquery) RETURNS boolean
4244
 
    LANGUAGE internal IMMUTABLE STRICT
4245
 
    AS $$tsq_mcontains$$;
4246
 
 
4247
 
 
4248
 
CREATE FUNCTION tsquery_and(pg_catalog.tsquery, pg_catalog.tsquery) RETURNS pg_catalog.tsquery
4249
 
    LANGUAGE internal IMMUTABLE STRICT
4250
 
    AS $$tsquery_and$$;
4251
 
 
4252
 
 
4253
 
CREATE FUNCTION tsquery_not(pg_catalog.tsquery) RETURNS pg_catalog.tsquery
4254
 
    LANGUAGE internal IMMUTABLE STRICT
4255
 
    AS $$tsquery_not$$;
4256
 
 
4257
 
 
4258
 
CREATE FUNCTION tsquery_or(pg_catalog.tsquery, pg_catalog.tsquery) RETURNS pg_catalog.tsquery
4259
 
    LANGUAGE internal IMMUTABLE STRICT
4260
 
    AS $$tsquery_or$$;
4261
 
 
4262
 
 
4263
 
SET search_path = public, pg_catalog;
4264
 
 
4265
 
CREATE OPERATOR > (
4266
 
    PROCEDURE = debversion_gt,
4267
 
    LEFTARG = debversion,
4268
 
    RIGHTARG = debversion,
4269
 
    COMMUTATOR = <,
4270
 
    NEGATOR = >=
4271
 
);
4272
 
 
4273
 
 
4274
 
COMMENT ON OPERATOR > (debversion, debversion) IS 'debversion greater-than';
4275
 
 
4276
 
 
4277
 
CREATE AGGREGATE max(debversion) (
4278
 
    SFUNC = debversion_larger,
4279
 
    STYPE = debversion,
4280
 
    SORTOP = >
4281
 
);
4282
 
 
4283
 
 
4284
 
CREATE OPERATOR < (
4285
 
    PROCEDURE = debversion_lt,
4286
 
    LEFTARG = debversion,
4287
 
    RIGHTARG = debversion,
4288
 
    COMMUTATOR = >,
4289
 
    NEGATOR = >=
4290
 
);
4291
 
 
4292
 
 
4293
 
COMMENT ON OPERATOR < (debversion, debversion) IS 'debversion less-than';
4294
 
 
4295
 
 
4296
 
CREATE AGGREGATE min(debversion) (
4297
 
    SFUNC = debversion_smaller,
4298
 
    STYPE = debversion,
4299
 
    SORTOP = <
4300
 
);
4301
 
 
4302
 
 
4303
 
SET search_path = ts2, pg_catalog;
4304
 
 
4305
 
CREATE AGGREGATE rewrite(pg_catalog.tsquery[]) (
4306
 
    SFUNC = rewrite_accum,
4307
 
    STYPE = pg_catalog.tsquery,
4308
 
    FINALFUNC = rewrite_finish
4309
 
);
4310
 
 
4311
 
 
4312
 
SET search_path = public, pg_catalog;
4313
 
 
4314
 
CREATE OPERATOR <= (
4315
 
    PROCEDURE = debversion_le,
4316
 
    LEFTARG = debversion,
4317
 
    RIGHTARG = debversion,
4318
 
    COMMUTATOR = >=,
4319
 
    NEGATOR = >
4320
 
);
4321
 
 
4322
 
 
4323
 
COMMENT ON OPERATOR <= (debversion, debversion) IS 'debversion less-than-or-equal';
4324
 
 
4325
 
 
4326
 
CREATE OPERATOR <> (
4327
 
    PROCEDURE = debversion_ne,
4328
 
    LEFTARG = debversion,
4329
 
    RIGHTARG = debversion,
4330
 
    COMMUTATOR = <>,
4331
 
    NEGATOR = =
4332
 
);
4333
 
 
4334
 
 
4335
 
COMMENT ON OPERATOR <> (debversion, debversion) IS 'debversion not equal';
4336
 
 
4337
 
 
4338
 
CREATE OPERATOR = (
4339
 
    PROCEDURE = debversion_eq,
4340
 
    LEFTARG = debversion,
4341
 
    RIGHTARG = debversion,
4342
 
    COMMUTATOR = =,
4343
 
    NEGATOR = <>
4344
 
);
4345
 
 
4346
 
 
4347
 
COMMENT ON OPERATOR = (debversion, debversion) IS 'debversion equal';
4348
 
 
4349
 
 
4350
 
CREATE OPERATOR >= (
4351
 
    PROCEDURE = debversion_ge,
4352
 
    LEFTARG = debversion,
4353
 
    RIGHTARG = debversion,
4354
 
    COMMUTATOR = <=,
4355
 
    NEGATOR = <
4356
 
);
4357
 
 
4358
 
 
4359
 
COMMENT ON OPERATOR >= (debversion, debversion) IS 'debversion greater-than-or-equal';
4360
 
 
4361
 
 
4362
 
CREATE OPERATOR FAMILY debversion_ops USING btree;
4363
 
 
4364
 
 
4365
 
CREATE OPERATOR CLASS debversion_ops
4366
 
    DEFAULT FOR TYPE debversion USING btree AS
4367
 
    OPERATOR 1 <(debversion,debversion) ,
4368
 
    OPERATOR 2 <=(debversion,debversion) ,
4369
 
    OPERATOR 3 =(debversion,debversion) ,
4370
 
    OPERATOR 4 >=(debversion,debversion) ,
4371
 
    OPERATOR 5 >(debversion,debversion) ,
4372
 
    FUNCTION 1 debversion_cmp(debversion,debversion);
4373
 
 
4374
 
 
4375
 
CREATE OPERATOR FAMILY debversion_ops USING hash;
4376
 
 
4377
 
 
4378
 
CREATE OPERATOR CLASS debversion_ops
4379
 
    DEFAULT FOR TYPE debversion USING hash AS
4380
 
    OPERATOR 1 =(debversion,debversion) ,
4381
 
    FUNCTION 1 debversion_hash(debversion);
4382
 
 
4383
 
 
4384
 
SET search_path = ts2, pg_catalog;
4385
 
 
4386
 
CREATE OPERATOR FAMILY tsquery_ops USING btree;
4387
 
 
4388
 
 
4389
 
CREATE OPERATOR CLASS tsquery_ops
4390
 
    FOR TYPE pg_catalog.tsquery USING btree AS
4391
 
    OPERATOR 1 <(pg_catalog.tsquery,pg_catalog.tsquery) ,
4392
 
    OPERATOR 2 <=(pg_catalog.tsquery,pg_catalog.tsquery) ,
4393
 
    OPERATOR 3 =(pg_catalog.tsquery,pg_catalog.tsquery) ,
4394
 
    OPERATOR 4 >=(pg_catalog.tsquery,pg_catalog.tsquery) ,
4395
 
    OPERATOR 5 >(pg_catalog.tsquery,pg_catalog.tsquery) ,
4396
 
    FUNCTION 1 tsquery_cmp(pg_catalog.tsquery,pg_catalog.tsquery);
4397
 
 
4398
 
 
4399
 
CREATE OPERATOR FAMILY tsvector_ops USING btree;
4400
 
 
4401
 
 
4402
 
CREATE OPERATOR CLASS tsvector_ops
4403
 
    FOR TYPE pg_catalog.tsvector USING btree AS
4404
 
    OPERATOR 1 <(pg_catalog.tsvector,pg_catalog.tsvector) ,
4405
 
    OPERATOR 2 <=(pg_catalog.tsvector,pg_catalog.tsvector) ,
4406
 
    OPERATOR 3 =(pg_catalog.tsvector,pg_catalog.tsvector) ,
4407
 
    OPERATOR 4 >=(pg_catalog.tsvector,pg_catalog.tsvector) ,
4408
 
    OPERATOR 5 >(pg_catalog.tsvector,pg_catalog.tsvector) ,
4409
 
    FUNCTION 1 tsvector_cmp(pg_catalog.tsvector,pg_catalog.tsvector);
4410
 
 
4411
 
 
4412
 
SET search_path = pg_catalog;
4413
 
 
4414
 
CREATE CAST (character AS public.debversion) WITH FUNCTION public.debversion(character);
4415
 
 
4416
 
 
4417
 
CREATE CAST (public.debversion AS character) WITHOUT FUNCTION AS ASSIGNMENT;
4418
 
 
4419
 
 
4420
 
CREATE CAST (public.debversion AS text) WITHOUT FUNCTION AS IMPLICIT;
4421
 
 
4422
 
 
4423
 
CREATE CAST (public.debversion AS character varying) WITHOUT FUNCTION AS IMPLICIT;
4424
 
 
4425
 
 
4426
 
CREATE CAST (text AS public.debversion) WITHOUT FUNCTION AS ASSIGNMENT;
4427
 
 
4428
 
 
4429
 
CREATE CAST (character varying AS public.debversion) WITHOUT FUNCTION AS ASSIGNMENT;
4430
 
 
4431
 
 
4432
 
SET search_path = ts2, pg_catalog;
4433
 
 
4434
 
CREATE TEXT SEARCH CONFIGURATION "default" (
4435
 
    PARSER = pg_catalog."default" );
4436
 
 
4437
 
ALTER TEXT SEARCH CONFIGURATION "default"
4438
 
    ADD MAPPING FOR asciiword WITH english_stem;
4439
 
 
4440
 
ALTER TEXT SEARCH CONFIGURATION "default"
4441
 
    ADD MAPPING FOR word WITH english_stem;
4442
 
 
4443
 
ALTER TEXT SEARCH CONFIGURATION "default"
4444
 
    ADD MAPPING FOR numword WITH simple;
4445
 
 
4446
 
ALTER TEXT SEARCH CONFIGURATION "default"
4447
 
    ADD MAPPING FOR email WITH simple;
4448
 
 
4449
 
ALTER TEXT SEARCH CONFIGURATION "default"
4450
 
    ADD MAPPING FOR url WITH simple;
4451
 
 
4452
 
ALTER TEXT SEARCH CONFIGURATION "default"
4453
 
    ADD MAPPING FOR host WITH simple;
4454
 
 
4455
 
ALTER TEXT SEARCH CONFIGURATION "default"
4456
 
    ADD MAPPING FOR sfloat WITH simple;
4457
 
 
4458
 
ALTER TEXT SEARCH CONFIGURATION "default"
4459
 
    ADD MAPPING FOR version WITH simple;
4460
 
 
4461
 
ALTER TEXT SEARCH CONFIGURATION "default"
4462
 
    ADD MAPPING FOR hword_numpart WITH simple;
4463
 
 
4464
 
ALTER TEXT SEARCH CONFIGURATION "default"
4465
 
    ADD MAPPING FOR hword_part WITH english_stem;
4466
 
 
4467
 
ALTER TEXT SEARCH CONFIGURATION "default"
4468
 
    ADD MAPPING FOR hword_asciipart WITH english_stem;
4469
 
 
4470
 
ALTER TEXT SEARCH CONFIGURATION "default"
4471
 
    ADD MAPPING FOR numhword WITH simple;
4472
 
 
4473
 
ALTER TEXT SEARCH CONFIGURATION "default"
4474
 
    ADD MAPPING FOR asciihword WITH english_stem;
4475
 
 
4476
 
ALTER TEXT SEARCH CONFIGURATION "default"
4477
 
    ADD MAPPING FOR hword WITH english_stem;
4478
 
 
4479
 
ALTER TEXT SEARCH CONFIGURATION "default"
4480
 
    ADD MAPPING FOR url_path WITH simple;
4481
 
 
4482
 
ALTER TEXT SEARCH CONFIGURATION "default"
4483
 
    ADD MAPPING FOR file WITH simple;
4484
 
 
4485
 
ALTER TEXT SEARCH CONFIGURATION "default"
4486
 
    ADD MAPPING FOR "float" WITH simple;
4487
 
 
4488
 
ALTER TEXT SEARCH CONFIGURATION "default"
4489
 
    ADD MAPPING FOR "int" WITH simple;
4490
 
 
4491
 
ALTER TEXT SEARCH CONFIGURATION "default"
4492
 
    ADD MAPPING FOR uint WITH simple;
4493
 
 
4494
 
 
4495
 
SET search_path = public, pg_catalog;
4496
 
 
4497
 
CREATE TABLE accesspolicy (
4498
 
    id integer NOT NULL,
4499
 
    product integer,
4500
 
    distribution integer,
4501
 
    type integer NOT NULL,
4502
 
    CONSTRAINT has_target CHECK (((product IS NULL) <> (distribution IS NULL)))
4503
 
);
4504
 
 
4505
 
 
4506
 
CREATE SEQUENCE accesspolicy_id_seq
4507
 
    START WITH 1
4508
 
    INCREMENT BY 1
4509
 
    NO MAXVALUE
4510
 
    NO MINVALUE
4511
 
    CACHE 1;
4512
 
 
4513
 
 
4514
 
ALTER SEQUENCE accesspolicy_id_seq OWNED BY accesspolicy.id;
4515
 
 
4516
 
 
4517
 
CREATE TABLE accesspolicyartifact (
4518
 
    id integer NOT NULL,
4519
 
    bug integer,
4520
 
    branch integer,
4521
 
    policy integer,
4522
 
    CONSTRAINT has_artifact CHECK (((bug IS NULL) <> (branch IS NULL)))
4523
 
);
4524
 
 
4525
 
 
4526
 
CREATE SEQUENCE accesspolicyartifact_id_seq
4527
 
    START WITH 1
4528
 
    INCREMENT BY 1
4529
 
    NO MAXVALUE
4530
 
    NO MINVALUE
4531
 
    CACHE 1;
4532
 
 
4533
 
 
4534
 
ALTER SEQUENCE accesspolicyartifact_id_seq OWNED BY accesspolicyartifact.id;
4535
 
 
4536
 
 
4537
 
CREATE TABLE accesspolicygrant (
4538
 
    id integer NOT NULL,
4539
 
    grantee integer NOT NULL,
4540
 
    grantor integer NOT NULL,
4541
 
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
4542
 
    policy integer,
4543
 
    artifact integer,
4544
 
    CONSTRAINT has_target CHECK (((policy IS NULL) <> (artifact IS NULL)))
4545
 
);
4546
 
 
4547
 
 
4548
 
CREATE SEQUENCE accesspolicygrant_id_seq
4549
 
    START WITH 1
4550
 
    INCREMENT BY 1
4551
 
    NO MAXVALUE
4552
 
    NO MINVALUE
4553
 
    CACHE 1;
4554
 
 
4555
 
 
4556
 
ALTER SEQUENCE accesspolicygrant_id_seq OWNED BY accesspolicygrant.id;
4557
 
 
 
56
    AS '$libdir/plpython', 'plpython_call_handler'
 
57
    LANGUAGE c;
4558
58
 
4559
59
CREATE TABLE account (
4560
60
    id integer NOT NULL,
4563
63
    status integer NOT NULL,
4564
64
    date_status_set timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
4565
65
    displayname text NOT NULL,
4566
 
    status_comment text
 
66
    openid_identifier text DEFAULT generate_openid_identifier() NOT NULL,
 
67
    status_comment text,
 
68
    old_openid_identifier text
4567
69
);
4568
70
 
4569
 
 
4570
 
COMMENT ON TABLE account IS 'An account that may be used for authenticating to Canonical or other systems.';
4571
 
 
4572
 
 
4573
 
COMMENT ON COLUMN account.status IS 'The status of the account.';
4574
 
 
4575
 
 
4576
 
COMMENT ON COLUMN account.date_status_set IS 'When the status was last changed.';
4577
 
 
4578
 
 
4579
 
COMMENT ON COLUMN account.displayname IS 'Name to display when rendering information about this account.';
4580
 
 
4581
 
 
4582
 
COMMENT ON COLUMN account.status_comment IS 'The comment on the status of the account.';
4583
 
 
4584
 
 
4585
71
CREATE SEQUENCE account_id_seq
4586
 
    START WITH 1
4587
72
    INCREMENT BY 1
4588
73
    NO MAXVALUE
4589
74
    NO MINVALUE
4590
75
    CACHE 1;
4591
76
 
4592
 
 
4593
77
ALTER SEQUENCE account_id_seq OWNED BY account.id;
4594
78
 
4595
 
 
4596
79
CREATE TABLE accountpassword (
4597
80
    id integer NOT NULL,
4598
81
    account integer NOT NULL,
4599
82
    password text NOT NULL
4600
83
);
4601
84
 
4602
 
 
4603
 
COMMENT ON TABLE accountpassword IS 'A password used to authenticate an Account.';
4604
 
 
4605
 
 
4606
 
COMMENT ON COLUMN accountpassword.password IS 'SSHA digest encrypted password.';
4607
 
 
4608
 
 
4609
85
CREATE SEQUENCE accountpassword_id_seq
4610
 
    START WITH 1
4611
86
    INCREMENT BY 1
4612
87
    NO MAXVALUE
4613
88
    NO MINVALUE
4614
89
    CACHE 1;
4615
90
 
4616
 
 
4617
91
ALTER SEQUENCE accountpassword_id_seq OWNED BY accountpassword.id;
4618
92
 
4619
 
 
4620
93
CREATE VIEW alllocks AS
4621
94
    SELECT a.procpid, a.usename, (now() - a.query_start) AS age, c.relname, l.mode, l.granted, a.current_query FROM ((pg_locks l JOIN pg_class c ON ((l.relation = c.oid))) LEFT JOIN pg_stat_activity a ON ((a.procpid = l.pid)));
4622
95
 
4623
 
 
4624
96
CREATE TABLE announcement (
4625
97
    id integer NOT NULL,
4626
98
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
4638
110
    CONSTRAINT valid_url CHECK (valid_absolute_url(url))
4639
111
);
4640
112
 
4641
 
 
4642
 
COMMENT ON TABLE announcement IS 'A project announcement. This is a single item of news or information that the project is communicating. Announcements can be attached to a Project, a Product or a Distribution.';
4643
 
 
4644
 
 
4645
 
COMMENT ON COLUMN announcement.date_announced IS 'The date at which an announcement will become public, if it is active. If this is not set then the announcement will not become public until someone consciously publishes it (which sets this date).';
4646
 
 
4647
 
 
4648
 
COMMENT ON COLUMN announcement.url IS 'A web location for the announcement itself.';
4649
 
 
4650
 
 
4651
 
COMMENT ON COLUMN announcement.active IS 'Whether or not the announcement is public. This is TRUE by default, but can be set to FALSE if the project "retracts" the announcement.';
4652
 
 
4653
 
 
4654
113
CREATE SEQUENCE announcement_id_seq
4655
 
    START WITH 1
4656
114
    INCREMENT BY 1
4657
115
    NO MAXVALUE
4658
116
    NO MINVALUE
4659
117
    CACHE 1;
4660
118
 
4661
 
 
4662
119
ALTER SEQUENCE announcement_id_seq OWNED BY announcement.id;
4663
120
 
4664
 
 
4665
121
CREATE TABLE answercontact (
4666
122
    id integer NOT NULL,
4667
123
    product integer,
4672
128
    CONSTRAINT valid_target CHECK ((((product IS NULL) <> (distribution IS NULL)) AND ((product IS NULL) OR (sourcepackagename IS NULL))))
4673
129
);
4674
130
 
4675
 
 
4676
 
COMMENT ON TABLE answercontact IS 'Defines the answer contact for a given question target. The answer contact will be automatically notified about changes to any questions filed on the question target.';
4677
 
 
4678
 
 
4679
 
COMMENT ON COLUMN answercontact.product IS 'The product that the answer contact supports.';
4680
 
 
4681
 
 
4682
 
COMMENT ON COLUMN answercontact.distribution IS 'The distribution that the answer contact supports.';
4683
 
 
4684
 
 
4685
 
COMMENT ON COLUMN answercontact.sourcepackagename IS 'The sourcepackagename that the answer contact supports.';
4686
 
 
4687
 
 
4688
 
COMMENT ON COLUMN answercontact.person IS 'The person or team associated with the question target.';
4689
 
 
4690
 
 
4691
 
COMMENT ON COLUMN answercontact.date_created IS 'The date the answer contact was submitted.';
4692
 
 
4693
 
 
4694
131
CREATE SEQUENCE answercontact_id_seq
4695
 
    START WITH 1
4696
132
    INCREMENT BY 1
4697
133
    NO MAXVALUE
4698
134
    NO MINVALUE
4699
135
    CACHE 1;
4700
136
 
4701
 
 
4702
137
ALTER SEQUENCE answercontact_id_seq OWNED BY answercontact.id;
4703
138
 
4704
 
 
4705
139
CREATE TABLE apportjob (
4706
140
    id integer NOT NULL,
4707
141
    job integer NOT NULL,
4710
144
    json_data text
4711
145
);
4712
146
 
4713
 
 
4714
 
COMMENT ON TABLE apportjob IS 'Contains references to jobs to be run against Apport BLOBs.';
4715
 
 
4716
 
 
4717
 
COMMENT ON COLUMN apportjob.blob IS 'The TemporaryBlobStorage entry on which the job is to be run.';
4718
 
 
4719
 
 
4720
 
COMMENT ON COLUMN apportjob.job_type IS 'The type of job (enumeration value). Allows us to query the database for a given subset of ApportJobs.';
4721
 
 
4722
 
 
4723
 
COMMENT ON COLUMN apportjob.json_data IS 'A JSON struct containing data for the job.';
4724
 
 
4725
 
 
4726
147
CREATE SEQUENCE apportjob_id_seq
4727
 
    START WITH 1
4728
148
    INCREMENT BY 1
4729
149
    NO MAXVALUE
4730
150
    NO MINVALUE
4731
151
    CACHE 1;
4732
152
 
4733
 
 
4734
153
ALTER SEQUENCE apportjob_id_seq OWNED BY apportjob.id;
4735
154
 
4736
 
 
4737
155
CREATE TABLE archive (
4738
156
    id integer NOT NULL,
4739
157
    owner integer NOT NULL,
4771
189
    CONSTRAINT valid_name CHECK (valid_name(name))
4772
190
);
4773
191
 
4774
 
 
4775
 
COMMENT ON TABLE archive IS 'A package archive. Commonly either a distribution''s main_archive or a ppa''s archive.';
4776
 
 
4777
 
 
4778
 
COMMENT ON COLUMN archive.owner IS 'Identifies the PPA owner when it has one.';
4779
 
 
4780
 
 
4781
 
COMMENT ON COLUMN archive.description IS 'Allow users to describe their PPAs content.';
4782
 
 
4783
 
 
4784
 
COMMENT ON COLUMN archive.enabled IS 'Whether or not the PPA is enabled for accepting uploads.';
4785
 
 
4786
 
 
4787
 
COMMENT ON COLUMN archive.authorized_size IS 'Size, in MiB, allowed for this PPA.';
4788
 
 
4789
 
 
4790
 
COMMENT ON COLUMN archive.distribution IS 'The distribution that uses this archive.';
4791
 
 
4792
 
 
4793
 
COMMENT ON COLUMN archive.purpose IS 'The purpose of this archive, e.g. COMMERCIAL.  See the ArchivePurpose DBSchema item.';
4794
 
 
4795
 
 
4796
 
COMMENT ON COLUMN archive.private IS 'Whether or not the archive is private. This affects the global visibility of the archive.';
4797
 
 
4798
 
 
4799
 
COMMENT ON COLUMN archive.sources_cached IS 'Number of sources already cached for this archive.';
4800
 
 
4801
 
 
4802
 
COMMENT ON COLUMN archive.binaries_cached IS 'Number of binaries already cached for this archive.';
4803
 
 
4804
 
 
4805
 
COMMENT ON COLUMN archive.package_description_cache IS 'Text blob containing all source and binary names and descriptions concatenated. Used to to build the tsearch indexes on this table.';
4806
 
 
4807
 
 
4808
 
COMMENT ON COLUMN archive.require_virtualized IS 'Whether this archive has binaries that should be built on a virtual machine, e.g. PPAs';
4809
 
 
4810
 
 
4811
 
COMMENT ON COLUMN archive.name IS 'The name of the archive.';
4812
 
 
4813
 
 
4814
 
COMMENT ON COLUMN archive.publish IS 'Whether this archive should be published.';
4815
 
 
4816
 
 
4817
 
COMMENT ON COLUMN archive.date_updated IS 'When were the rebuild statistics last updated?';
4818
 
 
4819
 
 
4820
 
COMMENT ON COLUMN archive.total_count IS 'How many source packages are in the rebuild archive altogether?';
4821
 
 
4822
 
 
4823
 
COMMENT ON COLUMN archive.pending_count IS 'How many packages still need building?';
4824
 
 
4825
 
 
4826
 
COMMENT ON COLUMN archive.succeeded_count IS 'How many source packages were built sucessfully?';
4827
 
 
4828
 
 
4829
 
COMMENT ON COLUMN archive.failed_count IS 'How many packages failed to build?';
4830
 
 
4831
 
 
4832
 
COMMENT ON COLUMN archive.building_count IS 'How many packages are building at present?';
4833
 
 
4834
 
 
4835
 
COMMENT ON COLUMN archive.signing_key IS 'The GpgKey used for signing this archive.';
4836
 
 
4837
 
 
4838
 
COMMENT ON COLUMN archive.removed_binary_retention_days IS 'The number of days before superseded or deleted binary files are expired in the librarian, or zero for never.';
4839
 
 
4840
 
 
4841
 
COMMENT ON COLUMN archive.num_old_versions_published IS 'The number of versions of a package to keep published before older versions are superseded.';
4842
 
 
4843
 
 
4844
 
COMMENT ON COLUMN archive.displayname IS 'User defined displayname for this archive.';
4845
 
 
4846
 
 
4847
 
COMMENT ON COLUMN archive.relative_build_score IS 'A delta to the build score that is applied to all builds in this archive.';
4848
 
 
4849
 
 
4850
 
COMMENT ON COLUMN archive.external_dependencies IS 'Newline-separated list of repositories to be used to retrieve any external build dependencies when building packages in this archive, in the format: deb http[s]://[user:pass@]<host>[/path] %(series)s[-pocket] [components]  The series variable is replaced with the series name of the context build.  This column is specifically and only intended for OEM migration to Launchpad and should be re-examined in October 2010 to see if it is still relevant.';
4851
 
 
4852
 
 
4853
 
COMMENT ON COLUMN archive.status IS 'The status of this archive, e.g. ACTIVE.  See the ArchiveState DBSchema item.';
4854
 
 
4855
 
 
4856
 
COMMENT ON COLUMN archive.commercial IS 'Whether this archive is a commercial Archive and should appear in the Software Center.';
4857
 
 
4858
 
 
4859
 
COMMENT ON COLUMN archive.build_debug_symbols IS 'Whether builds for this archive should create debug symbol packages.';
4860
 
 
4861
 
 
4862
192
CREATE SEQUENCE archive_id_seq
4863
 
    START WITH 1
4864
193
    INCREMENT BY 1
4865
194
    NO MAXVALUE
4866
195
    NO MINVALUE
4867
196
    CACHE 1;
4868
197
 
4869
 
 
4870
198
ALTER SEQUENCE archive_id_seq OWNED BY archive.id;
4871
199
 
4872
 
 
4873
200
CREATE TABLE archivearch (
4874
201
    id integer NOT NULL,
4875
202
    archive integer NOT NULL,
4876
203
    processorfamily integer NOT NULL
4877
204
);
4878
205
 
4879
 
 
4880
 
COMMENT ON TABLE archivearch IS 'ArchiveArch: A table that allows a user to specify which architectures an archive requires or supports.';
4881
 
 
4882
 
 
4883
 
COMMENT ON COLUMN archivearch.archive IS 'The archive for which an architecture is specified.';
4884
 
 
4885
 
 
4886
 
COMMENT ON COLUMN archivearch.processorfamily IS 'The architecture specified for the archive on hand.';
4887
 
 
4888
 
 
4889
206
CREATE SEQUENCE archivearch_id_seq
4890
 
    START WITH 1
4891
207
    INCREMENT BY 1
4892
208
    NO MAXVALUE
4893
209
    NO MINVALUE
4894
210
    CACHE 1;
4895
211
 
4896
 
 
4897
212
ALTER SEQUENCE archivearch_id_seq OWNED BY archivearch.id;
4898
213
 
4899
 
 
4900
214
CREATE TABLE archiveauthtoken (
4901
215
    id integer NOT NULL,
4902
216
    archive integer NOT NULL,
4906
220
    token text NOT NULL
4907
221
);
4908
222
 
4909
 
 
4910
 
COMMENT ON TABLE archiveauthtoken IS 'Authorisation tokens to use in .htaccess for published archives.';
4911
 
 
4912
 
 
4913
 
COMMENT ON COLUMN archiveauthtoken.archive IS 'The archive to which this token refers.';
4914
 
 
4915
 
 
4916
 
COMMENT ON COLUMN archiveauthtoken.person IS 'The person to which this token applies.';
4917
 
 
4918
 
 
4919
 
COMMENT ON COLUMN archiveauthtoken.date_created IS 'The date and time this token was created.';
4920
 
 
4921
 
 
4922
 
COMMENT ON COLUMN archiveauthtoken.date_deactivated IS 'The date and time this token was deactivated.';
4923
 
 
4924
 
 
4925
 
COMMENT ON COLUMN archiveauthtoken.token IS 'The token text for this authorisation.';
4926
 
 
4927
 
 
4928
223
CREATE SEQUENCE archiveauthtoken_id_seq
4929
 
    START WITH 1
4930
224
    INCREMENT BY 1
4931
225
    NO MAXVALUE
4932
226
    NO MINVALUE
4933
227
    CACHE 1;
4934
228
 
4935
 
 
4936
229
ALTER SEQUENCE archiveauthtoken_id_seq OWNED BY archiveauthtoken.id;
4937
230
 
4938
 
 
4939
231
CREATE TABLE archivedependency (
4940
232
    id integer NOT NULL,
4941
233
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
4946
238
    CONSTRAINT distinct_archives CHECK ((archive <> dependency))
4947
239
);
4948
240
 
4949
 
 
4950
 
COMMENT ON TABLE archivedependency IS 'This table maps a given archive to all other archives it should depend on.';
4951
 
 
4952
 
 
4953
 
COMMENT ON COLUMN archivedependency.date_created IS 'Instant when the dependency was created.';
4954
 
 
4955
 
 
4956
 
COMMENT ON COLUMN archivedependency.archive IS 'The archive where the dependency should be applied.';
4957
 
 
4958
 
 
4959
 
COMMENT ON COLUMN archivedependency.dependency IS 'The archive to depend on.';
4960
 
 
4961
 
 
4962
241
CREATE SEQUENCE archivedependency_id_seq
4963
 
    START WITH 1
4964
242
    INCREMENT BY 1
4965
243
    NO MAXVALUE
4966
244
    NO MINVALUE
4967
245
    CACHE 1;
4968
246
 
4969
 
 
4970
247
ALTER SEQUENCE archivedependency_id_seq OWNED BY archivedependency.id;
4971
248
 
4972
 
 
4973
249
CREATE TABLE archivejob (
4974
250
    id integer NOT NULL,
4975
251
    job integer NOT NULL,
4978
254
    json_data text
4979
255
);
4980
256
 
4981
 
 
4982
 
COMMENT ON TABLE archivejob IS 'Contains references to jobs to be run against Archives.';
4983
 
 
4984
 
 
4985
 
COMMENT ON COLUMN archivejob.archive IS 'The archive on which the job is to be run.';
4986
 
 
4987
 
 
4988
 
COMMENT ON COLUMN archivejob.job_type IS 'The type of job (enumeration value). Allows us to query the database for a given subset of ArchiveJobs.';
4989
 
 
4990
 
 
4991
 
COMMENT ON COLUMN archivejob.json_data IS 'A JSON struct containing data for the job.';
4992
 
 
4993
 
 
4994
257
CREATE SEQUENCE archivejob_id_seq
4995
258
    START WITH 1
4996
259
    INCREMENT BY 1
4998
261
    NO MINVALUE
4999
262
    CACHE 1;
5000
263
 
5001
 
 
5002
264
ALTER SEQUENCE archivejob_id_seq OWNED BY archivejob.id;
5003
265
 
5004
 
 
5005
266
CREATE TABLE archivepermission (
5006
267
    id integer NOT NULL,
5007
268
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
5015
276
    CONSTRAINT one_target CHECK ((null_count(ARRAY[packageset, component, sourcepackagename]) = 2))
5016
277
);
5017
278
 
5018
 
 
5019
 
COMMENT ON TABLE archivepermission IS 'ArchivePermission: A record of who has permission to upload and approve uploads to an archive (and hence a distribution)';
5020
 
 
5021
 
 
5022
 
COMMENT ON COLUMN archivepermission.date_created IS 'The date that this permission was created.';
5023
 
 
5024
 
 
5025
 
COMMENT ON COLUMN archivepermission.person IS 'The person or team to whom the permission is being granted.';
5026
 
 
5027
 
 
5028
 
COMMENT ON COLUMN archivepermission.permission IS 'The permission type being granted.';
5029
 
 
5030
 
 
5031
 
COMMENT ON COLUMN archivepermission.archive IS 'The archive to which this permission applies.';
5032
 
 
5033
 
 
5034
 
COMMENT ON COLUMN archivepermission.component IS 'The component to which this upload permission applies.';
5035
 
 
5036
 
 
5037
 
COMMENT ON COLUMN archivepermission.sourcepackagename IS 'The source package name to which this permission applies.  This can be used to provide package-level permissions to single users.';
5038
 
 
5039
 
 
5040
 
COMMENT ON COLUMN archivepermission.packageset IS 'The package set to which this permission applies.';
5041
 
 
5042
 
 
5043
 
COMMENT ON COLUMN archivepermission.explicit IS 'This flag is set for package sets containing high-profile packages that must not break and/or require specialist skills for proper handling e.g. the kernel.';
5044
 
 
5045
 
 
5046
279
CREATE SEQUENCE archivepermission_id_seq
5047
 
    START WITH 1
5048
280
    INCREMENT BY 1
5049
281
    NO MAXVALUE
5050
282
    NO MINVALUE
5051
283
    CACHE 1;
5052
284
 
5053
 
 
5054
285
ALTER SEQUENCE archivepermission_id_seq OWNED BY archivepermission.id;
5055
286
 
5056
 
 
5057
287
CREATE TABLE archivesubscriber (
5058
288
    id integer NOT NULL,
5059
289
    archive integer NOT NULL,
5067
297
    cancelled_by integer
5068
298
);
5069
299
 
5070
 
 
5071
 
COMMENT ON TABLE archivesubscriber IS 'An authorised person or team subscription to an archive.';
5072
 
 
5073
 
 
5074
 
COMMENT ON COLUMN archivesubscriber.archive IS 'The archive that the subscriber is authorised to see.';
5075
 
 
5076
 
 
5077
 
COMMENT ON COLUMN archivesubscriber.registrant IS 'The person who authorised this subscriber.';
5078
 
 
5079
 
 
5080
 
COMMENT ON COLUMN archivesubscriber.date_created IS 'The date and time this subscription was created.';
5081
 
 
5082
 
 
5083
 
COMMENT ON COLUMN archivesubscriber.subscriber IS 'The person or team that this subscription refers to.';
5084
 
 
5085
 
 
5086
 
COMMENT ON COLUMN archivesubscriber.date_expires IS 'The date and time this subscription will expire. If NULL, it does not expire.';
5087
 
 
5088
 
 
5089
 
COMMENT ON COLUMN archivesubscriber.status IS 'The status of the subscription, e.g. PENDING, ACTIVE, CANCELLING, CANCELLED.';
5090
 
 
5091
 
 
5092
 
COMMENT ON COLUMN archivesubscriber.description IS 'An optional note for the archive owner to describe the subscription.';
5093
 
 
5094
 
 
5095
 
COMMENT ON COLUMN archivesubscriber.date_cancelled IS 'The date and time this subscription was revoked.';
5096
 
 
5097
 
 
5098
 
COMMENT ON COLUMN archivesubscriber.cancelled_by IS 'The person who revoked this subscription.';
5099
 
 
5100
 
 
5101
300
CREATE SEQUENCE archivesubscriber_id_seq
5102
 
    START WITH 1
5103
301
    INCREMENT BY 1
5104
302
    NO MAXVALUE
5105
303
    NO MINVALUE
5106
304
    CACHE 1;
5107
305
 
5108
 
 
5109
306
ALTER SEQUENCE archivesubscriber_id_seq OWNED BY archivesubscriber.id;
5110
307
 
 
308
CREATE TABLE authtoken (
 
309
    id integer NOT NULL,
 
310
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
 
311
    date_consumed timestamp without time zone,
 
312
    token_type integer NOT NULL,
 
313
    token text NOT NULL,
 
314
    requester integer,
 
315
    requester_email text,
 
316
    email text NOT NULL,
 
317
    redirection_url text
 
318
);
 
319
 
 
320
CREATE SEQUENCE authtoken_id_seq
 
321
    INCREMENT BY 1
 
322
    NO MAXVALUE
 
323
    NO MINVALUE
 
324
    CACHE 1;
 
325
 
 
326
ALTER SEQUENCE authtoken_id_seq OWNED BY authtoken.id;
5111
327
 
5112
328
CREATE TABLE binarypackagename (
5113
329
    id integer NOT NULL,
5115
331
    CONSTRAINT valid_name CHECK (valid_name(name))
5116
332
);
5117
333
 
5118
 
 
5119
 
COMMENT ON TABLE binarypackagename IS 'BinaryPackageName: A soyuz binary package name.';
5120
 
 
5121
 
 
5122
 
COMMENT ON COLUMN binarypackagename.name IS 'A lowercase name identifying one or more binarypackages';
5123
 
 
5124
 
 
5125
334
CREATE TABLE sourcepackagename (
5126
335
    id integer NOT NULL,
5127
336
    name text NOT NULL,
5128
337
    CONSTRAINT valid_name CHECK (valid_name(name))
5129
338
);
5130
339
 
5131
 
 
5132
 
COMMENT ON TABLE sourcepackagename IS 'SourcePackageName: A soyuz source package name.';
5133
 
 
5134
 
 
5135
 
COMMENT ON COLUMN sourcepackagename.name IS 'A lowercase name identifying one or more sourcepackages';
5136
 
 
5137
 
 
5138
340
CREATE VIEW binaryandsourcepackagenameview AS
5139
341
    SELECT binarypackagename.name FROM binarypackagename UNION SELECT sourcepackagename.name FROM sourcepackagename;
5140
342
 
5141
 
 
5142
343
CREATE TABLE binarypackagebuild (
5143
344
    id integer NOT NULL,
5144
345
    package_build integer NOT NULL,
5146
347
    source_package_release integer NOT NULL
5147
348
);
5148
349
 
5149
 
 
5150
 
COMMENT ON TABLE binarypackagebuild IS 'BinaryPackageBuild: This table links a package build with a distroarchseries and sourcepackagerelease.';
5151
 
 
5152
 
 
5153
 
COMMENT ON COLUMN binarypackagebuild.package_build IS 'Points to the related package build with the base information.';
5154
 
 
5155
 
 
5156
 
COMMENT ON COLUMN binarypackagebuild.distro_arch_series IS 'Points the target DistroArchSeries for this build.';
5157
 
 
5158
 
 
5159
 
COMMENT ON COLUMN binarypackagebuild.source_package_release IS 'SourcePackageRelease which originated this build.';
5160
 
 
5161
 
 
5162
350
CREATE SEQUENCE binarypackagebuild_id_seq
5163
 
    START WITH 1
5164
351
    INCREMENT BY 1
5165
352
    NO MAXVALUE
5166
353
    NO MINVALUE
5167
354
    CACHE 1;
5168
355
 
5169
 
 
5170
356
ALTER SEQUENCE binarypackagebuild_id_seq OWNED BY binarypackagebuild.id;
5171
357
 
5172
 
 
5173
358
CREATE TABLE binarypackagefile (
5174
359
    binarypackagerelease integer NOT NULL,
5175
360
    libraryfile integer NOT NULL,
5177
362
    id integer DEFAULT nextval(('binarypackagefile_id_seq'::text)::regclass) NOT NULL
5178
363
);
5179
364
 
5180
 
 
5181
 
COMMENT ON TABLE binarypackagefile IS 'BinaryPackageFile: A soyuz <-> librarian link table. This table represents the ownership in the librarian of a file which represents a binary package';
5182
 
 
5183
 
 
5184
 
COMMENT ON COLUMN binarypackagefile.binarypackagerelease IS 'The binary package which is represented by the file';
5185
 
 
5186
 
 
5187
 
COMMENT ON COLUMN binarypackagefile.libraryfile IS 'The file in the librarian which represents the package';
5188
 
 
5189
 
 
5190
 
COMMENT ON COLUMN binarypackagefile.filetype IS 'The "type" of the file. E.g. DEB, RPM';
5191
 
 
5192
 
 
5193
365
CREATE SEQUENCE binarypackagefile_id_seq
5194
 
    START WITH 1
5195
366
    INCREMENT BY 1
5196
367
    NO MAXVALUE
5197
368
    NO MINVALUE
5198
369
    CACHE 1;
5199
370
 
5200
 
 
5201
371
ALTER SEQUENCE binarypackagefile_id_seq OWNED BY binarypackagefile.id;
5202
372
 
5203
 
 
5204
373
CREATE TABLE binarypackagepublishinghistory (
5205
374
    id integer NOT NULL,
5206
375
    binarypackagerelease integer NOT NULL,
5219
388
    pocket integer DEFAULT 0 NOT NULL,
5220
389
    archive integer NOT NULL,
5221
390
    removed_by integer,
5222
 
    removal_comment text,
5223
 
    binarypackagename integer
 
391
    removal_comment text
5224
392
);
5225
393
 
5226
 
 
5227
 
COMMENT ON TABLE binarypackagepublishinghistory IS 'PackagePublishingHistory: The history of a BinaryPackagePublishing record. This table represents the lifetime of a publishing record from inception to deletion. Records are never removed from here and in time the publishing table may become a view onto this table. A column being NULL indicates there''s no data for that state transition. E.g. a package which is removed without being superseded won''t have datesuperseded or supersededby filled in.';
5228
 
 
5229
 
 
5230
 
COMMENT ON COLUMN binarypackagepublishinghistory.binarypackagerelease IS 'The binarypackage being published.';
5231
 
 
5232
 
 
5233
 
COMMENT ON COLUMN binarypackagepublishinghistory.distroarchseries IS 'The distroarchseries into which the binarypackage is being published.';
5234
 
 
5235
 
 
5236
 
COMMENT ON COLUMN binarypackagepublishinghistory.status IS 'The current status of the publishing.';
5237
 
 
5238
 
 
5239
 
COMMENT ON COLUMN binarypackagepublishinghistory.component IS 'The component into which the publishing takes place.';
5240
 
 
5241
 
 
5242
 
COMMENT ON COLUMN binarypackagepublishinghistory.section IS 'The section into which the publishing takes place.';
5243
 
 
5244
 
 
5245
 
COMMENT ON COLUMN binarypackagepublishinghistory.priority IS 'The priority at which the publishing takes place.';
5246
 
 
5247
 
 
5248
 
COMMENT ON COLUMN binarypackagepublishinghistory.datecreated IS 'The date/time on which the publishing record was created.';
5249
 
 
5250
 
 
5251
 
COMMENT ON COLUMN binarypackagepublishinghistory.datepublished IS 'The date/time on which the source was actually published into an archive.';
5252
 
 
5253
 
 
5254
 
COMMENT ON COLUMN binarypackagepublishinghistory.datesuperseded IS 'The date/time on which the source was superseded by a new source.';
5255
 
 
5256
 
 
5257
 
COMMENT ON COLUMN binarypackagepublishinghistory.supersededby IS 'The build which superseded this package. This seems odd but it is important because a new build may not actually build a given binarypackage and we need to supersede it appropriately';
5258
 
 
5259
 
 
5260
 
COMMENT ON COLUMN binarypackagepublishinghistory.datemadepending IS 'The date/time on which this publishing record was made to be pending removal from the archive.';
5261
 
 
5262
 
 
5263
 
COMMENT ON COLUMN binarypackagepublishinghistory.scheduleddeletiondate IS 'The date/time at which the package is/was scheduled to be deleted.';
5264
 
 
5265
 
 
5266
 
COMMENT ON COLUMN binarypackagepublishinghistory.dateremoved IS 'The date/time at which the package was actually deleted.';
5267
 
 
5268
 
 
5269
 
COMMENT ON COLUMN binarypackagepublishinghistory.pocket IS 'The pocket into which this record is published. The RELEASE pocket (zero) provides behaviour as normal. Other pockets may append things to the distroseries name such as the UPDATES pocket (-updates) or the SECURITY pocket (-security).';
5270
 
 
5271
 
 
5272
 
COMMENT ON COLUMN binarypackagepublishinghistory.archive IS 'Target archive for this publishing record.';
5273
 
 
5274
 
 
5275
 
COMMENT ON COLUMN binarypackagepublishinghistory.removed_by IS 'Person responsible for the removal.';
5276
 
 
5277
 
 
5278
 
COMMENT ON COLUMN binarypackagepublishinghistory.removal_comment IS 'Reason why the publication was removed.';
5279
 
 
5280
 
 
5281
394
CREATE TABLE binarypackagerelease (
5282
395
    id integer NOT NULL,
5283
396
    binarypackagename integer NOT NULL,
5284
 
    version debversion NOT NULL,
 
397
    version text NOT NULL,
5285
398
    summary text NOT NULL,
5286
399
    description text NOT NULL,
5287
400
    build integer NOT NULL,
5305
418
    enhances text,
5306
419
    breaks text,
5307
420
    debug_package integer,
5308
 
    user_defined_fields text,
5309
 
    homepage text,
5310
 
    CONSTRAINT valid_version CHECK (valid_debian_version((version)::text))
 
421
    CONSTRAINT valid_version CHECK (valid_debian_version(version))
5311
422
);
5312
423
 
5313
 
 
5314
 
COMMENT ON TABLE binarypackagerelease IS 'BinaryPackageRelease: A soyuz binary package representation. This table stores the records for each binary package uploaded into the system. Each sourcepackagerelease may build various binarypackages on various architectures.';
5315
 
 
5316
 
 
5317
 
COMMENT ON COLUMN binarypackagerelease.binarypackagename IS 'A reference to the name of the binary package';
5318
 
 
5319
 
 
5320
 
COMMENT ON COLUMN binarypackagerelease.version IS 'The version of the binary package. E.g. "1.0-2"';
5321
 
 
5322
 
 
5323
 
COMMENT ON COLUMN binarypackagerelease.summary IS 'A summary of the binary package. Commonly used on listings of binary packages';
5324
 
 
5325
 
 
5326
 
COMMENT ON COLUMN binarypackagerelease.description IS 'A longer more detailed description of the binary package';
5327
 
 
5328
 
 
5329
 
COMMENT ON COLUMN binarypackagerelease.build IS 'The build in which this binarypackage was produced';
5330
 
 
5331
 
 
5332
 
COMMENT ON COLUMN binarypackagerelease.binpackageformat IS 'The binarypackage format. E.g. RPM, DEB etc';
5333
 
 
5334
 
 
5335
 
COMMENT ON COLUMN binarypackagerelease.component IS 'The archive component that this binarypackage is in. E.g. main, universe etc';
5336
 
 
5337
 
 
5338
 
COMMENT ON COLUMN binarypackagerelease.section IS 'The archive section that this binarypackage is in. E.g. devel, libdevel, editors';
5339
 
 
5340
 
 
5341
 
COMMENT ON COLUMN binarypackagerelease.priority IS 'The priority that this package has. E.g. Base, Standard, Extra, Optional';
5342
 
 
5343
 
 
5344
 
COMMENT ON COLUMN binarypackagerelease.shlibdeps IS 'The shared library dependencies of this binary package';
5345
 
 
5346
 
 
5347
 
COMMENT ON COLUMN binarypackagerelease.depends IS 'The list of packages this binarypackage depends on';
5348
 
 
5349
 
 
5350
 
COMMENT ON COLUMN binarypackagerelease.recommends IS 'The list of packages this binarypackage recommends. Recommended packages often enhance the behaviour of a package.';
5351
 
 
5352
 
 
5353
 
COMMENT ON COLUMN binarypackagerelease.suggests IS 'The list of packages this binarypackage suggests.';
5354
 
 
5355
 
 
5356
 
COMMENT ON COLUMN binarypackagerelease.conflicts IS 'The list of packages this binarypackage conflicts with.';
5357
 
 
5358
 
 
5359
 
COMMENT ON COLUMN binarypackagerelease.replaces IS 'The list of packages this binarypackage replaces files in. Often this is used to provide an upgrade path between two binarypackages of different names';
5360
 
 
5361
 
 
5362
 
COMMENT ON COLUMN binarypackagerelease.provides IS 'The list of virtual packages (or real packages under some circumstances) which this binarypackage provides.';
5363
 
 
5364
 
 
5365
 
COMMENT ON COLUMN binarypackagerelease.essential IS 'Whether or not this binarypackage is essential to the smooth operation of a base system';
5366
 
 
5367
 
 
5368
 
COMMENT ON COLUMN binarypackagerelease.installedsize IS 'What the installed size of the binarypackage is. This is represented as a number of kilobytes of storage.';
5369
 
 
5370
 
 
5371
 
COMMENT ON COLUMN binarypackagerelease.architecturespecific IS 'This field indicates whether or not a binarypackage is architecture-specific. If it is not specific to any given architecture then it can automatically be included in all the distroarchseries which pertain.';
5372
 
 
5373
 
 
5374
 
COMMENT ON COLUMN binarypackagerelease.pre_depends IS 'The list of packages this binary requires to be installed beforehand in apt/dpkg format, as it is in control file "Pre-Depends:" field.';
5375
 
 
5376
 
 
5377
 
COMMENT ON COLUMN binarypackagerelease.enhances IS 'The list of packages pointed as "enhanced" after the installation of this package, as it is in control file "Enhances:" field.';
5378
 
 
5379
 
 
5380
 
COMMENT ON COLUMN binarypackagerelease.breaks IS 'The list of packages which will be broken by the installtion of this package, as it is in the control file "Breaks:" field.';
5381
 
 
5382
 
 
5383
 
COMMENT ON COLUMN binarypackagerelease.debug_package IS 'The corresponding binary package release containing debug symbols for this binary, if any.';
5384
 
 
5385
 
 
5386
 
COMMENT ON COLUMN binarypackagerelease.user_defined_fields IS 'A JSON struct containing a sequence of key-value pairs with user defined fields in the control file.';
5387
 
 
5388
 
 
5389
 
COMMENT ON COLUMN binarypackagerelease.homepage IS 'Upstream project homepage URL, not checked for validity.';
5390
 
 
5391
 
 
5392
424
CREATE TABLE component (
5393
425
    id integer NOT NULL,
5394
426
    name text NOT NULL,
5396
428
    CONSTRAINT valid_name CHECK (valid_name(name))
5397
429
);
5398
430
 
5399
 
 
5400
 
COMMENT ON TABLE component IS 'Known components in Launchpad';
5401
 
 
5402
 
 
5403
 
COMMENT ON COLUMN component.name IS 'Component name text';
5404
 
 
5405
 
 
5406
 
COMMENT ON COLUMN component.description IS 'Description of this component.';
5407
 
 
5408
 
 
5409
431
CREATE TABLE distroarchseries (
5410
432
    id integer NOT NULL,
5411
433
    distroseries integer NOT NULL,
5415
437
    official boolean NOT NULL,
5416
438
    package_count integer DEFAULT 0 NOT NULL,
5417
439
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
5418
 
    supports_virtualized boolean DEFAULT false NOT NULL,
5419
 
    enabled boolean DEFAULT true NOT NULL,
5420
 
    CONSTRAINT valid_architecturetag CHECK (valid_name(architecturetag))
 
440
    supports_virtualized boolean DEFAULT false NOT NULL
5421
441
);
5422
442
 
5423
 
 
5424
 
COMMENT ON TABLE distroarchseries IS 'DistroArchSeries: A soyuz distribution release for a given architecture. A distroseries runs on various architectures. The distroarchseries groups that architecture-specific stuff.';
5425
 
 
5426
 
 
5427
 
COMMENT ON COLUMN distroarchseries.distroseries IS 'The distribution which this distroarchseries is part of.';
5428
 
 
5429
 
 
5430
 
COMMENT ON COLUMN distroarchseries.processorfamily IS 'A link to the ProcessorFamily table, giving the architecture of this DistroArchSeries.';
5431
 
 
5432
 
 
5433
 
COMMENT ON COLUMN distroarchseries.architecturetag IS 'The name of this architecture in the context of this specific distro release. For example, some distributions might label amd64 as amd64, others might call is x86_64. This information is used, for example, in determining the names of the actual package files... such as the "amd64" part of "apache2_2.0.56-1_amd64.deb"';
5434
 
 
5435
 
 
5436
 
COMMENT ON COLUMN distroarchseries.official IS 'Whether or not this architecture or "port" is an official release. If it is not official then you may not be able to install it or get all the packages for it.';
5437
 
 
5438
 
 
5439
 
COMMENT ON COLUMN distroarchseries.package_count IS 'A cache of the number of binary packages published in this distro arch release. The count only includes packages published in the release pocket.';
5440
 
 
5441
 
 
5442
 
COMMENT ON COLUMN distroarchseries.supports_virtualized IS 'Whether or not
5443
 
virtualized build support should be provided by this specific distroarchseries';
5444
 
 
5445
 
 
5446
 
COMMENT ON COLUMN distroarchseries.enabled IS 'Whether to allow build creation and publishing for this DistroArchSeries.';
5447
 
 
5448
 
 
5449
443
CREATE TABLE distroseries (
5450
444
    id integer NOT NULL,
5451
445
    distribution integer NOT NULL,
5456
450
    releasestatus integer NOT NULL,
5457
451
    datereleased timestamp without time zone,
5458
452
    parent_series integer,
5459
 
    registrant integer NOT NULL,
 
453
    owner integer NOT NULL,
 
454
    lucilleconfig text,
5460
455
    summary text NOT NULL,
5461
456
    displayname text NOT NULL,
5462
457
    datelastlangpack timestamp without time zone,
5473
468
    language_pack_delta integer,
5474
469
    language_pack_proposed integer,
5475
470
    language_pack_full_export_requested boolean DEFAULT false NOT NULL,
5476
 
    backports_not_automatic boolean DEFAULT false NOT NULL,
5477
 
    include_long_descriptions boolean DEFAULT true NOT NULL,
5478
471
    CONSTRAINT valid_language_pack_delta CHECK (((language_pack_base IS NOT NULL) OR (language_pack_delta IS NULL))),
5479
472
    CONSTRAINT valid_name CHECK (valid_name(name)),
5480
473
    CONSTRAINT valid_version CHECK (sane_version(version))
5481
474
);
5482
475
 
5483
 
 
5484
 
COMMENT ON TABLE distroseries IS 'DistroSeries: A soyuz distribution release. A DistroSeries is a given version of a distribution. E.g. "Warty" "Hoary" "Sarge" etc.';
5485
 
 
5486
 
 
5487
 
COMMENT ON COLUMN distroseries.distribution IS 'The distribution which contains this distroseries.';
5488
 
 
5489
 
 
5490
 
COMMENT ON COLUMN distroseries.name IS 'The unique name of the distroseries. This is a short name in lower case and would be used in sources.list configuration and in generated URLs. E.g. "warty" "sarge" "sid"';
5491
 
 
5492
 
 
5493
 
COMMENT ON COLUMN distroseries.title IS 'The display-name title of the distroseries E.g. "Warty Warthog"';
5494
 
 
5495
 
 
5496
 
COMMENT ON COLUMN distroseries.description IS 'The long detailed description of the release. This may describe the focus of the release or other related information.';
5497
 
 
5498
 
 
5499
 
COMMENT ON COLUMN distroseries.version IS 'The version of the release. E.g. warty would be "4.10" and hoary would be "5.4"';
5500
 
 
5501
 
 
5502
 
COMMENT ON COLUMN distroseries.releasestatus IS 'The current release status of this distroseries. E.g. "pre-release freeze" or "released"';
5503
 
 
5504
 
 
5505
 
COMMENT ON COLUMN distroseries.datereleased IS 'The date on which this distroseries was released. (obviously only valid for released distributions)';
5506
 
 
5507
 
 
5508
 
COMMENT ON COLUMN distroseries.parent_series IS 'The parent distroseries on which this distribution is based. This is related to the inheritance stuff.';
5509
 
 
5510
 
 
5511
 
COMMENT ON COLUMN distroseries.registrant IS 'The ultimate owner of this distroseries.';
5512
 
 
5513
 
 
5514
 
COMMENT ON COLUMN distroseries.summary IS 'A brief summary of the distro release. This will be displayed in bold at the top of the distroseries page, above the distroseries description. It should include any high points that are particularly important to draw to the attention of users.';
5515
 
 
5516
 
 
5517
 
COMMENT ON COLUMN distroseries.datelastlangpack IS 'The date we last generated a base language pack for this release. Language update packs for this release will only include translations added after that date.';
5518
 
 
5519
 
 
5520
 
COMMENT ON COLUMN distroseries.messagecount IS 'This is a cached value and may be a few hours out of sync with reality. It should, however, be in sync with the values in DistroSeriesLanguage, and should never be updated separately. The total number of translation messages in this distro release, as per IRosettaStats.';
5521
 
 
5522
 
 
5523
 
COMMENT ON COLUMN distroseries.nominatedarchindep IS 'This is the DistroArchSeries nominated to build architecture independent packages within this DistroRelase, it is mandatory for buildable distroseries, i.e., Auto Build System will avoid to create build jobs for a DistroSeries with no nominatedarchindep, but the database model allow us to do it (for non-buildable DistroSeries). See further info in NominatedArchIndep specification.';
5524
 
 
5525
 
 
5526
 
COMMENT ON COLUMN distroseries.changeslist IS 'The email address (name name) of the changes announcement list for this distroseries. If NULL, no announcement mail will be sent.';
5527
 
 
5528
 
 
5529
 
COMMENT ON COLUMN distroseries.binarycount IS 'A cache of the number of distinct binary package names published in this distro release.';
5530
 
 
5531
 
 
5532
 
COMMENT ON COLUMN distroseries.sourcecount IS 'A cache of the number of distinct source package names published in this distro release.';
5533
 
 
5534
 
 
5535
 
COMMENT ON COLUMN distroseries.driver IS 'This is a person or team who can act as a driver for this specific release - note that the distribution drivers can also set goals for any release.';
5536
 
 
5537
 
 
5538
 
COMMENT ON COLUMN distroseries.hide_all_translations IS 'Whether we should hid
5539
 
e all available translations for this distro release to non admin users.';
5540
 
 
5541
 
 
5542
 
COMMENT ON COLUMN distroseries.defer_translation_imports IS 'Don''t accept PO imports for this release just now.';
5543
 
 
5544
 
 
5545
 
COMMENT ON COLUMN distroseries.language_pack_base IS 'Current full export language pack for this distribution release.';
5546
 
 
5547
 
 
5548
 
COMMENT ON COLUMN distroseries.language_pack_delta IS 'Current language pack update based on language_pack_base information.';
5549
 
 
5550
 
 
5551
 
COMMENT ON COLUMN distroseries.language_pack_proposed IS 'Either a full or update language pack being tested to be used in language_pack_base or language_pack_delta.';
5552
 
 
5553
 
 
5554
 
COMMENT ON COLUMN distroseries.language_pack_full_export_requested IS 'Whether next language pack export should be a full export or an update.';
5555
 
 
5556
 
 
5557
476
CREATE TABLE libraryfilealias (
5558
477
    id integer NOT NULL,
5559
478
    content integer,
5567
486
    CONSTRAINT valid_filename CHECK ((filename !~~ '%/%'::text))
5568
487
);
5569
488
 
5570
 
 
5571
 
COMMENT ON TABLE libraryfilealias IS 'LibraryFileAlias: A librarian file''s alias. The librarian stores, along with the file contents, a record stating the file name and mimetype. This table represents it.';
5572
 
 
5573
 
 
5574
 
COMMENT ON COLUMN libraryfilealias.content IS 'The libraryfilecontent which is the data in this file.';
5575
 
 
5576
 
 
5577
 
COMMENT ON COLUMN libraryfilealias.filename IS 'The name of the file. E.g. "foo_1.0-1_i386.deb"';
5578
 
 
5579
 
 
5580
 
COMMENT ON COLUMN libraryfilealias.mimetype IS 'The mime type of the file. E.g. "application/x-debian-package"';
5581
 
 
5582
 
 
5583
 
COMMENT ON COLUMN libraryfilealias.expires IS 'The expiry date of this file. If NULL, this item may be removed as soon as it is no longer referenced. If set, the item will not be removed until this date. Once the date is passed, the file may be removed from disk even if this item is still being referenced (in which case content.deleted will be true)';
5584
 
 
5585
 
 
5586
 
COMMENT ON COLUMN libraryfilealias.last_accessed IS 'Roughly when this file was last retrieved from the Librarian. Initially set to this item''s creation date.';
5587
 
 
5588
 
 
5589
 
COMMENT ON COLUMN libraryfilealias.date_created IS 'The timestamp when this alias was created.';
5590
 
 
5591
 
 
5592
 
COMMENT ON COLUMN libraryfilealias.restricted IS 'Is this file available only from the restricted librarian?';
5593
 
 
5594
 
 
5595
 
COMMENT ON COLUMN libraryfilealias.hits IS 'The number of times this file has been downloaded.';
5596
 
 
5597
 
 
5598
489
CREATE TABLE sourcepackagerelease (
5599
490
    id integer NOT NULL,
5600
491
    creator integer NOT NULL,
5601
 
    version debversion NOT NULL,
 
492
    version text NOT NULL,
5602
493
    dateuploaded timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
5603
494
    urgency integer NOT NULL,
5604
495
    dscsigningkey integer,
5623
514
    build_conflicts_indep text,
5624
515
    sourcepackage_recipe_build integer,
5625
516
    changelog integer,
5626
 
    user_defined_fields text,
5627
 
    homepage text,
5628
 
    CONSTRAINT valid_version CHECK (valid_debian_version((version)::text))
 
517
    CONSTRAINT valid_version CHECK (valid_debian_version(version))
5629
518
);
5630
519
 
5631
 
 
5632
 
COMMENT ON TABLE sourcepackagerelease IS 'SourcePackageRelease: A source
5633
 
package release. This table represents a specific release of a source
5634
 
package. Source package releases may be published into a distroseries, or
5635
 
even multiple distroseries.';
5636
 
 
5637
 
 
5638
 
COMMENT ON COLUMN sourcepackagerelease.creator IS 'The creator of this
5639
 
sourcepackagerelease. This is the person referred to in the top entry in the
5640
 
package changelog in debian terms. Note that a source package maintainer in
5641
 
Ubuntu might be person A, but a particular release of that source package
5642
 
might in fact have been created by a different person B. The maintainer
5643
 
would be recorded in the Maintainership table, while the creator of THIS
5644
 
release would be recorded in the SourcePackageRelease.creator field.';
5645
 
 
5646
 
 
5647
 
COMMENT ON COLUMN sourcepackagerelease.version IS 'The version string for
5648
 
this source package release. E.g. "1.0-2" or "1.4-5ubuntu9.1". Note that, in
5649
 
ubuntu-style and redhat-style distributions, the version+sourcepackagename
5650
 
is unique, even across distroseries. In other words, you cannot have a
5651
 
foo-1.2-1 package in Hoary that is different from foo-1.2-1 in Warty.';
5652
 
 
5653
 
 
5654
 
COMMENT ON COLUMN sourcepackagerelease.dateuploaded IS 'The date/time that
5655
 
this sourcepackagerelease was first uploaded to the Launchpad.';
5656
 
 
5657
 
 
5658
 
COMMENT ON COLUMN sourcepackagerelease.urgency IS 'The urgency of the
5659
 
upload. This is generally used to prioritise buildd activity but may also be
5660
 
used for "testing" systems or security work in the future. The "urgency" is
5661
 
set by the uploader, in the DSC file.';
5662
 
 
5663
 
 
5664
 
COMMENT ON COLUMN sourcepackagerelease.dscsigningkey IS 'The GPG key used to
5665
 
sign the DSC. This is not necessarily the maintainer''s key, or the
5666
 
creator''s key. For example, it''s possible to produce a package, then ask a
5667
 
sponsor to upload it.';
5668
 
 
5669
 
 
5670
 
COMMENT ON COLUMN sourcepackagerelease.component IS 'The component in which
5671
 
this sourcepackagerelease is intended (by the uploader) to reside. E.g.
5672
 
main, universe, restricted. Note that the distribution managers will often
5673
 
override this data and publish the package in an entirely different
5674
 
component.';
5675
 
 
5676
 
 
5677
 
COMMENT ON COLUMN sourcepackagerelease.changelog_entry IS 'Changelog text section extracted from the changesfile.';
5678
 
 
5679
 
 
5680
 
COMMENT ON COLUMN sourcepackagerelease.builddepends IS 'The build
5681
 
dependencies for this source package release.';
5682
 
 
5683
 
 
5684
 
COMMENT ON COLUMN sourcepackagerelease.builddependsindep IS 'The
5685
 
architecture-independant build dependancies for this source package release.';
5686
 
 
5687
 
 
5688
 
COMMENT ON COLUMN sourcepackagerelease.architecturehintlist IS 'The
5689
 
architectures which this source package release believes it should be built.
5690
 
This is used as a hint to the build management system when deciding what
5691
 
builds are still needed.';
5692
 
 
5693
 
 
5694
 
COMMENT ON COLUMN sourcepackagerelease.dsc IS 'The "Debian Source Control"
5695
 
file for the sourcepackagerelease, from its upload into Ubuntu for the
5696
 
first time.';
5697
 
 
5698
 
 
5699
 
COMMENT ON COLUMN sourcepackagerelease.section IS 'This integer field references the Section which the source package claims to be in';
5700
 
 
5701
 
 
5702
 
COMMENT ON COLUMN sourcepackagerelease.maintainer IS 'Reference to the person noted as source package maintainer in the DSC.';
5703
 
 
5704
 
 
5705
 
COMMENT ON COLUMN sourcepackagerelease.sourcepackagename IS 'Reference to a SourcePackageName.';
5706
 
 
5707
 
 
5708
 
COMMENT ON COLUMN sourcepackagerelease.upload_distroseries IS 'The
5709
 
distroseries into which this source package release was uploaded into
5710
 
Launchpad / Ubuntu for the first time. In general, this will be the
5711
 
development Ubuntu release into which this package was uploaded. For a
5712
 
package which was unchanged between warty and hoary, this would show Warty.
5713
 
For a package which was uploaded into Hoary, this would show Hoary.';
5714
 
 
5715
 
 
5716
 
COMMENT ON COLUMN sourcepackagerelease.format IS 'The format of this
5717
 
sourcepackage release, e.g. DPKG, RPM, EBUILD, etc. This is an enum, and the
5718
 
values are listed in dbschema.SourcePackageFormat';
5719
 
 
5720
 
 
5721
 
COMMENT ON COLUMN sourcepackagerelease.dsc_maintainer_rfc822 IS 'The original maintainer line in RFC-822 format, to be used in archive indexes.';
5722
 
 
5723
 
 
5724
 
COMMENT ON COLUMN sourcepackagerelease.dsc_standards_version IS 'DSC standards version (such as "3.6.2", "3.5.9", etc) used to build this source.';
5725
 
 
5726
 
 
5727
 
COMMENT ON COLUMN sourcepackagerelease.dsc_format IS 'DSC format version (such as "1.0").';
5728
 
 
5729
 
 
5730
 
COMMENT ON COLUMN sourcepackagerelease.dsc_binaries IS 'DSC binary line, claimed binary-names produce by this source.';
5731
 
 
5732
 
 
5733
 
COMMENT ON COLUMN sourcepackagerelease.upload_archive IS 'The archive into which this sourcepackagerelese was originally uploaded.';
5734
 
 
5735
 
 
5736
 
COMMENT ON COLUMN sourcepackagerelease.copyright IS 'The copyright associated with this sourcepackage. Often in the case of debian packages and will be found after the installation in /usr/share/doc/<binarypackagename>/copyright';
5737
 
 
5738
 
 
5739
 
COMMENT ON COLUMN sourcepackagerelease.build_conflicts IS 'The list of packages that will conflict with this source while building, as mentioned in the control file "Build-Conflicts:" field.';
5740
 
 
5741
 
 
5742
 
COMMENT ON COLUMN sourcepackagerelease.build_conflicts_indep IS 'The list of packages that will conflict with this source while building in architecture independent environment, as mentioned in the control file "Build-Conflicts-Indep:" field.';
5743
 
 
5744
 
 
5745
 
COMMENT ON COLUMN sourcepackagerelease.changelog IS 'The LibraryFileAlias ID of changelog associated with this sourcepackage.  Often in the case of debian packages and will be found after the installation in /usr/share/doc/<binarypackagename>/changelog.Debian.gz';
5746
 
 
5747
 
 
5748
 
COMMENT ON COLUMN sourcepackagerelease.user_defined_fields IS 'A JSON struct containing a sequence of key-value pairs with user defined fields in the control file.';
5749
 
 
5750
 
 
5751
 
COMMENT ON COLUMN sourcepackagerelease.homepage IS 'Upstream project homepage URL, not checked for validity.';
5752
 
 
5753
 
 
5754
520
CREATE VIEW binarypackagefilepublishing AS
5755
521
    SELECT (((libraryfilealias.id)::text || '.'::text) || (securebinarypackagepublishinghistory.id)::text) AS id, distroseries.distribution, securebinarypackagepublishinghistory.id AS binarypackagepublishing, component.name AS componentname, libraryfilealias.filename AS libraryfilealiasfilename, sourcepackagename.name AS sourcepackagename, binarypackagefile.libraryfile AS libraryfilealias, distroseries.name AS distroseriesname, distroarchseries.architecturetag, securebinarypackagepublishinghistory.status AS publishingstatus, securebinarypackagepublishinghistory.pocket, securebinarypackagepublishinghistory.archive FROM (((((((((binarypackagepublishinghistory securebinarypackagepublishinghistory JOIN binarypackagerelease ON ((securebinarypackagepublishinghistory.binarypackagerelease = binarypackagerelease.id))) JOIN binarypackagebuild ON ((binarypackagerelease.build = binarypackagebuild.id))) JOIN sourcepackagerelease ON ((binarypackagebuild.source_package_release = sourcepackagerelease.id))) JOIN sourcepackagename ON ((sourcepackagerelease.sourcepackagename = sourcepackagename.id))) JOIN binarypackagefile ON ((binarypackagefile.binarypackagerelease = binarypackagerelease.id))) JOIN libraryfilealias ON ((binarypackagefile.libraryfile = libraryfilealias.id))) JOIN distroarchseries ON ((securebinarypackagepublishinghistory.distroarchseries = distroarchseries.id))) JOIN distroseries ON ((distroarchseries.distroseries = distroseries.id))) JOIN component ON ((securebinarypackagepublishinghistory.component = component.id))) WHERE (securebinarypackagepublishinghistory.dateremoved IS NULL);
5756
522
 
5757
 
 
5758
 
COMMENT ON VIEW binarypackagefilepublishing IS 'This view is used mostly by Lucille while performing publishing and unpublishing operations. It lists all the files associated with a binarypackage and collates all the textual representations needed for publishing components etc to allow rapid queries from SQLObject.';
5759
 
 
5760
 
 
5761
523
CREATE SEQUENCE binarypackagename_id_seq
5762
 
    START WITH 1
5763
524
    INCREMENT BY 1
5764
525
    NO MAXVALUE
5765
526
    NO MINVALUE
5766
527
    CACHE 1;
5767
528
 
5768
 
 
5769
529
ALTER SEQUENCE binarypackagename_id_seq OWNED BY binarypackagename.id;
5770
530
 
5771
 
 
5772
 
CREATE TABLE binarypackagepath (
5773
 
    id integer NOT NULL,
5774
 
    path bytea NOT NULL
5775
 
);
5776
 
 
5777
 
 
5778
 
CREATE SEQUENCE binarypackagepath_id_seq
5779
 
    START WITH 1
5780
 
    INCREMENT BY 1
5781
 
    NO MAXVALUE
5782
 
    NO MINVALUE
5783
 
    CACHE 1;
5784
 
 
5785
 
 
5786
 
ALTER SEQUENCE binarypackagepath_id_seq OWNED BY binarypackagepath.id;
5787
 
 
5788
 
 
5789
531
CREATE SEQUENCE binarypackagepublishinghistory_id_seq
5790
 
    START WITH 1
5791
532
    INCREMENT BY 1
5792
533
    NO MAXVALUE
5793
534
    NO MINVALUE
5794
535
    CACHE 1;
5795
536
 
5796
 
 
5797
537
ALTER SEQUENCE binarypackagepublishinghistory_id_seq OWNED BY binarypackagepublishinghistory.id;
5798
538
 
5799
 
 
5800
539
CREATE SEQUENCE binarypackagerelease_id_seq
5801
 
    START WITH 1
5802
540
    INCREMENT BY 1
5803
541
    NO MAXVALUE
5804
542
    NO MINVALUE
5805
543
    CACHE 1;
5806
544
 
5807
 
 
5808
545
ALTER SEQUENCE binarypackagerelease_id_seq OWNED BY binarypackagerelease.id;
5809
546
 
5810
 
 
5811
 
CREATE TABLE binarypackagereleasecontents (
5812
 
    binarypackagerelease integer NOT NULL,
5813
 
    binarypackagepath integer NOT NULL
5814
 
);
5815
 
 
5816
 
 
5817
547
CREATE TABLE binarypackagereleasedownloadcount (
5818
548
    id integer NOT NULL,
5819
549
    archive integer NOT NULL,
5823
553
    count integer NOT NULL
5824
554
);
5825
555
 
5826
 
 
5827
556
CREATE SEQUENCE binarypackagereleasedownloadcount_id_seq
5828
557
    START WITH 1
5829
558
    INCREMENT BY 1
5831
560
    NO MINVALUE
5832
561
    CACHE 1;
5833
562
 
5834
 
 
5835
563
ALTER SEQUENCE binarypackagereleasedownloadcount_id_seq OWNED BY binarypackagereleasedownloadcount.id;
5836
564
 
 
565
CREATE TABLE bounty (
 
566
    id integer NOT NULL,
 
567
    name text NOT NULL,
 
568
    title text NOT NULL,
 
569
    summary text NOT NULL,
 
570
    description text NOT NULL,
 
571
    usdvalue numeric(10,2) NOT NULL,
 
572
    difficulty integer NOT NULL,
 
573
    reviewer integer NOT NULL,
 
574
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone),
 
575
    owner integer NOT NULL,
 
576
    deadline timestamp without time zone,
 
577
    claimant integer,
 
578
    dateclaimed timestamp without time zone,
 
579
    bountystatus integer DEFAULT 1 NOT NULL
 
580
);
 
581
 
 
582
CREATE SEQUENCE bounty_id_seq
 
583
    INCREMENT BY 1
 
584
    NO MAXVALUE
 
585
    NO MINVALUE
 
586
    CACHE 1;
 
587
 
 
588
ALTER SEQUENCE bounty_id_seq OWNED BY bounty.id;
 
589
 
 
590
CREATE TABLE bountymessage (
 
591
    id integer NOT NULL,
 
592
    bounty integer NOT NULL,
 
593
    message integer NOT NULL
 
594
);
 
595
 
 
596
CREATE SEQUENCE bountymessage_id_seq
 
597
    INCREMENT BY 1
 
598
    NO MAXVALUE
 
599
    NO MINVALUE
 
600
    CACHE 1;
 
601
 
 
602
ALTER SEQUENCE bountymessage_id_seq OWNED BY bountymessage.id;
 
603
 
 
604
CREATE TABLE bountysubscription (
 
605
    id integer NOT NULL,
 
606
    bounty integer NOT NULL,
 
607
    person integer NOT NULL
 
608
);
 
609
 
 
610
CREATE SEQUENCE bountysubscription_id_seq
 
611
    INCREMENT BY 1
 
612
    NO MAXVALUE
 
613
    NO MINVALUE
 
614
    CACHE 1;
 
615
 
 
616
ALTER SEQUENCE bountysubscription_id_seq OWNED BY bountysubscription.id;
5837
617
 
5838
618
CREATE TABLE branch (
5839
619
    id integer NOT NULL,
5860
640
    private boolean DEFAULT false NOT NULL,
5861
641
    branch_type integer NOT NULL,
5862
642
    reviewer integer,
 
643
    merge_robot integer,
 
644
    merge_control_status integer DEFAULT 1 NOT NULL,
5863
645
    date_last_modified timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
5864
646
    registrant integer NOT NULL,
5865
647
    branch_format integer,
5872
654
    target_suffix text,
5873
655
    unique_name text,
5874
656
    size_on_disk bigint,
5875
 
    merge_queue integer,
5876
 
    merge_queue_config text,
5877
 
    transitively_private boolean DEFAULT true NOT NULL,
5878
 
    access_policy integer,
 
657
    CONSTRAINT branch_merge_control CHECK (((merge_robot IS NULL) OR (merge_control_status = ANY (ARRAY[3, 4])))),
5879
658
    CONSTRAINT branch_type_url_consistent CHECK (((((branch_type = 2) AND (url IS NOT NULL)) OR ((branch_type = ANY (ARRAY[1, 3])) AND (url IS NULL))) OR (branch_type = 4))),
5880
659
    CONSTRAINT branch_url_no_trailing_slash CHECK ((url !~~ '%/'::text)),
5881
660
    CONSTRAINT branch_url_not_supermirror CHECK ((url !~~ 'http://bazaar.launchpad.net/%'::text)),
5885
664
    CONSTRAINT valid_url CHECK (valid_absolute_url(url))
5886
665
);
5887
666
 
5888
 
 
5889
 
COMMENT ON TABLE branch IS 'Bzr branch';
5890
 
 
5891
 
 
5892
 
COMMENT ON COLUMN branch.summary IS 'A single paragraph description of the branch';
5893
 
 
5894
 
 
5895
 
COMMENT ON COLUMN branch.home_page IS 'This column is deprecated and to be removed soon.';
5896
 
 
5897
 
 
5898
 
COMMENT ON COLUMN branch.whiteboard IS 'Notes on the current status of the branch';
5899
 
 
5900
 
 
5901
 
COMMENT ON COLUMN branch.lifecycle_status IS 'Authors assesment of the branchs maturity';
5902
 
 
5903
 
 
5904
 
COMMENT ON COLUMN branch.last_mirrored IS 'The time when the branch was last mirrored.';
5905
 
 
5906
 
 
5907
 
COMMENT ON COLUMN branch.mirror_status_message IS 'The last message we got when mirroring this branch.';
5908
 
 
5909
 
 
5910
 
COMMENT ON COLUMN branch.last_scanned IS 'The time when the branch was last scanned.';
5911
 
 
5912
 
 
5913
 
COMMENT ON COLUMN branch.last_scanned_id IS 'The revision ID of the branch when it was last scanned.';
5914
 
 
5915
 
 
5916
 
COMMENT ON COLUMN branch.last_mirrored_id IS 'The revision ID of the branch when it was last mirrored.';
5917
 
 
5918
 
 
5919
 
COMMENT ON COLUMN branch.revision_count IS 'The number of revisions in the associated bazaar branch revision_history.';
5920
 
 
5921
 
 
5922
 
COMMENT ON COLUMN branch.next_mirror_time IS 'The time when we will next mirror this branch (NULL means never). This will be set automatically by pushing to a hosted branch, which, once mirrored, will be set back to NULL.';
5923
 
 
5924
 
 
5925
 
COMMENT ON COLUMN branch.private IS 'If the branch is private, then only the owner and subscribers of the branch can see it.';
5926
 
 
5927
 
 
5928
 
COMMENT ON COLUMN branch.branch_type IS 'Branches are currently one of HOSTED (1), MIRRORED (2), or IMPORTED (3).';
5929
 
 
5930
 
 
5931
 
COMMENT ON COLUMN branch.reviewer IS 'The reviewer (person or) team are able to transition merge proposals targetted at the branch throught the CODE_APPROVED state.';
5932
 
 
5933
 
 
5934
 
COMMENT ON COLUMN branch.date_last_modified IS 'A branch is modified any time a user updates something using a view, a new revision for the branch is scanned, or the branch is linked to a bug, blueprint or merge proposal.';
5935
 
 
5936
 
 
5937
 
COMMENT ON COLUMN branch.registrant IS 'The user that registered the branch.';
5938
 
 
5939
 
 
5940
 
COMMENT ON COLUMN branch.branch_format IS 'The bzr branch format';
5941
 
 
5942
 
 
5943
 
COMMENT ON COLUMN branch.repository_format IS 'The bzr repository format';
5944
 
 
5945
 
 
5946
 
COMMENT ON COLUMN branch.metadir_format IS 'The bzr metadir format';
5947
 
 
5948
 
 
5949
 
COMMENT ON COLUMN branch.stacked_on IS 'The Launchpad branch that this branch is stacked on (if any).';
5950
 
 
5951
 
 
5952
 
COMMENT ON COLUMN branch.distroseries IS 'The distribution series that the branch belongs to.';
5953
 
 
5954
 
 
5955
 
COMMENT ON COLUMN branch.sourcepackagename IS 'The source package this is a branch of.';
5956
 
 
5957
 
 
5958
 
COMMENT ON COLUMN branch.size_on_disk IS 'The size in bytes of this branch in the mirrored area.';
5959
 
 
5960
 
 
5961
 
COMMENT ON COLUMN branch.merge_queue IS 'A reference to the BranchMergeQueue record that manages merges.';
5962
 
 
5963
 
 
5964
 
COMMENT ON COLUMN branch.merge_queue_config IS 'A JSON string of configuration values that can be read by a merge queue script.';
5965
 
 
5966
 
 
5967
667
CREATE SEQUENCE branch_id_seq
5968
 
    START WITH 1
5969
668
    INCREMENT BY 1
5970
669
    NO MAXVALUE
5971
670
    NO MINVALUE
5972
671
    CACHE 1;
5973
672
 
5974
 
 
5975
673
ALTER SEQUENCE branch_id_seq OWNED BY branch.id;
5976
674
 
5977
 
 
5978
675
CREATE TABLE branchjob (
5979
676
    id integer NOT NULL,
5980
677
    job integer NOT NULL,
5983
680
    json_data text
5984
681
);
5985
682
 
5986
 
 
5987
 
COMMENT ON TABLE branchjob IS 'Contains references to jobs that are executed for a branch.';
5988
 
 
5989
 
 
5990
 
COMMENT ON COLUMN branchjob.job IS 'A reference to a row in the Job table that has all the common job details.';
5991
 
 
5992
 
 
5993
 
COMMENT ON COLUMN branchjob.branch IS 'The branch that this job is for.';
5994
 
 
5995
 
 
5996
 
COMMENT ON COLUMN branchjob.job_type IS 'The type of job, like new revisions, or attribute change.';
5997
 
 
5998
 
 
5999
 
COMMENT ON COLUMN branchjob.json_data IS 'Data that is specific to the type of job, whether this be the revisions to send email out for, or the changes that were recorded for the branch.';
6000
 
 
6001
 
 
6002
683
CREATE SEQUENCE branchjob_id_seq
6003
 
    START WITH 1
6004
684
    INCREMENT BY 1
6005
685
    NO MAXVALUE
6006
686
    NO MINVALUE
6007
687
    CACHE 1;
6008
688
 
6009
 
 
6010
689
ALTER SEQUENCE branchjob_id_seq OWNED BY branchjob.id;
6011
690
 
6012
 
 
6013
691
CREATE TABLE branchmergeproposal (
6014
692
    id integer NOT NULL,
6015
693
    registrant integer NOT NULL,
6038
716
    merge_log_file integer,
6039
717
    superseded_by integer,
6040
718
    root_message_id text,
 
719
    review_diff integer,
6041
720
    merge_diff integer,
6042
721
    description text,
6043
722
    CONSTRAINT different_branches CHECK ((((source_branch <> target_branch) AND (dependent_branch <> source_branch)) AND (dependent_branch <> target_branch))),
6044
723
    CONSTRAINT positive_revno CHECK (((merged_revno IS NULL) OR (merged_revno > 0)))
6045
724
);
6046
725
 
6047
 
 
6048
 
COMMENT ON TABLE branchmergeproposal IS 'Branch merge proposals record the intent of landing (or merging) one branch on another.';
6049
 
 
6050
 
 
6051
 
COMMENT ON COLUMN branchmergeproposal.registrant IS 'The person that created the merge proposal.';
6052
 
 
6053
 
 
6054
 
COMMENT ON COLUMN branchmergeproposal.source_branch IS 'The branch where the work is being written.  This branch contains the changes that the registrant wants to land.';
6055
 
 
6056
 
 
6057
 
COMMENT ON COLUMN branchmergeproposal.target_branch IS 'The branch where the user wants the changes from the source branch to be merged into.';
6058
 
 
6059
 
 
6060
 
COMMENT ON COLUMN branchmergeproposal.dependent_branch IS 'If the source branch was not branched off the target branch, then this is considered the dependent_branch.';
6061
 
 
6062
 
 
6063
 
COMMENT ON COLUMN branchmergeproposal.whiteboard IS 'Used to write other information about the branch, like test URLs.';
6064
 
 
6065
 
 
6066
 
COMMENT ON COLUMN branchmergeproposal.date_merged IS 'This is the date that merge occurred.';
6067
 
 
6068
 
 
6069
 
COMMENT ON COLUMN branchmergeproposal.merged_revno IS 'This is the revision number of the revision on the target branch that includes the merge from the source branch.';
6070
 
 
6071
 
 
6072
 
COMMENT ON COLUMN branchmergeproposal.merge_reporter IS 'This is the user that marked the proposal as merged.';
6073
 
 
6074
 
 
6075
 
COMMENT ON COLUMN branchmergeproposal.date_created IS 'When the registrant created the merge proposal.';
6076
 
 
6077
 
 
6078
 
COMMENT ON COLUMN branchmergeproposal.commit_message IS 'This is the commit message that is to be used when the branch is landed by a robot.';
6079
 
 
6080
 
 
6081
 
COMMENT ON COLUMN branchmergeproposal.queue_position IS 'The position on the merge proposal in the overall landing queue.  If the branch has a merge_robot set and the merge robot controls multiple branches then the queue position is unique over all the queued merge proposals for the landing robot.';
6082
 
 
6083
 
 
6084
 
COMMENT ON COLUMN branchmergeproposal.queue_status IS 'This is the current state of the merge proposal.';
6085
 
 
6086
 
 
6087
 
COMMENT ON COLUMN branchmergeproposal.date_review_requested IS 'The date that the merge proposal enters the REVIEW_REQUESTED state. This is stored so that we can determine how long a branch has been waiting for code approval.';
6088
 
 
6089
 
 
6090
 
COMMENT ON COLUMN branchmergeproposal.reviewer IS 'The individual who said that the code in this branch is OK to land.';
6091
 
 
6092
 
 
6093
 
COMMENT ON COLUMN branchmergeproposal.date_reviewed IS 'When the reviewer said the code is OK to land.';
6094
 
 
6095
 
 
6096
 
COMMENT ON COLUMN branchmergeproposal.reviewed_revision_id IS 'The Bazaar revision ID that was approved to land.';
6097
 
 
6098
 
 
6099
 
COMMENT ON COLUMN branchmergeproposal.queuer IS 'The individual who submitted the branch to the merge queue. This is usually the merge proposal registrant.';
6100
 
 
6101
 
 
6102
 
COMMENT ON COLUMN branchmergeproposal.date_queued IS 'When the queuer submitted the branch to the merge queue.';
6103
 
 
6104
 
 
6105
 
COMMENT ON COLUMN branchmergeproposal.queued_revision_id IS 'The Bazaar revision ID that is queued to land.';
6106
 
 
6107
 
 
6108
 
COMMENT ON COLUMN branchmergeproposal.merger IS 'The merger is the person who merged the branch.';
6109
 
 
6110
 
 
6111
 
COMMENT ON COLUMN branchmergeproposal.merged_revision_id IS 'The Bazaar revision ID that was actually merged.  If the owner of the source branch is a trusted person, this may be different than the revision_id that was actually queued or reviewed.';
6112
 
 
6113
 
 
6114
 
COMMENT ON COLUMN branchmergeproposal.date_merge_started IS 'If the merge is performed by a bot the time the merge was started is recorded otherwise it is NULL.';
6115
 
 
6116
 
 
6117
 
COMMENT ON COLUMN branchmergeproposal.date_merge_finished IS 'If the merge is performed by a bot the time the merge was finished is recorded otherwise it is NULL.';
6118
 
 
6119
 
 
6120
 
COMMENT ON COLUMN branchmergeproposal.merge_log_file IS 'If the merge is performed by a bot the log file is accessible from the librarian.';
6121
 
 
6122
 
 
6123
 
COMMENT ON COLUMN branchmergeproposal.superseded_by IS 'The proposal to merge has been superceded by this one.';
6124
 
 
6125
 
 
6126
 
COMMENT ON COLUMN branchmergeproposal.root_message_id IS 'The root message of this BranchMergeProposal''s mail thread.';
6127
 
 
6128
 
 
6129
 
COMMENT ON COLUMN branchmergeproposal.merge_diff IS 'The diff showing the predicted result of a merge.';
6130
 
 
6131
 
 
6132
726
CREATE SEQUENCE branchmergeproposal_id_seq
6133
 
    START WITH 1
6134
727
    INCREMENT BY 1
6135
728
    NO MAXVALUE
6136
729
    NO MINVALUE
6137
730
    CACHE 1;
6138
731
 
6139
 
 
6140
732
ALTER SEQUENCE branchmergeproposal_id_seq OWNED BY branchmergeproposal.id;
6141
733
 
6142
 
 
6143
734
CREATE TABLE branchmergeproposaljob (
6144
735
    id integer NOT NULL,
6145
736
    job integer NOT NULL,
6148
739
    json_data text
6149
740
);
6150
741
 
6151
 
 
6152
 
COMMENT ON TABLE branchmergeproposaljob IS 'Contains references to jobs that are executed for a branch merge proposal.';
6153
 
 
6154
 
 
6155
 
COMMENT ON COLUMN branchmergeproposaljob.job IS 'A reference to a row in the Job table that has all the common job details.';
6156
 
 
6157
 
 
6158
 
COMMENT ON COLUMN branchmergeproposaljob.branch_merge_proposal IS 'The branch merge proposal that this job is for.';
6159
 
 
6160
 
 
6161
 
COMMENT ON COLUMN branchmergeproposaljob.job_type IS 'The type of job, like new proposal, review comment, or new review requested.';
6162
 
 
6163
 
 
6164
 
COMMENT ON COLUMN branchmergeproposaljob.json_data IS 'Data that is specific to the type of job, normally references to code review messages and or votes.';
6165
 
 
6166
 
 
6167
742
CREATE SEQUENCE branchmergeproposaljob_id_seq
6168
 
    START WITH 1
6169
743
    INCREMENT BY 1
6170
744
    NO MAXVALUE
6171
745
    NO MINVALUE
6172
746
    CACHE 1;
6173
747
 
6174
 
 
6175
748
ALTER SEQUENCE branchmergeproposaljob_id_seq OWNED BY branchmergeproposaljob.id;
6176
749
 
6177
 
 
6178
 
CREATE TABLE branchmergequeue (
 
750
CREATE TABLE branchmergerobot (
6179
751
    id integer NOT NULL,
6180
752
    registrant integer NOT NULL,
6181
753
    owner integer NOT NULL,
6182
754
    name text NOT NULL,
6183
 
    description text,
6184
 
    configuration text,
6185
 
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
6186
 
    CONSTRAINT valid_name CHECK (valid_name(name))
 
755
    whiteboard text,
 
756
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
6187
757
);
6188
758
 
6189
 
 
6190
 
COMMENT ON TABLE branchmergequeue IS 'Queue for managing the merge workflow for branches.';
6191
 
 
6192
 
 
6193
 
COMMENT ON COLUMN branchmergequeue.id IS 'The id of the merge queue.';
6194
 
 
6195
 
 
6196
 
COMMENT ON COLUMN branchmergequeue.registrant IS 'A reference to the person who created the merge queue.';
6197
 
 
6198
 
 
6199
 
COMMENT ON COLUMN branchmergequeue.owner IS 'A reference to the person who owns the merge queue.';
6200
 
 
6201
 
 
6202
 
COMMENT ON COLUMN branchmergequeue.name IS 'The name of the queue.';
6203
 
 
6204
 
 
6205
 
COMMENT ON COLUMN branchmergequeue.description IS 'A description of the queue.';
6206
 
 
6207
 
 
6208
 
COMMENT ON COLUMN branchmergequeue.configuration IS 'A JSON string of configuration data to be read by the merging script.';
6209
 
 
6210
 
 
6211
 
COMMENT ON COLUMN branchmergequeue.date_created IS 'The date the queue was created.';
6212
 
 
6213
 
 
6214
 
CREATE SEQUENCE branchmergequeue_id_seq
6215
 
    START WITH 1
 
759
CREATE SEQUENCE branchmergerobot_id_seq
6216
760
    INCREMENT BY 1
6217
761
    NO MAXVALUE
6218
762
    NO MINVALUE
6219
763
    CACHE 1;
6220
764
 
6221
 
 
6222
 
ALTER SEQUENCE branchmergequeue_id_seq OWNED BY branchmergequeue.id;
6223
 
 
 
765
ALTER SEQUENCE branchmergerobot_id_seq OWNED BY branchmergerobot.id;
6224
766
 
6225
767
CREATE TABLE branchrevision (
 
768
    id integer NOT NULL,
6226
769
    sequence integer,
6227
770
    branch integer NOT NULL,
6228
771
    revision integer NOT NULL
6229
 
)
6230
 
WITH (fillfactor=100);
 
772
);
6231
773
ALTER TABLE ONLY branchrevision ALTER COLUMN branch SET STATISTICS 500;
6232
774
ALTER TABLE ONLY branchrevision ALTER COLUMN revision SET STATISTICS 500;
6233
775
 
 
776
CREATE SEQUENCE branchrevision_id_seq
 
777
    INCREMENT BY 1
 
778
    NO MAXVALUE
 
779
    NO MINVALUE
 
780
    CACHE 1;
 
781
 
 
782
ALTER SEQUENCE branchrevision_id_seq OWNED BY branchrevision.id;
6234
783
 
6235
784
CREATE TABLE branchsubscription (
6236
785
    id integer NOT NULL,
6243
792
    subscribed_by integer NOT NULL
6244
793
);
6245
794
 
6246
 
 
6247
 
COMMENT ON TABLE branchsubscription IS 'An association between a person or team and a bazaar branch.';
6248
 
 
6249
 
 
6250
 
COMMENT ON COLUMN branchsubscription.person IS 'The person or team associated with the branch.';
6251
 
 
6252
 
 
6253
 
COMMENT ON COLUMN branchsubscription.branch IS 'The branch associated with the person or team.';
6254
 
 
6255
 
 
6256
 
COMMENT ON COLUMN branchsubscription.notification_level IS 'The level of email the person wants to receive from branch updates.';
6257
 
 
6258
 
 
6259
 
COMMENT ON COLUMN branchsubscription.max_diff_lines IS 'If the generated diff for a revision is larger than this number, then the diff is not sent in the notification email.';
6260
 
 
6261
 
 
6262
 
COMMENT ON COLUMN branchsubscription.review_level IS 'The level of email the person wants to receive from review activity';
6263
 
 
6264
 
 
6265
795
CREATE SEQUENCE branchsubscription_id_seq
6266
 
    START WITH 1
6267
796
    INCREMENT BY 1
6268
797
    NO MAXVALUE
6269
798
    NO MINVALUE
6270
799
    CACHE 1;
6271
800
 
6272
 
 
6273
801
ALTER SEQUENCE branchsubscription_id_seq OWNED BY branchsubscription.id;
6274
802
 
6275
 
 
6276
803
CREATE TABLE branchvisibilitypolicy (
6277
804
    id integer NOT NULL,
6278
805
    project integer,
6282
809
    CONSTRAINT only_one_target CHECK (((project IS NULL) <> (product IS NULL)))
6283
810
);
6284
811
 
6285
 
 
6286
 
COMMENT ON TABLE branchvisibilitypolicy IS 'Defines the policy for the initial visibility of branches.';
6287
 
 
6288
 
 
6289
 
COMMENT ON COLUMN branchvisibilitypolicy.project IS 'Even though projects don''t directly have branches themselves, if a product of the project does not specify its own branch visibility policies, those of the project are used.';
6290
 
 
6291
 
 
6292
 
COMMENT ON COLUMN branchvisibilitypolicy.product IS 'The product that the visibility policies apply to.';
6293
 
 
6294
 
 
6295
 
COMMENT ON COLUMN branchvisibilitypolicy.team IS 'Refers to the team that the policy applies to.  NULL is used to indicate ALL people, as there is no team defined for *everybody*.';
6296
 
 
6297
 
 
6298
 
COMMENT ON COLUMN branchvisibilitypolicy.policy IS 'An enumerated type, one of PUBLIC or PRIVATE.  PUBLIC is the default value.';
6299
 
 
6300
 
 
6301
812
CREATE SEQUENCE branchvisibilitypolicy_id_seq
6302
 
    START WITH 1
6303
813
    INCREMENT BY 1
6304
814
    NO MAXVALUE
6305
815
    NO MINVALUE
6306
816
    CACHE 1;
6307
817
 
6308
 
 
6309
818
ALTER SEQUENCE branchvisibilitypolicy_id_seq OWNED BY branchvisibilitypolicy.id;
6310
819
 
 
820
CREATE TABLE person (
 
821
    id integer NOT NULL,
 
822
    displayname text NOT NULL,
 
823
    teamowner integer,
 
824
    teamdescription text,
 
825
    name text NOT NULL,
 
826
    language integer,
 
827
    fti ts2.tsvector,
 
828
    defaultmembershipperiod integer,
 
829
    defaultrenewalperiod integer,
 
830
    subscriptionpolicy integer DEFAULT 1 NOT NULL,
 
831
    merged integer,
 
832
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
 
833
    homepage_content text,
 
834
    icon integer,
 
835
    mugshot integer,
 
836
    hide_email_addresses boolean DEFAULT false NOT NULL,
 
837
    creation_rationale integer,
 
838
    creation_comment text,
 
839
    registrant integer,
 
840
    logo integer,
 
841
    renewal_policy integer DEFAULT 10 NOT NULL,
 
842
    personal_standing integer DEFAULT 0 NOT NULL,
 
843
    personal_standing_reason text,
 
844
    mail_resumption_date date,
 
845
    mailing_list_auto_subscribe_policy integer DEFAULT 1 NOT NULL,
 
846
    mailing_list_receive_duplicates boolean DEFAULT true NOT NULL,
 
847
    visibility integer DEFAULT 1 NOT NULL,
 
848
    verbose_bugnotifications boolean DEFAULT false NOT NULL,
 
849
    account integer,
 
850
    CONSTRAINT creation_rationale_not_null_for_people CHECK (((creation_rationale IS NULL) = (teamowner IS NOT NULL))),
 
851
    CONSTRAINT no_loops CHECK ((id <> teamowner)),
 
852
    CONSTRAINT non_empty_displayname CHECK ((btrim(displayname) <> ''::text)),
 
853
    CONSTRAINT people_have_no_emblems CHECK (((icon IS NULL) OR (teamowner IS NOT NULL))),
 
854
    CONSTRAINT sane_defaultrenewalperiod CHECK (CASE WHEN (teamowner IS NULL) THEN (defaultrenewalperiod IS NULL) WHEN (renewal_policy = ANY (ARRAY[20, 30])) THEN ((defaultrenewalperiod IS NOT NULL) AND (defaultrenewalperiod > 0)) ELSE ((defaultrenewalperiod IS NULL) OR (defaultrenewalperiod > 0)) END),
 
855
    CONSTRAINT teams_have_no_account CHECK (((account IS NULL) OR (teamowner IS NULL))),
 
856
    CONSTRAINT valid_name CHECK (valid_name(name))
 
857
);
 
858
 
 
859
CREATE TABLE product (
 
860
    id integer NOT NULL,
 
861
    project integer,
 
862
    owner integer NOT NULL,
 
863
    name text NOT NULL,
 
864
    displayname text NOT NULL,
 
865
    title text NOT NULL,
 
866
    summary text NOT NULL,
 
867
    description text,
 
868
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
 
869
    homepageurl text,
 
870
    screenshotsurl text,
 
871
    wikiurl text,
 
872
    listurl text,
 
873
    programminglang text,
 
874
    downloadurl text,
 
875
    lastdoap text,
 
876
    sourceforgeproject text,
 
877
    freshmeatproject text,
 
878
    reviewed boolean DEFAULT false NOT NULL,
 
879
    active boolean DEFAULT true NOT NULL,
 
880
    fti ts2.tsvector,
 
881
    autoupdate boolean DEFAULT false NOT NULL,
 
882
    translationgroup integer,
 
883
    translationpermission integer DEFAULT 1 NOT NULL,
 
884
    official_rosetta boolean DEFAULT false NOT NULL,
 
885
    official_malone boolean DEFAULT false NOT NULL,
 
886
    bug_supervisor integer,
 
887
    security_contact integer,
 
888
    driver integer,
 
889
    bugtracker integer,
 
890
    development_focus integer,
 
891
    homepage_content text,
 
892
    icon integer,
 
893
    mugshot integer,
 
894
    logo integer,
 
895
    official_answers boolean DEFAULT false NOT NULL,
 
896
    private_bugs boolean DEFAULT false NOT NULL,
 
897
    private_specs boolean DEFAULT false NOT NULL,
 
898
    license_info text,
 
899
    official_blueprints boolean DEFAULT false NOT NULL,
 
900
    enable_bug_expiration boolean DEFAULT false NOT NULL,
 
901
    bug_reporting_guidelines text,
 
902
    reviewer_whiteboard text,
 
903
    license_approved boolean DEFAULT false NOT NULL,
 
904
    registrant integer NOT NULL,
 
905
    remote_product text,
 
906
    translation_focus integer,
 
907
    max_bug_heat integer,
 
908
    date_next_suggest_packaging timestamp without time zone,
 
909
    bug_reported_acknowledgement text,
 
910
    answers_usage integer DEFAULT 10 NOT NULL,
 
911
    blueprints_usage integer DEFAULT 10 NOT NULL,
 
912
    translations_usage integer DEFAULT 10 NOT NULL,
 
913
    CONSTRAINT only_launchpad_has_expiration CHECK (((enable_bug_expiration IS FALSE) OR (official_malone IS TRUE))),
 
914
    CONSTRAINT private_bugs_need_contact CHECK (((private_bugs IS FALSE) OR (bug_supervisor IS NOT NULL))),
 
915
    CONSTRAINT valid_name CHECK (valid_name(name))
 
916
);
 
917
 
 
918
CREATE VIEW branchwithsortkeys AS
 
919
    SELECT branch.id, branch.title, branch.summary, branch.owner, branch.product, branch.author, branch.name, branch.home_page, branch.url, branch.whiteboard, branch.lifecycle_status, branch.last_mirrored, branch.last_mirror_attempt, branch.mirror_failures, branch.mirror_status_message, branch.last_scanned, branch.last_scanned_id, branch.last_mirrored_id, branch.date_created, branch.revision_count, branch.next_mirror_time, branch.private, branch.branch_type, branch.reviewer, branch.merge_robot, branch.merge_control_status, branch.date_last_modified, branch.registrant, branch.branch_format, branch.repository_format, branch.metadir_format, branch.stacked_on, product.name AS product_name, author.displayname AS author_name, owner.displayname AS owner_name FROM (((branch JOIN person owner ON ((branch.owner = owner.id))) LEFT JOIN product ON ((branch.product = product.id))) LEFT JOIN person author ON ((branch.author = author.id)));
 
920
 
 
921
CREATE TABLE bug (
 
922
    id integer NOT NULL,
 
923
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
 
924
    name text,
 
925
    title text NOT NULL,
 
926
    description text NOT NULL,
 
927
    owner integer NOT NULL,
 
928
    duplicateof integer,
 
929
    fti ts2.tsvector,
 
930
    private boolean DEFAULT false NOT NULL,
 
931
    security_related boolean DEFAULT false NOT NULL,
 
932
    date_last_updated timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
 
933
    date_made_private timestamp without time zone,
 
934
    who_made_private integer,
 
935
    date_last_message timestamp without time zone,
 
936
    number_of_duplicates integer DEFAULT 0 NOT NULL,
 
937
    message_count integer DEFAULT 0 NOT NULL,
 
938
    users_affected_count integer DEFAULT 0,
 
939
    users_unaffected_count integer DEFAULT 0,
 
940
    heat integer DEFAULT 0 NOT NULL,
 
941
    heat_last_updated timestamp without time zone,
 
942
    latest_patch_uploaded timestamp without time zone,
 
943
    CONSTRAINT notduplicateofself CHECK ((NOT (id = duplicateof))),
 
944
    CONSTRAINT sane_description CHECK (((ltrim(description) <> ''::text) AND (char_length(description) <= 50000))),
 
945
    CONSTRAINT valid_bug_name CHECK (valid_bug_name(name))
 
946
);
6311
947
 
6312
948
CREATE SEQUENCE bug_id_seq
6313
 
    START WITH 1
6314
949
    INCREMENT BY 1
6315
950
    NO MAXVALUE
6316
951
    NO MINVALUE
6317
952
    CACHE 1;
6318
953
 
6319
 
 
6320
954
ALTER SEQUENCE bug_id_seq OWNED BY bug.id;
6321
955
 
6322
 
 
6323
956
CREATE TABLE bugactivity (
6324
957
    id integer NOT NULL,
6325
958
    bug integer NOT NULL,
6329
962
    oldvalue text,
6330
963
    newvalue text,
6331
964
    message text
6332
 
)
6333
 
WITH (fillfactor=100);
6334
 
 
 
965
);
6335
966
 
6336
967
CREATE SEQUENCE bugactivity_id_seq
6337
 
    START WITH 1
6338
968
    INCREMENT BY 1
6339
969
    NO MAXVALUE
6340
970
    NO MINVALUE
6341
971
    CACHE 1;
6342
972
 
6343
 
 
6344
973
ALTER SEQUENCE bugactivity_id_seq OWNED BY bugactivity.id;
6345
974
 
6346
 
 
6347
975
CREATE TABLE bugaffectsperson (
6348
976
    id integer NOT NULL,
6349
977
    bug integer NOT NULL,
6351
979
    affected boolean DEFAULT true NOT NULL
6352
980
);
6353
981
 
6354
 
 
6355
 
COMMENT ON TABLE bugaffectsperson IS 'This table maintains a mapping between bugs and users indicating that they are affected by that bug. The value is calculated and cached in the Bug.users_affected_count column.';
6356
 
 
6357
 
 
6358
 
COMMENT ON COLUMN bugaffectsperson.bug IS 'The bug affecting this person.';
6359
 
 
6360
 
 
6361
 
COMMENT ON COLUMN bugaffectsperson.person IS 'The person affected by this bug.';
6362
 
 
6363
 
 
6364
982
CREATE SEQUENCE bugaffectsperson_id_seq
6365
 
    START WITH 1
6366
983
    INCREMENT BY 1
6367
984
    NO MAXVALUE
6368
985
    NO MINVALUE
6369
986
    CACHE 1;
6370
987
 
6371
 
 
6372
988
ALTER SEQUENCE bugaffectsperson_id_seq OWNED BY bugaffectsperson.id;
6373
989
 
6374
 
 
6375
990
CREATE TABLE bugattachment (
6376
991
    id integer NOT NULL,
6377
992
    message integer NOT NULL,
6383
998
    CONSTRAINT valid_name CHECK (valid_name(name))
6384
999
);
6385
1000
 
6386
 
 
6387
1001
CREATE SEQUENCE bugattachment_id_seq
6388
 
    START WITH 1
6389
1002
    INCREMENT BY 1
6390
1003
    NO MAXVALUE
6391
1004
    NO MINVALUE
6392
1005
    CACHE 1;
6393
1006
 
6394
 
 
6395
1007
ALTER SEQUENCE bugattachment_id_seq OWNED BY bugattachment.id;
6396
1008
 
6397
 
 
6398
1009
CREATE TABLE bugbranch (
6399
1010
    id integer NOT NULL,
6400
1011
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
6405
1016
    registrant integer NOT NULL
6406
1017
);
6407
1018
 
6408
 
 
6409
 
COMMENT ON TABLE bugbranch IS 'A branch related to a bug, most likely a branch for fixing the bug.';
6410
 
 
6411
 
 
6412
 
COMMENT ON COLUMN bugbranch.bug IS 'The bug associated with this branch.';
6413
 
 
6414
 
 
6415
 
COMMENT ON COLUMN bugbranch.branch IS 'The branch associated to the bug.';
6416
 
 
6417
 
 
6418
 
COMMENT ON COLUMN bugbranch.revision_hint IS 'An optional revision at which this branch became interesting to this bug, and/or may contain a fix for the bug.';
6419
 
 
6420
 
 
6421
 
COMMENT ON COLUMN bugbranch.whiteboard IS 'Additional information about the status of the bugfix in this branch.';
6422
 
 
6423
 
 
6424
 
COMMENT ON COLUMN bugbranch.registrant IS 'The person who linked the bug to the branch.';
6425
 
 
6426
 
 
6427
1019
CREATE SEQUENCE bugbranch_id_seq
6428
 
    START WITH 1
6429
1020
    INCREMENT BY 1
6430
1021
    NO MAXVALUE
6431
1022
    NO MINVALUE
6432
1023
    CACHE 1;
6433
1024
 
6434
 
 
6435
1025
ALTER SEQUENCE bugbranch_id_seq OWNED BY bugbranch.id;
6436
1026
 
6437
 
 
6438
1027
CREATE TABLE bugcve (
6439
1028
    id integer NOT NULL,
6440
1029
    bug integer NOT NULL,
6442
1031
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
6443
1032
);
6444
1033
 
6445
 
 
6446
 
COMMENT ON TABLE bugcve IS 'A table that records the link between a given malone bug number, and a CVE entry.';
6447
 
 
6448
 
 
6449
1034
CREATE SEQUENCE bugcve_id_seq
6450
 
    START WITH 1
6451
1035
    INCREMENT BY 1
6452
1036
    NO MAXVALUE
6453
1037
    NO MINVALUE
6454
1038
    CACHE 1;
6455
1039
 
6456
 
 
6457
1040
ALTER SEQUENCE bugcve_id_seq OWNED BY bugcve.id;
6458
1041
 
6459
 
 
6460
1042
CREATE TABLE bugjob (
6461
1043
    id integer NOT NULL,
6462
1044
    job integer NOT NULL,
6465
1047
    json_data text
6466
1048
);
6467
1049
 
6468
 
 
6469
 
COMMENT ON TABLE bugjob IS 'Contains references to jobs to be run against Bugs.';
6470
 
 
6471
 
 
6472
 
COMMENT ON COLUMN bugjob.bug IS 'The bug on which the job is to be run.';
6473
 
 
6474
 
 
6475
 
COMMENT ON COLUMN bugjob.job_type IS 'The type of job (enumeration value). Allows us to query the database for a given subset of BugJobs.';
6476
 
 
6477
 
 
6478
 
COMMENT ON COLUMN bugjob.json_data IS 'A JSON struct containing data for the job.';
6479
 
 
6480
 
 
6481
1050
CREATE SEQUENCE bugjob_id_seq
6482
 
    START WITH 1
6483
1051
    INCREMENT BY 1
6484
1052
    NO MAXVALUE
6485
1053
    NO MINVALUE
6486
1054
    CACHE 1;
6487
1055
 
6488
 
 
6489
1056
ALTER SEQUENCE bugjob_id_seq OWNED BY bugjob.id;
6490
1057
 
6491
 
 
6492
1058
CREATE TABLE bugmessage (
6493
1059
    id integer NOT NULL,
6494
1060
    bug integer NOT NULL,
6495
1061
    message integer NOT NULL,
6496
1062
    bugwatch integer,
6497
1063
    remote_comment_id text,
6498
 
    index integer NOT NULL,
6499
 
    owner integer NOT NULL,
 
1064
    visible boolean DEFAULT true NOT NULL,
6500
1065
    CONSTRAINT imported_comment CHECK (((remote_comment_id IS NULL) OR (bugwatch IS NOT NULL)))
6501
1066
);
6502
1067
 
6503
 
 
6504
 
COMMENT ON TABLE bugmessage IS 'This table maps a message to a bug. In other words, it shows that a particular message is associated with a particular bug.';
6505
 
 
6506
 
 
6507
 
COMMENT ON COLUMN bugmessage.bugwatch IS 'The external bug this bug comment was imported from.';
6508
 
 
6509
 
 
6510
 
COMMENT ON COLUMN bugmessage.remote_comment_id IS 'The id this bug comment has in the external bug tracker, if it is an imported comment. If it is NULL while having a bugwatch set, this comment was added in Launchpad and needs to be pushed to the external bug tracker.';
6511
 
 
6512
 
 
6513
 
COMMENT ON COLUMN bugmessage.index IS 'The index (used in urls) of the message in a particular bug.';
6514
 
 
6515
 
 
6516
1068
CREATE SEQUENCE bugmessage_id_seq
6517
 
    START WITH 1
6518
1069
    INCREMENT BY 1
6519
1070
    NO MAXVALUE
6520
1071
    NO MINVALUE
6521
1072
    CACHE 1;
6522
1073
 
6523
 
 
6524
1074
ALTER SEQUENCE bugmessage_id_seq OWNED BY bugmessage.id;
6525
1075
 
6526
 
 
6527
 
CREATE TABLE bugmute (
6528
 
    person integer NOT NULL,
6529
 
    bug integer NOT NULL,
6530
 
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
6531
 
);
6532
 
 
6533
 
 
6534
1076
CREATE TABLE bugnomination (
6535
1077
    id integer NOT NULL,
6536
1078
    bug integer NOT NULL,
6544
1086
    CONSTRAINT distroseries_or_productseries CHECK (((distroseries IS NULL) <> (productseries IS NULL)))
6545
1087
);
6546
1088
 
6547
 
 
6548
 
COMMENT ON TABLE bugnomination IS 'A bug nominated for fixing in a distroseries or productseries';
6549
 
 
6550
 
 
6551
 
COMMENT ON COLUMN bugnomination.bug IS 'The bug being nominated.';
6552
 
 
6553
 
 
6554
 
COMMENT ON COLUMN bugnomination.distroseries IS 'The distroseries for which the bug is nominated.';
6555
 
 
6556
 
 
6557
 
COMMENT ON COLUMN bugnomination.productseries IS 'The productseries for which the bug is nominated.';
6558
 
 
6559
 
 
6560
 
COMMENT ON COLUMN bugnomination.status IS 'The status of the nomination.';
6561
 
 
6562
 
 
6563
 
COMMENT ON COLUMN bugnomination.date_created IS 'The date the nomination was submitted.';
6564
 
 
6565
 
 
6566
 
COMMENT ON COLUMN bugnomination.date_decided IS 'The date the nomination was approved or declined.';
6567
 
 
6568
 
 
6569
 
COMMENT ON COLUMN bugnomination.owner IS 'The person that submitted the nomination';
6570
 
 
6571
 
 
6572
 
COMMENT ON COLUMN bugnomination.decider IS 'The person who approved or declined the nomination';
6573
 
 
6574
 
 
6575
1089
CREATE SEQUENCE bugnomination_id_seq
6576
 
    START WITH 1
6577
1090
    INCREMENT BY 1
6578
1091
    NO MAXVALUE
6579
1092
    NO MINVALUE
6580
1093
    CACHE 1;
6581
1094
 
6582
 
 
6583
1095
ALTER SEQUENCE bugnomination_id_seq OWNED BY bugnomination.id;
6584
1096
 
6585
 
 
6586
1097
CREATE TABLE bugnotification (
6587
1098
    id integer NOT NULL,
6588
1099
    bug integer NOT NULL,
6589
1100
    message integer NOT NULL,
6590
1101
    is_comment boolean NOT NULL,
6591
 
    date_emailed timestamp without time zone,
6592
 
    status integer DEFAULT 10 NOT NULL,
6593
 
    activity integer
 
1102
    date_emailed timestamp without time zone
6594
1103
);
6595
1104
 
6596
 
 
6597
 
COMMENT ON TABLE bugnotification IS 'The text representation of changes to a bug, which are used to send email notifications to bug changes.';
6598
 
 
6599
 
 
6600
 
COMMENT ON COLUMN bugnotification.bug IS 'The bug that was changed.';
6601
 
 
6602
 
 
6603
 
COMMENT ON COLUMN bugnotification.message IS 'The message the contains the textual representation of the change.';
6604
 
 
6605
 
 
6606
 
COMMENT ON COLUMN bugnotification.is_comment IS 'Is the change a comment addition.';
6607
 
 
6608
 
 
6609
 
COMMENT ON COLUMN bugnotification.date_emailed IS 'When this notification was emailed to the bug subscribers.';
6610
 
 
6611
 
 
6612
1105
CREATE SEQUENCE bugnotification_id_seq
6613
 
    START WITH 1
6614
1106
    INCREMENT BY 1
6615
1107
    NO MAXVALUE
6616
1108
    NO MINVALUE
6617
1109
    CACHE 1;
6618
1110
 
6619
 
 
6620
1111
ALTER SEQUENCE bugnotification_id_seq OWNED BY bugnotification.id;
6621
1112
 
6622
 
 
6623
1113
CREATE TABLE bugnotificationarchive (
6624
1114
    id integer NOT NULL,
6625
1115
    bug integer,
6628
1118
    date_emailed timestamp without time zone
6629
1119
);
6630
1120
 
6631
 
 
6632
1121
CREATE TABLE bugnotificationattachment (
6633
1122
    id integer NOT NULL,
6634
1123
    message integer NOT NULL,
6635
1124
    bug_notification integer NOT NULL
6636
1125
);
6637
1126
 
6638
 
 
6639
 
COMMENT ON TABLE bugnotificationattachment IS 'Attachments to be attached to a bug notification.';
6640
 
 
6641
 
 
6642
 
COMMENT ON COLUMN bugnotificationattachment.message IS 'A message to be attached to the sent bug notification. It will be attached as a mime/multipart part, with a content type of message/rfc822.';
6643
 
 
6644
 
 
6645
 
COMMENT ON COLUMN bugnotificationattachment.bug_notification IS 'The bug notification, to which things should be attached to.';
6646
 
 
6647
 
 
6648
1127
CREATE SEQUENCE bugnotificationattachment_id_seq
6649
 
    START WITH 1
6650
1128
    INCREMENT BY 1
6651
1129
    NO MAXVALUE
6652
1130
    NO MINVALUE
6653
1131
    CACHE 1;
6654
1132
 
6655
 
 
6656
1133
ALTER SEQUENCE bugnotificationattachment_id_seq OWNED BY bugnotificationattachment.id;
6657
1134
 
6658
 
 
6659
 
CREATE TABLE bugnotificationfilter (
6660
 
    bug_notification integer NOT NULL,
6661
 
    bug_subscription_filter integer NOT NULL
6662
 
);
6663
 
 
6664
 
 
6665
1135
CREATE TABLE bugnotificationrecipient (
6666
1136
    id integer NOT NULL,
6667
1137
    bug_notification integer NOT NULL,
6670
1140
    reason_body text NOT NULL
6671
1141
);
6672
1142
 
6673
 
 
6674
 
COMMENT ON TABLE bugnotificationrecipient IS 'The recipient for a bug notification.';
6675
 
 
6676
 
 
6677
 
COMMENT ON COLUMN bugnotificationrecipient.bug_notification IS 'The notification this recipient should get.';
6678
 
 
6679
 
 
6680
 
COMMENT ON COLUMN bugnotificationrecipient.person IS 'The person who should receive this notification.';
6681
 
 
6682
 
 
6683
 
COMMENT ON COLUMN bugnotificationrecipient.reason_header IS 'The reason this person is receiving this notification (the value for the X-Launchpad-Message-Rationale header).';
6684
 
 
6685
 
 
6686
 
COMMENT ON COLUMN bugnotificationrecipient.reason_body IS 'A line of text describing the reason this person is receiving this notification (to be included in the email message).';
6687
 
 
6688
 
 
6689
1143
CREATE SEQUENCE bugnotificationrecipient_id_seq
6690
 
    START WITH 1
6691
1144
    INCREMENT BY 1
6692
1145
    NO MAXVALUE
6693
1146
    NO MINVALUE
6694
1147
    CACHE 1;
6695
1148
 
6696
 
 
6697
1149
ALTER SEQUENCE bugnotificationrecipient_id_seq OWNED BY bugnotificationrecipient.id;
6698
1150
 
6699
 
 
6700
1151
CREATE TABLE bugnotificationrecipientarchive (
6701
1152
    id integer NOT NULL,
6702
1153
    bug_notification integer,
6705
1156
    reason_body text
6706
1157
);
6707
1158
 
 
1159
CREATE TABLE bugpackageinfestation (
 
1160
    id integer NOT NULL,
 
1161
    bug integer NOT NULL,
 
1162
    sourcepackagerelease integer NOT NULL,
 
1163
    explicit boolean NOT NULL,
 
1164
    infestationstatus integer NOT NULL,
 
1165
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
 
1166
    creator integer NOT NULL,
 
1167
    dateverified timestamp without time zone,
 
1168
    verifiedby integer,
 
1169
    lastmodified timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
 
1170
    lastmodifiedby integer NOT NULL
 
1171
);
 
1172
 
 
1173
CREATE SEQUENCE bugpackageinfestation_id_seq
 
1174
    INCREMENT BY 1
 
1175
    NO MAXVALUE
 
1176
    NO MINVALUE
 
1177
    CACHE 1;
 
1178
 
 
1179
ALTER SEQUENCE bugpackageinfestation_id_seq OWNED BY bugpackageinfestation.id;
 
1180
 
 
1181
CREATE TABLE bugproductinfestation (
 
1182
    id integer NOT NULL,
 
1183
    bug integer NOT NULL,
 
1184
    productrelease integer NOT NULL,
 
1185
    explicit boolean NOT NULL,
 
1186
    infestationstatus integer NOT NULL,
 
1187
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
 
1188
    creator integer NOT NULL,
 
1189
    dateverified timestamp without time zone,
 
1190
    verifiedby integer,
 
1191
    lastmodified timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
 
1192
    lastmodifiedby integer NOT NULL
 
1193
);
 
1194
 
 
1195
CREATE SEQUENCE bugproductinfestation_id_seq
 
1196
    INCREMENT BY 1
 
1197
    NO MAXVALUE
 
1198
    NO MINVALUE
 
1199
    CACHE 1;
 
1200
 
 
1201
ALTER SEQUENCE bugproductinfestation_id_seq OWNED BY bugproductinfestation.id;
 
1202
 
 
1203
CREATE TABLE bugsubscription (
 
1204
    id integer NOT NULL,
 
1205
    person integer NOT NULL,
 
1206
    bug integer NOT NULL,
 
1207
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
 
1208
    subscribed_by integer NOT NULL,
 
1209
    bug_notification_level integer DEFAULT 40 NOT NULL
 
1210
);
6708
1211
 
6709
1212
CREATE SEQUENCE bugsubscription_id_seq
6710
 
    START WITH 1
6711
1213
    INCREMENT BY 1
6712
1214
    NO MAXVALUE
6713
1215
    NO MINVALUE
6714
1216
    CACHE 1;
6715
1217
 
6716
 
 
6717
1218
ALTER SEQUENCE bugsubscription_id_seq OWNED BY bugsubscription.id;
6718
1219
 
6719
 
 
6720
 
CREATE TABLE bugsubscriptionfilter (
6721
 
    id integer NOT NULL,
6722
 
    structuralsubscription integer,
6723
 
    find_all_tags boolean NOT NULL,
6724
 
    include_any_tags boolean NOT NULL,
6725
 
    exclude_any_tags boolean NOT NULL,
6726
 
    other_parameters text,
6727
 
    description text,
6728
 
    bug_notification_level integer DEFAULT 40 NOT NULL
6729
 
);
6730
 
 
6731
 
 
6732
 
COMMENT ON TABLE bugsubscriptionfilter IS 'A filter with search criteria. Emails are sent only if the affected bug matches the specified parameters. The parameters are the same as those used for bugtask searches.';
6733
 
 
6734
 
 
6735
 
COMMENT ON COLUMN bugsubscriptionfilter.structuralsubscription IS 'The structural subscription to be filtered.';
6736
 
 
6737
 
 
6738
 
COMMENT ON COLUMN bugsubscriptionfilter.find_all_tags IS 'If set, search for bugs having all tags specified in BugSubscriptionFilterTag, else search for bugs having any of the tags specified in BugSubscriptionFilterTag.';
6739
 
 
6740
 
 
6741
 
COMMENT ON COLUMN bugsubscriptionfilter.include_any_tags IS 'If True, include messages for bugs having any tag set.';
6742
 
 
6743
 
 
6744
 
COMMENT ON COLUMN bugsubscriptionfilter.exclude_any_tags IS 'If True, exclude bugs having any tag set.';
6745
 
 
6746
 
 
6747
 
COMMENT ON COLUMN bugsubscriptionfilter.other_parameters IS 'Other filter paremeters. Actual filtering is implemented on Python level.';
6748
 
 
6749
 
 
6750
 
COMMENT ON COLUMN bugsubscriptionfilter.description IS 'A description of the filter, allowing subscribers to note the intent of the filter.';
6751
 
 
6752
 
 
6753
 
CREATE SEQUENCE bugsubscriptionfilter_id_seq
6754
 
    START WITH 1
6755
 
    INCREMENT BY 1
6756
 
    NO MAXVALUE
6757
 
    NO MINVALUE
6758
 
    CACHE 1;
6759
 
 
6760
 
 
6761
 
ALTER SEQUENCE bugsubscriptionfilter_id_seq OWNED BY bugsubscriptionfilter.id;
6762
 
 
6763
 
 
6764
 
CREATE TABLE bugsubscriptionfilterimportance (
6765
 
    id integer NOT NULL,
6766
 
    filter integer NOT NULL,
6767
 
    importance integer NOT NULL
6768
 
);
6769
 
 
6770
 
 
6771
 
COMMENT ON TABLE bugsubscriptionfilterimportance IS 'Filter a bugsubscription by bug task status.';
6772
 
 
6773
 
 
6774
 
COMMENT ON COLUMN bugsubscriptionfilterimportance.filter IS 'The subscription filter of this record.';
6775
 
 
6776
 
 
6777
 
COMMENT ON COLUMN bugsubscriptionfilterimportance.importance IS 'The bug task importance.';
6778
 
 
6779
 
 
6780
 
CREATE SEQUENCE bugsubscriptionfilterimportance_id_seq
6781
 
    START WITH 1
6782
 
    INCREMENT BY 1
6783
 
    NO MAXVALUE
6784
 
    NO MINVALUE
6785
 
    CACHE 1;
6786
 
 
6787
 
 
6788
 
ALTER SEQUENCE bugsubscriptionfilterimportance_id_seq OWNED BY bugsubscriptionfilterimportance.id;
6789
 
 
6790
 
 
6791
 
CREATE TABLE bugsubscriptionfiltermute (
6792
 
    person integer NOT NULL,
6793
 
    filter integer NOT NULL,
6794
 
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
6795
 
);
6796
 
 
6797
 
 
6798
 
CREATE TABLE bugsubscriptionfilterstatus (
6799
 
    id integer NOT NULL,
6800
 
    filter integer NOT NULL,
6801
 
    status integer NOT NULL
6802
 
);
6803
 
 
6804
 
 
6805
 
COMMENT ON TABLE bugsubscriptionfilterstatus IS 'Filter a bugsubscription by bug task status.';
6806
 
 
6807
 
 
6808
 
COMMENT ON COLUMN bugsubscriptionfilterstatus.filter IS 'The subscription filter of this record.';
6809
 
 
6810
 
 
6811
 
COMMENT ON COLUMN bugsubscriptionfilterstatus.status IS 'The bug task status.';
6812
 
 
6813
 
 
6814
 
CREATE SEQUENCE bugsubscriptionfilterstatus_id_seq
6815
 
    START WITH 1
6816
 
    INCREMENT BY 1
6817
 
    NO MAXVALUE
6818
 
    NO MINVALUE
6819
 
    CACHE 1;
6820
 
 
6821
 
 
6822
 
ALTER SEQUENCE bugsubscriptionfilterstatus_id_seq OWNED BY bugsubscriptionfilterstatus.id;
6823
 
 
6824
 
 
6825
 
CREATE TABLE bugsubscriptionfiltertag (
6826
 
    id integer NOT NULL,
6827
 
    filter integer NOT NULL,
 
1220
CREATE TABLE bugtag (
 
1221
    id integer NOT NULL,
 
1222
    bug integer NOT NULL,
6828
1223
    tag text NOT NULL,
6829
 
    include boolean NOT NULL
6830
 
);
6831
 
 
6832
 
 
6833
 
COMMENT ON TABLE bugsubscriptionfiltertag IS 'Filter by bug tag.';
6834
 
 
6835
 
 
6836
 
COMMENT ON COLUMN bugsubscriptionfiltertag.filter IS 'The subscription filter of this record.';
6837
 
 
6838
 
 
6839
 
COMMENT ON COLUMN bugsubscriptionfiltertag.tag IS 'A bug tag.';
6840
 
 
6841
 
 
6842
 
COMMENT ON COLUMN bugsubscriptionfiltertag.include IS 'If True, send only messages for bugs having this tag, else send only messages for bugs which do not have this tag.';
6843
 
 
6844
 
 
6845
 
CREATE SEQUENCE bugsubscriptionfiltertag_id_seq
6846
 
    START WITH 1
6847
 
    INCREMENT BY 1
6848
 
    NO MAXVALUE
6849
 
    NO MINVALUE
6850
 
    CACHE 1;
6851
 
 
6852
 
 
6853
 
ALTER SEQUENCE bugsubscriptionfiltertag_id_seq OWNED BY bugsubscriptionfiltertag.id;
6854
 
 
6855
 
 
6856
 
CREATE SEQUENCE bugsummary_id_seq
6857
 
    START WITH 1
6858
 
    INCREMENT BY 1
6859
 
    NO MAXVALUE
6860
 
    NO MINVALUE
6861
 
    CACHE 1;
6862
 
 
6863
 
 
6864
 
ALTER SEQUENCE bugsummary_id_seq OWNED BY bugsummary.id;
6865
 
 
6866
 
 
6867
 
CREATE TABLE bugsummaryjournal (
6868
 
    id integer NOT NULL,
6869
 
    count integer DEFAULT 0 NOT NULL,
6870
 
    product integer,
6871
 
    productseries integer,
6872
 
    distribution integer,
6873
 
    distroseries integer,
6874
 
    sourcepackagename integer,
6875
 
    viewed_by integer,
6876
 
    tag text,
6877
 
    status integer NOT NULL,
6878
 
    milestone integer,
6879
 
    importance integer NOT NULL,
6880
 
    has_patch boolean NOT NULL,
6881
 
    fixed_upstream boolean NOT NULL
6882
 
);
6883
 
 
6884
 
 
6885
 
CREATE SEQUENCE bugsummaryjournal_id_seq
6886
 
    START WITH 1
6887
 
    INCREMENT BY 1
6888
 
    NO MAXVALUE
6889
 
    NO MINVALUE
6890
 
    CACHE 1;
6891
 
 
6892
 
 
6893
 
ALTER SEQUENCE bugsummaryjournal_id_seq OWNED BY bugsummaryjournal.id;
6894
 
 
 
1224
    CONSTRAINT valid_tag CHECK (valid_name(tag))
 
1225
);
6895
1226
 
6896
1227
CREATE SEQUENCE bugtag_id_seq
6897
 
    START WITH 1
6898
1228
    INCREMENT BY 1
6899
1229
    NO MAXVALUE
6900
1230
    NO MINVALUE
6901
1231
    CACHE 1;
6902
1232
 
6903
 
 
6904
1233
ALTER SEQUENCE bugtag_id_seq OWNED BY bugtag.id;
6905
1234
 
 
1235
CREATE TABLE bugtask (
 
1236
    id integer NOT NULL,
 
1237
    bug integer NOT NULL,
 
1238
    product integer,
 
1239
    distribution integer,
 
1240
    distroseries integer,
 
1241
    sourcepackagename integer,
 
1242
    binarypackagename integer,
 
1243
    status integer NOT NULL,
 
1244
    priority integer,
 
1245
    importance integer DEFAULT 5 NOT NULL,
 
1246
    assignee integer,
 
1247
    date_assigned timestamp without time zone,
 
1248
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone),
 
1249
    owner integer NOT NULL,
 
1250
    milestone integer,
 
1251
    bugwatch integer,
 
1252
    statusexplanation text,
 
1253
    fti ts2.tsvector,
 
1254
    targetnamecache text,
 
1255
    date_confirmed timestamp without time zone,
 
1256
    date_inprogress timestamp without time zone,
 
1257
    date_closed timestamp without time zone,
 
1258
    productseries integer,
 
1259
    date_incomplete timestamp without time zone,
 
1260
    date_left_new timestamp without time zone,
 
1261
    date_triaged timestamp without time zone,
 
1262
    date_fix_committed timestamp without time zone,
 
1263
    date_fix_released timestamp without time zone,
 
1264
    date_left_closed timestamp without time zone,
 
1265
    heat_rank integer DEFAULT 0 NOT NULL,
 
1266
    date_milestone_set timestamp without time zone,
 
1267
    CONSTRAINT bugtask_assignment_checks CHECK (CASE WHEN (product IS NOT NULL) THEN ((((productseries IS NULL) AND (distribution IS NULL)) AND (distroseries IS NULL)) AND (sourcepackagename IS NULL)) WHEN (productseries IS NOT NULL) THEN (((distribution IS NULL) AND (distroseries IS NULL)) AND (sourcepackagename IS NULL)) WHEN (distribution IS NOT NULL) THEN (distroseries IS NULL) WHEN (distroseries IS NOT NULL) THEN true ELSE false END)
 
1268
);
6906
1269
 
6907
1270
CREATE SEQUENCE bugtask_id_seq
6908
 
    START WITH 1
6909
1271
    INCREMENT BY 1
6910
1272
    NO MAXVALUE
6911
1273
    NO MINVALUE
6912
1274
    CACHE 1;
6913
1275
 
6914
 
 
6915
1276
ALTER SEQUENCE bugtask_id_seq OWNED BY bugtask.id;
6916
1277
 
6917
 
 
6918
1278
CREATE TABLE bugtracker (
6919
1279
    id integer NOT NULL,
6920
1280
    bugtrackertype integer NOT NULL,
6932
1292
    CONSTRAINT valid_name CHECK (valid_name(name))
6933
1293
);
6934
1294
 
6935
 
 
6936
 
COMMENT ON TABLE bugtracker IS 'A bug tracker in some other project. Malone allows us to link Malone bugs with bugs recorded in other bug tracking systems, and to keep the status of the relevant bug task in sync with the status in that upstream bug tracker. So, for example, you might note that Malone bug #43224 is the same as a bug in the Apache bugzilla, number 534536. Then when the upstream guys mark that bug fixed in their bugzilla, Malone know that the bug is fixed upstream.';
6937
 
 
6938
 
 
6939
 
COMMENT ON COLUMN bugtracker.bugtrackertype IS 'The type of bug tracker, a pointer to the table of bug tracker types. Currently we know about debbugs and bugzilla bugtrackers, and plan to support roundup and sourceforge as well.';
6940
 
 
6941
 
 
6942
 
COMMENT ON COLUMN bugtracker.name IS 'The unique name of this bugtracker, allowing us to refer to it directly.';
6943
 
 
6944
 
 
6945
 
COMMENT ON COLUMN bugtracker.title IS 'A title for the bug tracker, used in listings of all the bug trackers and also displayed at the top of the descriptive page for the bug tracker.';
6946
 
 
6947
 
 
6948
 
COMMENT ON COLUMN bugtracker.summary IS 'A brief summary of this bug tracker, which might for example list any interesting policies regarding the use of the bug tracker. The summary is displayed in bold at the top of the bug tracker page.';
6949
 
 
6950
 
 
6951
 
COMMENT ON COLUMN bugtracker.baseurl IS 'The base URL for this bug tracker. Using our knowledge of the bugtrackertype, and the details in the BugWatch table we are then able to calculate relative URLs for relevant pages in the bug tracker based on this baseurl.';
6952
 
 
6953
 
 
6954
 
COMMENT ON COLUMN bugtracker.owner IS 'The person who created this bugtracker entry and who thus has permission to modify it. Ideally we would like this to be the person who coordinates the running of the actual bug tracker upstream.';
6955
 
 
6956
 
 
6957
 
COMMENT ON COLUMN bugtracker.contactdetails IS 'The contact details of the people responsible for that bug tracker. This allows us to coordinate the syncing of bugs to and from that bug tracker with the responsible people on the other side.';
6958
 
 
6959
 
 
6960
 
COMMENT ON COLUMN bugtracker.version IS 'The version of the bug tracker software being used.';
6961
 
 
6962
 
 
6963
 
COMMENT ON COLUMN bugtracker.block_comment_pushing IS 'Whether to block pushing comments to the bug tracker. Having a value of false means that we will push the comments if the bug tracker supports it.';
6964
 
 
6965
 
 
6966
 
COMMENT ON COLUMN bugtracker.has_lp_plugin IS 'Whether we have confirmed that the Launchpad plugin was installed on the bug tracker, the last time checkwatches was run.';
6967
 
 
6968
 
 
6969
1295
CREATE SEQUENCE bugtracker_id_seq
6970
 
    START WITH 1
6971
1296
    INCREMENT BY 1
6972
1297
    NO MAXVALUE
6973
1298
    NO MINVALUE
6974
1299
    CACHE 1;
6975
1300
 
6976
 
 
6977
1301
ALTER SEQUENCE bugtracker_id_seq OWNED BY bugtracker.id;
6978
1302
 
6979
 
 
6980
1303
CREATE TABLE bugtrackeralias (
6981
1304
    id integer NOT NULL,
6982
1305
    bugtracker integer NOT NULL,
6983
1306
    base_url text NOT NULL
6984
1307
);
6985
1308
 
6986
 
 
6987
 
COMMENT ON TABLE bugtrackeralias IS 'A bugtracker alias is a URL that also refers to the same bugtracker as the master bugtracker. For example, a bugtracker might be accessible as both http://www.bugsrus.com/ and http://bugsrus.com/. A bugtracker can have many aliases, and all of them are checked to prevents users registering duplicate bugtrackers inadvertently.';
6988
 
 
6989
 
 
6990
 
COMMENT ON COLUMN bugtrackeralias.bugtracker IS 'The master bugtracker that this alias refers to.';
6991
 
 
6992
 
 
6993
 
COMMENT ON COLUMN bugtrackeralias.base_url IS 'Another base URL for this bug tracker. See BugTracker.baseurl.';
6994
 
 
6995
 
 
6996
1309
CREATE SEQUENCE bugtrackeralias_id_seq
6997
 
    START WITH 1
6998
1310
    INCREMENT BY 1
6999
1311
    NO MAXVALUE
7000
1312
    NO MINVALUE
7001
1313
    CACHE 1;
7002
1314
 
7003
 
 
7004
1315
ALTER SEQUENCE bugtrackeralias_id_seq OWNED BY bugtrackeralias.id;
7005
1316
 
7006
 
 
7007
 
CREATE TABLE bugtrackercomponent (
7008
 
    id integer NOT NULL,
7009
 
    name text NOT NULL,
7010
 
    is_visible boolean DEFAULT true NOT NULL,
7011
 
    is_custom boolean DEFAULT true NOT NULL,
7012
 
    component_group integer NOT NULL,
7013
 
    distribution integer,
7014
 
    source_package_name integer,
7015
 
    CONSTRAINT valid_target CHECK (((distribution IS NULL) = (source_package_name IS NULL)))
7016
 
);
7017
 
 
7018
 
 
7019
 
COMMENT ON TABLE bugtrackercomponent IS 'A software component in a remote bug tracker, which can be linked to the corresponding source package in a distribution using this table.';
7020
 
 
7021
 
 
7022
 
COMMENT ON COLUMN bugtrackercomponent.name IS 'The name of the component as registered in the remote bug tracker.';
7023
 
 
7024
 
 
7025
 
COMMENT ON COLUMN bugtrackercomponent.is_visible IS 'Whether to display or hide the item in the Launchpad user interface.';
7026
 
 
7027
 
 
7028
 
COMMENT ON COLUMN bugtrackercomponent.is_custom IS 'Whether the item was added by a user in Launchpad or is kept in sync with the remote bug tracker.';
7029
 
 
7030
 
 
7031
 
COMMENT ON COLUMN bugtrackercomponent.component_group IS 'The product or other higher level category used by the remote bug tracker to group projects, if any.';
7032
 
 
7033
 
 
7034
 
COMMENT ON COLUMN bugtrackercomponent.distribution IS 'Link to the distribution for the associated source package.  This can be NULL if no ling has been established.';
7035
 
 
7036
 
 
7037
 
COMMENT ON COLUMN bugtrackercomponent.source_package_name IS 'The text name of the source package in a distribution that corresponds to this component.  This can be NULL if no link has been established yet.';
7038
 
 
7039
 
 
7040
 
CREATE SEQUENCE bugtrackercomponent_id_seq
7041
 
    START WITH 1
7042
 
    INCREMENT BY 1
7043
 
    NO MAXVALUE
7044
 
    NO MINVALUE
7045
 
    CACHE 1;
7046
 
 
7047
 
 
7048
 
ALTER SEQUENCE bugtrackercomponent_id_seq OWNED BY bugtrackercomponent.id;
7049
 
 
7050
 
 
7051
 
CREATE TABLE bugtrackercomponentgroup (
7052
 
    id integer NOT NULL,
7053
 
    name text NOT NULL,
7054
 
    bug_tracker integer NOT NULL
7055
 
);
7056
 
 
7057
 
 
7058
 
COMMENT ON TABLE bugtrackercomponentgroup IS 'A collection of components as modeled in a remote bug tracker, often referred to as a product.  Some bug trackers do not categorize software components this way, so they will have a single default component group that all components belong to.';
7059
 
 
7060
 
 
7061
 
COMMENT ON COLUMN bugtrackercomponentgroup.name IS 'The product or category name used in the remote bug tracker for grouping components.';
7062
 
 
7063
 
 
7064
 
COMMENT ON COLUMN bugtrackercomponentgroup.bug_tracker IS 'The external bug tracker this component group belongs to.';
7065
 
 
7066
 
 
7067
 
CREATE SEQUENCE bugtrackercomponentgroup_id_seq
7068
 
    START WITH 1
7069
 
    INCREMENT BY 1
7070
 
    NO MAXVALUE
7071
 
    NO MINVALUE
7072
 
    CACHE 1;
7073
 
 
7074
 
 
7075
 
ALTER SEQUENCE bugtrackercomponentgroup_id_seq OWNED BY bugtrackercomponentgroup.id;
7076
 
 
7077
 
 
7078
1317
CREATE TABLE bugtrackerperson (
7079
1318
    id integer NOT NULL,
7080
1319
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
7083
1322
    name text NOT NULL
7084
1323
);
7085
1324
 
7086
 
 
7087
 
COMMENT ON TABLE bugtrackerperson IS 'A mapping from a user in an external bug tracker to a Person record in Launchpad. This is used when we can''t get an e-mail address from the bug tracker.';
7088
 
 
7089
 
 
7090
 
COMMENT ON COLUMN bugtrackerperson.date_created IS 'When was this mapping added.';
7091
 
 
7092
 
 
7093
 
COMMENT ON COLUMN bugtrackerperson.bugtracker IS 'The external bug tracker in which this user has an account.';
7094
 
 
7095
 
 
7096
 
COMMENT ON COLUMN bugtrackerperson.person IS 'The Person record in Launchpad this user corresponds to.';
7097
 
 
7098
 
 
7099
 
COMMENT ON COLUMN bugtrackerperson.name IS 'The (within the bug tracker) unique username in the external bug tracker.';
7100
 
 
7101
 
 
7102
1325
CREATE SEQUENCE bugtrackerperson_id_seq
7103
 
    START WITH 1
7104
1326
    INCREMENT BY 1
7105
1327
    NO MAXVALUE
7106
1328
    NO MINVALUE
7107
1329
    CACHE 1;
7108
1330
 
7109
 
 
7110
1331
ALTER SEQUENCE bugtrackerperson_id_seq OWNED BY bugtrackerperson.id;
7111
1332
 
7112
 
 
7113
1333
CREATE TABLE bugwatch (
7114
1334
    id integer NOT NULL,
7115
1335
    bug integer NOT NULL,
7126
1346
    next_check timestamp without time zone
7127
1347
);
7128
1348
 
7129
 
 
7130
 
COMMENT ON COLUMN bugwatch.last_error_type IS 'The type of error which last prevented this entry from being updated. Legal values are defined by the BugWatchErrorType enumeration.';
7131
 
 
7132
 
 
7133
 
COMMENT ON COLUMN bugwatch.remote_importance IS 'The importance of the bug as returned by the remote server. This will be converted into a Launchpad BugTaskImportance value.';
7134
 
 
7135
 
 
7136
 
COMMENT ON COLUMN bugwatch.remote_lp_bug_id IS 'The bug in Launchpad that the remote bug is pointing at. This can be different than the BugWatch.bug column, since the same remote bug can be linked from multiple bugs in Launchpad, but the remote bug can only link to a single bug in Launchpad. The main use case for this column is to avoid having to query the remote bug tracker for this information, in order to decide whether we need to give this information to the remote bug tracker.';
7137
 
 
7138
 
 
7139
 
COMMENT ON COLUMN bugwatch.next_check IS 'The time after which the watch should next be checked. Note that this does not denote an exact schedule for the next check since checkwatches only runs periodically.';
7140
 
 
7141
 
 
7142
1349
CREATE SEQUENCE bugwatch_id_seq
7143
 
    START WITH 1
7144
1350
    INCREMENT BY 1
7145
1351
    NO MAXVALUE
7146
1352
    NO MINVALUE
7147
1353
    CACHE 1;
7148
1354
 
7149
 
 
7150
1355
ALTER SEQUENCE bugwatch_id_seq OWNED BY bugwatch.id;
7151
1356
 
7152
 
 
7153
1357
CREATE TABLE bugwatchactivity (
7154
1358
    id integer NOT NULL,
7155
1359
    bug_watch integer NOT NULL,
7157
1361
    result integer NOT NULL,
7158
1362
    message text,
7159
1363
    oops_id text
7160
 
)
7161
 
WITH (fillfactor=100);
7162
 
 
7163
 
 
7164
 
COMMENT ON TABLE bugwatchactivity IS 'This table contains a record of each update for a given bug watch. This allows us to track whether a given update was successful or not and, if not, the details of the error which caused the update to fail.';
7165
 
 
7166
 
 
7167
 
COMMENT ON COLUMN bugwatchactivity.bug_watch IS 'The bug_watch to which this activity entry relates.';
7168
 
 
7169
 
 
7170
 
COMMENT ON COLUMN bugwatchactivity.activity_date IS 'The datetime at which the activity occurred.';
7171
 
 
7172
 
 
7173
 
COMMENT ON COLUMN bugwatchactivity.result IS 'The result of the update. Legal values are defined in the BugWatchErrorType enumeration. An update is considered successful if its error_type is NULL.';
7174
 
 
7175
 
 
7176
 
COMMENT ON COLUMN bugwatchactivity.message IS 'The message (if any) associated with the update.';
7177
 
 
7178
 
 
7179
 
COMMENT ON COLUMN bugwatchactivity.oops_id IS 'The OOPS id, if any, associated with the error that caused the update to fail.';
7180
 
 
 
1364
);
7181
1365
 
7182
1366
CREATE SEQUENCE bugwatchactivity_id_seq
7183
 
    START WITH 1
7184
1367
    INCREMENT BY 1
7185
1368
    NO MAXVALUE
7186
1369
    NO MINVALUE
7187
1370
    CACHE 1;
7188
1371
 
7189
 
 
7190
1372
ALTER SEQUENCE bugwatchactivity_id_seq OWNED BY bugwatchactivity.id;
7191
1373
 
7192
 
 
7193
1374
CREATE TABLE builder (
7194
1375
    id integer NOT NULL,
7195
1376
    processor integer NOT NULL,
7206
1387
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
7207
1388
    vm_host text,
7208
1389
    active boolean DEFAULT true NOT NULL,
7209
 
    failure_count integer DEFAULT 0 NOT NULL,
7210
1390
    CONSTRAINT valid_absolute_url CHECK (valid_absolute_url(url))
7211
1391
);
7212
1392
 
7213
 
 
7214
 
COMMENT ON TABLE builder IS 'Builder: This table stores the build-slave registry and status information as: name, url, trusted, builderok, builderaction, failnotes.';
7215
 
 
7216
 
 
7217
 
COMMENT ON COLUMN builder.speedindex IS 'A relative measure of the speed of this builder. If NULL, we do not yet have a speedindex for the builder else it is the number of seconds needed to perform a reference build';
7218
 
 
7219
 
 
7220
 
COMMENT ON COLUMN builder.builderok IS 'Should a builder fail for any reason, from out-of-disk-space to not responding to the buildd master, the builderok flag is set to false and the failnotes column is filled with a reason.';
7221
 
 
7222
 
 
7223
 
COMMENT ON COLUMN builder.failnotes IS 'This column gets filled out with a textual description of how/why a builder has failed. If the builderok column is true then the value in this column is irrelevant and should be treated as NULL or empty.';
7224
 
 
7225
 
 
7226
 
COMMENT ON COLUMN builder.virtualized IS 'Whether or not the builder is a virtual Xen builder. Packages coming via ubuntu workflow are trusted to build on non-Xen and do not need facist behaviour to be built. Other packages like ppa/grumpy incoming packages can contain malicious code, so are unstrusted and build in a Xen virtual machine.';
7227
 
 
7228
 
 
7229
 
COMMENT ON COLUMN builder.url IS 'The url to the build slave. There may be more than one build slave on a given host so this url includes the port number to use. The default port number for a build slave is 8221';
7230
 
 
7231
 
 
7232
 
COMMENT ON COLUMN builder.manual IS 'Whether or not builder was manual mode, i.e., collect any result from the it, but do not dispach anything to it automatically.';
7233
 
 
7234
 
 
7235
 
COMMENT ON COLUMN builder.vm_host IS 'The virtual machine host associated to this builder. It should be empty for "native" builders (old fashion or architectures not yet supported by XEN).';
7236
 
 
7237
 
 
7238
 
COMMENT ON COLUMN builder.active IS 'Whether to present or not the builder in the public list of builders avaialble. It is used to hide transient or defunct builders while they get fixed.';
7239
 
 
7240
 
 
7241
 
COMMENT ON COLUMN builder.failure_count IS 'The number of consecutive failures on this builder.  Is reset to zero after a sucessful dispatch.';
7242
 
 
7243
 
 
7244
1393
CREATE SEQUENCE builder_id_seq
7245
 
    START WITH 1
7246
1394
    INCREMENT BY 1
7247
1395
    NO MAXVALUE
7248
1396
    NO MINVALUE
7249
1397
    CACHE 1;
7250
1398
 
7251
 
 
7252
1399
ALTER SEQUENCE builder_id_seq OWNED BY builder.id;
7253
1400
 
7254
 
 
7255
1401
CREATE TABLE buildfarmjob (
7256
1402
    id integer NOT NULL,
7257
1403
    processor integer,
7264
1410
    status integer NOT NULL,
7265
1411
    log integer,
7266
1412
    job_type integer NOT NULL,
7267
 
    failure_count integer DEFAULT 0 NOT NULL,
7268
1413
    CONSTRAINT started_if_finished CHECK (((date_finished IS NULL) OR (date_started IS NOT NULL)))
7269
1414
);
7270
1415
 
7271
 
 
7272
 
COMMENT ON TABLE buildfarmjob IS 'BuildFarmJob: This table stores the information common to all jobs on the Launchpad build farm.';
7273
 
 
7274
 
 
7275
 
COMMENT ON COLUMN buildfarmjob.processor IS 'Points to the required processor target for this job, or null.';
7276
 
 
7277
 
 
7278
 
COMMENT ON COLUMN buildfarmjob.virtualized IS 'The virtualization setting required by this build farm job, or null.';
7279
 
 
7280
 
 
7281
 
COMMENT ON COLUMN buildfarmjob.date_created IS 'When the build farm job record was created.';
7282
 
 
7283
 
 
7284
 
COMMENT ON COLUMN buildfarmjob.date_started IS 'When the build farm job started being processed.';
7285
 
 
7286
 
 
7287
 
COMMENT ON COLUMN buildfarmjob.date_finished IS 'When the build farm job finished being processed.';
7288
 
 
7289
 
 
7290
 
COMMENT ON COLUMN buildfarmjob.date_first_dispatched IS 'The instant the build was dispatched the first time. This value will not get overridden if the build is retried.';
7291
 
 
7292
 
 
7293
 
COMMENT ON COLUMN buildfarmjob.builder IS 'Points to the builder which processed this build farm job.';
7294
 
 
7295
 
 
7296
 
COMMENT ON COLUMN buildfarmjob.status IS 'Stores the current build status.';
7297
 
 
7298
 
 
7299
 
COMMENT ON COLUMN buildfarmjob.log IS 'Points to the log for this build farm job file stored in librarian.';
7300
 
 
7301
 
 
7302
 
COMMENT ON COLUMN buildfarmjob.job_type IS 'The type of build farm job to which this record corresponds.';
7303
 
 
7304
 
 
7305
 
COMMENT ON COLUMN buildfarmjob.failure_count IS 'The number of consecutive failures on this job.  If excessive, the job may be terminated.';
7306
 
 
7307
 
 
7308
1416
CREATE SEQUENCE buildfarmjob_id_seq
7309
 
    START WITH 1
7310
1417
    INCREMENT BY 1
7311
1418
    NO MAXVALUE
7312
1419
    NO MINVALUE
7313
1420
    CACHE 1;
7314
1421
 
7315
 
 
7316
1422
ALTER SEQUENCE buildfarmjob_id_seq OWNED BY buildfarmjob.id;
7317
1423
 
7318
 
 
7319
1424
CREATE TABLE buildpackagejob (
7320
1425
    id integer NOT NULL,
7321
1426
    job integer NOT NULL,
7322
1427
    build integer NOT NULL
7323
1428
);
7324
1429
 
7325
 
 
7326
1430
CREATE SEQUENCE buildpackagejob_id_seq
7327
 
    START WITH 1
7328
1431
    INCREMENT BY 1
7329
1432
    NO MAXVALUE
7330
1433
    NO MINVALUE
7331
1434
    CACHE 1;
7332
1435
 
7333
 
 
7334
1436
ALTER SEQUENCE buildpackagejob_id_seq OWNED BY buildpackagejob.id;
7335
1437
 
7336
 
 
7337
1438
CREATE TABLE buildqueue (
7338
1439
    id integer NOT NULL,
7339
1440
    builder integer,
7347
1448
    virtualized boolean
7348
1449
);
7349
1450
 
7350
 
 
7351
 
COMMENT ON TABLE buildqueue IS 'BuildQueue: The queue of jobs in progress/scheduled to run on the Soyuz build farm.';
7352
 
 
7353
 
 
7354
 
COMMENT ON COLUMN buildqueue.builder IS 'The builder assigned to this build. Some builds will have a builder assigned to queue them up; some will be building on the specified builder already; others will not have a builder yet (NULL) and will be waiting to be assigned into a builder''s queue';
7355
 
 
7356
 
 
7357
 
COMMENT ON COLUMN buildqueue.logtail IS 'The tail end of the log of the current build. This is updated regularly as the buildd master polls the buildd slaves. Once the build is complete; the full log will be lodged with the librarian and linked into the build table.';
7358
 
 
7359
 
 
7360
 
COMMENT ON COLUMN buildqueue.lastscore IS 'The last score ascribed to this build record. This can be used in the UI among other places.';
7361
 
 
7362
 
 
7363
 
COMMENT ON COLUMN buildqueue.manual IS 'Indicates if the current record was or not rescored manually, if so it get skipped from the auto-score procedure.';
7364
 
 
7365
 
 
7366
 
COMMENT ON COLUMN buildqueue.job IS 'Foreign key to the `Job` table row with the generic job data.';
7367
 
 
7368
 
 
7369
 
COMMENT ON COLUMN buildqueue.job_type IS 'Type of job (enumeration value), enables us to find/query the correct table with the data specific to this type of job.';
7370
 
 
7371
 
 
7372
 
COMMENT ON COLUMN buildqueue.estimated_duration IS 'Estimated job duration, based on previous running times of comparable jobs.';
7373
 
 
7374
 
 
7375
 
COMMENT ON COLUMN buildqueue.processor IS 'The processor required by the associated build farm job.';
7376
 
 
7377
 
 
7378
 
COMMENT ON COLUMN buildqueue.virtualized IS 'The virtualization setting required by the associated build farm job.';
7379
 
 
7380
 
 
7381
1451
CREATE SEQUENCE buildqueue_id_seq
7382
 
    START WITH 1
7383
1452
    INCREMENT BY 1
7384
1453
    NO MAXVALUE
7385
1454
    NO MINVALUE
7386
1455
    CACHE 1;
7387
1456
 
7388
 
 
7389
1457
ALTER SEQUENCE buildqueue_id_seq OWNED BY buildqueue.id;
7390
1458
 
7391
 
 
7392
1459
CREATE TABLE codeimport (
7393
1460
    id integer NOT NULL,
7394
1461
    branch integer NOT NULL,
7403
1470
    assignee integer,
7404
1471
    update_interval interval,
7405
1472
    url text,
7406
 
    CONSTRAINT valid_vcs_details CHECK (CASE WHEN (rcs_type = 1) THEN (((((cvs_root IS NOT NULL) AND (cvs_root <> ''::text)) AND (cvs_module IS NOT NULL)) AND (cvs_module <> ''::text)) AND (url IS NULL)) WHEN (rcs_type = ANY (ARRAY[2, 3])) THEN ((((cvs_root IS NULL) AND (cvs_module IS NULL)) AND (url IS NOT NULL)) AND valid_absolute_url(url)) WHEN (rcs_type = ANY (ARRAY[4, 5, 6])) THEN (((cvs_root IS NULL) AND (cvs_module IS NULL)) AND (url IS NOT NULL)) ELSE false END)
 
1473
    CONSTRAINT valid_vcs_details CHECK (CASE WHEN (rcs_type = 1) THEN (((((cvs_root IS NOT NULL) AND (cvs_root <> ''::text)) AND (cvs_module IS NOT NULL)) AND (cvs_module <> ''::text)) AND (url IS NULL)) WHEN (rcs_type = ANY (ARRAY[2, 3])) THEN ((((cvs_root IS NULL) AND (cvs_module IS NULL)) AND (url IS NOT NULL)) AND valid_absolute_url(url)) WHEN (rcs_type = ANY (ARRAY[4, 5])) THEN (((cvs_root IS NULL) AND (cvs_module IS NULL)) AND (url IS NOT NULL)) ELSE false END)
7407
1474
);
7408
1475
 
7409
 
 
7410
 
COMMENT ON TABLE codeimport IS 'The persistent record of an import from a foreign version control system to Bazaar, from the initial request to the regularly updated import branch.';
7411
 
 
7412
 
 
7413
 
COMMENT ON COLUMN codeimport.branch IS 'The Bazaar branch produced by the import system.  Always non-NULL: a placeholder branch is created when the import is created.  The import is associated to a Product and Series though the branch.';
7414
 
 
7415
 
 
7416
 
COMMENT ON COLUMN codeimport.registrant IS 'The person who originally requested this import.';
7417
 
 
7418
 
 
7419
 
COMMENT ON COLUMN codeimport.rcs_type IS 'The revision control system used by the import source. The value is defined in dbschema.RevisionControlSystems.';
7420
 
 
7421
 
 
7422
 
COMMENT ON COLUMN codeimport.cvs_root IS 'The $CVSROOT details, probably of the form :pserver:user@host:/path.';
7423
 
 
7424
 
 
7425
 
COMMENT ON COLUMN codeimport.cvs_module IS 'The module in cvs_root to import, often the name of the project.';
7426
 
 
7427
 
 
7428
 
COMMENT ON COLUMN codeimport.review_status IS 'Whether this code import request has been reviewed, and whether it was accepted.';
7429
 
 
7430
 
 
7431
 
COMMENT ON COLUMN codeimport.date_last_successful IS 'When this code import last succeeded. NULL if this import has never succeeded.';
7432
 
 
7433
 
 
7434
 
COMMENT ON COLUMN codeimport.owner IS 'The person who is currently responsible for keeping the import details up to date, initially set to the registrant. This person can edit some of the details of the code import branch.';
7435
 
 
7436
 
 
7437
 
COMMENT ON COLUMN codeimport.assignee IS 'The person in charge of delivering this code import and interacting with the owner.';
7438
 
 
7439
 
 
7440
 
COMMENT ON COLUMN codeimport.update_interval IS 'How often should this import be updated. If NULL, defaults to a system-wide value set by the Launchpad administrators.';
7441
 
 
7442
 
 
7443
 
COMMENT ON COLUMN codeimport.url IS 'The URL of the foreign VCS branch for this import.';
7444
 
 
7445
 
 
7446
1476
CREATE SEQUENCE codeimport_id_seq
7447
 
    START WITH 1
7448
1477
    INCREMENT BY 1
7449
1478
    NO MAXVALUE
7450
1479
    NO MINVALUE
7451
1480
    CACHE 1;
7452
1481
 
7453
 
 
7454
1482
ALTER SEQUENCE codeimport_id_seq OWNED BY codeimport.id;
7455
1483
 
7456
 
 
7457
1484
CREATE TABLE codeimportevent (
7458
1485
    id integer NOT NULL,
7459
1486
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
7463
1490
    machine integer
7464
1491
);
7465
1492
 
7466
 
 
7467
 
COMMENT ON TABLE codeimportevent IS 'A record of events in the code import system.  Rows in this table are created by triggers on other code import tables.';
7468
 
 
7469
 
 
7470
 
COMMENT ON COLUMN codeimportevent.entry_type IS 'The type of event that is recorded by this entry. Legal values are defined by the CodeImportEventType enumeration.';
7471
 
 
7472
 
 
7473
 
COMMENT ON COLUMN codeimportevent.code_import IS 'The code import that was associated to this event, if any and if it has not been deleted.';
7474
 
 
7475
 
 
7476
 
COMMENT ON COLUMN codeimportevent.person IS 'The user who caused the event, if the event is not automatically generated.';
7477
 
 
7478
 
 
7479
 
COMMENT ON COLUMN codeimportevent.machine IS 'The code import machine that was concerned by this event, if any.';
7480
 
 
7481
 
 
7482
1493
CREATE SEQUENCE codeimportevent_id_seq
7483
 
    START WITH 1
7484
1494
    INCREMENT BY 1
7485
1495
    NO MAXVALUE
7486
1496
    NO MINVALUE
7487
1497
    CACHE 1;
7488
1498
 
7489
 
 
7490
1499
ALTER SEQUENCE codeimportevent_id_seq OWNED BY codeimportevent.id;
7491
1500
 
7492
 
 
7493
1501
CREATE TABLE codeimporteventdata (
7494
1502
    id integer NOT NULL,
7495
1503
    event integer,
7497
1505
    data_value text
7498
1506
);
7499
1507
 
7500
 
 
7501
 
COMMENT ON TABLE codeimporteventdata IS 'Additional data associated to a particular code import event.';
7502
 
 
7503
 
 
7504
 
COMMENT ON COLUMN codeimporteventdata.event IS 'The event the data is associated to.';
7505
 
 
7506
 
 
7507
 
COMMENT ON COLUMN codeimporteventdata.data_type IS 'The type of additional data, from the CodeImportEventDataType enumeration.';
7508
 
 
7509
 
 
7510
 
COMMENT ON COLUMN codeimporteventdata.data_value IS 'The value of the additional data.  A string.';
7511
 
 
7512
 
 
7513
1508
CREATE SEQUENCE codeimporteventdata_id_seq
7514
 
    START WITH 1
7515
1509
    INCREMENT BY 1
7516
1510
    NO MAXVALUE
7517
1511
    NO MINVALUE
7518
1512
    CACHE 1;
7519
1513
 
7520
 
 
7521
1514
ALTER SEQUENCE codeimporteventdata_id_seq OWNED BY codeimporteventdata.id;
7522
1515
 
7523
 
 
7524
1516
CREATE TABLE codeimportjob (
7525
1517
    id integer NOT NULL,
7526
1518
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
7536
1528
    CONSTRAINT valid_state CHECK (CASE WHEN (state = 10) THEN (((((machine IS NULL) AND (ordering IS NULL)) AND (heartbeat IS NULL)) AND (date_started IS NULL)) AND (logtail IS NULL)) WHEN (state = 20) THEN (((((machine IS NOT NULL) AND (ordering IS NOT NULL)) AND (heartbeat IS NULL)) AND (date_started IS NULL)) AND (logtail IS NULL)) WHEN (state = 30) THEN (((((machine IS NOT NULL) AND (ordering IS NULL)) AND (heartbeat IS NOT NULL)) AND (date_started IS NOT NULL)) AND (logtail IS NOT NULL)) ELSE false END)
7537
1529
);
7538
1530
 
7539
 
 
7540
 
COMMENT ON TABLE codeimportjob IS 'A pending or active code import job.  There is always such a row for any active import, but it will not run until date_due is in the past.';
7541
 
 
7542
 
 
7543
 
COMMENT ON COLUMN codeimportjob.code_import IS 'The code import that is being worked upon.';
7544
 
 
7545
 
 
7546
 
COMMENT ON COLUMN codeimportjob.machine IS 'The machine job is currently scheduled to run on, or where the job is currently running.';
7547
 
 
7548
 
 
7549
 
COMMENT ON COLUMN codeimportjob.date_due IS 'When the import should happen.';
7550
 
 
7551
 
 
7552
 
COMMENT ON COLUMN codeimportjob.state IS 'One of PENDING (waiting until its due or a machine is online), SCHEDULED (assigned to a machine, but not yet running) or RUNNING (actually in the process of being imported now).';
7553
 
 
7554
 
 
7555
 
COMMENT ON COLUMN codeimportjob.requesting_user IS 'The user who requested the import, if any. Set if and only if reason = REQUEST.';
7556
 
 
7557
 
 
7558
 
COMMENT ON COLUMN codeimportjob.ordering IS 'A measure of how urgent the job is -- queue entries with lower "ordering" should be processed first, or in other works "ORDER BY ordering" returns the most import jobs first.';
7559
 
 
7560
 
 
7561
 
COMMENT ON COLUMN codeimportjob.heartbeat IS 'While the job is running, this field should be updated frequently to indicate that the import job hasn''t crashed.';
7562
 
 
7563
 
 
7564
 
COMMENT ON COLUMN codeimportjob.logtail IS 'The last few lines of output produced by the running job. It should be updated at the same time as the heartbeat.';
7565
 
 
7566
 
 
7567
 
COMMENT ON COLUMN codeimportjob.date_started IS 'When the import began to be processed.';
7568
 
 
7569
 
 
7570
1531
CREATE SEQUENCE codeimportjob_id_seq
7571
 
    START WITH 1
7572
1532
    INCREMENT BY 1
7573
1533
    NO MAXVALUE
7574
1534
    NO MINVALUE
7575
1535
    CACHE 1;
7576
1536
 
7577
 
 
7578
1537
ALTER SEQUENCE codeimportjob_id_seq OWNED BY codeimportjob.id;
7579
1538
 
7580
 
 
7581
1539
CREATE TABLE codeimportmachine (
7582
1540
    id integer NOT NULL,
7583
1541
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
7586
1544
    heartbeat timestamp without time zone
7587
1545
);
7588
1546
 
7589
 
 
7590
 
COMMENT ON TABLE codeimportmachine IS 'The record of a machine capable of performing jobs for the code import system.';
7591
 
 
7592
 
 
7593
 
COMMENT ON COLUMN codeimportmachine.hostname IS 'The (unique) hostname of the machine.';
7594
 
 
7595
 
 
7596
 
COMMENT ON COLUMN codeimportmachine.state IS 'Whether the controller daemon on this machine is offline, online, or quiescing (running but not accepting new jobs).';
7597
 
 
7598
 
 
7599
 
COMMENT ON COLUMN codeimportmachine.heartbeat IS 'When the code-import-controller daemon was last known to be running on this machine. If it is not updated for a long time the machine state will change to offline.';
7600
 
 
7601
 
 
7602
1547
CREATE SEQUENCE codeimportmachine_id_seq
7603
 
    START WITH 1
7604
1548
    INCREMENT BY 1
7605
1549
    NO MAXVALUE
7606
1550
    NO MINVALUE
7607
1551
    CACHE 1;
7608
1552
 
7609
 
 
7610
1553
ALTER SEQUENCE codeimportmachine_id_seq OWNED BY codeimportmachine.id;
7611
1554
 
7612
 
 
7613
1555
CREATE TABLE codeimportresult (
7614
1556
    id integer NOT NULL,
7615
1557
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
7622
1564
    date_job_started timestamp without time zone
7623
1565
);
7624
1566
 
7625
 
 
7626
 
COMMENT ON TABLE codeimportresult IS 'A completed code import job.';
7627
 
 
7628
 
 
7629
 
COMMENT ON COLUMN codeimportresult.code_import IS 'The code import for which the job was run.';
7630
 
 
7631
 
 
7632
 
COMMENT ON COLUMN codeimportresult.machine IS 'The machine the job ran on.';
7633
 
 
7634
 
 
7635
 
COMMENT ON COLUMN codeimportresult.log_excerpt IS 'The last few lines of the partial log, in case it is set.';
7636
 
 
7637
 
 
7638
 
COMMENT ON COLUMN codeimportresult.log_file IS 'A partial log of the job for users to see. It is normally only recorded if the job failed in a step that interacts with the remote repository. If a job was successful, or failed in a houskeeping step, the log file would not contain information useful to the user.';
7639
 
 
7640
 
 
7641
 
COMMENT ON COLUMN codeimportresult.status IS 'How the job ended. Success, some kind of failure, or some kind of interruption before completion.';
7642
 
 
7643
 
 
7644
 
COMMENT ON COLUMN codeimportresult.date_job_started IS 'When the job started to run (date_created is when it finished).';
7645
 
 
7646
 
 
7647
1567
CREATE SEQUENCE codeimportresult_id_seq
7648
 
    START WITH 1
7649
1568
    INCREMENT BY 1
7650
1569
    NO MAXVALUE
7651
1570
    NO MINVALUE
7652
1571
    CACHE 1;
7653
1572
 
7654
 
 
7655
1573
ALTER SEQUENCE codeimportresult_id_seq OWNED BY codeimportresult.id;
7656
1574
 
7657
 
 
7658
1575
CREATE TABLE codereviewmessage (
7659
1576
    id integer NOT NULL,
7660
1577
    branch_merge_proposal integer NOT NULL,
7663
1580
    vote_tag text
7664
1581
);
7665
1582
 
7666
 
 
7667
 
COMMENT ON TABLE codereviewmessage IS 'A message that is part of a code review discussion.';
7668
 
 
7669
 
 
7670
 
COMMENT ON COLUMN codereviewmessage.branch_merge_proposal IS 'The merge proposal that is being discussed.';
7671
 
 
7672
 
 
7673
 
COMMENT ON COLUMN codereviewmessage.message IS 'The actual message.';
7674
 
 
7675
 
 
7676
 
COMMENT ON COLUMN codereviewmessage.vote IS 'The reviewer''s vote for this message.';
7677
 
 
7678
 
 
7679
 
COMMENT ON COLUMN codereviewmessage.vote_tag IS 'A short description of the vote';
7680
 
 
7681
 
 
7682
1583
CREATE SEQUENCE codereviewmessage_id_seq
7683
 
    START WITH 1
7684
1584
    INCREMENT BY 1
7685
1585
    NO MAXVALUE
7686
1586
    NO MINVALUE
7687
1587
    CACHE 1;
7688
1588
 
7689
 
 
7690
1589
ALTER SEQUENCE codereviewmessage_id_seq OWNED BY codereviewmessage.id;
7691
1590
 
7692
 
 
7693
1591
CREATE TABLE codereviewvote (
7694
1592
    id integer NOT NULL,
7695
1593
    branch_merge_proposal integer NOT NULL,
7700
1598
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
7701
1599
);
7702
1600
 
7703
 
 
7704
 
COMMENT ON TABLE codereviewvote IS 'Reference to a person''s last vote in a code review discussion.';
7705
 
 
7706
 
 
7707
 
COMMENT ON COLUMN codereviewvote.branch_merge_proposal IS 'The BranchMergeProposal for the code review.';
7708
 
 
7709
 
 
7710
 
COMMENT ON COLUMN codereviewvote.reviewer IS 'The person performing the review.';
7711
 
 
7712
 
 
7713
 
COMMENT ON COLUMN codereviewvote.review_type IS 'The aspect of the code being reviewed.';
7714
 
 
7715
 
 
7716
 
COMMENT ON COLUMN codereviewvote.registrant IS 'The person who registered this vote';
7717
 
 
7718
 
 
7719
 
COMMENT ON COLUMN codereviewvote.vote_message IS 'The message associated with the vote';
7720
 
 
7721
 
 
7722
 
COMMENT ON COLUMN codereviewvote.date_created IS 'The date this vote reference was created';
7723
 
 
7724
 
 
7725
1601
CREATE SEQUENCE codereviewvote_id_seq
7726
 
    START WITH 1
7727
1602
    INCREMENT BY 1
7728
1603
    NO MAXVALUE
7729
1604
    NO MINVALUE
7730
1605
    CACHE 1;
7731
1606
 
7732
 
 
7733
1607
ALTER SEQUENCE codereviewvote_id_seq OWNED BY codereviewvote.id;
7734
1608
 
7735
 
 
7736
 
CREATE VIEW combinedbugsummary AS
7737
 
    SELECT bugsummary.id, bugsummary.count, bugsummary.product, bugsummary.productseries, bugsummary.distribution, bugsummary.distroseries, bugsummary.sourcepackagename, bugsummary.viewed_by, bugsummary.tag, bugsummary.status, bugsummary.milestone, bugsummary.importance, bugsummary.has_patch, bugsummary.fixed_upstream FROM bugsummary UNION ALL SELECT (- bugsummaryjournal.id) AS id, bugsummaryjournal.count, bugsummaryjournal.product, bugsummaryjournal.productseries, bugsummaryjournal.distribution, bugsummaryjournal.distroseries, bugsummaryjournal.sourcepackagename, bugsummaryjournal.viewed_by, bugsummaryjournal.tag, bugsummaryjournal.status, bugsummaryjournal.milestone, bugsummaryjournal.importance, bugsummaryjournal.has_patch, bugsummaryjournal.fixed_upstream FROM bugsummaryjournal;
7738
 
 
7739
 
 
7740
1609
CREATE TABLE commercialsubscription (
7741
1610
    id integer NOT NULL,
7742
1611
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
7751
1620
    sales_system_id text
7752
1621
);
7753
1622
 
7754
 
 
7755
 
COMMENT ON TABLE commercialsubscription IS 'A Commercial Subscription entry for a project.  Projects with licenses of Other/Proprietary must purchase a subscription in order to use Launchpad.';
7756
 
 
7757
 
 
7758
 
COMMENT ON COLUMN commercialsubscription.date_created IS 'The date this subscription was created in Launchpad.';
7759
 
 
7760
 
 
7761
 
COMMENT ON COLUMN commercialsubscription.date_last_modified IS 'The date this subscription was last modified.';
7762
 
 
7763
 
 
7764
 
COMMENT ON COLUMN commercialsubscription.date_starts IS 'The beginning date for this subscription.  It is invalid until that date.';
7765
 
 
7766
 
 
7767
 
COMMENT ON COLUMN commercialsubscription.date_expires IS 'The expiration date for this subscription.  It is invalid after that date.';
7768
 
 
7769
 
 
7770
 
COMMENT ON COLUMN commercialsubscription.status IS 'The current status.  One of: SUBSCRIBED, LAPSED, SUSPENDED.';
7771
 
 
7772
 
 
7773
 
COMMENT ON COLUMN commercialsubscription.product IS 'The product this subscription enables.';
7774
 
 
7775
 
 
7776
 
COMMENT ON COLUMN commercialsubscription.registrant IS 'The person who created this subscription.';
7777
 
 
7778
 
 
7779
 
COMMENT ON COLUMN commercialsubscription.purchaser IS 'The person who purchased this subscription.';
7780
 
 
7781
 
 
7782
 
COMMENT ON COLUMN commercialsubscription.whiteboard IS 'A place for administrators to store comments related to this subscription.';
7783
 
 
7784
 
 
7785
 
COMMENT ON COLUMN commercialsubscription.sales_system_id IS 'A reference in the external sales system (e.g. Salesforce) that can be used to identify this subscription.';
7786
 
 
7787
 
 
7788
1623
CREATE SEQUENCE commercialsubscription_id_seq
7789
 
    START WITH 1
7790
1624
    INCREMENT BY 1
7791
1625
    NO MAXVALUE
7792
1626
    NO MINVALUE
7793
1627
    CACHE 1;
7794
1628
 
7795
 
 
7796
1629
ALTER SEQUENCE commercialsubscription_id_seq OWNED BY commercialsubscription.id;
7797
1630
 
7798
 
 
7799
1631
CREATE SEQUENCE component_id_seq
7800
 
    START WITH 1
7801
1632
    INCREMENT BY 1
7802
1633
    NO MAXVALUE
7803
1634
    NO MINVALUE
7804
1635
    CACHE 1;
7805
1636
 
7806
 
 
7807
1637
ALTER SEQUENCE component_id_seq OWNED BY component.id;
7808
1638
 
7809
 
 
7810
1639
CREATE TABLE componentselection (
7811
1640
    id integer NOT NULL,
7812
1641
    distroseries integer NOT NULL,
7814
1643
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
7815
1644
);
7816
1645
 
7817
 
 
7818
 
COMMENT ON TABLE componentselection IS 'Allowed components in a given distroseries.';
7819
 
 
7820
 
 
7821
 
COMMENT ON COLUMN componentselection.distroseries IS 'Refers to the distroseries in question.';
7822
 
 
7823
 
 
7824
 
COMMENT ON COLUMN componentselection.component IS 'Refers to the component in qestion.';
7825
 
 
7826
 
 
7827
1646
CREATE SEQUENCE componentselection_id_seq
7828
 
    START WITH 1
7829
1647
    INCREMENT BY 1
7830
1648
    NO MAXVALUE
7831
1649
    NO MINVALUE
7832
1650
    CACHE 1;
7833
1651
 
7834
 
 
7835
1652
ALTER SEQUENCE componentselection_id_seq OWNED BY componentselection.id;
7836
1653
 
7837
 
 
7838
1654
CREATE TABLE continent (
7839
1655
    id integer NOT NULL,
7840
1656
    code text NOT NULL,
7841
1657
    name text NOT NULL
7842
 
)
7843
 
WITH (fillfactor=100);
7844
 
 
7845
 
 
7846
 
COMMENT ON TABLE continent IS 'A continent in this huge world.';
7847
 
 
7848
 
 
7849
 
COMMENT ON COLUMN continent.code IS 'A two-letter code for a continent.';
7850
 
 
7851
 
 
7852
 
COMMENT ON COLUMN continent.name IS 'The name of the continent.';
7853
 
 
 
1658
);
7854
1659
 
7855
1660
CREATE SEQUENCE continent_id_seq
7856
 
    START WITH 1
7857
1661
    INCREMENT BY 1
7858
1662
    NO MAXVALUE
7859
1663
    NO MINVALUE
7860
1664
    CACHE 1;
7861
1665
 
7862
 
 
7863
1666
ALTER SEQUENCE continent_id_seq OWNED BY continent.id;
7864
1667
 
7865
 
 
7866
1668
CREATE TABLE country (
7867
1669
    id integer NOT NULL,
7868
1670
    iso3166code2 character(2) NOT NULL,
7871
1673
    title text,
7872
1674
    description text,
7873
1675
    continent integer NOT NULL
7874
 
)
7875
 
WITH (fillfactor=100);
7876
 
 
 
1676
);
7877
1677
 
7878
1678
CREATE SEQUENCE country_id_seq
7879
 
    START WITH 1
7880
1679
    INCREMENT BY 1
7881
1680
    NO MAXVALUE
7882
1681
    NO MINVALUE
7883
1682
    CACHE 1;
7884
1683
 
7885
 
 
7886
1684
ALTER SEQUENCE country_id_seq OWNED BY country.id;
7887
1685
 
7888
 
 
7889
1686
CREATE TABLE customlanguagecode (
7890
1687
    id integer NOT NULL,
7891
1688
    product integer,
7897
1694
    CONSTRAINT product_or_distro CHECK (((product IS NULL) <> (distribution IS NULL)))
7898
1695
);
7899
1696
 
7900
 
 
7901
 
COMMENT ON TABLE customlanguagecode IS 'Overrides translation importer''s interpretation of language codes where needed.';
7902
 
 
7903
 
 
7904
 
COMMENT ON COLUMN customlanguagecode.product IS 'Product for which this custom language code applies (alternative to distribution + source package name).';
7905
 
 
7906
 
 
7907
 
COMMENT ON COLUMN customlanguagecode.distribution IS 'Distribution in which this custom language code applies (if not a product).';
7908
 
 
7909
 
 
7910
 
COMMENT ON COLUMN customlanguagecode.sourcepackagename IS 'Source package name to which this custom language code applies; goes with distribution.';
7911
 
 
7912
 
 
7913
 
COMMENT ON COLUMN customlanguagecode.language_code IS 'Custom language code; need not be for a real language, and typically not for a "useful" language.';
7914
 
 
7915
 
 
7916
 
COMMENT ON COLUMN customlanguagecode.language IS 'Language to which code really refers in this context, or NULL if files with this code are to be rejected.';
7917
 
 
7918
 
 
7919
1697
CREATE SEQUENCE customlanguagecode_id_seq
7920
 
    START WITH 1
7921
1698
    INCREMENT BY 1
7922
1699
    NO MAXVALUE
7923
1700
    NO MINVALUE
7924
1701
    CACHE 1;
7925
1702
 
7926
 
 
7927
1703
ALTER SEQUENCE customlanguagecode_id_seq OWNED BY customlanguagecode.id;
7928
1704
 
7929
 
 
7930
1705
CREATE TABLE cve (
7931
1706
    id integer NOT NULL,
7932
1707
    sequence text NOT NULL,
7938
1713
    CONSTRAINT valid_cve_ref CHECK (valid_cve(sequence))
7939
1714
);
7940
1715
 
7941
 
 
7942
 
COMMENT ON TABLE cve IS 'A CVE Entry. The formal database of CVE entries is available at http://cve.mitre.org/ and we sync that database into Launchpad on a regular basis.';
7943
 
 
7944
 
 
7945
 
COMMENT ON COLUMN cve.sequence IS 'The official CVE entry number. It takes the form XXXX-XXXX where the first four digits are a year indicator, like 2004, and the latter four are the sequence number of the vulnerability in that year.';
7946
 
 
7947
 
 
7948
 
COMMENT ON COLUMN cve.status IS 'The current status of the CVE. The values are documented in dbschema.CVEState, and are Entry, Candidate, and Deprecated.';
7949
 
 
7950
 
 
7951
 
COMMENT ON COLUMN cve.datemodified IS 'The last time this CVE entry changed in some way - including addition or modification of references.';
7952
 
 
7953
 
 
7954
1716
CREATE SEQUENCE cve_id_seq
7955
 
    START WITH 1
7956
1717
    INCREMENT BY 1
7957
1718
    NO MAXVALUE
7958
1719
    NO MINVALUE
7959
1720
    CACHE 1;
7960
1721
 
7961
 
 
7962
1722
ALTER SEQUENCE cve_id_seq OWNED BY cve.id;
7963
1723
 
7964
 
 
7965
1724
CREATE TABLE cvereference (
7966
1725
    id integer NOT NULL,
7967
1726
    cve integer NOT NULL,
7971
1730
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
7972
1731
);
7973
1732
 
7974
 
 
7975
 
COMMENT ON TABLE cvereference IS 'A reference in the CVE system that shows what outside tracking numbers are associated with the CVE. These are tracked in the CVE database and extracted from the daily XML dump that we fetch.';
7976
 
 
7977
 
 
7978
 
COMMENT ON COLUMN cvereference.source IS 'The SOURCE of the CVE reference. This is a text string, like XF or BUGTRAQ or MSKB. Each string indicates a different kind of reference. The list of known types is documented on the CVE web site. At some future date we might turn this into an enum rather than a text, but for the moment we prefer to keep it fluid and just suck in what CVE gives us. This means that CVE can add new source types without us having to update our code.';
7979
 
 
7980
 
 
7981
 
COMMENT ON COLUMN cvereference.content IS 'The content of the ref in the CVE database. This is sometimes a comment, sometimes a description, sometimes a bug number... it is not predictable.';
7982
 
 
7983
 
 
7984
 
COMMENT ON COLUMN cvereference.url IS 'The URL to this reference out there on the web, if it was present in the CVE database.';
7985
 
 
7986
 
 
7987
1733
CREATE SEQUENCE cvereference_id_seq
7988
 
    START WITH 1
7989
1734
    INCREMENT BY 1
7990
1735
    NO MAXVALUE
7991
1736
    NO MINVALUE
7992
1737
    CACHE 1;
7993
1738
 
7994
 
 
7995
1739
ALTER SEQUENCE cvereference_id_seq OWNED BY cvereference.id;
7996
1740
 
7997
 
 
7998
1741
CREATE TABLE databasecpustats (
7999
1742
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
8000
1743
    username text NOT NULL,
8001
1744
    cpu integer NOT NULL
8002
 
)
8003
 
WITH (fillfactor=100);
8004
 
 
8005
 
 
8006
 
COMMENT ON TABLE databasecpustats IS 'Snapshots of CPU utilization per database username.';
8007
 
 
8008
 
 
8009
 
COMMENT ON COLUMN databasecpustats.cpu IS '% CPU utilization * 100, as reported by ps -o cp';
8010
 
 
8011
 
 
8012
 
CREATE TABLE databasediskutilization (
8013
 
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
8014
 
    namespace text NOT NULL,
8015
 
    name text NOT NULL,
8016
 
    sub_namespace text,
8017
 
    sub_name text,
8018
 
    kind character(1) NOT NULL,
8019
 
    sort text NOT NULL,
8020
 
    table_len bigint NOT NULL,
8021
 
    tuple_count bigint NOT NULL,
8022
 
    tuple_len bigint NOT NULL,
8023
 
    tuple_percent double precision NOT NULL,
8024
 
    dead_tuple_count bigint NOT NULL,
8025
 
    dead_tuple_len bigint NOT NULL,
8026
 
    dead_tuple_percent double precision NOT NULL,
8027
 
    free_space bigint NOT NULL,
8028
 
    free_percent double precision NOT NULL
8029
 
)
8030
 
WITH (fillfactor=100);
8031
 
 
 
1745
);
8032
1746
 
8033
1747
CREATE TABLE databasereplicationlag (
8034
1748
    node integer NOT NULL,
8036
1750
    updated timestamp without time zone DEFAULT timezone('UTC'::text, now())
8037
1751
);
8038
1752
 
8039
 
 
8040
 
COMMENT ON TABLE databasereplicationlag IS 'A cached snapshot of database replication lag between our master Slony node and its slaves.';
8041
 
 
8042
 
 
8043
 
COMMENT ON COLUMN databasereplicationlag.node IS 'The Slony node number identifying the slave database.';
8044
 
 
8045
 
 
8046
 
COMMENT ON COLUMN databasereplicationlag.lag IS 'lag time.';
8047
 
 
8048
 
 
8049
 
COMMENT ON COLUMN databasereplicationlag.updated IS 'When this value was updated.';
8050
 
 
8051
 
 
8052
1753
CREATE TABLE databasetablestats (
8053
1754
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
8054
1755
    schemaname name NOT NULL,
8067
1768
    last_autovacuum timestamp with time zone,
8068
1769
    last_analyze timestamp with time zone,
8069
1770
    last_autoanalyze timestamp with time zone
8070
 
)
8071
 
WITH (fillfactor=100);
8072
 
 
8073
 
 
8074
 
COMMENT ON TABLE databasetablestats IS 'Snapshots of pg_stat_user_tables to let us calculate arbitrary deltas';
8075
 
 
 
1771
);
8076
1772
 
8077
1773
CREATE TABLE diff (
8078
1774
    id integer NOT NULL,
8083
1779
    removed_lines_count integer
8084
1780
);
8085
1781
 
8086
 
 
8087
 
COMMENT ON TABLE diff IS 'Information common to static or preview diffs';
8088
 
 
8089
 
 
8090
 
COMMENT ON COLUMN diff.diff_text IS 'The library copy of the fulltext of the diff';
8091
 
 
8092
 
 
8093
 
COMMENT ON COLUMN diff.diff_lines_count IS 'The number of lines in the diff';
8094
 
 
8095
 
 
8096
 
COMMENT ON COLUMN diff.diffstat IS 'Statistics about the diff';
8097
 
 
8098
 
 
8099
 
COMMENT ON COLUMN diff.added_lines_count IS 'The number of lines added in the diff.';
8100
 
 
8101
 
 
8102
 
COMMENT ON COLUMN diff.removed_lines_count IS 'The number of lines removed in the diff';
8103
 
 
8104
 
 
8105
1782
CREATE SEQUENCE diff_id_seq
8106
 
    START WITH 1
8107
1783
    INCREMENT BY 1
8108
1784
    NO MAXVALUE
8109
1785
    NO MINVALUE
8110
1786
    CACHE 1;
8111
1787
 
8112
 
 
8113
1788
ALTER SEQUENCE diff_id_seq OWNED BY diff.id;
8114
1789
 
8115
 
 
8116
1790
CREATE TABLE distribution (
8117
1791
    id integer NOT NULL,
8118
1792
    name text NOT NULL,
8120
1794
    description text NOT NULL,
8121
1795
    domainname text NOT NULL,
8122
1796
    owner integer NOT NULL,
 
1797
    lucilleconfig text,
8123
1798
    displayname text NOT NULL,
8124
1799
    summary text NOT NULL,
8125
1800
    members integer NOT NULL,
8151
1826
    answers_usage integer DEFAULT 10 NOT NULL,
8152
1827
    blueprints_usage integer DEFAULT 10 NOT NULL,
8153
1828
    translations_usage integer DEFAULT 10 NOT NULL,
8154
 
    registrant integer NOT NULL,
8155
 
    package_derivatives_email text,
8156
1829
    CONSTRAINT only_launchpad_has_expiration CHECK (((enable_bug_expiration IS FALSE) OR (official_malone IS TRUE))),
8157
1830
    CONSTRAINT valid_name CHECK (valid_name(name))
8158
1831
);
8159
1832
 
8160
 
 
8161
 
COMMENT ON TABLE distribution IS 'Distribution: A soyuz distribution. A distribution is a collection of DistroSeries. Distributions often group together policy and may be referred to by a name such as "Ubuntu" or "Debian"';
8162
 
 
8163
 
 
8164
 
COMMENT ON COLUMN distribution.name IS 'The unique name of the distribution as a short lowercase name suitable for use in a URL.';
8165
 
 
8166
 
 
8167
 
COMMENT ON COLUMN distribution.title IS 'The title of the distribution. More a "display name" as it were. E.g. "Ubuntu" or "Debian GNU/Linux"';
8168
 
 
8169
 
 
8170
 
COMMENT ON COLUMN distribution.description IS 'A description of the distribution. More detailed than the title, this column may also contain information about the project this distribution is run by.';
8171
 
 
8172
 
 
8173
 
COMMENT ON COLUMN distribution.domainname IS 'The domain name of the distribution. This may be used both for linking to the distribution and for context-related stuff.';
8174
 
 
8175
 
 
8176
 
COMMENT ON COLUMN distribution.owner IS 'The person in launchpad who is in ultimate-charge of this distribution within launchpad.';
8177
 
 
8178
 
 
8179
 
COMMENT ON COLUMN distribution.displayname IS 'A short, well-capitalised
8180
 
name for this distribution that is not required to be unique but in almost
8181
 
all cases would be so.';
8182
 
 
8183
 
 
8184
 
COMMENT ON COLUMN distribution.summary IS 'A single paragraph that
8185
 
summarises the highlights of this distribution. It should be no longer than
8186
 
240 characters, although this is not enforced in the database.';
8187
 
 
8188
 
 
8189
 
COMMENT ON COLUMN distribution.members IS 'Person or team with upload and commit priviledges relating to this distribution. Other rights may be assigned to this role in the future.';
8190
 
 
8191
 
 
8192
 
COMMENT ON COLUMN distribution.translationgroup IS 'The translation group that is responsible for all translation work in this distribution.';
8193
 
 
8194
 
 
8195
 
COMMENT ON COLUMN distribution.translationpermission IS 'The level of openness of this distribution''s translation process. The enum lists different approaches to translation, from the very open (anybody can edit any translation in any language) to the completely closed (only designated translators can make any changes at all).';
8196
 
 
8197
 
 
8198
 
COMMENT ON COLUMN distribution.bug_supervisor IS 'Person who is responsible for managing bugs on this distribution.';
8199
 
 
8200
 
 
8201
 
COMMENT ON COLUMN distribution.official_malone IS 'Whether or not this distribution uses Malone for an official bug tracker.';
8202
 
 
8203
 
 
8204
 
COMMENT ON COLUMN distribution.official_rosetta IS 'Whether or not this distribution uses Rosetta for its official translation team and coordination.';
8205
 
 
8206
 
 
8207
 
COMMENT ON COLUMN distribution.security_contact IS 'The person or team who handles security-related issues in the distribution.';
8208
 
 
8209
 
 
8210
 
COMMENT ON COLUMN distribution.driver IS 'The team or person responsible for approving goals for each release in the distribution. This should usually be a very small team because the Distribution driver can approve items for backporting to past releases as well as the current release under development. Each distroseries has its own driver too, so you can have the small superset in the Distribution driver, and then specific teams per distroseries for backporting, for example, or for the current release management team on the current development focus release.';
8211
 
 
8212
 
 
8213
 
COMMENT ON COLUMN distribution.translation_focus IS 'The DistroSeries that should get the translation effort focus.';
8214
 
 
8215
 
 
8216
 
COMMENT ON COLUMN distribution.mirror_admin IS 'Person or team with privileges to mark a mirror as official.';
8217
 
 
8218
 
 
8219
 
COMMENT ON COLUMN distribution.upload_admin IS 'Person foreign key which have access to modify the queue ui. If NULL, we fall back to launchpad admin members';
8220
 
 
8221
 
 
8222
 
COMMENT ON COLUMN distribution.upload_sender IS 'The email address (and name) of the default sender used by the upload processor. If NULL, we fall back to the default sender in the launchpad config.';
8223
 
 
8224
 
 
8225
 
COMMENT ON COLUMN distribution.homepage_content IS 'A home page for this distribution in the Launchpad.';
8226
 
 
8227
 
 
8228
 
COMMENT ON COLUMN distribution.icon IS 'The library file alias to a small image to be used as an icon whenever we are referring to a distribution.';
8229
 
 
8230
 
 
8231
 
COMMENT ON COLUMN distribution.mugshot IS 'The library file alias of a mugshot image to display as the branding of a distribution, on its home page.';
8232
 
 
8233
 
 
8234
 
COMMENT ON COLUMN distribution.logo IS 'The library file alias of a smaller version of this distributions''s mugshot.';
8235
 
 
8236
 
 
8237
 
COMMENT ON COLUMN distribution.official_answers IS 'Whether or not this product upstream uses Answers officialy.';
8238
 
 
8239
 
 
8240
 
COMMENT ON COLUMN distribution.language_pack_admin IS 'The Person or Team that handle language packs for the distro release.';
8241
 
 
8242
 
 
8243
 
COMMENT ON COLUMN distribution.enable_bug_expiration IS 'Indicates whether automatic bug expiration is enabled.';
8244
 
 
8245
 
 
8246
 
COMMENT ON COLUMN distribution.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on this distribution.';
8247
 
 
8248
 
 
8249
 
COMMENT ON COLUMN distribution.reviewer_whiteboard IS 'A whiteboard for Launchpad admins, registry experts and the project owners to capture the state of current issues with the project.';
8250
 
 
8251
 
 
8252
 
COMMENT ON COLUMN distribution.max_bug_heat IS 'The highest heat value across bugs for this distribution.';
8253
 
 
8254
 
 
8255
 
COMMENT ON COLUMN distribution.bug_reported_acknowledgement IS 'A message of acknowledgement to display to a bug reporter after they''ve reported a new bug.';
8256
 
 
8257
 
 
8258
1833
CREATE SEQUENCE distribution_id_seq
8259
 
    START WITH 1
8260
1834
    INCREMENT BY 1
8261
1835
    NO MAXVALUE
8262
1836
    NO MINVALUE
8263
1837
    CACHE 1;
8264
1838
 
8265
 
 
8266
1839
ALTER SEQUENCE distribution_id_seq OWNED BY distribution.id;
8267
1840
 
8268
 
 
8269
 
CREATE TABLE distributionjob (
 
1841
CREATE TABLE distributionbounty (
8270
1842
    id integer NOT NULL,
8271
 
    job integer NOT NULL,
 
1843
    bounty integer NOT NULL,
8272
1844
    distribution integer NOT NULL,
8273
 
    distroseries integer,
8274
 
    job_type integer NOT NULL,
8275
 
    json_data text
 
1845
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
8276
1846
);
8277
1847
 
8278
 
 
8279
 
COMMENT ON TABLE distributionjob IS 'Contains references to jobs to be run on distributions.';
8280
 
 
8281
 
 
8282
 
COMMENT ON COLUMN distributionjob.distribution IS 'The distribution to be acted on.';
8283
 
 
8284
 
 
8285
 
COMMENT ON COLUMN distributionjob.distroseries IS 'The distroseries to be acted on.';
8286
 
 
8287
 
 
8288
 
COMMENT ON COLUMN distributionjob.job_type IS 'The type of job';
8289
 
 
8290
 
 
8291
 
COMMENT ON COLUMN distributionjob.json_data IS 'A JSON struct containing data for the job.';
8292
 
 
8293
 
 
8294
 
CREATE SEQUENCE distributionjob_id_seq
8295
 
    START WITH 1
 
1848
CREATE SEQUENCE distributionbounty_id_seq
8296
1849
    INCREMENT BY 1
8297
1850
    NO MAXVALUE
8298
1851
    NO MINVALUE
8299
1852
    CACHE 1;
8300
1853
 
8301
 
 
8302
 
ALTER SEQUENCE distributionjob_id_seq OWNED BY distributionjob.id;
8303
 
 
 
1854
ALTER SEQUENCE distributionbounty_id_seq OWNED BY distributionbounty.id;
8304
1855
 
8305
1856
CREATE TABLE distributionmirror (
8306
1857
    id integer NOT NULL,
8330
1881
    CONSTRAINT valid_rsync_base_url CHECK (valid_absolute_url(rsync_base_url))
8331
1882
);
8332
1883
 
8333
 
 
8334
 
COMMENT ON TABLE distributionmirror IS 'A mirror of a given distribution.';
8335
 
 
8336
 
 
8337
 
COMMENT ON COLUMN distributionmirror.distribution IS 'The distribution to which the mirror refers to.';
8338
 
 
8339
 
 
8340
 
COMMENT ON COLUMN distributionmirror.name IS 'The unique name of the mirror.';
8341
 
 
8342
 
 
8343
 
COMMENT ON COLUMN distributionmirror.http_base_url IS 'The HTTP URL used to access the mirror.';
8344
 
 
8345
 
 
8346
 
COMMENT ON COLUMN distributionmirror.ftp_base_url IS 'The FTP URL used to access the mirror.';
8347
 
 
8348
 
 
8349
 
COMMENT ON COLUMN distributionmirror.rsync_base_url IS 'The Rsync URL used to access the mirror.';
8350
 
 
8351
 
 
8352
 
COMMENT ON COLUMN distributionmirror.displayname IS 'The displayname of the mirror.';
8353
 
 
8354
 
 
8355
 
COMMENT ON COLUMN distributionmirror.description IS 'A description of the mirror.';
8356
 
 
8357
 
 
8358
 
COMMENT ON COLUMN distributionmirror.owner IS 'The owner of the mirror.';
8359
 
 
8360
 
 
8361
 
COMMENT ON COLUMN distributionmirror.speed IS 'The speed of the mirror''s Internet link.';
8362
 
 
8363
 
 
8364
 
COMMENT ON COLUMN distributionmirror.country IS 'The country where the mirror is located.';
8365
 
 
8366
 
 
8367
 
COMMENT ON COLUMN distributionmirror.content IS 'The content that is mirrored.';
8368
 
 
8369
 
 
8370
 
COMMENT ON COLUMN distributionmirror.official_candidate IS 'Is the mirror a candidate for becoming an official mirror?';
8371
 
 
8372
 
 
8373
 
COMMENT ON COLUMN distributionmirror.enabled IS 'Is this mirror enabled?';
8374
 
 
8375
 
 
8376
 
COMMENT ON COLUMN distributionmirror.date_created IS 'The date and time the mirror was created.';
8377
 
 
8378
 
 
8379
 
COMMENT ON COLUMN distributionmirror.whiteboard IS 'Notes on the current status of the mirror';
8380
 
 
8381
 
 
8382
 
COMMENT ON COLUMN distributionmirror.status IS 'This mirror''s status.';
8383
 
 
8384
 
 
8385
 
COMMENT ON COLUMN distributionmirror.date_reviewed IS 'The date and time the mirror was reviewed.';
8386
 
 
8387
 
 
8388
 
COMMENT ON COLUMN distributionmirror.reviewer IS 'The person who reviewed the mirror.';
8389
 
 
8390
 
 
8391
 
COMMENT ON COLUMN distributionmirror.country_dns_mirror IS 'Is the mirror a country DNS mirror?';
8392
 
 
8393
 
 
8394
1884
CREATE SEQUENCE distributionmirror_id_seq
8395
 
    START WITH 1
8396
1885
    INCREMENT BY 1
8397
1886
    NO MAXVALUE
8398
1887
    NO MINVALUE
8399
1888
    CACHE 1;
8400
1889
 
8401
 
 
8402
1890
ALTER SEQUENCE distributionmirror_id_seq OWNED BY distributionmirror.id;
8403
1891
 
8404
 
 
8405
1892
CREATE TABLE distributionsourcepackage (
8406
1893
    id integer NOT NULL,
8407
1894
    distribution integer NOT NULL,
8412
1899
    total_bug_heat integer,
8413
1900
    bug_count integer,
8414
1901
    po_message_count integer,
8415
 
    is_upstream_link_allowed boolean DEFAULT true NOT NULL,
8416
 
    enable_bugfiling_duplicate_search boolean DEFAULT true NOT NULL
 
1902
    is_upstream_link_allowed boolean DEFAULT true NOT NULL
8417
1903
);
8418
1904
 
8419
 
 
8420
 
COMMENT ON TABLE distributionsourcepackage IS 'Representing a sourcepackage in a distribution across all distribution series.';
8421
 
 
8422
 
 
8423
 
COMMENT ON COLUMN distributionsourcepackage.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on a particular a source package in a distribution.';
8424
 
 
8425
 
 
8426
 
COMMENT ON COLUMN distributionsourcepackage.max_bug_heat IS 'The highest heat value across bugs for this source package. NULL means it has not yet been calculated.';
8427
 
 
8428
 
 
8429
 
COMMENT ON COLUMN distributionsourcepackage.bug_reported_acknowledgement IS 'A message of acknowledgement to display to a bug reporter after they''ve reported a new bug.';
8430
 
 
8431
 
 
8432
 
COMMENT ON COLUMN distributionsourcepackage.total_bug_heat IS 'Sum of bug heat matching the package distribution and sourcepackagename. NULL means it has not yet been calculated.';
8433
 
 
8434
 
 
8435
 
COMMENT ON COLUMN distributionsourcepackage.bug_count IS 'Number of bugs matching the package distribution and sourcepackagename. NULL means it has not yet been calculated.';
8436
 
 
8437
 
 
8438
 
COMMENT ON COLUMN distributionsourcepackage.po_message_count IS 'Number of translations matching the package distribution and sourcepackagename. NULL means it has not yet been calculated.';
8439
 
 
8440
 
 
8441
 
COMMENT ON COLUMN distributionsourcepackage.is_upstream_link_allowed IS 'Whether an upstream link may be added if it does not already exist.';
8442
 
 
8443
 
 
8444
 
COMMENT ON COLUMN distributionsourcepackage.enable_bugfiling_duplicate_search IS 'Enable/disable a search for posiible duplicates when a bug is filed.';
8445
 
 
8446
 
 
8447
1905
CREATE SEQUENCE distributionsourcepackage_id_seq
8448
 
    START WITH 1
8449
1906
    INCREMENT BY 1
8450
1907
    NO MAXVALUE
8451
1908
    NO MINVALUE
8452
1909
    CACHE 1;
8453
1910
 
8454
 
 
8455
1911
ALTER SEQUENCE distributionsourcepackage_id_seq OWNED BY distributionsourcepackage.id;
8456
1912
 
8457
 
 
8458
1913
CREATE TABLE distributionsourcepackagecache (
8459
1914
    id integer NOT NULL,
8460
1915
    distribution integer NOT NULL,
8468
1923
    archive integer NOT NULL
8469
1924
);
8470
1925
 
8471
 
 
8472
 
COMMENT ON TABLE distributionsourcepackagecache IS 'A cache of the text associated with binary and source packages in the distribution. This table allows for fast queries to find a source packagename that matches a given text.';
8473
 
 
8474
 
 
8475
 
COMMENT ON COLUMN distributionsourcepackagecache.distribution IS 'The distribution in which we are checking.';
8476
 
 
8477
 
 
8478
 
COMMENT ON COLUMN distributionsourcepackagecache.sourcepackagename IS 'The source package name for which we are caching details.';
8479
 
 
8480
 
 
8481
 
COMMENT ON COLUMN distributionsourcepackagecache.name IS 'The source package name itself. This is just a copy of the value of sourcepackagename.name. We have it here so it can be part of the full text index.';
8482
 
 
8483
 
 
8484
 
COMMENT ON COLUMN distributionsourcepackagecache.binpkgnames IS 'The binary package names of binary packages generated from these source packages across all architectures.';
8485
 
 
8486
 
 
8487
 
COMMENT ON COLUMN distributionsourcepackagecache.binpkgsummaries IS 'The aggregated summaries of all the binary packages generated from these source packages in this distribution.';
8488
 
 
8489
 
 
8490
 
COMMENT ON COLUMN distributionsourcepackagecache.binpkgdescriptions IS 'The aggregated description of all the binary packages generated from these source packages in this distribution.';
8491
 
 
8492
 
 
8493
 
COMMENT ON COLUMN distributionsourcepackagecache.changelog IS 'A concatenation of the source package release changelogs for this source package, where the status is not REMOVED.';
8494
 
 
8495
 
 
8496
 
COMMENT ON COLUMN distributionsourcepackagecache.archive IS 'The archive where the source is published.';
8497
 
 
8498
 
 
8499
1926
CREATE SEQUENCE distributionsourcepackagecache_id_seq
8500
 
    START WITH 1
8501
1927
    INCREMENT BY 1
8502
1928
    NO MAXVALUE
8503
1929
    NO MINVALUE
8504
1930
    CACHE 1;
8505
1931
 
8506
 
 
8507
1932
ALTER SEQUENCE distributionsourcepackagecache_id_seq OWNED BY distributionsourcepackagecache.id;
8508
1933
 
8509
 
 
8510
1934
CREATE SEQUENCE distroarchseries_id_seq
8511
 
    START WITH 1
8512
1935
    INCREMENT BY 1
8513
1936
    NO MAXVALUE
8514
1937
    NO MINVALUE
8515
1938
    CACHE 1;
8516
1939
 
8517
 
 
8518
1940
ALTER SEQUENCE distroarchseries_id_seq OWNED BY distroarchseries.id;
8519
1941
 
 
1942
CREATE TABLE distrocomponentuploader (
 
1943
    id integer NOT NULL,
 
1944
    distribution integer NOT NULL,
 
1945
    component integer NOT NULL,
 
1946
    uploader integer NOT NULL,
 
1947
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
 
1948
);
 
1949
 
 
1950
CREATE SEQUENCE distrocomponentuploader_id_seq
 
1951
    INCREMENT BY 1
 
1952
    NO MAXVALUE
 
1953
    NO MINVALUE
 
1954
    CACHE 1;
 
1955
 
 
1956
ALTER SEQUENCE distrocomponentuploader_id_seq OWNED BY distrocomponentuploader.id;
8520
1957
 
8521
1958
CREATE SEQUENCE distroseries_id_seq
8522
 
    START WITH 1
8523
1959
    INCREMENT BY 1
8524
1960
    NO MAXVALUE
8525
1961
    NO MINVALUE
8526
1962
    CACHE 1;
8527
1963
 
8528
 
 
8529
1964
ALTER SEQUENCE distroseries_id_seq OWNED BY distroseries.id;
8530
1965
 
8531
 
 
8532
 
CREATE TABLE distroseriesdifference (
8533
 
    id integer NOT NULL,
8534
 
    derived_series integer NOT NULL,
8535
 
    source_package_name integer NOT NULL,
8536
 
    package_diff integer,
8537
 
    status integer NOT NULL,
8538
 
    difference_type integer NOT NULL,
8539
 
    parent_package_diff integer,
8540
 
    source_version debversion,
8541
 
    parent_source_version debversion,
8542
 
    base_version debversion,
8543
 
    parent_series integer NOT NULL,
8544
 
    CONSTRAINT valid_base_version CHECK (valid_debian_version((base_version)::text)),
8545
 
    CONSTRAINT valid_parent_source_version CHECK (valid_debian_version((parent_source_version)::text)),
8546
 
    CONSTRAINT valid_source_version CHECK (valid_debian_version((source_version)::text))
8547
 
);
8548
 
 
8549
 
 
8550
 
COMMENT ON TABLE distroseriesdifference IS 'A difference of versions for a package in a derived distroseries and its parent distroseries.';
8551
 
 
8552
 
 
8553
 
COMMENT ON COLUMN distroseriesdifference.derived_series IS 'The derived distroseries with the difference from its parent.';
8554
 
 
8555
 
 
8556
 
COMMENT ON COLUMN distroseriesdifference.source_package_name IS 'The name of the source package which is different in the two series.';
8557
 
 
8558
 
 
8559
 
COMMENT ON COLUMN distroseriesdifference.package_diff IS 'The most recent package diff that was created for the base version to derived version.';
8560
 
 
8561
 
 
8562
 
COMMENT ON COLUMN distroseriesdifference.status IS 'A distroseries difference can be needing attention, ignored or resolved.';
8563
 
 
8564
 
 
8565
 
COMMENT ON COLUMN distroseriesdifference.difference_type IS 'The type of difference that this record represents - a package unique to the derived series, or missing, or in both.';
8566
 
 
8567
 
 
8568
 
COMMENT ON COLUMN distroseriesdifference.parent_package_diff IS 'The most recent package diff that was created for the base version to the parent version.';
8569
 
 
8570
 
 
8571
 
COMMENT ON COLUMN distroseriesdifference.source_version IS 'The version of the package in the derived series.';
8572
 
 
8573
 
 
8574
 
COMMENT ON COLUMN distroseriesdifference.parent_source_version IS 'The version of the package in the parent series.';
8575
 
 
8576
 
 
8577
 
COMMENT ON COLUMN distroseriesdifference.base_version IS 'The common base version of the package for the derived and parent series.';
8578
 
 
8579
 
 
8580
 
CREATE SEQUENCE distroseriesdifference_id_seq
8581
 
    START WITH 1
8582
 
    INCREMENT BY 1
8583
 
    NO MAXVALUE
8584
 
    NO MINVALUE
8585
 
    CACHE 1;
8586
 
 
8587
 
 
8588
 
ALTER SEQUENCE distroseriesdifference_id_seq OWNED BY distroseriesdifference.id;
8589
 
 
8590
 
 
8591
 
CREATE TABLE distroseriesdifferencemessage (
8592
 
    id integer NOT NULL,
8593
 
    distro_series_difference integer NOT NULL,
8594
 
    message integer NOT NULL
8595
 
);
8596
 
 
8597
 
 
8598
 
COMMENT ON TABLE distroseriesdifferencemessage IS 'A message/comment on a distro series difference.';
8599
 
 
8600
 
 
8601
 
COMMENT ON COLUMN distroseriesdifferencemessage.distro_series_difference IS 'The distro series difference for this comment.';
8602
 
 
8603
 
 
8604
 
COMMENT ON COLUMN distroseriesdifferencemessage.message IS 'The comment for the distro series difference.';
8605
 
 
8606
 
 
8607
 
CREATE SEQUENCE distroseriesdifferencemessage_id_seq
8608
 
    START WITH 1
8609
 
    INCREMENT BY 1
8610
 
    NO MAXVALUE
8611
 
    NO MINVALUE
8612
 
    CACHE 1;
8613
 
 
8614
 
 
8615
 
ALTER SEQUENCE distroseriesdifferencemessage_id_seq OWNED BY distroseriesdifferencemessage.id;
8616
 
 
8617
 
 
8618
1966
CREATE TABLE distroserieslanguage (
8619
1967
    id integer NOT NULL,
8620
1968
    distroseries integer,
8627
1975
    unreviewed_count integer DEFAULT 0 NOT NULL
8628
1976
);
8629
1977
 
8630
 
 
8631
 
COMMENT ON TABLE distroserieslanguage IS 'A cache of the current translation status of that language across an entire distroseries.';
8632
 
 
8633
 
 
8634
 
COMMENT ON COLUMN distroserieslanguage.currentcount IS 'As per IRosettaStats.';
8635
 
 
8636
 
 
8637
 
COMMENT ON COLUMN distroserieslanguage.updatescount IS 'As per IRosettaStats.';
8638
 
 
8639
 
 
8640
 
COMMENT ON COLUMN distroserieslanguage.rosettacount IS 'As per IRosettaStats.';
8641
 
 
8642
 
 
8643
 
COMMENT ON COLUMN distroserieslanguage.contributorcount IS 'The total number of contributors to the translation of this distroseries into this language.';
8644
 
 
8645
 
 
8646
 
COMMENT ON COLUMN distroserieslanguage.dateupdated IS 'The date these statistucs were last updated.';
8647
 
 
8648
 
 
8649
 
COMMENT ON COLUMN distroserieslanguage.unreviewed_count IS 'As per IRosettaStats.';
8650
 
 
8651
 
 
8652
1978
CREATE SEQUENCE distroserieslanguage_id_seq
8653
 
    START WITH 1
8654
1979
    INCREMENT BY 1
8655
1980
    NO MAXVALUE
8656
1981
    NO MINVALUE
8657
1982
    CACHE 1;
8658
1983
 
8659
 
 
8660
1984
ALTER SEQUENCE distroserieslanguage_id_seq OWNED BY distroserieslanguage.id;
8661
1985
 
8662
 
 
8663
1986
CREATE TABLE distroseriespackagecache (
8664
1987
    id integer NOT NULL,
8665
1988
    distroseries integer NOT NULL,
8673
1996
    archive integer NOT NULL
8674
1997
);
8675
1998
 
8676
 
 
8677
 
COMMENT ON TABLE distroseriespackagecache IS 'A cache of the text associated with binary packages in the distroseries. This table allows for fast queries to find a binary packagename that matches a given text.';
8678
 
 
8679
 
 
8680
 
COMMENT ON COLUMN distroseriespackagecache.distroseries IS 'The distroseries in which we are checking.';
8681
 
 
8682
 
 
8683
 
COMMENT ON COLUMN distroseriespackagecache.binarypackagename IS 'The binary package name for which we are caching details.';
8684
 
 
8685
 
 
8686
 
COMMENT ON COLUMN distroseriespackagecache.name IS 'The binary package name itself. This is just a copy of the value of binarypackagename.name. We have it here so it can be part of the full text index.';
8687
 
 
8688
 
 
8689
 
COMMENT ON COLUMN distroseriespackagecache.summary IS 'A single summary for one of the binary packages of this name in this distroseries. We could potentially have binary packages in different architectures with the same name and different summaries, so this is a way of collapsing to one arbitrarily-chosen one, for display purposes. The chances of actually having different summaries and descriptions is pretty small. It could happen, though, because of the way package superseding works when a package does not build on a specific architecture.';
8690
 
 
8691
 
 
8692
 
COMMENT ON COLUMN distroseriespackagecache.summaries IS 'The aggregated summaries of all the binary packages with this name in this distroseries.';
8693
 
 
8694
 
 
8695
 
COMMENT ON COLUMN distroseriespackagecache.descriptions IS 'The aggregated description of all the binary packages with this name in this distroseries.';
8696
 
 
8697
 
 
8698
 
COMMENT ON COLUMN distroseriespackagecache.archive IS 'The archive where the binary is published.';
8699
 
 
8700
 
 
8701
1999
CREATE SEQUENCE distroseriespackagecache_id_seq
8702
 
    START WITH 1
8703
2000
    INCREMENT BY 1
8704
2001
    NO MAXVALUE
8705
2002
    NO MINVALUE
8706
2003
    CACHE 1;
8707
2004
 
8708
 
 
8709
2005
ALTER SEQUENCE distroseriespackagecache_id_seq OWNED BY distroseriespackagecache.id;
8710
2006
 
8711
 
 
8712
 
CREATE TABLE distroseriesparent (
8713
 
    id integer NOT NULL,
8714
 
    derived_series integer NOT NULL,
8715
 
    parent_series integer NOT NULL,
8716
 
    initialized boolean NOT NULL,
8717
 
    is_overlay boolean DEFAULT false NOT NULL,
8718
 
    component integer,
8719
 
    pocket integer,
8720
 
    ordering integer DEFAULT 1 NOT NULL
8721
 
);
8722
 
 
8723
 
 
8724
 
CREATE SEQUENCE distroseriesparent_id_seq
8725
 
    START WITH 1
8726
 
    INCREMENT BY 1
8727
 
    NO MAXVALUE
8728
 
    NO MINVALUE
8729
 
    CACHE 1;
8730
 
 
8731
 
 
8732
 
ALTER SEQUENCE distroseriesparent_id_seq OWNED BY distroseriesparent.id;
8733
 
 
8734
 
 
8735
2007
CREATE TABLE emailaddress (
8736
2008
    id integer NOT NULL,
8737
2009
    email text NOT NULL,
8742
2014
    CONSTRAINT emailaddress__is_linked__chk CHECK (((person IS NOT NULL) OR (account IS NOT NULL)))
8743
2015
);
8744
2016
 
8745
 
 
8746
 
COMMENT ON COLUMN emailaddress.email IS 'An email address used by a Person. The email address is stored in a casesensitive way, but must be case insensitivly unique.';
8747
 
 
8748
 
 
8749
2017
CREATE SEQUENCE emailaddress_id_seq
8750
 
    START WITH 1
8751
2018
    INCREMENT BY 1
8752
2019
    NO MAXVALUE
8753
2020
    NO MINVALUE
8754
2021
    CACHE 1;
8755
2022
 
8756
 
 
8757
2023
ALTER SEQUENCE emailaddress_id_seq OWNED BY emailaddress.id;
8758
2024
 
8759
 
 
8760
2025
CREATE TABLE entitlement (
8761
2026
    id integer NOT NULL,
8762
2027
    person integer,
8778
2043
    CONSTRAINT only_one_target CHECK ((null_count(ARRAY[person, product, project, distribution]) = 3))
8779
2044
);
8780
2045
 
8781
 
 
8782
 
COMMENT ON TABLE entitlement IS 'Entitlements and usage of privileged features.';
8783
 
 
8784
 
 
8785
 
COMMENT ON COLUMN entitlement.person IS 'The person to which the entitlements apply.';
8786
 
 
8787
 
 
8788
 
COMMENT ON COLUMN entitlement.entitlement_type IS 'The type of this entitlement (e.g. private bug).';
8789
 
 
8790
 
 
8791
 
COMMENT ON COLUMN entitlement.quota IS 'Number of this entitlement allowed.';
8792
 
 
8793
 
 
8794
 
COMMENT ON COLUMN entitlement.amount_used IS 'Quantity of this entitlement allocation that is used.';
8795
 
 
8796
 
 
8797
 
COMMENT ON COLUMN entitlement.date_starts IS 'When this entitlement becomes active.';
8798
 
 
8799
 
 
8800
 
COMMENT ON COLUMN entitlement.date_expires IS 'When this entitlement expires.';
8801
 
 
8802
 
 
8803
 
COMMENT ON COLUMN entitlement.registrant IS 'The person (admin) who registered this entitlement.  It is NULL if imported directly from an external sales system.';
8804
 
 
8805
 
 
8806
 
COMMENT ON COLUMN entitlement.date_created IS 'Creation date of entitlement.';
8807
 
 
8808
 
 
8809
 
COMMENT ON COLUMN entitlement.approved_by IS 'The person who approved this entitlement.  It is NULL if imported directly from an external sales system.';
8810
 
 
8811
 
 
8812
 
COMMENT ON COLUMN entitlement.date_approved IS 'Approval date of entitlement.  It is NULL if imported directly from an external sales system.';
8813
 
 
8814
 
 
8815
 
COMMENT ON COLUMN entitlement.state IS 'The state (REQUESTED, ACTIVE, INACTIVE) of the entitlement.';
8816
 
 
8817
 
 
8818
 
COMMENT ON COLUMN entitlement.whiteboard IS 'A place for administrator notes.';
8819
 
 
8820
 
 
8821
 
COMMENT ON COLUMN entitlement.is_dirty IS 'This entitlement has been modified and the state needst to be updated on the external system.';
8822
 
 
8823
 
 
8824
 
COMMENT ON COLUMN entitlement.distribution IS 'The distribution to which this entitlement applies.';
8825
 
 
8826
 
 
8827
 
COMMENT ON COLUMN entitlement.product IS 'The product to which this entitlement applies.';
8828
 
 
8829
 
 
8830
 
COMMENT ON COLUMN entitlement.project IS 'The project to which this entitlement applies.';
8831
 
 
8832
 
 
8833
2046
CREATE SEQUENCE entitlement_id_seq
8834
 
    START WITH 1
8835
2047
    INCREMENT BY 1
8836
2048
    NO MAXVALUE
8837
2049
    NO MINVALUE
8838
2050
    CACHE 1;
8839
2051
 
8840
 
 
8841
2052
ALTER SEQUENCE entitlement_id_seq OWNED BY entitlement.id;
8842
2053
 
8843
 
 
8844
2054
CREATE VIEW exclusivelocks AS
8845
2055
    SELECT alllocks.procpid, alllocks.usename, alllocks.age, alllocks.relname, alllocks.mode, alllocks.granted, alllocks.current_query FROM alllocks WHERE (alllocks.mode !~~ '%Share%'::text);
8846
2056
 
8847
 
 
8848
2057
CREATE TABLE faq (
8849
2058
    id integer NOT NULL,
8850
2059
    title text NOT NULL,
8860
2069
    CONSTRAINT product_or_distro CHECK (((product IS NULL) <> (distribution IS NULL)))
8861
2070
);
8862
2071
 
8863
 
 
8864
 
COMMENT ON TABLE faq IS 'A technical document containing the answer to a common question.';
8865
 
 
8866
 
 
8867
 
COMMENT ON COLUMN faq.id IS 'The FAQ document sequence number.';
8868
 
 
8869
 
 
8870
 
COMMENT ON COLUMN faq.title IS 'The document title.';
8871
 
 
8872
 
 
8873
 
COMMENT ON COLUMN faq.tags IS 'White-space separated list of tags.';
8874
 
 
8875
 
 
8876
 
COMMENT ON COLUMN faq.content IS 'The content of FAQ. It can also contain a short summary and a link.';
8877
 
 
8878
 
 
8879
 
COMMENT ON COLUMN faq.product IS 'The product to which this document is
8880
 
related. Either "product" or "distribution" must be set.';
8881
 
 
8882
 
 
8883
 
COMMENT ON COLUMN faq.distribution IS 'The distribution to which this document
8884
 
is related. Either "product" or "distribution" must be set.';
8885
 
 
8886
 
 
8887
 
COMMENT ON COLUMN faq.owner IS 'The person who created the document.';
8888
 
 
8889
 
 
8890
 
COMMENT ON COLUMN faq.date_created IS 'The datetime when the document was created.';
8891
 
 
8892
 
 
8893
 
COMMENT ON COLUMN faq.last_updated_by IS 'The person who last modified the document.';
8894
 
 
8895
 
 
8896
 
COMMENT ON COLUMN faq.date_last_updated IS 'The datetime when the document was last modified.';
8897
 
 
8898
 
 
8899
2072
CREATE SEQUENCE faq_id_seq
8900
 
    START WITH 1
8901
2073
    INCREMENT BY 1
8902
2074
    NO MAXVALUE
8903
2075
    NO MINVALUE
8904
2076
    CACHE 1;
8905
2077
 
8906
 
 
8907
2078
ALTER SEQUENCE faq_id_seq OWNED BY faq.id;
8908
2079
 
8909
 
 
8910
2080
CREATE TABLE featuredproject (
8911
2081
    id integer NOT NULL,
8912
2082
    pillar_name integer NOT NULL
8913
2083
);
8914
2084
 
8915
 
 
8916
 
COMMENT ON TABLE featuredproject IS 'A list of featured projects. This table is really just a list of pillarname IDs, if a project''s pillar name is in this list then it is a featured project and will be listed on the Launchpad home page.';
8917
 
 
8918
 
 
8919
 
COMMENT ON COLUMN featuredproject.pillar_name IS 'A reference to PillarName.id';
8920
 
 
8921
 
 
8922
2085
CREATE SEQUENCE featuredproject_id_seq
8923
 
    START WITH 1
8924
2086
    INCREMENT BY 1
8925
2087
    NO MAXVALUE
8926
2088
    NO MINVALUE
8927
2089
    CACHE 1;
8928
2090
 
8929
 
 
8930
2091
ALTER SEQUENCE featuredproject_id_seq OWNED BY featuredproject.id;
8931
2092
 
8932
 
 
8933
2093
CREATE TABLE featureflag (
8934
2094
    scope text NOT NULL,
8935
2095
    priority integer NOT NULL,
8936
2096
    flag text NOT NULL,
8937
 
    value text NOT NULL,
 
2097
    value text,
8938
2098
    date_modified timestamp without time zone DEFAULT timezone('utc'::text, now()) NOT NULL
8939
2099
);
8940
2100
 
8941
 
 
8942
 
COMMENT ON TABLE featureflag IS 'Configuration that varies by the active scope and that 
8943
 
can be changed without restarting Launchpad
8944
 
<https://dev.launchpad.net/LEP/FeatureFlags>';
8945
 
 
8946
 
 
8947
 
COMMENT ON COLUMN featureflag.scope IS 'Scope in which this setting is active';
8948
 
 
8949
 
 
8950
 
COMMENT ON COLUMN featureflag.priority IS 'Higher priority flags override lower';
8951
 
 
8952
 
 
8953
 
COMMENT ON COLUMN featureflag.flag IS 'Name of the flag being controlled';
8954
 
 
8955
 
 
8956
 
CREATE TABLE featureflagchangelogentry (
8957
 
    id integer NOT NULL,
8958
 
    date_changed timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
8959
 
    diff text NOT NULL,
8960
 
    comment text NOT NULL,
8961
 
    person integer NOT NULL
8962
 
);
8963
 
 
8964
 
 
8965
 
CREATE SEQUENCE featureflagchangelogentry_id_seq
8966
 
    START WITH 1
8967
 
    INCREMENT BY 1
8968
 
    NO MAXVALUE
8969
 
    NO MINVALUE
8970
 
    CACHE 1;
8971
 
 
8972
 
 
8973
 
ALTER SEQUENCE featureflagchangelogentry_id_seq OWNED BY featureflagchangelogentry.id;
8974
 
 
8975
 
 
8976
2101
CREATE TABLE flatpackagesetinclusion (
8977
2102
    id integer NOT NULL,
8978
2103
    parent integer NOT NULL,
8979
2104
    child integer NOT NULL
8980
2105
);
8981
2106
 
8982
 
 
8983
 
COMMENT ON TABLE flatpackagesetinclusion IS 'In order to facilitate the querying of set-subset relationships an expanded or flattened representation of the set-subset hierarchy is provided by this table.';
8984
 
 
8985
 
 
8986
 
COMMENT ON COLUMN flatpackagesetinclusion.parent IS 'The package set that is (directly or indirectly) including a subset.';
8987
 
 
8988
 
 
8989
 
COMMENT ON COLUMN flatpackagesetinclusion.child IS 'The package set that is being included as a subset.';
8990
 
 
8991
 
 
8992
2107
CREATE SEQUENCE flatpackagesetinclusion_id_seq
8993
 
    START WITH 1
8994
2108
    INCREMENT BY 1
8995
2109
    NO MAXVALUE
8996
2110
    NO MINVALUE
8997
2111
    CACHE 1;
8998
2112
 
8999
 
 
9000
2113
ALTER SEQUENCE flatpackagesetinclusion_id_seq OWNED BY flatpackagesetinclusion.id;
9001
2114
 
9002
 
 
9003
2115
CREATE TABLE fticache (
9004
2116
    id integer NOT NULL,
9005
2117
    tablename text NOT NULL,
9006
2118
    columns text NOT NULL
9007
2119
);
9008
2120
 
9009
 
 
9010
2121
CREATE SEQUENCE fticache_id_seq
9011
 
    START WITH 1
9012
2122
    INCREMENT BY 1
9013
2123
    NO MAXVALUE
9014
2124
    NO MINVALUE
9015
2125
    CACHE 1;
9016
2126
 
9017
 
 
9018
2127
ALTER SEQUENCE fticache_id_seq OWNED BY fticache.id;
9019
2128
 
9020
 
 
9021
2129
CREATE TABLE gpgkey (
9022
2130
    id integer NOT NULL,
9023
2131
    owner integer NOT NULL,
9032
2140
    CONSTRAINT valid_keyid CHECK (valid_keyid(keyid))
9033
2141
);
9034
2142
 
9035
 
 
9036
 
COMMENT ON TABLE gpgkey IS 'A GPG key belonging to a Person';
9037
 
 
9038
 
 
9039
 
COMMENT ON COLUMN gpgkey.keyid IS 'The 8 character GPG key id, uppercase and no whitespace';
9040
 
 
9041
 
 
9042
 
COMMENT ON COLUMN gpgkey.fingerprint IS 'The 40 character GPG fingerprint, uppercase and no whitespace';
9043
 
 
9044
 
 
9045
 
COMMENT ON COLUMN gpgkey.active IS 'True if this key is active for use in Launchpad context, false could be deactivated by user or revoked in the global key ring.';
9046
 
 
9047
 
 
9048
 
COMMENT ON COLUMN gpgkey.algorithm IS 'The algorithm used to generate this key. Valid values defined in dbschema.GPGKeyAlgorithms';
9049
 
 
9050
 
 
9051
 
COMMENT ON COLUMN gpgkey.keysize IS 'Size of the key in bits, as reported by GPG. We may refuse to deal with keysizes < 768 bits in the future.';
9052
 
 
9053
 
 
9054
 
COMMENT ON COLUMN gpgkey.can_encrypt IS 'Whether the key has been validated for use in encryption (as opposed to just signing)';
9055
 
 
9056
 
 
9057
2143
CREATE SEQUENCE gpgkey_id_seq
9058
 
    START WITH 1
9059
2144
    INCREMENT BY 1
9060
2145
    NO MAXVALUE
9061
2146
    NO MINVALUE
9062
2147
    CACHE 1;
9063
2148
 
9064
 
 
9065
2149
ALTER SEQUENCE gpgkey_id_seq OWNED BY gpgkey.id;
9066
2150
 
9067
 
 
9068
2151
CREATE TABLE hwdevice (
9069
2152
    id integer NOT NULL,
9070
2153
    bus_vendor_id integer NOT NULL,
9074
2157
    submissions integer NOT NULL
9075
2158
);
9076
2159
 
9077
 
 
9078
 
COMMENT ON TABLE hwdevice IS 'Basic information on devices.';
9079
 
 
9080
 
 
9081
 
COMMENT ON COLUMN hwdevice.bus_vendor_id IS 'A reference to a HWVendorID record.';
9082
 
 
9083
 
 
9084
 
COMMENT ON COLUMN hwdevice.bus_product_id IS 'The bus product ID of a device';
9085
 
 
9086
 
 
9087
 
COMMENT ON COLUMN hwdevice.variant IS 'An optional additional description for a device that shares its vendor and product ID with another, technically different, device.';
9088
 
 
9089
 
 
9090
 
COMMENT ON COLUMN hwdevice.name IS 'The human readable product name of the device.';
9091
 
 
9092
 
 
9093
 
COMMENT ON COLUMN hwdevice.submissions IS 'The number of submissions that contain this device.';
9094
 
 
9095
 
 
9096
2160
CREATE SEQUENCE hwdevice_id_seq
9097
 
    START WITH 1
9098
2161
    INCREMENT BY 1
9099
2162
    NO MAXVALUE
9100
2163
    NO MINVALUE
9101
2164
    CACHE 1;
9102
2165
 
9103
 
 
9104
2166
ALTER SEQUENCE hwdevice_id_seq OWNED BY hwdevice.id;
9105
2167
 
9106
 
 
9107
2168
CREATE TABLE hwdeviceclass (
9108
2169
    id integer NOT NULL,
9109
2170
    device integer NOT NULL,
9111
2172
    sub_class integer
9112
2173
);
9113
2174
 
9114
 
 
9115
 
COMMENT ON TABLE hwdeviceclass IS 'Capabilities of a device.';
9116
 
 
9117
 
 
9118
 
COMMENT ON COLUMN hwdeviceclass.device IS 'A reference to a device.';
9119
 
 
9120
 
 
9121
 
COMMENT ON COLUMN hwdeviceclass.main_class IS 'The main class of a device. Legal values are defined by the HWMainClass enumeration.';
9122
 
 
9123
 
 
9124
 
COMMENT ON COLUMN hwdeviceclass.sub_class IS 'The sub-class of a device. Legal values are defined by the HWSubClass enumeration.';
9125
 
 
9126
 
 
9127
2175
CREATE SEQUENCE hwdeviceclass_id_seq
9128
 
    START WITH 1
9129
2176
    INCREMENT BY 1
9130
2177
    NO MAXVALUE
9131
2178
    NO MINVALUE
9132
2179
    CACHE 1;
9133
2180
 
9134
 
 
9135
2181
ALTER SEQUENCE hwdeviceclass_id_seq OWNED BY hwdeviceclass.id;
9136
2182
 
9137
 
 
9138
2183
CREATE TABLE hwdevicedriverlink (
9139
2184
    id integer NOT NULL,
9140
2185
    device integer NOT NULL,
9141
2186
    driver integer
9142
2187
);
9143
2188
 
9144
 
 
9145
 
COMMENT ON TABLE hwdevicedriverlink IS 'Combinations of devices and drivers mentioned in submissions.';
9146
 
 
9147
 
 
9148
 
COMMENT ON COLUMN hwdevicedriverlink.device IS 'The device controlled by the driver.';
9149
 
 
9150
 
 
9151
 
COMMENT ON COLUMN hwdevicedriverlink.driver IS 'The driver controlling the device.';
9152
 
 
9153
 
 
9154
2189
CREATE SEQUENCE hwdevicedriverlink_id_seq
9155
 
    START WITH 1
9156
2190
    INCREMENT BY 1
9157
2191
    NO MAXVALUE
9158
2192
    NO MINVALUE
9159
2193
    CACHE 1;
9160
2194
 
9161
 
 
9162
2195
ALTER SEQUENCE hwdevicedriverlink_id_seq OWNED BY hwdevicedriverlink.id;
9163
2196
 
9164
 
 
9165
2197
CREATE TABLE hwdevicenamevariant (
9166
2198
    id integer NOT NULL,
9167
2199
    vendor_name integer NOT NULL,
9170
2202
    submissions integer NOT NULL
9171
2203
);
9172
2204
 
9173
 
 
9174
 
COMMENT ON TABLE hwdevicenamevariant IS 'Alternative vendor and product names of devices.';
9175
 
 
9176
 
 
9177
 
COMMENT ON COLUMN hwdevicenamevariant.vendor_name IS 'The alternative vendor name.';
9178
 
 
9179
 
 
9180
 
COMMENT ON COLUMN hwdevicenamevariant.product_name IS 'The alternative product name.';
9181
 
 
9182
 
 
9183
 
COMMENT ON COLUMN hwdevicenamevariant.device IS 'The device named by this alternative vendor and product names.';
9184
 
 
9185
 
 
9186
 
COMMENT ON COLUMN hwdevicenamevariant.submissions IS 'The number of submissions containing this alternative vendor and product name.';
9187
 
 
9188
 
 
9189
2205
CREATE SEQUENCE hwdevicenamevariant_id_seq
9190
 
    START WITH 1
9191
2206
    INCREMENT BY 1
9192
2207
    NO MAXVALUE
9193
2208
    NO MINVALUE
9194
2209
    CACHE 1;
9195
2210
 
9196
 
 
9197
2211
ALTER SEQUENCE hwdevicenamevariant_id_seq OWNED BY hwdevicenamevariant.id;
9198
2212
 
9199
 
 
9200
2213
CREATE TABLE hwdmihandle (
9201
2214
    id integer NOT NULL,
9202
2215
    handle integer NOT NULL,
9204
2217
    submission integer
9205
2218
);
9206
2219
 
9207
 
 
9208
 
COMMENT ON TABLE hwdmihandle IS 'A DMI Handle appearing in the DMI data of a submission.';
9209
 
 
9210
 
 
9211
 
COMMENT ON COLUMN hwdmihandle.handle IS 'The ID of the handle.';
9212
 
 
9213
 
 
9214
 
COMMENT ON COLUMN hwdmihandle.type IS 'The type of the handle.';
9215
 
 
9216
 
 
9217
2220
CREATE SEQUENCE hwdmihandle_id_seq
9218
 
    START WITH 1
9219
2221
    INCREMENT BY 1
9220
2222
    NO MAXVALUE
9221
2223
    NO MINVALUE
9222
2224
    CACHE 1;
9223
2225
 
9224
 
 
9225
2226
ALTER SEQUENCE hwdmihandle_id_seq OWNED BY hwdmihandle.id;
9226
2227
 
9227
 
 
9228
2228
CREATE TABLE hwdmivalue (
9229
2229
    id integer NOT NULL,
9230
2230
    key text,
9232
2232
    handle integer NOT NULL
9233
2233
);
9234
2234
 
9235
 
 
9236
 
COMMENT ON TABLE hwdmivalue IS 'Key/value pairs of DMI data of a handle.';
9237
 
 
9238
 
 
9239
 
COMMENT ON COLUMN hwdmivalue.key IS 'The key.';
9240
 
 
9241
 
 
9242
 
COMMENT ON COLUMN hwdmivalue.value IS 'The value';
9243
 
 
9244
 
 
9245
 
COMMENT ON COLUMN hwdmivalue.handle IS 'The handle to which this key/value pair belongs.';
9246
 
 
9247
 
 
9248
2235
CREATE SEQUENCE hwdmivalue_id_seq
9249
 
    START WITH 1
9250
2236
    INCREMENT BY 1
9251
2237
    NO MAXVALUE
9252
2238
    NO MINVALUE
9253
2239
    CACHE 1;
9254
2240
 
9255
 
 
9256
2241
ALTER SEQUENCE hwdmivalue_id_seq OWNED BY hwdmivalue.id;
9257
2242
 
9258
 
 
9259
2243
CREATE TABLE hwdriver (
9260
2244
    id integer NOT NULL,
9261
2245
    package_name text,
9263
2247
    license integer
9264
2248
);
9265
2249
 
9266
 
 
9267
 
COMMENT ON TABLE hwdriver IS 'Information about a driver for a device';
9268
 
 
9269
 
 
9270
 
COMMENT ON COLUMN hwdriver.package_name IS 'The Debian package name a driver is a part of';
9271
 
 
9272
 
 
9273
 
COMMENT ON COLUMN hwdriver.name IS 'The name of a driver.';
9274
 
 
9275
 
 
9276
2250
CREATE SEQUENCE hwdriver_id_seq
9277
 
    START WITH 1
9278
2251
    INCREMENT BY 1
9279
2252
    NO MAXVALUE
9280
2253
    NO MINVALUE
9281
2254
    CACHE 1;
9282
2255
 
9283
 
 
9284
2256
ALTER SEQUENCE hwdriver_id_seq OWNED BY hwdriver.id;
9285
2257
 
9286
 
 
9287
2258
CREATE VIEW hwdrivernames AS
9288
2259
    SELECT DISTINCT ON (hwdriver.name) hwdriver.id, hwdriver.name FROM hwdriver ORDER BY hwdriver.name, hwdriver.id;
9289
2260
 
9290
 
 
9291
 
COMMENT ON VIEW hwdrivernames IS 'A view returning the distinct driver names stored in HWDriver.';
9292
 
 
9293
 
 
9294
 
COMMENT ON COLUMN hwdrivernames.name IS 'The name of a driver.';
9295
 
 
9296
 
 
9297
2261
CREATE VIEW hwdriverpackagenames AS
9298
2262
    SELECT DISTINCT ON (hwdriver.package_name) hwdriver.id, hwdriver.package_name FROM hwdriver ORDER BY hwdriver.package_name, hwdriver.id;
9299
2263
 
9300
 
 
9301
 
COMMENT ON VIEW hwdriverpackagenames IS 'A view returning the distinct Debian package names stored in HWDriver.';
9302
 
 
9303
 
 
9304
 
COMMENT ON COLUMN hwdriverpackagenames.package_name IS 'The Debian package name a driver is a part of.';
9305
 
 
9306
 
 
9307
2264
CREATE TABLE hwsubmission (
9308
2265
    id integer NOT NULL,
9309
2266
    date_created timestamp without time zone NOT NULL,
9320
2277
    raw_emailaddress text
9321
2278
);
9322
2279
 
9323
 
 
9324
 
COMMENT ON TABLE hwsubmission IS 'Raw HWDB submission data';
9325
 
 
9326
 
 
9327
 
COMMENT ON COLUMN hwsubmission.date_created IS 'Date and time of the submission (generated by the client).';
9328
 
 
9329
 
 
9330
 
COMMENT ON COLUMN hwsubmission.date_submitted IS 'Date and time of the submission (generated by the server).';
9331
 
 
9332
 
 
9333
 
COMMENT ON COLUMN hwsubmission.format IS 'The format version of the submitted data, as given by the HWDB client. See HWSubmissionFormat for valid values.';
9334
 
 
9335
 
 
9336
 
COMMENT ON COLUMN hwsubmission.status IS 'The status of the submission. See HWSubmissionProcessingStatus for valid values.';
9337
 
 
9338
 
 
9339
 
COMMENT ON COLUMN hwsubmission.private IS 'If false, the submitter allows public access to the data. If true, the data may be used only for statistical purposes.';
9340
 
 
9341
 
 
9342
 
COMMENT ON COLUMN hwsubmission.contactable IS 'If True, the submitter agrees to be contacted by upstream developers and package maintainers for tests etc.';
9343
 
 
9344
 
 
9345
 
COMMENT ON COLUMN hwsubmission.submission_key IS 'A unique submission ID.';
9346
 
 
9347
 
 
9348
 
COMMENT ON COLUMN hwsubmission.owner IS 'A reference to the Person table: The owner/submitter of the data.';
9349
 
 
9350
 
 
9351
 
COMMENT ON COLUMN hwsubmission.distroarchseries IS 'A reference to the distroarchseries of the submission. This value is null, if the submitted values for distribution, distroseries and architecture do not match an existing entry in the Distroarchseries table.';
9352
 
 
9353
 
 
9354
 
COMMENT ON COLUMN hwsubmission.raw_submission IS 'A reference to a row of LibraryFileAlias. The library file contains the raw submission data.';
9355
 
 
9356
 
 
9357
 
COMMENT ON COLUMN hwsubmission.system_fingerprint IS 'A reference to an entry of the HWDBSystemFingerPrint table. This table stores the system name as returned by HAL (system.vendor, system.product)';
9358
 
 
9359
 
 
9360
 
COMMENT ON COLUMN hwsubmission.raw_emailaddress IS 'The email address of the submitter.';
9361
 
 
9362
 
 
9363
2280
CREATE SEQUENCE hwsubmission_id_seq
9364
 
    START WITH 1
9365
2281
    INCREMENT BY 1
9366
2282
    NO MAXVALUE
9367
2283
    NO MINVALUE
9368
2284
    CACHE 1;
9369
2285
 
9370
 
 
9371
2286
ALTER SEQUENCE hwsubmission_id_seq OWNED BY hwsubmission.id;
9372
2287
 
9373
 
 
9374
2288
CREATE TABLE hwsubmissionbug (
9375
2289
    id integer NOT NULL,
9376
2290
    submission integer NOT NULL,
9377
2291
    bug integer NOT NULL
9378
2292
);
9379
2293
 
9380
 
 
9381
 
COMMENT ON TABLE hwsubmissionbug IS 'Link bugs to HWDB submissions';
9382
 
 
9383
 
 
9384
2294
CREATE SEQUENCE hwsubmissionbug_id_seq
9385
 
    START WITH 1
9386
2295
    INCREMENT BY 1
9387
2296
    NO MAXVALUE
9388
2297
    NO MINVALUE
9389
2298
    CACHE 1;
9390
2299
 
9391
 
 
9392
2300
ALTER SEQUENCE hwsubmissionbug_id_seq OWNED BY hwsubmissionbug.id;
9393
2301
 
9394
 
 
9395
2302
CREATE TABLE hwsubmissiondevice (
9396
2303
    id integer NOT NULL,
9397
2304
    device_driver_link integer NOT NULL,
9400
2307
    hal_device_id integer NOT NULL
9401
2308
);
9402
2309
 
9403
 
 
9404
 
COMMENT ON TABLE hwsubmissiondevice IS 'Links between devices and submissions.';
9405
 
 
9406
 
 
9407
 
COMMENT ON COLUMN hwsubmissiondevice.device_driver_link IS 'The combination (device, driver) mentioned in a submission.';
9408
 
 
9409
 
 
9410
 
COMMENT ON COLUMN hwsubmissiondevice.submission IS 'The submission mentioning this (device, driver) combination.';
9411
 
 
9412
 
 
9413
 
COMMENT ON COLUMN hwsubmissiondevice.parent IS 'The parent device of this device.';
9414
 
 
9415
 
 
9416
 
COMMENT ON COLUMN hwsubmissiondevice.hal_device_id IS 'The ID of the HAL node of this device in the submitted data.';
9417
 
 
9418
 
 
9419
2310
CREATE SEQUENCE hwsubmissiondevice_id_seq
9420
 
    START WITH 1
9421
2311
    INCREMENT BY 1
9422
2312
    NO MAXVALUE
9423
2313
    NO MINVALUE
9424
2314
    CACHE 1;
9425
2315
 
9426
 
 
9427
2316
ALTER SEQUENCE hwsubmissiondevice_id_seq OWNED BY hwsubmissiondevice.id;
9428
2317
 
9429
 
 
9430
2318
CREATE TABLE hwsystemfingerprint (
9431
2319
    id integer NOT NULL,
9432
2320
    fingerprint text NOT NULL
9433
2321
);
9434
2322
 
9435
 
 
9436
 
COMMENT ON TABLE hwsystemfingerprint IS 'A distinct list of "fingerprints" (HAL system.name, system.vendor) from raw submission data';
9437
 
 
9438
 
 
9439
 
COMMENT ON COLUMN hwsystemfingerprint.fingerprint IS 'The fingerprint';
9440
 
 
9441
 
 
9442
2323
CREATE SEQUENCE hwsystemfingerprint_id_seq
9443
 
    START WITH 1
9444
2324
    INCREMENT BY 1
9445
2325
    NO MAXVALUE
9446
2326
    NO MINVALUE
9447
2327
    CACHE 1;
9448
2328
 
9449
 
 
9450
2329
ALTER SEQUENCE hwsystemfingerprint_id_seq OWNED BY hwsystemfingerprint.id;
9451
2330
 
9452
 
 
9453
2331
CREATE TABLE hwtest (
9454
2332
    id integer NOT NULL,
9455
2333
    namespace text,
9457
2335
    version text NOT NULL
9458
2336
);
9459
2337
 
9460
 
 
9461
 
COMMENT ON TABLE hwtest IS 'General information about a device test.';
9462
 
 
9463
 
 
9464
 
COMMENT ON COLUMN hwtest.namespace IS 'The namespace of a test.';
9465
 
 
9466
 
 
9467
 
COMMENT ON COLUMN hwtest.name IS 'The name of a test.';
9468
 
 
9469
 
 
9470
2338
CREATE SEQUENCE hwtest_id_seq
9471
 
    START WITH 1
9472
2339
    INCREMENT BY 1
9473
2340
    NO MAXVALUE
9474
2341
    NO MINVALUE
9475
2342
    CACHE 1;
9476
2343
 
9477
 
 
9478
2344
ALTER SEQUENCE hwtest_id_seq OWNED BY hwtest.id;
9479
2345
 
9480
 
 
9481
2346
CREATE TABLE hwtestanswer (
9482
2347
    id integer NOT NULL,
9483
2348
    test integer NOT NULL,
9491
2356
    CONSTRAINT hwtestanswer_check CHECK (((((choice IS NULL) AND (unit IS NOT NULL)) AND ((intval IS NULL) <> (floatval IS NULL))) OR ((((choice IS NOT NULL) AND (unit IS NULL)) AND (intval IS NULL)) AND (floatval IS NULL))))
9492
2357
);
9493
2358
 
9494
 
 
9495
 
COMMENT ON TABLE hwtestanswer IS 'The answer for a test from a submission. This can be either a multiple choice selection or a numerical value. Exactly one of the columns choice, intval, floatval must be non-null.';
9496
 
 
9497
 
 
9498
 
COMMENT ON COLUMN hwtestanswer.test IS 'The test answered by this answer.';
9499
 
 
9500
 
 
9501
 
COMMENT ON COLUMN hwtestanswer.choice IS 'The selected value of a multiple choice test.';
9502
 
 
9503
 
 
9504
 
COMMENT ON COLUMN hwtestanswer.intval IS 'The integer result of a test with a numerical result.';
9505
 
 
9506
 
 
9507
 
COMMENT ON COLUMN hwtestanswer.floatval IS 'The double precision floating point number result of a test with a numerical result.';
9508
 
 
9509
 
 
9510
 
COMMENT ON COLUMN hwtestanswer.unit IS 'The physical unit of a test with a numerical result.';
9511
 
 
9512
 
 
9513
2359
CREATE SEQUENCE hwtestanswer_id_seq
9514
 
    START WITH 1
9515
2360
    INCREMENT BY 1
9516
2361
    NO MAXVALUE
9517
2362
    NO MINVALUE
9518
2363
    CACHE 1;
9519
2364
 
9520
 
 
9521
2365
ALTER SEQUENCE hwtestanswer_id_seq OWNED BY hwtestanswer.id;
9522
2366
 
9523
 
 
9524
2367
CREATE TABLE hwtestanswerchoice (
9525
2368
    id integer NOT NULL,
9526
2369
    choice text NOT NULL,
9527
2370
    test integer NOT NULL
9528
2371
);
9529
2372
 
9530
 
 
9531
 
COMMENT ON TABLE hwtestanswerchoice IS 'Choice values of multiple choice tests/questions.';
9532
 
 
9533
 
 
9534
 
COMMENT ON COLUMN hwtestanswerchoice.choice IS 'The choice value.';
9535
 
 
9536
 
 
9537
 
COMMENT ON COLUMN hwtestanswerchoice.test IS 'The test this choice belongs to.';
9538
 
 
9539
 
 
9540
2373
CREATE SEQUENCE hwtestanswerchoice_id_seq
9541
 
    START WITH 1
9542
2374
    INCREMENT BY 1
9543
2375
    NO MAXVALUE
9544
2376
    NO MINVALUE
9545
2377
    CACHE 1;
9546
2378
 
9547
 
 
9548
2379
ALTER SEQUENCE hwtestanswerchoice_id_seq OWNED BY hwtestanswerchoice.id;
9549
2380
 
9550
 
 
9551
2381
CREATE TABLE hwtestanswercount (
9552
2382
    id integer NOT NULL,
9553
2383
    test integer NOT NULL,
9560
2390
    CONSTRAINT hwtestanswercount_check CHECK ((((((choice IS NULL) AND (average IS NOT NULL)) AND (sum_square IS NOT NULL)) AND (unit IS NOT NULL)) OR ((((choice IS NOT NULL) AND (average IS NULL)) AND (sum_square IS NULL)) AND (unit IS NULL))))
9561
2391
);
9562
2392
 
9563
 
 
9564
 
COMMENT ON TABLE hwtestanswercount IS 'Accumulated results of tests. Either the column choice or the columns average and sum_square must be non-null.';
9565
 
 
9566
 
 
9567
 
COMMENT ON COLUMN hwtestanswercount.test IS 'The test.';
9568
 
 
9569
 
 
9570
 
COMMENT ON COLUMN hwtestanswercount.distroarchseries IS 'The distroarchseries for which results are accumulated,';
9571
 
 
9572
 
 
9573
 
COMMENT ON COLUMN hwtestanswercount.choice IS 'The choice value of a multiple choice test.';
9574
 
 
9575
 
 
9576
 
COMMENT ON COLUMN hwtestanswercount.average IS 'The average value of the result of a numerical test.';
9577
 
 
9578
 
 
9579
 
COMMENT ON COLUMN hwtestanswercount.sum_square IS 'The sum of the squares of the results of a numerical test.';
9580
 
 
9581
 
 
9582
 
COMMENT ON COLUMN hwtestanswercount.unit IS 'The physical unit of a numerical test result.';
9583
 
 
9584
 
 
9585
 
COMMENT ON COLUMN hwtestanswercount.num_answers IS 'The number of submissions from which the result is accumulated.';
9586
 
 
9587
 
 
9588
2393
CREATE SEQUENCE hwtestanswercount_id_seq
9589
 
    START WITH 1
9590
2394
    INCREMENT BY 1
9591
2395
    NO MAXVALUE
9592
2396
    NO MINVALUE
9593
2397
    CACHE 1;
9594
2398
 
9595
 
 
9596
2399
ALTER SEQUENCE hwtestanswercount_id_seq OWNED BY hwtestanswercount.id;
9597
2400
 
9598
 
 
9599
2401
CREATE TABLE hwtestanswercountdevice (
9600
2402
    id integer NOT NULL,
9601
2403
    answer integer NOT NULL,
9602
2404
    device_driver integer NOT NULL
9603
2405
);
9604
2406
 
9605
 
 
9606
 
COMMENT ON TABLE hwtestanswercountdevice IS 'Association of accumulated test results and device/driver combinations.';
9607
 
 
9608
 
 
9609
 
COMMENT ON COLUMN hwtestanswercountdevice.answer IS 'The test answer.';
9610
 
 
9611
 
 
9612
 
COMMENT ON COLUMN hwtestanswercountdevice.device_driver IS 'The device/driver combination.';
9613
 
 
9614
 
 
9615
2407
CREATE SEQUENCE hwtestanswercountdevice_id_seq
9616
 
    START WITH 1
9617
2408
    INCREMENT BY 1
9618
2409
    NO MAXVALUE
9619
2410
    NO MINVALUE
9620
2411
    CACHE 1;
9621
2412
 
9622
 
 
9623
2413
ALTER SEQUENCE hwtestanswercountdevice_id_seq OWNED BY hwtestanswercountdevice.id;
9624
2414
 
9625
 
 
9626
2415
CREATE TABLE hwtestanswerdevice (
9627
2416
    id integer NOT NULL,
9628
2417
    answer integer NOT NULL,
9629
2418
    device_driver integer NOT NULL
9630
2419
);
9631
2420
 
9632
 
 
9633
 
COMMENT ON TABLE hwtestanswerdevice IS 'Association of test results and device/driver combinations.';
9634
 
 
9635
 
 
9636
 
COMMENT ON COLUMN hwtestanswerdevice.answer IS 'The test answer.';
9637
 
 
9638
 
 
9639
 
COMMENT ON COLUMN hwtestanswerdevice.device_driver IS 'The device/driver combination.';
9640
 
 
9641
 
 
9642
2421
CREATE SEQUENCE hwtestanswerdevice_id_seq
9643
 
    START WITH 1
9644
2422
    INCREMENT BY 1
9645
2423
    NO MAXVALUE
9646
2424
    NO MINVALUE
9647
2425
    CACHE 1;
9648
2426
 
9649
 
 
9650
2427
ALTER SEQUENCE hwtestanswerdevice_id_seq OWNED BY hwtestanswerdevice.id;
9651
2428
 
9652
 
 
9653
2429
CREATE TABLE hwvendorid (
9654
2430
    id integer NOT NULL,
9655
2431
    bus integer NOT NULL,
9657
2433
    vendor_name integer NOT NULL
9658
2434
);
9659
2435
 
9660
 
 
9661
 
COMMENT ON TABLE hwvendorid IS 'Associates tuples (bus, vendor ID for this bus) with vendor names.';
9662
 
 
9663
 
 
9664
 
COMMENT ON COLUMN hwvendorid.bus IS 'The bus.';
9665
 
 
9666
 
 
9667
 
COMMENT ON COLUMN hwvendorid.vendor_id_for_bus IS 'The ID of a vendor for the bus given by column `bus`';
9668
 
 
9669
 
 
9670
2436
CREATE SEQUENCE hwvendorid_id_seq
9671
 
    START WITH 1
9672
2437
    INCREMENT BY 1
9673
2438
    NO MAXVALUE
9674
2439
    NO MINVALUE
9675
2440
    CACHE 1;
9676
2441
 
9677
 
 
9678
2442
ALTER SEQUENCE hwvendorid_id_seq OWNED BY hwvendorid.id;
9679
2443
 
9680
 
 
9681
2444
CREATE TABLE hwvendorname (
9682
2445
    id integer NOT NULL,
9683
2446
    name text NOT NULL
9684
2447
);
9685
2448
 
9686
 
 
9687
 
COMMENT ON TABLE hwvendorname IS 'A list of hardware vendor names.';
9688
 
 
9689
 
 
9690
 
COMMENT ON COLUMN hwvendorname.name IS 'The name of a vendor.';
9691
 
 
9692
 
 
9693
2449
CREATE SEQUENCE hwvendorname_id_seq
9694
 
    START WITH 1
9695
2450
    INCREMENT BY 1
9696
2451
    NO MAXVALUE
9697
2452
    NO MINVALUE
9698
2453
    CACHE 1;
9699
2454
 
9700
 
 
9701
2455
ALTER SEQUENCE hwvendorname_id_seq OWNED BY hwvendorname.id;
9702
2456
 
9703
 
 
9704
 
CREATE TABLE incrementaldiff (
9705
 
    id integer NOT NULL,
9706
 
    diff integer NOT NULL,
9707
 
    branch_merge_proposal integer NOT NULL,
9708
 
    old_revision integer NOT NULL,
9709
 
    new_revision integer NOT NULL
9710
 
);
9711
 
 
9712
 
 
9713
 
COMMENT ON TABLE incrementaldiff IS 'Incremental diffs for merge proposals.';
9714
 
 
9715
 
 
9716
 
COMMENT ON COLUMN incrementaldiff.diff IS 'The contents of the diff.';
9717
 
 
9718
 
 
9719
 
COMMENT ON COLUMN incrementaldiff.branch_merge_proposal IS 'The merge proposal the diff is for.';
9720
 
 
9721
 
 
9722
 
COMMENT ON COLUMN incrementaldiff.old_revision IS 'The revision the diff is from.';
9723
 
 
9724
 
 
9725
 
COMMENT ON COLUMN incrementaldiff.new_revision IS 'The revision the diff is to.';
9726
 
 
9727
 
 
9728
 
CREATE SEQUENCE incrementaldiff_id_seq
9729
 
    START WITH 1
9730
 
    INCREMENT BY 1
9731
 
    NO MAXVALUE
9732
 
    NO MINVALUE
9733
 
    CACHE 1;
9734
 
 
9735
 
 
9736
 
ALTER SEQUENCE incrementaldiff_id_seq OWNED BY incrementaldiff.id;
9737
 
 
9738
 
 
9739
2457
CREATE TABLE ircid (
9740
2458
    id integer NOT NULL,
9741
2459
    person integer NOT NULL,
9743
2461
    nickname text NOT NULL
9744
2462
);
9745
2463
 
9746
 
 
9747
2464
CREATE SEQUENCE ircid_id_seq
9748
 
    START WITH 1
9749
2465
    INCREMENT BY 1
9750
2466
    NO MAXVALUE
9751
2467
    NO MINVALUE
9752
2468
    CACHE 1;
9753
2469
 
9754
 
 
9755
2470
ALTER SEQUENCE ircid_id_seq OWNED BY ircid.id;
9756
2471
 
9757
 
 
9758
2472
CREATE TABLE jabberid (
9759
2473
    id integer NOT NULL,
9760
2474
    person integer NOT NULL,
9761
2475
    jabberid text NOT NULL
9762
2476
);
9763
2477
 
9764
 
 
9765
2478
CREATE SEQUENCE jabberid_id_seq
9766
 
    START WITH 1
9767
2479
    INCREMENT BY 1
9768
2480
    NO MAXVALUE
9769
2481
    NO MINVALUE
9770
2482
    CACHE 1;
9771
2483
 
9772
 
 
9773
2484
ALTER SEQUENCE jabberid_id_seq OWNED BY jabberid.id;
9774
2485
 
9775
 
 
9776
2486
CREATE TABLE job (
9777
2487
    id integer NOT NULL,
9778
2488
    requester integer,
9791
2501
    date_finished timestamp without time zone
9792
2502
);
9793
2503
 
9794
 
 
9795
 
COMMENT ON TABLE job IS 'Common info about a job.';
9796
 
 
9797
 
 
9798
 
COMMENT ON COLUMN job.requester IS 'Ther person who requested this job (if applicable).';
9799
 
 
9800
 
 
9801
 
COMMENT ON COLUMN job.reason IS 'The reason that this job was created (if applicable)';
9802
 
 
9803
 
 
9804
 
COMMENT ON COLUMN job.status IS 'An enum (JobStatus) indicating the job status, one of: new, in-progress, complete, failed, cancelling, cancelled.';
9805
 
 
9806
 
 
9807
 
COMMENT ON COLUMN job.progress IS 'The percentage complete.  Can be NULL for some jobs that do not report progress.';
9808
 
 
9809
 
 
9810
 
COMMENT ON COLUMN job.last_report_seen IS 'The last time the progress was reported.';
9811
 
 
9812
 
 
9813
 
COMMENT ON COLUMN job.next_report_due IS 'The next time a progress report is expected.';
9814
 
 
9815
 
 
9816
 
COMMENT ON COLUMN job.attempt_count IS 'The number of times this job has been attempted.';
9817
 
 
9818
 
 
9819
 
COMMENT ON COLUMN job.max_retries IS 'The maximum number of retries valid for this job.';
9820
 
 
9821
 
 
9822
 
COMMENT ON COLUMN job.log IS 'If provided, this is the tail of the log file being generated by the running job.';
9823
 
 
9824
 
 
9825
 
COMMENT ON COLUMN job.scheduled_start IS 'The time when the job should start';
9826
 
 
9827
 
 
9828
 
COMMENT ON COLUMN job.lease_expires IS 'The time when the lease expires.';
9829
 
 
9830
 
 
9831
 
COMMENT ON COLUMN job.date_created IS 'The time when the job was created.';
9832
 
 
9833
 
 
9834
 
COMMENT ON COLUMN job.date_started IS 'If the job has started, the time when the job started.';
9835
 
 
9836
 
 
9837
 
COMMENT ON COLUMN job.date_finished IS 'If the job has finished, the time when the job finished.';
9838
 
 
9839
 
 
9840
2504
CREATE SEQUENCE job_id_seq
9841
 
    START WITH 1
9842
2505
    INCREMENT BY 1
9843
2506
    NO MAXVALUE
9844
2507
    NO MINVALUE
9845
2508
    CACHE 1;
9846
2509
 
9847
 
 
9848
2510
ALTER SEQUENCE job_id_seq OWNED BY job.id;
9849
2511
 
9850
 
 
9851
2512
CREATE TABLE karma (
9852
2513
    id integer NOT NULL,
9853
2514
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
9856
2517
    product integer,
9857
2518
    distribution integer,
9858
2519
    sourcepackagename integer
9859
 
)
9860
 
WITH (fillfactor=100);
9861
 
 
9862
 
 
9863
 
COMMENT ON TABLE karma IS 'Used to quantify all the ''operations'' a user performs inside the system, which maybe reporting and fixing bugs, uploading packages, end-user support, wiki editting, etc.';
9864
 
 
9865
 
 
9866
 
COMMENT ON COLUMN karma.datecreated IS 'A timestamp for the assignment of this Karma.';
9867
 
 
9868
 
 
9869
 
COMMENT ON COLUMN karma.person IS 'The Person for wich this Karma was assigned.';
9870
 
 
9871
 
 
9872
 
COMMENT ON COLUMN karma.action IS 'A foreign key to the KarmaAction table.';
9873
 
 
9874
 
 
9875
 
COMMENT ON COLUMN karma.product IS 'The Project to which this Product belongs.  An entry on this table with a non-NULL Project and a NULL Product represents the total karma of the person across all products of that project..';
9876
 
 
9877
 
 
9878
 
COMMENT ON COLUMN karma.distribution IS 'The Distribution on which a person performed an action that resulted on this karma.';
9879
 
 
9880
 
 
9881
 
COMMENT ON COLUMN karma.sourcepackagename IS 'The SourcePackageName on which a person performed an action that resulted on this karma.';
9882
 
 
 
2520
);
9883
2521
 
9884
2522
CREATE SEQUENCE karma_id_seq
9885
 
    START WITH 1
9886
2523
    INCREMENT BY 1
9887
2524
    NO MAXVALUE
9888
2525
    NO MINVALUE
9889
2526
    CACHE 1;
9890
2527
 
9891
 
 
9892
2528
ALTER SEQUENCE karma_id_seq OWNED BY karma.id;
9893
2529
 
9894
 
 
9895
2530
CREATE TABLE karmaaction (
9896
2531
    id integer NOT NULL,
9897
2532
    category integer,
9901
2536
    summary text NOT NULL
9902
2537
);
9903
2538
 
9904
 
 
9905
 
COMMENT ON TABLE karmaaction IS 'Stores all the actions that would give karma to the user which performed it.';
9906
 
 
9907
 
 
9908
 
COMMENT ON COLUMN karmaaction.category IS 'A dbschema value used to group actions together.';
9909
 
 
9910
 
 
9911
 
COMMENT ON COLUMN karmaaction.points IS 'The number of points this action is worth of.';
9912
 
 
9913
 
 
9914
 
COMMENT ON COLUMN karmaaction.name IS 'The unique name of this action.';
9915
 
 
9916
 
 
9917
2539
CREATE SEQUENCE karmaaction_id_seq
9918
 
    START WITH 1
9919
2540
    INCREMENT BY 1
9920
2541
    NO MAXVALUE
9921
2542
    NO MINVALUE
9922
2543
    CACHE 1;
9923
2544
 
9924
 
 
9925
2545
ALTER SEQUENCE karmaaction_id_seq OWNED BY karmaaction.id;
9926
2546
 
9927
 
 
9928
2547
CREATE TABLE karmacache (
9929
2548
    id integer NOT NULL,
9930
2549
    person integer NOT NULL,
9940
2559
    CONSTRAINT sourcepackagename_requires_distribution CHECK (((sourcepackagename IS NULL) OR (distribution IS NOT NULL)))
9941
2560
);
9942
2561
 
9943
 
 
9944
 
COMMENT ON TABLE karmacache IS 'Stores a cached value of a person''s karma points, grouped by the action category and the context where that action was performed.';
9945
 
 
9946
 
 
9947
 
COMMENT ON COLUMN karmacache.person IS 'The person which performed the actions of this category, and thus got the karma.';
9948
 
 
9949
 
 
9950
 
COMMENT ON COLUMN karmacache.category IS 'The category of the actions.';
9951
 
 
9952
 
 
9953
 
COMMENT ON COLUMN karmacache.karmavalue IS 'The karma points of all actions of this category performed by this person on this context (product/distribution).';
9954
 
 
9955
 
 
9956
2562
CREATE SEQUENCE karmacache_id_seq
9957
 
    START WITH 1
9958
2563
    INCREMENT BY 1
9959
2564
    NO MAXVALUE
9960
2565
    NO MINVALUE
9961
2566
    CACHE 1;
9962
2567
 
9963
 
 
9964
2568
ALTER SEQUENCE karmacache_id_seq OWNED BY karmacache.id;
9965
2569
 
9966
 
 
9967
2570
CREATE TABLE karmacategory (
9968
2571
    id integer NOT NULL,
9969
2572
    name text NOT NULL,
9971
2574
    summary text NOT NULL
9972
2575
);
9973
2576
 
9974
 
 
9975
 
COMMENT ON TABLE karmacategory IS 'A category of karma. This allows us to
9976
 
present an overall picture of the different areas where a user has been
9977
 
active.';
9978
 
 
9979
 
 
9980
2577
CREATE SEQUENCE karmacategory_id_seq
9981
 
    START WITH 1
9982
2578
    INCREMENT BY 1
9983
2579
    NO MAXVALUE
9984
2580
    NO MINVALUE
9985
2581
    CACHE 1;
9986
2582
 
9987
 
 
9988
2583
ALTER SEQUENCE karmacategory_id_seq OWNED BY karmacategory.id;
9989
2584
 
9990
 
 
9991
2585
CREATE TABLE karmatotalcache (
9992
2586
    id integer NOT NULL,
9993
2587
    person integer NOT NULL,
9994
2588
    karma_total integer NOT NULL
9995
2589
);
9996
2590
 
9997
 
 
9998
2591
CREATE SEQUENCE karmatotalcache_id_seq
9999
 
    START WITH 1
10000
2592
    INCREMENT BY 1
10001
2593
    NO MAXVALUE
10002
2594
    NO MINVALUE
10003
2595
    CACHE 1;
10004
2596
 
10005
 
 
10006
2597
ALTER SEQUENCE karmatotalcache_id_seq OWNED BY karmatotalcache.id;
10007
2598
 
10008
 
 
10009
2599
CREATE TABLE language (
10010
2600
    id integer NOT NULL,
10011
2601
    code text NOT NULL,
10019
2609
    CONSTRAINT valid_language CHECK (((pluralforms IS NULL) = (pluralexpression IS NULL)))
10020
2610
);
10021
2611
 
10022
 
 
10023
 
COMMENT ON TABLE language IS 'A human language.';
10024
 
 
10025
 
 
10026
 
COMMENT ON COLUMN language.code IS 'The ISO 639 code for this language';
10027
 
 
10028
 
 
10029
 
COMMENT ON COLUMN language.englishname IS 'The english name for this language';
10030
 
 
10031
 
 
10032
 
COMMENT ON COLUMN language.nativename IS 'The name of this language in the language itself';
10033
 
 
10034
 
 
10035
 
COMMENT ON COLUMN language.pluralforms IS 'The number of plural forms this language has';
10036
 
 
10037
 
 
10038
 
COMMENT ON COLUMN language.pluralexpression IS 'The plural expression for this language, as used by gettext';
10039
 
 
10040
 
 
10041
 
COMMENT ON COLUMN language.visible IS 'Whether this language should usually be visible or not';
10042
 
 
10043
 
 
10044
 
COMMENT ON COLUMN language.direction IS 'The direction that text is written in this language';
10045
 
 
10046
 
 
10047
 
COMMENT ON COLUMN language.uuid IS 'Mozilla language pack unique ID';
10048
 
 
10049
 
 
10050
2612
CREATE SEQUENCE language_id_seq
10051
 
    START WITH 1
10052
2613
    INCREMENT BY 1
10053
2614
    NO MAXVALUE
10054
2615
    NO MINVALUE
10055
2616
    CACHE 1;
10056
2617
 
10057
 
 
10058
2618
ALTER SEQUENCE language_id_seq OWNED BY language.id;
10059
2619
 
10060
 
 
10061
2620
CREATE TABLE languagepack (
10062
2621
    id integer NOT NULL,
10063
2622
    file integer NOT NULL,
10069
2628
    CONSTRAINT valid_updates CHECK ((((type = 2) AND (updates IS NOT NULL)) OR ((type = 1) AND (updates IS NULL))))
10070
2629
);
10071
2630
 
10072
 
 
10073
 
COMMENT ON TABLE languagepack IS 'Store exported language packs for DistroSeries.';
10074
 
 
10075
 
 
10076
 
COMMENT ON COLUMN languagepack.file IS 'Librarian file where the language pack is stored.';
10077
 
 
10078
 
 
10079
 
COMMENT ON COLUMN languagepack.date_exported IS 'When was exported the language pack.';
10080
 
 
10081
 
 
10082
 
COMMENT ON COLUMN languagepack.date_last_used IS 'When did we stop using the language pack. It''s used to decide whether we can remove it completely from the system. When it''s being used, its value is NULL';
10083
 
 
10084
 
 
10085
 
COMMENT ON COLUMN languagepack.distroseries IS 'The distribution series from where this language pack was exported.';
10086
 
 
10087
 
 
10088
 
COMMENT ON COLUMN languagepack.type IS 'Type of language pack. There are two types available, 1: Full export, 2: Update export based on language_pack_that_updates export.';
10089
 
 
10090
 
 
10091
 
COMMENT ON COLUMN languagepack.updates IS 'The LanguagePack that this one updates.';
10092
 
 
10093
 
 
10094
2631
CREATE SEQUENCE languagepack_id_seq
10095
 
    START WITH 1
10096
2632
    INCREMENT BY 1
10097
2633
    NO MAXVALUE
10098
2634
    NO MINVALUE
10099
2635
    CACHE 1;
10100
2636
 
10101
 
 
10102
2637
ALTER SEQUENCE languagepack_id_seq OWNED BY languagepack.id;
10103
2638
 
10104
 
 
10105
 
CREATE VIEW latestdatabasediskutilization AS
10106
 
    SELECT databasediskutilization.date_created, databasediskutilization.namespace, databasediskutilization.name, databasediskutilization.sub_namespace, databasediskutilization.sub_name, databasediskutilization.kind, databasediskutilization.sort, databasediskutilization.table_len, databasediskutilization.tuple_count, databasediskutilization.tuple_len, databasediskutilization.tuple_percent, databasediskutilization.dead_tuple_count, databasediskutilization.dead_tuple_len, databasediskutilization.dead_tuple_percent, databasediskutilization.free_space, databasediskutilization.free_percent FROM databasediskutilization WHERE (databasediskutilization.date_created = (SELECT max(databasediskutilization.date_created) AS max FROM databasediskutilization));
10107
 
 
10108
 
 
10109
2639
CREATE TABLE launchpaddatabaserevision (
10110
2640
    major integer NOT NULL,
10111
2641
    minor integer NOT NULL,
10112
 
    patch integer NOT NULL,
10113
 
    start_time timestamp without time zone DEFAULT timezone('UTC'::text, transaction_timestamp()),
10114
 
    end_time timestamp without time zone DEFAULT timezone('UTC'::text, statement_timestamp()),
10115
 
    branch_nick text,
10116
 
    revno integer,
10117
 
    revid text
10118
 
);
10119
 
 
10120
 
 
10121
 
COMMENT ON TABLE launchpaddatabaserevision IS 'This table contains a list of the database patches that have been successfully applied to this database.';
10122
 
 
10123
 
 
10124
 
COMMENT ON COLUMN launchpaddatabaserevision.major IS 'Major number. This is the version of the baseline schema the patch was made agains.';
10125
 
 
10126
 
 
10127
 
COMMENT ON COLUMN launchpaddatabaserevision.minor IS 'Minor number. Patches made during development each increment the minor number.';
10128
 
 
10129
 
 
10130
 
COMMENT ON COLUMN launchpaddatabaserevision.patch IS 'The patch number will hopefully always be ''0'', as it exists to support emergency patches made to the production server. eg. If production is running ''4.0.0'' and needs to have a patch applied ASAP, we would create a ''4.0.1'' patch and roll it out. We then may need to refactor all the existing ''4.x.0'' patches.';
10131
 
 
10132
 
 
10133
 
CREATE TABLE launchpaddatabaseupdatelog (
10134
 
    id integer NOT NULL,
10135
 
    start_time timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
10136
 
    end_time timestamp without time zone,
10137
 
    branch_nick text,
10138
 
    revno integer,
10139
 
    revid text
10140
 
);
10141
 
 
10142
 
 
10143
 
CREATE SEQUENCE launchpaddatabaseupdatelog_id_seq
10144
 
    START WITH 1
10145
 
    INCREMENT BY 1
10146
 
    NO MAXVALUE
10147
 
    NO MINVALUE
10148
 
    CACHE 1;
10149
 
 
10150
 
 
10151
 
ALTER SEQUENCE launchpaddatabaseupdatelog_id_seq OWNED BY launchpaddatabaseupdatelog.id;
10152
 
 
 
2642
    patch integer NOT NULL
 
2643
);
10153
2644
 
10154
2645
CREATE TABLE launchpadstatistic (
10155
2646
    id integer NOT NULL,
10158
2649
    dateupdated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL
10159
2650
);
10160
2651
 
10161
 
 
10162
 
COMMENT ON TABLE launchpadstatistic IS 'A store of system-wide statistics or other integer values, keyed by names. The names are unique and the values can be any integer. Each field has a place to store the timestamp when it was last updated, so it is possible to know how far out of date any given statistic is.';
10163
 
 
10164
 
 
10165
2652
CREATE SEQUENCE launchpadstatistic_id_seq
10166
 
    START WITH 1
10167
2653
    INCREMENT BY 1
10168
2654
    NO MAXVALUE
10169
2655
    NO MINVALUE
10170
2656
    CACHE 1;
10171
2657
 
10172
 
 
10173
2658
ALTER SEQUENCE launchpadstatistic_id_seq OWNED BY launchpadstatistic.id;
10174
2659
 
10175
 
 
10176
2660
CREATE SEQUENCE libraryfilealias_id_seq
10177
 
    START WITH 1
10178
2661
    INCREMENT BY 1
10179
2662
    NO MAXVALUE
10180
2663
    NO MINVALUE
10181
2664
    CACHE 1;
10182
2665
 
10183
 
 
10184
2666
ALTER SEQUENCE libraryfilealias_id_seq OWNED BY libraryfilealias.id;
10185
2667
 
10186
 
 
10187
2668
CREATE TABLE libraryfilecontent (
10188
2669
    id integer NOT NULL,
10189
2670
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
10191
2672
    sha1 character(40) NOT NULL,
10192
2673
    md5 character(32) NOT NULL,
10193
2674
    sha256 character(64)
10194
 
)
10195
 
WITH (fillfactor=100);
10196
 
 
10197
 
 
10198
 
COMMENT ON TABLE libraryfilecontent IS 'LibraryFileContent: A librarian file''s contents. The librarian stores files in a safe and transactional way. This table represents the contents of those files within the database.';
10199
 
 
10200
 
 
10201
 
COMMENT ON COLUMN libraryfilecontent.datecreated IS 'The date on which this librarian file was created';
10202
 
 
10203
 
 
10204
 
COMMENT ON COLUMN libraryfilecontent.filesize IS 'The size of the file';
10205
 
 
10206
 
 
10207
 
COMMENT ON COLUMN libraryfilecontent.sha1 IS 'The SHA1 sum of the file''s contents';
10208
 
 
10209
 
 
10210
 
COMMENT ON COLUMN libraryfilecontent.md5 IS 'The MD5 sum of the file''s contents';
10211
 
 
10212
 
 
10213
 
COMMENT ON COLUMN libraryfilecontent.sha256 IS 'The SHA256 sum of the file''s contents';
10214
 
 
 
2675
);
10215
2676
 
10216
2677
CREATE SEQUENCE libraryfilecontent_id_seq
10217
 
    START WITH 1
10218
2678
    INCREMENT BY 1
10219
2679
    NO MAXVALUE
10220
2680
    NO MINVALUE
10221
2681
    CACHE 1;
10222
2682
 
10223
 
 
10224
2683
ALTER SEQUENCE libraryfilecontent_id_seq OWNED BY libraryfilecontent.id;
10225
2684
 
10226
 
 
10227
2685
CREATE TABLE libraryfiledownloadcount (
10228
2686
    id integer NOT NULL,
10229
2687
    libraryfilealias integer NOT NULL,
10232
2690
    country integer
10233
2691
);
10234
2692
 
10235
 
 
10236
 
COMMENT ON TABLE libraryfiledownloadcount IS 'The number of daily downloads for a given LibraryFileAlias.';
10237
 
 
10238
 
 
10239
 
COMMENT ON COLUMN libraryfiledownloadcount.libraryfilealias IS 'The LibraryFileAlias.';
10240
 
 
10241
 
 
10242
 
COMMENT ON COLUMN libraryfiledownloadcount.day IS 'The day of the downloads.';
10243
 
 
10244
 
 
10245
 
COMMENT ON COLUMN libraryfiledownloadcount.count IS 'The number of downloads.';
10246
 
 
10247
 
 
10248
 
COMMENT ON COLUMN libraryfiledownloadcount.country IS 'The country from where the download requests came from.';
10249
 
 
10250
 
 
10251
2693
CREATE SEQUENCE libraryfiledownloadcount_id_seq
10252
 
    START WITH 1
10253
2694
    INCREMENT BY 1
10254
2695
    NO MAXVALUE
10255
2696
    NO MINVALUE
10256
2697
    CACHE 1;
10257
2698
 
10258
 
 
10259
2699
ALTER SEQUENCE libraryfiledownloadcount_id_seq OWNED BY libraryfiledownloadcount.id;
10260
2700
 
10261
 
 
10262
2701
CREATE TABLE logintoken (
10263
2702
    id integer NOT NULL,
10264
2703
    requester integer,
10273
2712
    CONSTRAINT valid_fingerprint CHECK (((fingerprint IS NULL) OR valid_fingerprint(fingerprint)))
10274
2713
);
10275
2714
 
10276
 
 
10277
 
COMMENT ON TABLE logintoken IS 'LoginToken stores one time tokens used by Launchpad for validating email addresses and other tasks that require verifying an email address is valid such as password recovery and account merging. This table will be cleaned occasionally to remove expired tokens. Expiry time is not yet defined.';
10278
 
 
10279
 
 
10280
 
COMMENT ON COLUMN logintoken.requester IS 'The Person that made this request. This will be null for password recovery requests.';
10281
 
 
10282
 
 
10283
 
COMMENT ON COLUMN logintoken.requesteremail IS 'The email address that was used to login when making this request. This provides an audit trail to help the end user confirm that this is a valid request. It is not a link to the EmailAddress table as this may be changed after the request is made. This field will be null for password recovery requests.';
10284
 
 
10285
 
 
10286
 
COMMENT ON COLUMN logintoken.email IS 'The email address that this request was sent to.';
10287
 
 
10288
 
 
10289
 
COMMENT ON COLUMN logintoken.created IS 'The timestamp that this request was made.';
10290
 
 
10291
 
 
10292
 
COMMENT ON COLUMN logintoken.tokentype IS 'The type of request, as per dbschema.TokenType.';
10293
 
 
10294
 
 
10295
 
COMMENT ON COLUMN logintoken.token IS 'The token (not the URL) emailed used to uniquely identify this request. This token will be used to generate a URL that when clicked on will continue a workflow.';
10296
 
 
10297
 
 
10298
 
COMMENT ON COLUMN logintoken.fingerprint IS 'The GPG key fingerprint to be validated on this transaction, it means that a new register will be created relating this given key with the requester in question. The requesteremail still passing for the same usual checks.';
10299
 
 
10300
 
 
10301
 
COMMENT ON COLUMN logintoken.date_consumed IS 'The date and time when this token was consumed. It''s NULL if it hasn''t been consumed yet.';
10302
 
 
10303
 
 
10304
2715
CREATE SEQUENCE logintoken_id_seq
10305
 
    START WITH 1
10306
2716
    INCREMENT BY 1
10307
2717
    NO MAXVALUE
10308
2718
    NO MINVALUE
10309
2719
    CACHE 1;
10310
2720
 
10311
 
 
10312
2721
ALTER SEQUENCE logintoken_id_seq OWNED BY logintoken.id;
10313
2722
 
10314
 
 
10315
2723
CREATE TABLE lp_account (
10316
2724
    id integer NOT NULL,
10317
2725
    openid_identifier text NOT NULL
10318
2726
);
10319
2727
 
10320
 
 
10321
 
CREATE TABLE lp_openididentifier (
10322
 
    identifier text NOT NULL,
10323
 
    account integer NOT NULL,
10324
 
    date_created timestamp without time zone NOT NULL
10325
 
);
10326
 
 
10327
 
 
10328
2728
CREATE TABLE lp_person (
10329
2729
    id integer NOT NULL,
10330
2730
    displayname text,
10365
2765
    account integer
10366
2766
);
10367
2767
 
10368
 
 
10369
2768
CREATE TABLE lp_personlocation (
10370
2769
    id integer NOT NULL,
10371
2770
    date_created timestamp without time zone,
10379
2778
    locked boolean
10380
2779
);
10381
2780
 
10382
 
 
10383
2781
CREATE TABLE lp_teamparticipation (
10384
2782
    id integer NOT NULL,
10385
2783
    team integer,
10386
2784
    person integer
10387
2785
);
10388
2786
 
10389
 
 
10390
2787
CREATE TABLE mailinglist (
10391
2788
    id integer NOT NULL,
10392
2789
    team integer NOT NULL,
10399
2796
    welcome_message text
10400
2797
);
10401
2798
 
10402
 
 
10403
 
COMMENT ON TABLE mailinglist IS 'The mailing list for a team.  Teams may have zero or one mailing list, and a mailing list is associated with exactly one team.  This table manages the state changes that a team mailing list can go through, and it contains information that will be used to instruct Mailman how to create, delete, and modify mailing lists (via XMLRPC).';
10404
 
 
10405
 
 
10406
 
COMMENT ON COLUMN mailinglist.team IS 'The team this mailing list is associated with.';
10407
 
 
10408
 
 
10409
 
COMMENT ON COLUMN mailinglist.registrant IS 'The id of the Person who requested this list be created.';
10410
 
 
10411
 
 
10412
 
COMMENT ON COLUMN mailinglist.date_registered IS 'Date the list was requested to be created';
10413
 
 
10414
 
 
10415
 
COMMENT ON COLUMN mailinglist.reviewer IS 'The id of the Person who reviewed the creation request, or NULL if not yet reviewed.';
10416
 
 
10417
 
 
10418
 
COMMENT ON COLUMN mailinglist.date_reviewed IS 'The date the request was reviewed, or NULL if not yet reviewed.';
10419
 
 
10420
 
 
10421
 
COMMENT ON COLUMN mailinglist.date_activated IS 'The date the list was (last) activated.  If the list is not yet active, this field will be NULL.';
10422
 
 
10423
 
 
10424
 
COMMENT ON COLUMN mailinglist.status IS 'The current status of the mailing list, as a dbschema.MailingListStatus value.';
10425
 
 
10426
 
 
10427
 
COMMENT ON COLUMN mailinglist.welcome_message IS 'Text sent to new members when they are subscribed to the team list.  If NULL, no welcome message is sent.';
10428
 
 
10429
 
 
10430
2799
CREATE SEQUENCE mailinglist_id_seq
10431
 
    START WITH 1
10432
2800
    INCREMENT BY 1
10433
2801
    NO MAXVALUE
10434
2802
    NO MINVALUE
10435
2803
    CACHE 1;
10436
2804
 
10437
 
 
10438
2805
ALTER SEQUENCE mailinglist_id_seq OWNED BY mailinglist.id;
10439
2806
 
 
2807
CREATE TABLE mailinglistban (
 
2808
    id integer NOT NULL,
 
2809
    person integer NOT NULL,
 
2810
    banned_by integer NOT NULL,
 
2811
    date_banned timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
 
2812
    reason text NOT NULL
 
2813
);
 
2814
 
 
2815
CREATE SEQUENCE mailinglistban_id_seq
 
2816
    INCREMENT BY 1
 
2817
    NO MAXVALUE
 
2818
    NO MINVALUE
 
2819
    CACHE 1;
 
2820
 
 
2821
ALTER SEQUENCE mailinglistban_id_seq OWNED BY mailinglistban.id;
10440
2822
 
10441
2823
CREATE TABLE mailinglistsubscription (
10442
2824
    id integer NOT NULL,
10446
2828
    email_address integer
10447
2829
);
10448
2830
 
10449
 
 
10450
 
COMMENT ON TABLE mailinglistsubscription IS 'Track the subscriptions of a person to team mailing lists.';
10451
 
 
10452
 
 
10453
 
COMMENT ON COLUMN mailinglistsubscription.person IS 'The person who is subscribed to the mailing list.';
10454
 
 
10455
 
 
10456
 
COMMENT ON COLUMN mailinglistsubscription.mailing_list IS 'The mailing list this person is subscribed to.';
10457
 
 
10458
 
 
10459
 
COMMENT ON COLUMN mailinglistsubscription.date_joined IS 'The date this person subscribed to the mailing list.';
10460
 
 
10461
 
 
10462
 
COMMENT ON COLUMN mailinglistsubscription.email_address IS 'Which of the person''s email addresses are subscribed to the mailing list.  This may be NULL to indicate that it''s the person''s preferred address.';
10463
 
 
10464
 
 
10465
2831
CREATE SEQUENCE mailinglistsubscription_id_seq
10466
 
    START WITH 1
10467
2832
    INCREMENT BY 1
10468
2833
    NO MAXVALUE
10469
2834
    NO MINVALUE
10470
2835
    CACHE 1;
10471
2836
 
10472
 
 
10473
2837
ALTER SEQUENCE mailinglistsubscription_id_seq OWNED BY mailinglistsubscription.id;
10474
2838
 
 
2839
CREATE TABLE mentoringoffer (
 
2840
    id integer NOT NULL,
 
2841
    owner integer NOT NULL,
 
2842
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
 
2843
    team integer NOT NULL,
 
2844
    bug integer,
 
2845
    specification integer,
 
2846
    CONSTRAINT context_required CHECK (((bug IS NULL) <> (specification IS NULL)))
 
2847
);
 
2848
 
 
2849
CREATE SEQUENCE mentoringoffer_id_seq
 
2850
    INCREMENT BY 1
 
2851
    NO MAXVALUE
 
2852
    NO MINVALUE
 
2853
    CACHE 1;
 
2854
 
 
2855
ALTER SEQUENCE mentoringoffer_id_seq OWNED BY mentoringoffer.id;
10475
2856
 
10476
2857
CREATE TABLE mergedirectivejob (
10477
2858
    id integer NOT NULL,
10480
2861
    action integer NOT NULL
10481
2862
);
10482
2863
 
10483
 
 
10484
 
COMMENT ON TABLE mergedirectivejob IS 'A job to process a merge directive.';
10485
 
 
10486
 
 
10487
 
COMMENT ON COLUMN mergedirectivejob.job IS 'The job associated with this MergeDirectiveJob.';
10488
 
 
10489
 
 
10490
 
COMMENT ON COLUMN mergedirectivejob.merge_directive IS 'Full MIME content of the message containing the merge directive.';
10491
 
 
10492
 
 
10493
 
COMMENT ON COLUMN mergedirectivejob.action IS 'Enumeration of the action to perform with the merge directive; push or create merge proposal.';
10494
 
 
10495
 
 
10496
2864
CREATE SEQUENCE mergedirectivejob_id_seq
10497
 
    START WITH 1
10498
2865
    INCREMENT BY 1
10499
2866
    NO MAXVALUE
10500
2867
    NO MINVALUE
10501
2868
    CACHE 1;
10502
2869
 
10503
 
 
10504
2870
ALTER SEQUENCE mergedirectivejob_id_seq OWNED BY mergedirectivejob.id;
10505
2871
 
10506
 
 
10507
2872
CREATE TABLE message (
10508
2873
    id integer NOT NULL,
10509
2874
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
10513
2878
    distribution integer,
10514
2879
    rfc822msgid text NOT NULL,
10515
2880
    fti ts2.tsvector,
10516
 
    raw integer,
10517
 
    visible boolean DEFAULT true NOT NULL
10518
 
)
10519
 
WITH (fillfactor=100);
10520
 
 
10521
 
 
10522
 
COMMENT ON TABLE message IS 'This table stores a single RFC822-style message. Messages can be threaded (using the parent field). These messages can then be referenced from elsewhere in the system, such as the BugMessage table, integrating messageboard facilities with the rest of The Launchpad.';
10523
 
 
10524
 
 
10525
 
COMMENT ON COLUMN message.subject IS 'The title text of the message, or the subject if it was an email.';
10526
 
 
10527
 
 
10528
 
COMMENT ON COLUMN message.parent IS 'A "parent message". This allows for some level of threading in Messages.';
10529
 
 
10530
 
 
10531
 
COMMENT ON COLUMN message.distribution IS 'The distribution in which this message originated, if we know it.';
10532
 
 
10533
 
 
10534
 
COMMENT ON COLUMN message.raw IS 'The original unadulterated message if it arrived via email. This is required to provide access to the original, undecoded message.';
10535
 
 
 
2881
    raw integer
 
2882
);
10536
2883
 
10537
2884
CREATE SEQUENCE message_id_seq
10538
 
    START WITH 1
10539
2885
    INCREMENT BY 1
10540
2886
    NO MAXVALUE
10541
2887
    NO MINVALUE
10542
2888
    CACHE 1;
10543
2889
 
10544
 
 
10545
2890
ALTER SEQUENCE message_id_seq OWNED BY message.id;
10546
2891
 
10547
 
 
10548
2892
CREATE TABLE messageapproval (
10549
2893
    id integer NOT NULL,
10550
2894
    posted_by integer NOT NULL,
10558
2902
    message integer NOT NULL
10559
2903
);
10560
2904
 
10561
 
 
10562
 
COMMENT ON TABLE messageapproval IS 'Track mailing list postings awaiting approval from the team owner.';
10563
 
 
10564
 
 
10565
 
COMMENT ON COLUMN messageapproval.posted_by IS 'The person who posted the message.';
10566
 
 
10567
 
 
10568
 
COMMENT ON COLUMN messageapproval.mailing_list IS 'The mailing list to which the message was posted.';
10569
 
 
10570
 
 
10571
 
COMMENT ON COLUMN messageapproval.posted_message IS 'Foreign key to libraryfilealias table pointing to where the posted message''s text lives.';
10572
 
 
10573
 
 
10574
 
COMMENT ON COLUMN messageapproval.posted_date IS 'The date the message was posted.';
10575
 
 
10576
 
 
10577
 
COMMENT ON COLUMN messageapproval.status IS 'The status of the posted message.  Values are described in dbschema.PostedMessageStatus.';
10578
 
 
10579
 
 
10580
 
COMMENT ON COLUMN messageapproval.disposed_by IS 'The person who disposed of (i.e. approved or rejected) the message, or NULL if no disposition has yet been made.';
10581
 
 
10582
 
 
10583
 
COMMENT ON COLUMN messageapproval.disposal_date IS 'The date on which this message was disposed, or NULL if no disposition has yet been made.';
10584
 
 
10585
 
 
10586
 
COMMENT ON COLUMN messageapproval.reason IS 'The reason for the current status if any. This information will be displayed to the end user and mailing list moderators need to be aware of this - not a private whiteboard.';
10587
 
 
10588
 
 
10589
 
COMMENT ON COLUMN messageapproval.message IS 'Foreign key to message table pointing to the posted message.';
10590
 
 
10591
 
 
10592
2905
CREATE SEQUENCE messageapproval_id_seq
10593
 
    START WITH 1
10594
2906
    INCREMENT BY 1
10595
2907
    NO MAXVALUE
10596
2908
    NO MINVALUE
10597
2909
    CACHE 1;
10598
2910
 
10599
 
 
10600
2911
ALTER SEQUENCE messageapproval_id_seq OWNED BY messageapproval.id;
10601
2912
 
10602
 
 
10603
2913
CREATE TABLE messagechunk (
10604
2914
    id integer NOT NULL,
10605
2915
    message integer NOT NULL,
10608
2918
    blob integer,
10609
2919
    fti ts2.tsvector,
10610
2920
    CONSTRAINT text_or_content CHECK ((((blob IS NULL) AND (content IS NULL)) OR ((blob IS NULL) <> (content IS NULL))))
10611
 
)
10612
 
WITH (fillfactor=100);
10613
 
 
10614
 
 
10615
 
COMMENT ON TABLE messagechunk IS 'This table stores a single chunk of a possibly multipart message. There will be at least one row in this table for each message. text/* parts are stored in the content column. All other parts are stored in the Librarian and referenced via the blob column. If both content and blob are NULL, then this chunk has been removed (eg. offensive, legal reasons, virus etc.)';
10616
 
 
10617
 
 
10618
 
COMMENT ON COLUMN messagechunk.sequence IS 'Order of a particular chunk. Chunks are orders in ascending order starting from 1.';
10619
 
 
10620
 
 
10621
 
COMMENT ON COLUMN messagechunk.content IS 'Text content for this chunk of the message. This content is full text searchable.';
10622
 
 
10623
 
 
10624
 
COMMENT ON COLUMN messagechunk.blob IS 'Binary content for this chunk of the message.';
10625
 
 
 
2921
);
10626
2922
 
10627
2923
CREATE SEQUENCE messagechunk_id_seq
10628
 
    START WITH 1
10629
2924
    INCREMENT BY 1
10630
2925
    NO MAXVALUE
10631
2926
    NO MINVALUE
10632
2927
    CACHE 1;
10633
2928
 
10634
 
 
10635
2929
ALTER SEQUENCE messagechunk_id_seq OWNED BY messagechunk.id;
10636
2930
 
10637
 
 
10638
2931
CREATE TABLE milestone (
10639
2932
    id integer NOT NULL,
10640
2933
    product integer,
10651
2944
    CONSTRAINT valid_target CHECK ((NOT ((product IS NULL) AND (distribution IS NULL))))
10652
2945
);
10653
2946
 
10654
 
 
10655
 
COMMENT ON TABLE milestone IS 'An identifier that helps a maintainer group together things in some way, e.g. "1.2" could be a Milestone that bazaar developers could use to mark a task as needing fixing in bazaar 1.2.';
10656
 
 
10657
 
 
10658
 
COMMENT ON COLUMN milestone.product IS 'The product for which this is a milestone.';
10659
 
 
10660
 
 
10661
 
COMMENT ON COLUMN milestone.name IS 'The identifier text, e.g. "1.2."';
10662
 
 
10663
 
 
10664
 
COMMENT ON COLUMN milestone.distribution IS 'The distribution to which this milestone belongs, if it is a distro milestone.';
10665
 
 
10666
 
 
10667
 
COMMENT ON COLUMN milestone.dateexpected IS 'If set, the date on which we expect this milestone to be delivered. This allows for optional sorting by date.';
10668
 
 
10669
 
 
10670
 
COMMENT ON COLUMN milestone.active IS 'Whether or not this milestone should be displayed in general listings. All milestones will be visible on the "page of milestones for product foo", but we want to be able to screen out obviously old milestones over time, for the general listings and vocabularies.';
10671
 
 
10672
 
 
10673
 
COMMENT ON COLUMN milestone.productseries IS 'The productseries for which this is a milestone. A milestone on a productseries is ALWAYS also a milestone for the same product. This is because milestones started out on products/distributions but are moving to being on series/distroseries.';
10674
 
 
10675
 
 
10676
 
COMMENT ON COLUMN milestone.distroseries IS 'The distroseries for which this is a milestone. A milestone on a distroseries is ALWAYS also a milestone for the same distribution. This is because milestones started out on products/distributions but are moving to being on series/distroseries.';
10677
 
 
10678
 
 
10679
 
COMMENT ON COLUMN milestone.summary IS 'This can be used to summarize the changes included in past milestones and to document the status of current milestones.';
10680
 
 
10681
 
 
10682
 
COMMENT ON COLUMN milestone.codename IS 'A fun or easier to remember name for the milestone/release.';
10683
 
 
10684
 
 
10685
2947
CREATE SEQUENCE milestone_id_seq
10686
 
    START WITH 1
10687
2948
    INCREMENT BY 1
10688
2949
    NO MAXVALUE
10689
2950
    NO MINVALUE
10690
2951
    CACHE 1;
10691
2952
 
10692
 
 
10693
2953
ALTER SEQUENCE milestone_id_seq OWNED BY milestone.id;
10694
2954
 
10695
 
 
10696
2955
CREATE TABLE mirror (
10697
2956
    id integer NOT NULL,
10698
2957
    owner integer NOT NULL,
10706
2965
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
10707
2966
);
10708
2967
 
10709
 
 
10710
 
COMMENT ON TABLE mirror IS 'Stores general information about mirror sites. Both regular pull mirrors and top tier mirrors are included.';
10711
 
 
10712
 
 
10713
 
COMMENT ON COLUMN mirror.baseurl IS 'The base URL to the mirror, including protocol and optional trailing slash.';
10714
 
 
10715
 
 
10716
 
COMMENT ON COLUMN mirror.country IS 'The country where the mirror is located.';
10717
 
 
10718
 
 
10719
 
COMMENT ON COLUMN mirror.name IS 'Unique name for the mirror, suitable for use in URLs.';
10720
 
 
10721
 
 
10722
 
COMMENT ON COLUMN mirror.description IS 'Description of the mirror.';
10723
 
 
10724
 
 
10725
 
COMMENT ON COLUMN mirror.freshness IS 'dbschema.MirrorFreshness enumeration indicating freshness.';
10726
 
 
10727
 
 
10728
 
COMMENT ON COLUMN mirror.lastcheckeddate IS 'UTC timestamp of when the last check for freshness and consistency was made. NULL indicates no check has ever been made.';
10729
 
 
10730
 
 
10731
 
COMMENT ON COLUMN mirror.approved IS 'True if this mirror has been approved by the Ubuntu/Canonical mirror manager, otherwise False.';
10732
 
 
10733
 
 
10734
2968
CREATE SEQUENCE mirror_id_seq
10735
 
    START WITH 1
10736
2969
    INCREMENT BY 1
10737
2970
    NO MAXVALUE
10738
2971
    NO MINVALUE
10739
2972
    CACHE 1;
10740
2973
 
10741
 
 
10742
2974
ALTER SEQUENCE mirror_id_seq OWNED BY mirror.id;
10743
2975
 
10744
 
 
10745
2976
CREATE TABLE mirrorcdimagedistroseries (
10746
2977
    id integer NOT NULL,
10747
2978
    distribution_mirror integer NOT NULL,
10750
2981
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
10751
2982
);
10752
2983
 
10753
 
 
10754
 
COMMENT ON TABLE mirrorcdimagedistroseries IS 'The mirror of a given CD/DVD image.';
10755
 
 
10756
 
 
10757
 
COMMENT ON COLUMN mirrorcdimagedistroseries.distribution_mirror IS 'The distribution mirror.';
10758
 
 
10759
 
 
10760
 
COMMENT ON COLUMN mirrorcdimagedistroseries.distroseries IS 'The Distribution Release.';
10761
 
 
10762
 
 
10763
 
COMMENT ON COLUMN mirrorcdimagedistroseries.flavour IS 'The Distribution Release Flavour.';
10764
 
 
10765
 
 
10766
2984
CREATE SEQUENCE mirrorcdimagedistroseries_id_seq
10767
 
    START WITH 1
10768
2985
    INCREMENT BY 1
10769
2986
    NO MAXVALUE
10770
2987
    NO MINVALUE
10771
2988
    CACHE 1;
10772
2989
 
10773
 
 
10774
2990
ALTER SEQUENCE mirrorcdimagedistroseries_id_seq OWNED BY mirrorcdimagedistroseries.id;
10775
2991
 
10776
 
 
10777
2992
CREATE TABLE mirrorcontent (
10778
2993
    id integer NOT NULL,
10779
2994
    mirror integer NOT NULL,
10782
2997
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
10783
2998
);
10784
2999
 
10785
 
 
10786
 
COMMENT ON TABLE mirrorcontent IS 'Stores which distroarchseries and compoenents a given mirror has.';
10787
 
 
10788
 
 
10789
 
COMMENT ON COLUMN mirrorcontent.distroarchseries IS 'A distroarchseries that this mirror contains.';
10790
 
 
10791
 
 
10792
 
COMMENT ON COLUMN mirrorcontent.component IS 'What component of the distroarchseries that this mirror contains.';
10793
 
 
10794
 
 
10795
3000
CREATE SEQUENCE mirrorcontent_id_seq
10796
 
    START WITH 1
10797
3001
    INCREMENT BY 1
10798
3002
    NO MAXVALUE
10799
3003
    NO MINVALUE
10800
3004
    CACHE 1;
10801
3005
 
10802
 
 
10803
3006
ALTER SEQUENCE mirrorcontent_id_seq OWNED BY mirrorcontent.id;
10804
3007
 
10805
 
 
10806
3008
CREATE TABLE mirrordistroarchseries (
10807
3009
    id integer NOT NULL,
10808
3010
    distribution_mirror integer NOT NULL,
10813
3015
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
10814
3016
);
10815
3017
 
10816
 
 
10817
 
COMMENT ON TABLE mirrordistroarchseries IS 'The mirror of the packages of a given Distro Arch Release.';
10818
 
 
10819
 
 
10820
 
COMMENT ON COLUMN mirrordistroarchseries.distribution_mirror IS 'The distribution mirror.';
10821
 
 
10822
 
 
10823
 
COMMENT ON COLUMN mirrordistroarchseries.distroarchseries IS 'The distro arch series.';
10824
 
 
10825
 
 
10826
 
COMMENT ON COLUMN mirrordistroarchseries.freshness IS 'The freshness of the mirror, that is, how up-to-date it is.';
10827
 
 
10828
 
 
10829
 
COMMENT ON COLUMN mirrordistroarchseries.pocket IS 'The PackagePublishingPocket.';
10830
 
 
10831
 
 
10832
3018
CREATE SEQUENCE mirrordistroarchseries_id_seq
10833
 
    START WITH 1
10834
3019
    INCREMENT BY 1
10835
3020
    NO MAXVALUE
10836
3021
    NO MINVALUE
10837
3022
    CACHE 1;
10838
3023
 
10839
 
 
10840
3024
ALTER SEQUENCE mirrordistroarchseries_id_seq OWNED BY mirrordistroarchseries.id;
10841
3025
 
10842
 
 
10843
3026
CREATE TABLE mirrordistroseriessource (
10844
3027
    id integer NOT NULL,
10845
3028
    distribution_mirror integer NOT NULL,
10850
3033
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
10851
3034
);
10852
3035
 
10853
 
 
10854
 
COMMENT ON TABLE mirrordistroseriessource IS 'The mirror of a given Distro Release';
10855
 
 
10856
 
 
10857
 
COMMENT ON COLUMN mirrordistroseriessource.distribution_mirror IS 'The distribution mirror.';
10858
 
 
10859
 
 
10860
 
COMMENT ON COLUMN mirrordistroseriessource.distroseries IS 'The Distribution Release.';
10861
 
 
10862
 
 
10863
 
COMMENT ON COLUMN mirrordistroseriessource.freshness IS 'The freshness of the mirror, that is, how up-to-date it is.';
10864
 
 
10865
 
 
10866
3036
CREATE SEQUENCE mirrordistroseriessource_id_seq
10867
 
    START WITH 1
10868
3037
    INCREMENT BY 1
10869
3038
    NO MAXVALUE
10870
3039
    NO MINVALUE
10871
3040
    CACHE 1;
10872
3041
 
10873
 
 
10874
3042
ALTER SEQUENCE mirrordistroseriessource_id_seq OWNED BY mirrordistroseriessource.id;
10875
3043
 
10876
 
 
10877
3044
CREATE TABLE mirrorproberecord (
10878
3045
    id integer NOT NULL,
10879
3046
    distribution_mirror integer NOT NULL,
10881
3048
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL
10882
3049
);
10883
3050
 
10884
 
 
10885
 
COMMENT ON TABLE mirrorproberecord IS 'Records stored when a mirror is probed.';
10886
 
 
10887
 
 
10888
 
COMMENT ON COLUMN mirrorproberecord.distribution_mirror IS 'The DistributionMirror.';
10889
 
 
10890
 
 
10891
 
COMMENT ON COLUMN mirrorproberecord.log_file IS 'The log file of the probe.';
10892
 
 
10893
 
 
10894
 
COMMENT ON COLUMN mirrorproberecord.date_created IS 'The date and time the probe was performed.';
10895
 
 
10896
 
 
10897
3051
CREATE SEQUENCE mirrorproberecord_id_seq
10898
 
    START WITH 1
10899
3052
    INCREMENT BY 1
10900
3053
    NO MAXVALUE
10901
3054
    NO MINVALUE
10902
3055
    CACHE 1;
10903
3056
 
10904
 
 
10905
3057
ALTER SEQUENCE mirrorproberecord_id_seq OWNED BY mirrorproberecord.id;
10906
3058
 
10907
 
 
10908
3059
CREATE TABLE mirrorsourcecontent (
10909
3060
    id integer NOT NULL,
10910
3061
    mirror integer NOT NULL,
10913
3064
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
10914
3065
);
10915
3066
 
10916
 
 
10917
 
COMMENT ON TABLE mirrorsourcecontent IS 'Stores which distroseries and components a given mirror that includes source packages has.';
10918
 
 
10919
 
 
10920
 
COMMENT ON COLUMN mirrorsourcecontent.distroseries IS 'A distroseries that this mirror contains.';
10921
 
 
10922
 
 
10923
 
COMMENT ON COLUMN mirrorsourcecontent.component IS 'What component of the distroseries that this sourcepackage mirror contains.';
10924
 
 
10925
 
 
10926
3067
CREATE SEQUENCE mirrorsourcecontent_id_seq
10927
 
    START WITH 1
10928
3068
    INCREMENT BY 1
10929
3069
    NO MAXVALUE
10930
3070
    NO MINVALUE
10931
3071
    CACHE 1;
10932
3072
 
10933
 
 
10934
3073
ALTER SEQUENCE mirrorsourcecontent_id_seq OWNED BY mirrorsourcecontent.id;
10935
3074
 
10936
 
 
10937
3075
CREATE TABLE nameblacklist (
10938
3076
    id integer NOT NULL,
10939
3077
    regexp text NOT NULL,
10940
3078
    comment text,
10941
 
    admin integer,
10942
3079
    CONSTRAINT valid_regexp CHECK (valid_regexp(regexp))
10943
3080
);
10944
3081
 
10945
 
 
10946
 
COMMENT ON TABLE nameblacklist IS 'A list of regular expressions used to blacklist names.';
10947
 
 
10948
 
 
10949
 
COMMENT ON COLUMN nameblacklist.regexp IS 'A Python regular expression. It will be compiled with the IGNORECASE, UNICODE and VERBOSE flags. The Python search method will be used rather than match, so ^ markers should be used to indicate the start of a string.';
10950
 
 
10951
 
 
10952
 
COMMENT ON COLUMN nameblacklist.comment IS 'An optional comment on why this regexp was entered. It should not be displayed to non-admins and its only purpose is documentation.';
10953
 
 
10954
 
 
10955
3082
CREATE SEQUENCE nameblacklist_id_seq
10956
 
    START WITH 1
10957
3083
    INCREMENT BY 1
10958
3084
    NO MAXVALUE
10959
3085
    NO MINVALUE
10960
3086
    CACHE 1;
10961
3087
 
10962
 
 
10963
3088
ALTER SEQUENCE nameblacklist_id_seq OWNED BY nameblacklist.id;
10964
3089
 
10965
 
 
10966
3090
CREATE TABLE oauthaccesstoken (
10967
3091
    id integer NOT NULL,
10968
3092
    consumer integer NOT NULL,
10980
3104
    CONSTRAINT sourcepackagename_needs_distro CHECK (((sourcepackagename IS NULL) OR (distribution IS NOT NULL)))
10981
3105
);
10982
3106
 
10983
 
 
10984
 
COMMENT ON TABLE oauthaccesstoken IS 'An access token used by the consumer to act on behalf of one of our users.';
10985
 
 
10986
 
 
10987
 
COMMENT ON COLUMN oauthaccesstoken.consumer IS 'The consumer which is going to access the protected resources.';
10988
 
 
10989
 
 
10990
 
COMMENT ON COLUMN oauthaccesstoken.person IS 'The person on whose behalf the
10991
 
consumer will access Launchpad.';
10992
 
 
10993
 
 
10994
 
COMMENT ON COLUMN oauthaccesstoken.permission IS 'The permission given by that person to the consumer.';
10995
 
 
10996
 
 
10997
 
COMMENT ON COLUMN oauthaccesstoken.date_created IS 'The date/time in which the token was created.';
10998
 
 
10999
 
 
11000
 
COMMENT ON COLUMN oauthaccesstoken.date_expires IS 'The date/time in which this token will stop being accepted by Launchpad.';
11001
 
 
11002
 
 
11003
 
COMMENT ON COLUMN oauthaccesstoken.key IS 'This token''s unique key.';
11004
 
 
11005
 
 
11006
 
COMMENT ON COLUMN oauthaccesstoken.secret IS 'The secret used by the consumer (together with the token''s key) to access Launchpad on behalf of the person.';
11007
 
 
11008
 
 
11009
 
COMMENT ON COLUMN oauthaccesstoken.product IS 'The product associated with this token.';
11010
 
 
11011
 
 
11012
 
COMMENT ON COLUMN oauthaccesstoken.project IS 'The project associated with this token.';
11013
 
 
11014
 
 
11015
 
COMMENT ON COLUMN oauthaccesstoken.distribution IS 'The distribution associated with this token.';
11016
 
 
11017
 
 
11018
 
COMMENT ON COLUMN oauthaccesstoken.sourcepackagename IS 'The sourcepackagename associated with this token.';
11019
 
 
11020
 
 
11021
3107
CREATE SEQUENCE oauthaccesstoken_id_seq
11022
 
    START WITH 1
11023
3108
    INCREMENT BY 1
11024
3109
    NO MAXVALUE
11025
3110
    NO MINVALUE
11026
3111
    CACHE 1;
11027
3112
 
11028
 
 
11029
3113
ALTER SEQUENCE oauthaccesstoken_id_seq OWNED BY oauthaccesstoken.id;
11030
3114
 
11031
 
 
11032
3115
CREATE TABLE oauthconsumer (
11033
3116
    id integer NOT NULL,
11034
3117
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
11037
3120
    secret text
11038
3121
);
11039
3122
 
11040
 
 
11041
 
COMMENT ON TABLE oauthconsumer IS 'A third part application that will access Launchpad on behalf of one of our users.';
11042
 
 
11043
 
 
11044
 
COMMENT ON COLUMN oauthconsumer.date_created IS 'The creation date.';
11045
 
 
11046
 
 
11047
 
COMMENT ON COLUMN oauthconsumer.disabled IS 'Is this consumer disabled?';
11048
 
 
11049
 
 
11050
 
COMMENT ON COLUMN oauthconsumer.key IS 'The unique key for this consumer.';
11051
 
 
11052
 
 
11053
 
COMMENT ON COLUMN oauthconsumer.secret IS 'The secret used by this consumer (together with its key) to identify itself with Launchpad.';
11054
 
 
11055
 
 
11056
3123
CREATE SEQUENCE oauthconsumer_id_seq
11057
 
    START WITH 1
11058
3124
    INCREMENT BY 1
11059
3125
    NO MAXVALUE
11060
3126
    NO MINVALUE
11061
3127
    CACHE 1;
11062
3128
 
11063
 
 
11064
3129
ALTER SEQUENCE oauthconsumer_id_seq OWNED BY oauthconsumer.id;
11065
3130
 
11066
 
 
11067
3131
CREATE TABLE oauthnonce (
 
3132
    id integer NOT NULL,
11068
3133
    request_timestamp timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
11069
3134
    nonce text NOT NULL,
11070
3135
    access_token integer NOT NULL
11071
3136
);
11072
3137
 
11073
 
 
11074
 
COMMENT ON TABLE oauthnonce IS 'The unique nonce for any request with a given timestamp and access token. This is generated by the consumer.';
11075
 
 
11076
 
 
11077
 
COMMENT ON COLUMN oauthnonce.request_timestamp IS 'The date and time (as a timestamp) in which the request was made.';
11078
 
 
11079
 
 
11080
 
COMMENT ON COLUMN oauthnonce.nonce IS 'The nonce itself.';
11081
 
 
11082
 
 
11083
 
COMMENT ON COLUMN oauthnonce.access_token IS 'The access token.';
11084
 
 
 
3138
CREATE SEQUENCE oauthnonce_id_seq
 
3139
    INCREMENT BY 1
 
3140
    NO MAXVALUE
 
3141
    NO MINVALUE
 
3142
    CACHE 1;
 
3143
 
 
3144
ALTER SEQUENCE oauthnonce_id_seq OWNED BY oauthnonce.id;
11085
3145
 
11086
3146
CREATE TABLE oauthrequesttoken (
11087
3147
    id integer NOT NULL,
11102
3162
    CONSTRAINT sourcepackagename_needs_distro CHECK (((sourcepackagename IS NULL) OR (distribution IS NOT NULL)))
11103
3163
);
11104
3164
 
11105
 
 
11106
 
COMMENT ON TABLE oauthrequesttoken IS 'A request token which, once authorized by the user, is exchanged for an access token.';
11107
 
 
11108
 
 
11109
 
COMMENT ON COLUMN oauthrequesttoken.consumer IS 'The consumer which is going to access the protected resources.';
11110
 
 
11111
 
 
11112
 
COMMENT ON COLUMN oauthrequesttoken.person IS 'The person who authorized this token.';
11113
 
 
11114
 
 
11115
 
COMMENT ON COLUMN oauthrequesttoken.permission IS 'The permission given by the
11116
 
person to the consumer.';
11117
 
 
11118
 
 
11119
 
COMMENT ON COLUMN oauthrequesttoken.date_expires IS 'When the authorization is to expire.';
11120
 
 
11121
 
 
11122
 
COMMENT ON COLUMN oauthrequesttoken.date_created IS 'The date/time in which the token was created.';
11123
 
 
11124
 
 
11125
 
COMMENT ON COLUMN oauthrequesttoken.date_reviewed IS 'When the authorization request was authorized or rejected by the person.';
11126
 
 
11127
 
 
11128
 
COMMENT ON COLUMN oauthrequesttoken.key IS 'This token''s unique key.';
11129
 
 
11130
 
 
11131
 
COMMENT ON COLUMN oauthrequesttoken.secret IS 'The secret used by the consumer (together with the token''s key) to get an access token once the user has authorized its use.';
11132
 
 
11133
 
 
11134
 
COMMENT ON COLUMN oauthrequesttoken.product IS 'The product associated with this token.';
11135
 
 
11136
 
 
11137
 
COMMENT ON COLUMN oauthrequesttoken.project IS 'The project associated with this token.';
11138
 
 
11139
 
 
11140
 
COMMENT ON COLUMN oauthrequesttoken.distribution IS 'The distribution associated with this token.';
11141
 
 
11142
 
 
11143
 
COMMENT ON COLUMN oauthrequesttoken.sourcepackagename IS 'The sourcepackagename associated with this token.';
11144
 
 
11145
 
 
11146
3165
CREATE SEQUENCE oauthrequesttoken_id_seq
11147
 
    START WITH 1
11148
3166
    INCREMENT BY 1
11149
3167
    NO MAXVALUE
11150
3168
    NO MINVALUE
11151
3169
    CACHE 1;
11152
3170
 
11153
 
 
11154
3171
ALTER SEQUENCE oauthrequesttoken_id_seq OWNED BY oauthrequesttoken.id;
11155
3172
 
11156
 
 
11157
3173
CREATE TABLE officialbugtag (
11158
3174
    id integer NOT NULL,
11159
3175
    tag text NOT NULL,
11163
3179
    CONSTRAINT context_required CHECK (((product IS NOT NULL) OR (distribution IS NOT NULL)))
11164
3180
);
11165
3181
 
11166
 
 
11167
 
COMMENT ON TABLE officialbugtag IS 'Bug tags that have been officially endorced by this product''s or distribution''s lead';
11168
 
 
11169
 
 
11170
3182
CREATE SEQUENCE officialbugtag_id_seq
11171
 
    START WITH 1
11172
3183
    INCREMENT BY 1
11173
3184
    NO MAXVALUE
11174
3185
    NO MINVALUE
11175
3186
    CACHE 1;
11176
3187
 
11177
 
 
11178
3188
ALTER SEQUENCE officialbugtag_id_seq OWNED BY officialbugtag.id;
11179
3189
 
 
3190
CREATE TABLE openidassociation (
 
3191
    server_url character varying(2047) NOT NULL,
 
3192
    handle character varying(255) NOT NULL,
 
3193
    secret bytea,
 
3194
    issued integer,
 
3195
    lifetime integer,
 
3196
    assoc_type character varying(64),
 
3197
    CONSTRAINT secret_length_constraint CHECK ((length(secret) <= 128))
 
3198
);
11180
3199
 
11181
3200
CREATE TABLE openidconsumerassociation (
11182
3201
    server_url character varying(2047) NOT NULL,
11188
3207
    CONSTRAINT secret_length_constraint CHECK ((length(secret) <= 128))
11189
3208
);
11190
3209
 
11191
 
 
11192
3210
CREATE TABLE openidconsumernonce (
11193
3211
    server_url character varying(2047) NOT NULL,
11194
3212
    "timestamp" integer NOT NULL,
11195
3213
    salt character(40) NOT NULL
11196
3214
);
11197
3215
 
11198
 
 
11199
 
CREATE TABLE openididentifier (
11200
 
    identifier text NOT NULL,
 
3216
CREATE TABLE openidrpconfig (
 
3217
    id integer NOT NULL,
 
3218
    trust_root text NOT NULL,
 
3219
    displayname text NOT NULL,
 
3220
    description text NOT NULL,
 
3221
    logo integer,
 
3222
    allowed_sreg text,
 
3223
    creation_rationale integer DEFAULT 13 NOT NULL,
 
3224
    can_query_any_team boolean DEFAULT false NOT NULL,
 
3225
    auto_authorize boolean DEFAULT false NOT NULL
 
3226
);
 
3227
 
 
3228
CREATE SEQUENCE openidrpconfig_id_seq
 
3229
    INCREMENT BY 1
 
3230
    NO MAXVALUE
 
3231
    NO MINVALUE
 
3232
    CACHE 1;
 
3233
 
 
3234
ALTER SEQUENCE openidrpconfig_id_seq OWNED BY openidrpconfig.id;
 
3235
 
 
3236
CREATE TABLE openidrpsummary (
 
3237
    id integer NOT NULL,
11201
3238
    account integer NOT NULL,
 
3239
    openid_identifier text NOT NULL,
 
3240
    trust_root text NOT NULL,
 
3241
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
 
3242
    date_last_used timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
 
3243
    total_logins integer DEFAULT 1 NOT NULL
 
3244
);
 
3245
 
 
3246
CREATE SEQUENCE openidrpsummary_id_seq
 
3247
    INCREMENT BY 1
 
3248
    NO MAXVALUE
 
3249
    NO MINVALUE
 
3250
    CACHE 1;
 
3251
 
 
3252
ALTER SEQUENCE openidrpsummary_id_seq OWNED BY openidrpsummary.id;
 
3253
 
 
3254
CREATE TABLE packagebugsupervisor (
 
3255
    id integer NOT NULL,
 
3256
    distribution integer NOT NULL,
 
3257
    sourcepackagename integer NOT NULL,
 
3258
    bug_supervisor integer NOT NULL,
11202
3259
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
11203
3260
);
11204
3261
 
11205
 
 
11206
 
COMMENT ON TABLE openididentifier IS 'OpenId Identifiers that can be used to log into an Account.';
11207
 
 
11208
 
 
11209
 
COMMENT ON COLUMN openididentifier.identifier IS 'OpenId Identifier. This should be a URL, but is currently just a token that can be used to generate the Identity URL for the Canonical SSO OpenId Provider.';
11210
 
 
 
3262
CREATE SEQUENCE packagebugsupervisor_id_seq
 
3263
    INCREMENT BY 1
 
3264
    NO MAXVALUE
 
3265
    NO MINVALUE
 
3266
    CACHE 1;
 
3267
 
 
3268
ALTER SEQUENCE packagebugsupervisor_id_seq OWNED BY packagebugsupervisor.id;
11211
3269
 
11212
3270
CREATE TABLE packagebuild (
11213
3271
    id integer NOT NULL,
11218
3276
    dependencies text
11219
3277
);
11220
3278
 
11221
 
 
11222
 
COMMENT ON TABLE packagebuild IS 'PackageBuild: This table stores the information common to build farm jobs that build source or binary packages.';
11223
 
 
11224
 
 
11225
 
COMMENT ON COLUMN packagebuild.build_farm_job IS 'Points to the build farm job with the base information.';
11226
 
 
11227
 
 
11228
 
COMMENT ON COLUMN packagebuild.archive IS 'Targeted archive for this package build.';
11229
 
 
11230
 
 
11231
 
COMMENT ON COLUMN packagebuild.pocket IS 'Stores the target pocket identifier for this package build.';
11232
 
 
11233
 
 
11234
 
COMMENT ON COLUMN packagebuild.upload_log IS 'Reference to a LibraryFileAlias containing the upload log messages generated while processing the packages resulting from this package build.';
11235
 
 
11236
 
 
11237
 
COMMENT ON COLUMN packagebuild.dependencies IS 'Contains a debian-like dependency line specifying the current missing-dependencies for this package.';
11238
 
 
11239
 
 
11240
3279
CREATE SEQUENCE packagebuild_id_seq
11241
 
    START WITH 1
11242
3280
    INCREMENT BY 1
11243
3281
    NO MAXVALUE
11244
3282
    NO MINVALUE
11245
3283
    CACHE 1;
11246
3284
 
11247
 
 
11248
3285
ALTER SEQUENCE packagebuild_id_seq OWNED BY packagebuild.id;
11249
3286
 
11250
 
 
11251
 
CREATE TABLE packagecopyjob (
11252
 
    id integer NOT NULL,
11253
 
    job integer NOT NULL,
11254
 
    source_archive integer NOT NULL,
11255
 
    target_archive integer NOT NULL,
11256
 
    target_distroseries integer,
11257
 
    job_type integer NOT NULL,
11258
 
    json_data text,
11259
 
    package_name text NOT NULL,
11260
 
    copy_policy integer
11261
 
);
11262
 
 
11263
 
 
11264
 
CREATE SEQUENCE packagecopyjob_id_seq
11265
 
    START WITH 1
11266
 
    INCREMENT BY 1
11267
 
    NO MAXVALUE
11268
 
    NO MINVALUE
11269
 
    CACHE 1;
11270
 
 
11271
 
 
11272
 
ALTER SEQUENCE packagecopyjob_id_seq OWNED BY packagecopyjob.id;
11273
 
 
11274
 
 
11275
3287
CREATE TABLE packagecopyrequest (
11276
3288
    id integer NOT NULL,
11277
3289
    target_archive integer NOT NULL,
11291
3303
    date_completed timestamp without time zone
11292
3304
);
11293
3305
 
11294
 
 
11295
 
COMMENT ON TABLE packagecopyrequest IS 'PackageCopyRequest: A table that captures the status and the details of an inter-archive package copy operation.';
11296
 
 
11297
 
 
11298
 
COMMENT ON COLUMN packagecopyrequest.target_archive IS 'The archive to which packages will be copied.';
11299
 
 
11300
 
 
11301
 
COMMENT ON COLUMN packagecopyrequest.target_distroseries IS 'The target distroseries.';
11302
 
 
11303
 
 
11304
 
COMMENT ON COLUMN packagecopyrequest.target_component IS 'The target component.';
11305
 
 
11306
 
 
11307
 
COMMENT ON COLUMN packagecopyrequest.target_pocket IS 'The target pocket.';
11308
 
 
11309
 
 
11310
 
COMMENT ON COLUMN packagecopyrequest.source_archive IS 'The archive from which packages are to be copied.';
11311
 
 
11312
 
 
11313
 
COMMENT ON COLUMN packagecopyrequest.source_distroseries IS 'The distroseries to which the packages to be copied belong in the source archive.';
11314
 
 
11315
 
 
11316
 
COMMENT ON COLUMN packagecopyrequest.source_component IS 'The component to which the packages to be copied belong in the source archive.';
11317
 
 
11318
 
 
11319
 
COMMENT ON COLUMN packagecopyrequest.source_pocket IS 'The pocket for the packages to be copied.';
11320
 
 
11321
 
 
11322
 
COMMENT ON COLUMN packagecopyrequest.requester IS 'The person who requested the archive operation.';
11323
 
 
11324
 
 
11325
 
COMMENT ON COLUMN packagecopyrequest.status IS 'Archive operation status, may be one of: new, in-progress, complete, failed, cancelling, cancelled.';
11326
 
 
11327
 
 
11328
 
COMMENT ON COLUMN packagecopyrequest.reason IS 'The reason why this copy operation was requested.';
11329
 
 
11330
 
 
11331
 
COMMENT ON COLUMN packagecopyrequest.date_created IS 'Date of creation for this archive operation.';
11332
 
 
11333
 
 
11334
 
COMMENT ON COLUMN packagecopyrequest.date_started IS 'Start date/time of this archive operation.';
11335
 
 
11336
 
 
11337
 
COMMENT ON COLUMN packagecopyrequest.date_completed IS 'When did this archive operation conclude?';
11338
 
 
11339
 
 
11340
3306
CREATE SEQUENCE packagecopyrequest_id_seq
11341
 
    START WITH 1
11342
3307
    INCREMENT BY 1
11343
3308
    NO MAXVALUE
11344
3309
    NO MINVALUE
11345
3310
    CACHE 1;
11346
3311
 
11347
 
 
11348
3312
ALTER SEQUENCE packagecopyrequest_id_seq OWNED BY packagecopyrequest.id;
11349
3313
 
11350
 
 
11351
3314
CREATE TABLE packagediff (
11352
3315
    id integer NOT NULL,
11353
3316
    date_requested timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
11360
3323
    CONSTRAINT distinct_sources CHECK ((from_source <> to_source))
11361
3324
);
11362
3325
 
11363
 
 
11364
 
COMMENT ON TABLE packagediff IS 'This table stores diffs bettwen two scpecific SourcePackageRelease versions.';
11365
 
 
11366
 
 
11367
 
COMMENT ON COLUMN packagediff.date_requested IS 'Instant when the diff was requested.';
11368
 
 
11369
 
 
11370
 
COMMENT ON COLUMN packagediff.requester IS 'The Person responsible for the request.';
11371
 
 
11372
 
 
11373
 
COMMENT ON COLUMN packagediff.from_source IS 'The SourcePackageRelease to diff from.';
11374
 
 
11375
 
 
11376
 
COMMENT ON COLUMN packagediff.to_source IS 'The SourcePackageRelease to diff to.';
11377
 
 
11378
 
 
11379
 
COMMENT ON COLUMN packagediff.date_fulfilled IS 'Instant when the diff was completed.';
11380
 
 
11381
 
 
11382
 
COMMENT ON COLUMN packagediff.diff_content IS 'LibraryFileAlias containing the th diff results.';
11383
 
 
11384
 
 
11385
 
COMMENT ON COLUMN packagediff.status IS 'Request status, PENDING(0) when created then goes to COMPLETED(1) or FAILED(2), both terminal status where diff_content and date_fulfilled will contain the results of the request.';
11386
 
 
11387
 
 
11388
3326
CREATE SEQUENCE packagediff_id_seq
11389
 
    START WITH 1
11390
3327
    INCREMENT BY 1
11391
3328
    NO MAXVALUE
11392
3329
    NO MINVALUE
11393
3330
    CACHE 1;
11394
3331
 
11395
 
 
11396
3332
ALTER SEQUENCE packagediff_id_seq OWNED BY packagediff.id;
11397
3333
 
 
3334
CREATE TABLE packageselection (
 
3335
    id integer NOT NULL,
 
3336
    distroseries integer NOT NULL,
 
3337
    sourcepackagename integer,
 
3338
    binarypackagename integer,
 
3339
    action integer NOT NULL,
 
3340
    component integer,
 
3341
    section integer,
 
3342
    priority integer,
 
3343
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
 
3344
);
 
3345
 
 
3346
CREATE SEQUENCE packageselection_id_seq
 
3347
    INCREMENT BY 1
 
3348
    NO MAXVALUE
 
3349
    NO MINVALUE
 
3350
    CACHE 1;
 
3351
 
 
3352
ALTER SEQUENCE packageselection_id_seq OWNED BY packageselection.id;
11398
3353
 
11399
3354
CREATE TABLE packageset (
11400
3355
    id integer NOT NULL,
11407
3362
    CONSTRAINT packageset_name_check CHECK (valid_name(name))
11408
3363
);
11409
3364
 
11410
 
 
11411
 
COMMENT ON TABLE packageset IS 'Package sets facilitate the grouping of packages (in a given distro series) for purposes like the control of upload permissions, etc.';
11412
 
 
11413
 
 
11414
 
COMMENT ON COLUMN packageset.date_created IS 'Date and time of creation.';
11415
 
 
11416
 
 
11417
 
COMMENT ON COLUMN packageset.owner IS 'The Person or team who owns the package
11418
 
set group.';
11419
 
 
11420
 
 
11421
 
COMMENT ON COLUMN packageset.name IS 'The name for the package set on hand.';
11422
 
 
11423
 
 
11424
 
COMMENT ON COLUMN packageset.description IS 'The description for the package set on hand.';
11425
 
 
11426
 
 
11427
 
COMMENT ON COLUMN packageset.packagesetgroup IS 'The group this package set is affiliated with.';
11428
 
 
11429
 
 
11430
 
COMMENT ON COLUMN packageset.distroseries IS 'The distro series this package set belongs to.';
11431
 
 
11432
 
 
11433
3365
CREATE SEQUENCE packageset_id_seq
11434
 
    START WITH 1
11435
3366
    INCREMENT BY 1
11436
3367
    NO MAXVALUE
11437
3368
    NO MINVALUE
11438
3369
    CACHE 1;
11439
3370
 
11440
 
 
11441
3371
ALTER SEQUENCE packageset_id_seq OWNED BY packageset.id;
11442
3372
 
11443
 
 
11444
3373
CREATE TABLE packagesetgroup (
11445
3374
    id integer NOT NULL,
11446
3375
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
11447
3376
    owner integer NOT NULL
11448
3377
);
11449
3378
 
11450
 
 
11451
 
COMMENT ON TABLE packagesetgroup IS 'Package set groups keep track of equivalent package sets across distro series boundaries.';
11452
 
 
11453
 
 
11454
3379
CREATE SEQUENCE packagesetgroup_id_seq
11455
 
    START WITH 1
11456
3380
    INCREMENT BY 1
11457
3381
    NO MAXVALUE
11458
3382
    NO MINVALUE
11459
3383
    CACHE 1;
11460
3384
 
11461
 
 
11462
3385
ALTER SEQUENCE packagesetgroup_id_seq OWNED BY packagesetgroup.id;
11463
3386
 
11464
 
 
11465
3387
CREATE TABLE packagesetinclusion (
11466
3388
    id integer NOT NULL,
11467
3389
    parent integer NOT NULL,
11468
3390
    child integer NOT NULL
11469
3391
);
11470
3392
 
11471
 
 
11472
 
COMMENT ON TABLE packagesetinclusion IS 'sets may form a set-subset hierarchy; this table facilitates the definition of these set-subset relationships.';
11473
 
 
11474
 
 
11475
 
COMMENT ON COLUMN packagesetinclusion.parent IS 'The package set that is including a subset.';
11476
 
 
11477
 
 
11478
 
COMMENT ON COLUMN packagesetinclusion.child IS 'The package set that is being included as a subset.';
11479
 
 
11480
 
 
11481
3393
CREATE SEQUENCE packagesetinclusion_id_seq
11482
3394
    START WITH 1
11483
3395
    INCREMENT BY 1
11485
3397
    NO MINVALUE
11486
3398
    CACHE 1;
11487
3399
 
11488
 
 
11489
3400
ALTER SEQUENCE packagesetinclusion_id_seq OWNED BY packagesetinclusion.id;
11490
3401
 
11491
 
 
11492
3402
CREATE TABLE packagesetsources (
11493
3403
    id integer NOT NULL,
11494
3404
    packageset integer NOT NULL,
11495
3405
    sourcepackagename integer NOT NULL
11496
3406
);
11497
3407
 
11498
 
 
11499
 
COMMENT ON TABLE packagesetsources IS 'This table associates package sets and source package names.';
11500
 
 
11501
 
 
11502
 
COMMENT ON COLUMN packagesetsources.packageset IS 'The associated package set.';
11503
 
 
11504
 
 
11505
 
COMMENT ON COLUMN packagesetsources.sourcepackagename IS 'The associated source package name.';
11506
 
 
11507
 
 
11508
3408
CREATE SEQUENCE packagesetsources_id_seq
11509
 
    START WITH 1
11510
3409
    INCREMENT BY 1
11511
3410
    NO MAXVALUE
11512
3411
    NO MINVALUE
11513
3412
    CACHE 1;
11514
3413
 
11515
 
 
11516
3414
ALTER SEQUENCE packagesetsources_id_seq OWNED BY packagesetsources.id;
11517
3415
 
11518
 
 
11519
3416
CREATE TABLE packageupload (
11520
3417
    id integer NOT NULL,
11521
3418
    status integer DEFAULT 0 NOT NULL,
11524
3421
    changesfile integer,
11525
3422
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
11526
3423
    signing_key integer,
11527
 
    archive integer NOT NULL,
11528
 
    package_copy_job integer
 
3424
    archive integer NOT NULL
11529
3425
);
11530
3426
 
11531
 
 
11532
 
COMMENT ON TABLE packageupload IS 'An upload. This table stores information pertaining to uploads to a given DistroSeries/Archive.';
11533
 
 
11534
 
 
11535
 
COMMENT ON COLUMN packageupload.status IS 'This is an integer field containing the current status of the upload. Possible values are given by the UploadStatus class in dbschema.py';
11536
 
 
11537
 
 
11538
 
COMMENT ON COLUMN packageupload.distroseries IS 'This integer field refers to the DistroSeries to which this upload is targeted';
11539
 
 
11540
 
 
11541
 
COMMENT ON COLUMN packageupload.pocket IS 'This is the pocket the upload is targeted at.';
11542
 
 
11543
 
 
11544
 
COMMENT ON COLUMN packageupload.changesfile IS 'The changes file associated with this upload. It is null for records refering to a delayed-copy.';
11545
 
 
11546
 
 
11547
 
COMMENT ON COLUMN packageupload.archive IS 'The archive to which this upload is targetted.';
11548
 
 
11549
 
 
11550
3427
CREATE SEQUENCE packageupload_id_seq
11551
 
    START WITH 1
11552
3428
    INCREMENT BY 1
11553
3429
    NO MAXVALUE
11554
3430
    NO MINVALUE
11555
3431
    CACHE 1;
11556
3432
 
11557
 
 
11558
3433
ALTER SEQUENCE packageupload_id_seq OWNED BY packageupload.id;
11559
3434
 
11560
 
 
11561
3435
CREATE TABLE packageuploadbuild (
11562
3436
    id integer NOT NULL,
11563
3437
    packageupload integer NOT NULL,
11565
3439
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
11566
3440
);
11567
3441
 
11568
 
 
11569
 
COMMENT ON TABLE packageuploadbuild IS 'An upload binary build. This table stores information pertaining to the builds in a package upload.';
11570
 
 
11571
 
 
11572
 
COMMENT ON COLUMN packageuploadbuild.packageupload IS 'This integer field refers to the PackageUpload row that this source belongs to.';
11573
 
 
11574
 
 
11575
 
COMMENT ON COLUMN packageuploadbuild.build IS 'This integer field refers to the Build record related to this upload.';
11576
 
 
11577
 
 
11578
3442
CREATE SEQUENCE packageuploadbuild_id_seq
11579
 
    START WITH 1
11580
3443
    INCREMENT BY 1
11581
3444
    NO MAXVALUE
11582
3445
    NO MINVALUE
11583
3446
    CACHE 1;
11584
3447
 
11585
 
 
11586
3448
ALTER SEQUENCE packageuploadbuild_id_seq OWNED BY packageuploadbuild.id;
11587
3449
 
11588
 
 
11589
3450
CREATE TABLE packageuploadcustom (
11590
3451
    id integer NOT NULL,
11591
3452
    packageupload integer NOT NULL,
11594
3455
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
11595
3456
);
11596
3457
 
11597
 
 
11598
 
COMMENT ON TABLE packageuploadcustom IS 'An uploaded custom format file. This table stores information pertaining to the custom upload formats in a package upload.';
11599
 
 
11600
 
 
11601
 
COMMENT ON COLUMN packageuploadcustom.packageupload IS 'The PackageUpload row this refers to.';
11602
 
 
11603
 
 
11604
 
COMMENT ON COLUMN packageuploadcustom.customformat IS 'The format of this particular custom uploaded file.';
11605
 
 
11606
 
 
11607
 
COMMENT ON COLUMN packageuploadcustom.libraryfilealias IS 'The actual file as a librarian alias.';
11608
 
 
11609
 
 
11610
3458
CREATE SEQUENCE packageuploadcustom_id_seq
11611
 
    START WITH 1
11612
3459
    INCREMENT BY 1
11613
3460
    NO MAXVALUE
11614
3461
    NO MINVALUE
11615
3462
    CACHE 1;
11616
3463
 
11617
 
 
11618
3464
ALTER SEQUENCE packageuploadcustom_id_seq OWNED BY packageuploadcustom.id;
11619
3465
 
11620
 
 
11621
3466
CREATE TABLE packageuploadsource (
11622
3467
    id integer NOT NULL,
11623
3468
    packageupload integer NOT NULL,
11625
3470
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
11626
3471
);
11627
3472
 
11628
 
 
11629
 
COMMENT ON TABLE packageuploadsource IS 'Link between an upload and a source package. This table stores information pertaining to the source files in a package upload.';
11630
 
 
11631
 
 
11632
 
COMMENT ON COLUMN packageuploadsource.packageupload IS 'This integer field refers to the PackageUpload row that this source belongs to.';
11633
 
 
11634
 
 
11635
 
COMMENT ON COLUMN packageuploadsource.sourcepackagerelease IS 'This integer field refers to the SourcePackageRelease record related to this upload.';
11636
 
 
11637
 
 
11638
3473
CREATE SEQUENCE packageuploadsource_id_seq
11639
 
    START WITH 1
11640
3474
    INCREMENT BY 1
11641
3475
    NO MAXVALUE
11642
3476
    NO MINVALUE
11643
3477
    CACHE 1;
11644
3478
 
11645
 
 
11646
3479
ALTER SEQUENCE packageuploadsource_id_seq OWNED BY packageuploadsource.id;
11647
3480
 
11648
 
 
11649
3481
CREATE TABLE packaging (
11650
3482
    packaging integer NOT NULL,
11651
3483
    id integer DEFAULT nextval(('packaging_id_seq'::text)::regclass) NOT NULL,
11652
3484
    sourcepackagename integer,
11653
 
    distroseries integer NOT NULL,
 
3485
    distroseries integer,
11654
3486
    productseries integer NOT NULL,
11655
3487
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
11656
3488
    owner integer,
11657
3489
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
11658
3490
);
11659
3491
 
11660
 
 
11661
 
COMMENT ON TABLE packaging IS 'DO NOT JOIN THROUGH THIS TABLE. This is a set
11662
 
of information linking upstream product series (branches) to distro
11663
 
packages, but it''s not planned or likely to be complete, in the sense that
11664
 
we do not attempt to have information for every branch in every derivative
11665
 
distro managed in Launchpad. So don''t join through this table to get from
11666
 
product to source package, or vice versa. Rather, use the
11667
 
ProductSeries.sourcepackages attribute, or the
11668
 
SourcePackage.productseries attribute. You may need to create a
11669
 
SourcePackage with a given sourcepackagename and distroseries, then use its
11670
 
.productrelease attribute. The code behind those methods does more than just
11671
 
join through the tables, it is also smart enough to look at related
11672
 
distro''s and parent distroseries, and at Ubuntu in particular.';
11673
 
 
11674
 
 
11675
 
COMMENT ON COLUMN packaging.packaging IS 'A dbschema Enum (PackagingType)
11676
 
describing the way the upstream productseries has been packaged. Generally
11677
 
it will be of type PRIME, meaning that the upstream productseries is the
11678
 
primary substance of the package, but it might also be INCLUDES, if the
11679
 
productseries has been included as a statically linked library, for example.
11680
 
This allows us to say that a given Source Package INCLUDES libneon but is a
11681
 
PRIME package of tla, for example. By INCLUDES we mean that the code is
11682
 
actually lumped into the package as ancilliary support material, rather
11683
 
than simply depending on a separate packaging of that code.';
11684
 
 
11685
 
 
11686
 
COMMENT ON COLUMN packaging.sourcepackagename IS 'The source package name for
11687
 
the source package that includes the upstream productseries described in
11688
 
this Packaging record. There is no requirement that such a sourcepackage
11689
 
actually be published in the distro.';
11690
 
 
11691
 
 
11692
 
COMMENT ON COLUMN packaging.distroseries IS 'The distroseries in which the
11693
 
productseries has been packaged.';
11694
 
 
11695
 
 
11696
 
COMMENT ON COLUMN packaging.productseries IS 'The upstream product series
11697
 
that has been packaged in this distroseries sourcepackage.';
11698
 
 
11699
 
 
11700
 
COMMENT ON COLUMN packaging.owner IS 'This is not the "owner" in the sense
11701
 
of giving the person any special privileges to edit the Packaging record,
11702
 
it is simply a record of who told us about this packaging relationship. Note
11703
 
that we do not keep a history of these, so if someone sets it correctly,
11704
 
then someone else sets it incorrectly, we lose the first setting.';
11705
 
 
11706
 
 
11707
3492
CREATE SEQUENCE packaging_id_seq
11708
 
    START WITH 1
11709
3493
    INCREMENT BY 1
11710
3494
    NO MAXVALUE
11711
3495
    NO MINVALUE
11712
3496
    CACHE 1;
11713
3497
 
11714
 
 
11715
3498
ALTER SEQUENCE packaging_id_seq OWNED BY packaging.id;
11716
3499
 
11717
 
 
11718
 
CREATE TABLE packagingjob (
11719
 
    id integer NOT NULL,
11720
 
    job integer NOT NULL,
11721
 
    job_type integer NOT NULL,
11722
 
    productseries integer,
11723
 
    sourcepackagename integer,
11724
 
    distroseries integer,
11725
 
    potemplate integer,
11726
 
    CONSTRAINT translationtemplatejob_valid_link CHECK ((((((potemplate IS NOT NULL) AND (productseries IS NULL)) AND (distroseries IS NULL)) AND (sourcepackagename IS NULL)) OR ((((potemplate IS NULL) AND (productseries IS NOT NULL)) AND (distroseries IS NOT NULL)) AND (sourcepackagename IS NOT NULL))))
11727
 
);
11728
 
 
11729
 
 
11730
 
CREATE SEQUENCE packagingjob_id_seq
11731
 
    START WITH 1
11732
 
    INCREMENT BY 1
11733
 
    NO MAXVALUE
11734
 
    NO MINVALUE
11735
 
    CACHE 1;
11736
 
 
11737
 
 
11738
 
ALTER SEQUENCE packagingjob_id_seq OWNED BY packagingjob.id;
11739
 
 
11740
 
 
11741
3500
CREATE TABLE parsedapachelog (
11742
3501
    id integer NOT NULL,
11743
3502
    first_line text NOT NULL,
11744
 
    bytes_read bigint NOT NULL,
 
3503
    bytes_read integer NOT NULL,
11745
3504
    date_last_parsed timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
11746
3505
);
11747
3506
 
11748
 
 
11749
 
COMMENT ON TABLE parsedapachelog IS 'A parsed apache log file for librarian.';
11750
 
 
11751
 
 
11752
 
COMMENT ON COLUMN parsedapachelog.first_line IS 'The first line of this log file, smashed to ASCII. This uniquely identifies the log file, even if its filename is changed by log rotation or archival.';
11753
 
 
11754
 
 
11755
 
COMMENT ON COLUMN parsedapachelog.bytes_read IS 'The number of bytes from this log file that have been parsed.';
11756
 
 
11757
 
 
11758
3507
CREATE SEQUENCE parsedapachelog_id_seq
11759
 
    START WITH 1
11760
3508
    INCREMENT BY 1
11761
3509
    NO MAXVALUE
11762
3510
    NO MINVALUE
11763
3511
    CACHE 1;
11764
3512
 
11765
 
 
11766
3513
ALTER SEQUENCE parsedapachelog_id_seq OWNED BY parsedapachelog.id;
11767
3514
 
11768
 
 
11769
 
CREATE TABLE person (
11770
 
    id integer NOT NULL,
11771
 
    displayname text NOT NULL,
11772
 
    teamowner integer,
11773
 
    teamdescription text,
11774
 
    name text NOT NULL,
11775
 
    language integer,
11776
 
    fti ts2.tsvector,
11777
 
    defaultmembershipperiod integer,
11778
 
    defaultrenewalperiod integer,
11779
 
    subscriptionpolicy integer DEFAULT 1 NOT NULL,
11780
 
    merged integer,
11781
 
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
11782
 
    homepage_content text,
11783
 
    icon integer,
11784
 
    mugshot integer,
11785
 
    hide_email_addresses boolean DEFAULT false NOT NULL,
11786
 
    creation_rationale integer,
11787
 
    creation_comment text,
11788
 
    registrant integer,
11789
 
    logo integer,
11790
 
    renewal_policy integer DEFAULT 10 NOT NULL,
11791
 
    personal_standing integer DEFAULT 0 NOT NULL,
11792
 
    personal_standing_reason text,
11793
 
    mail_resumption_date date,
11794
 
    mailing_list_auto_subscribe_policy integer DEFAULT 1 NOT NULL,
11795
 
    mailing_list_receive_duplicates boolean DEFAULT true NOT NULL,
11796
 
    visibility integer DEFAULT 1 NOT NULL,
11797
 
    verbose_bugnotifications boolean DEFAULT false NOT NULL,
11798
 
    account integer,
11799
 
    description text,
11800
 
    CONSTRAINT creation_rationale_not_null_for_people CHECK (((creation_rationale IS NULL) = (teamowner IS NOT NULL))),
11801
 
    CONSTRAINT no_loops CHECK ((id <> teamowner)),
11802
 
    CONSTRAINT non_empty_displayname CHECK ((btrim(displayname) <> ''::text)),
11803
 
    CONSTRAINT people_have_no_emblems CHECK (((icon IS NULL) OR (teamowner IS NOT NULL))),
11804
 
    CONSTRAINT sane_defaultrenewalperiod CHECK (CASE WHEN (teamowner IS NULL) THEN (defaultrenewalperiod IS NULL) WHEN (renewal_policy = ANY (ARRAY[20, 30])) THEN ((defaultrenewalperiod IS NOT NULL) AND (defaultrenewalperiod > 0)) ELSE ((defaultrenewalperiod IS NULL) OR (defaultrenewalperiod > 0)) END),
11805
 
    CONSTRAINT teams_have_no_account CHECK (((account IS NULL) OR (teamowner IS NULL))),
11806
 
    CONSTRAINT valid_name CHECK (valid_name(name))
11807
 
);
11808
 
 
11809
 
 
11810
 
COMMENT ON TABLE person IS 'A row represents a person if teamowner is NULL, and represents a team if teamowner is set.';
11811
 
 
11812
 
 
11813
 
COMMENT ON COLUMN person.displayname IS 'Person or group''s name as it should be rendered to screen';
11814
 
 
11815
 
 
11816
 
COMMENT ON COLUMN person.teamowner IS 'id of the team owner. Team owners will have authority to add or remove people from the team.';
11817
 
 
11818
 
 
11819
 
COMMENT ON COLUMN person.teamdescription IS 'Informative description of the team. Format and restrictions are as yet undefined.';
11820
 
 
11821
 
 
11822
 
COMMENT ON COLUMN person.name IS 'Short mneumonic name uniquely identifying this person or team. Useful for url traversal or in places where we need to unambiguously refer to a person or team (as displayname is not unique).';
11823
 
 
11824
 
 
11825
 
COMMENT ON COLUMN person.language IS 'Preferred language for this person (unset for teams). UI should be displayed in this language wherever possible.';
11826
 
 
11827
 
 
11828
 
COMMENT ON COLUMN person.subscriptionpolicy IS 'The policy for new members to join this team.';
11829
 
 
11830
 
 
11831
 
COMMENT ON COLUMN person.homepage_content IS 'A home page for this person in the Launchpad. In short, this is like a personal wiki page. The person will get to edit their own page, and it will be published on /people/foo/. Note that this is in text format, and will migrate to being in Moin format as a sort of mini-wiki-homepage.';
11832
 
 
11833
 
 
11834
 
COMMENT ON COLUMN person.icon IS 'The library file alias to a small image to be used as an icon whenever we are referring to that person.';
11835
 
 
11836
 
 
11837
 
COMMENT ON COLUMN person.mugshot IS 'The library file alias of a hackermugshot image to display as the "face" of a person, on their home page.';
11838
 
 
11839
 
 
11840
 
COMMENT ON COLUMN person.creation_rationale IS 'The rationale for the creation of this person -- a dbschema value.';
11841
 
 
11842
 
 
11843
 
COMMENT ON COLUMN person.creation_comment IS 'A text comment for the creation of this person.';
11844
 
 
11845
 
 
11846
 
COMMENT ON COLUMN person.registrant IS 'The user who created this profile.';
11847
 
 
11848
 
 
11849
 
COMMENT ON COLUMN person.logo IS 'The library file alias of a smaller version of this person''s mugshot.';
11850
 
 
11851
 
 
11852
 
COMMENT ON COLUMN person.renewal_policy IS 'The policy for membership renewal on this team.';
11853
 
 
11854
 
 
11855
 
COMMENT ON COLUMN person.personal_standing IS 'The standing of the person, which indicates (for now, just) whether the person can post to a mailing list without requiring first post moderation.  Values are documented in dbschema.PersonalStanding.';
11856
 
 
11857
 
 
11858
 
COMMENT ON COLUMN person.personal_standing_reason IS 'The reason a person''s standing has changed.';
11859
 
 
11860
 
 
11861
 
COMMENT ON COLUMN person.mail_resumption_date IS 'A NULL resumption date or a date in the past indicates that there is no vacation in effect.  Vacations are granular to the day, so a datetime is not necessary.';
11862
 
 
11863
 
 
11864
 
COMMENT ON COLUMN person.mailing_list_auto_subscribe_policy IS 'The auto-subscription policy for the person, i.e. whether and how the user is automatically subscribed to mailing lists for teams they join.  Values are described in dbschema.MailingListAutoSubscribePolicy.';
11865
 
 
11866
 
 
11867
 
COMMENT ON COLUMN person.mailing_list_receive_duplicates IS 'True means the user wants to receive list copies of messages on which they are explicitly named as a recipient.';
11868
 
 
11869
 
 
11870
 
COMMENT ON COLUMN person.visibility IS 'person.PersonVisibility enumeration which can be set to Public, Public with Private Membership, or Private.';
11871
 
 
11872
 
 
11873
 
COMMENT ON COLUMN person.verbose_bugnotifications IS 'If true, all bugnotifications sent to this Person will include the bug description.';
11874
 
 
11875
 
 
11876
 
COMMENT ON COLUMN person.account IS 'The Account linked to this Person, if there is one.';
11877
 
 
11878
 
 
11879
3515
CREATE SEQUENCE person_id_seq
11880
 
    START WITH 1
11881
3516
    INCREMENT BY 1
11882
3517
    NO MAXVALUE
11883
3518
    NO MINVALUE
11884
3519
    CACHE 1;
11885
3520
 
11886
 
 
11887
3521
ALTER SEQUENCE person_id_seq OWNED BY person.id;
11888
3522
 
11889
 
 
11890
3523
CREATE TABLE personlanguage (
11891
3524
    id integer NOT NULL,
11892
3525
    person integer NOT NULL,
11894
3527
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
11895
3528
);
11896
3529
 
11897
 
 
11898
 
COMMENT ON TABLE personlanguage IS 'PersonLanguage: This table stores the preferred languages that a Person has, it''s used in Rosetta to select the languages that should be showed to be translated.';
11899
 
 
11900
 
 
11901
 
COMMENT ON COLUMN personlanguage.person IS 'This field is a reference to a Person object that has this preference.';
11902
 
 
11903
 
 
11904
 
COMMENT ON COLUMN personlanguage.language IS 'This field is a reference to a Language object that says that the Person associated to this row knows how to translate/understand this language.';
11905
 
 
11906
 
 
11907
3530
CREATE SEQUENCE personlanguage_id_seq
11908
 
    START WITH 1
11909
3531
    INCREMENT BY 1
11910
3532
    NO MAXVALUE
11911
3533
    NO MINVALUE
11912
3534
    CACHE 1;
11913
3535
 
11914
 
 
11915
3536
ALTER SEQUENCE personlanguage_id_seq OWNED BY personlanguage.id;
11916
3537
 
11917
 
 
11918
3538
CREATE TABLE personlocation (
11919
3539
    id integer NOT NULL,
11920
3540
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
11929
3549
    CONSTRAINT latitude_and_longitude_together CHECK (((latitude IS NULL) = (longitude IS NULL)))
11930
3550
);
11931
3551
 
11932
 
 
11933
 
COMMENT ON TABLE personlocation IS 'The geographical coordinates and time zone for a person.';
11934
 
 
11935
 
 
11936
 
COMMENT ON COLUMN personlocation.latitude IS 'The latitude this person has given for their default location.';
11937
 
 
11938
 
 
11939
 
COMMENT ON COLUMN personlocation.longitude IS 'The longitude this person has given for their default location.';
11940
 
 
11941
 
 
11942
 
COMMENT ON COLUMN personlocation.time_zone IS 'The name of the time zone this person prefers (if unset, UTC is used).  UI should display dates and times in this time zone wherever possible.';
11943
 
 
11944
 
 
11945
 
COMMENT ON COLUMN personlocation.last_modified_by IS 'The person who last updated this record. We allow people to provide location and time zone information for other users, when those users have not specified their own location. This allows people to garden the location information for their teams, for example, like a wiki.';
11946
 
 
11947
 
 
11948
 
COMMENT ON COLUMN personlocation.date_last_modified IS 'The date this record was last modified.';
11949
 
 
11950
 
 
11951
 
COMMENT ON COLUMN personlocation.visible IS 'Should this person''s location and time zone be visible to others?';
11952
 
 
11953
 
 
11954
 
COMMENT ON COLUMN personlocation.locked IS 'Whether or not this record can be modified by someone other than the person himself?';
11955
 
 
11956
 
 
11957
3552
CREATE SEQUENCE personlocation_id_seq
11958
 
    START WITH 1
11959
3553
    INCREMENT BY 1
11960
3554
    NO MAXVALUE
11961
3555
    NO MINVALUE
11962
3556
    CACHE 1;
11963
3557
 
11964
 
 
11965
3558
ALTER SEQUENCE personlocation_id_seq OWNED BY personlocation.id;
11966
3559
 
11967
 
 
11968
3560
CREATE TABLE personnotification (
11969
3561
    id integer NOT NULL,
11970
3562
    person integer NOT NULL,
11974
3566
    subject text NOT NULL
11975
3567
);
11976
3568
 
11977
 
 
11978
 
COMMENT ON TABLE personnotification IS 'Notifications to be sent that are related to edits and changes of the details of a specific person or team. Note that these are not keyed against the "person who will be notified", these are notifications "about a person". We use this table to queue up notifications that can then be sent asyncronously - when one user edits information about another person (like the PersonLocation) we want to notify the person concerned that their details have been modified but we do not want to do this during the handling of the form submission. So we store the reminder to notify here, and send it later in a batch. This is modelled on the pattern of BugNotification.';
11979
 
 
11980
 
 
11981
 
COMMENT ON COLUMN personnotification.person IS 'The Person who has been edited or modified.';
11982
 
 
11983
 
 
11984
 
COMMENT ON COLUMN personnotification.date_emailed IS 'When this notification was emailed to the relevant people.';
11985
 
 
11986
 
 
11987
 
COMMENT ON COLUMN personnotification.body IS 'The textual body of the notification to be sent.';
11988
 
 
11989
 
 
11990
 
COMMENT ON COLUMN personnotification.subject IS 'The subject of the mail to be sent.';
11991
 
 
11992
 
 
11993
3569
CREATE SEQUENCE personnotification_id_seq
11994
 
    START WITH 1
11995
3570
    INCREMENT BY 1
11996
3571
    NO MAXVALUE
11997
3572
    NO MINVALUE
11998
3573
    CACHE 1;
11999
3574
 
12000
 
 
12001
3575
ALTER SEQUENCE personnotification_id_seq OWNED BY personnotification.id;
12002
3576
 
12003
 
 
12004
 
CREATE TABLE personsettings (
12005
 
    person integer NOT NULL,
12006
 
    selfgenerated_bugnotifications boolean DEFAULT false NOT NULL
12007
 
);
12008
 
 
12009
 
 
12010
 
CREATE TABLE persontransferjob (
12011
 
    id integer NOT NULL,
12012
 
    job integer NOT NULL,
12013
 
    job_type integer NOT NULL,
12014
 
    minor_person integer NOT NULL,
12015
 
    major_person integer NOT NULL,
12016
 
    json_data text
12017
 
);
12018
 
 
12019
 
 
12020
 
COMMENT ON TABLE persontransferjob IS 'Contains references to jobs for adding team members or merging person entries.';
12021
 
 
12022
 
 
12023
 
COMMENT ON COLUMN persontransferjob.job IS 'A reference to a row in the Job table that has all the common job details.';
12024
 
 
12025
 
 
12026
 
COMMENT ON COLUMN persontransferjob.job_type IS 'The type of job, like add-member notification or merge persons.';
12027
 
 
12028
 
 
12029
 
COMMENT ON COLUMN persontransferjob.minor_person IS 'The person that is being added is a new member or being merged into another person.';
12030
 
 
12031
 
 
12032
 
COMMENT ON COLUMN persontransferjob.major_person IS 'The team receiving a new member or the person that another person is merged into.';
12033
 
 
12034
 
 
12035
 
COMMENT ON COLUMN persontransferjob.json_data IS 'Data that is specific to the type of job, normally stores text to append to email notifications.';
12036
 
 
12037
 
 
12038
 
CREATE SEQUENCE persontransferjob_id_seq
12039
 
    START WITH 1
12040
 
    INCREMENT BY 1
12041
 
    NO MAXVALUE
12042
 
    NO MINVALUE
12043
 
    CACHE 1;
12044
 
 
12045
 
 
12046
 
ALTER SEQUENCE persontransferjob_id_seq OWNED BY persontransferjob.id;
12047
 
 
12048
 
 
12049
3577
CREATE TABLE pillarname (
12050
3578
    id integer NOT NULL,
12051
3579
    name text NOT NULL,
12058
3586
    CONSTRAINT valid_name CHECK (valid_name(name))
12059
3587
);
12060
3588
 
12061
 
 
12062
 
COMMENT ON TABLE pillarname IS 'A cache of the names of our "Pillar''s" (distribution, product, project) to ensure uniqueness in this shared namespace. This is a materialized view maintained by database triggers.';
12063
 
 
12064
 
 
12065
 
COMMENT ON COLUMN pillarname.alias_for IS 'An alias for another pillarname. Rows with this column set are not maintained by triggers.';
12066
 
 
12067
 
 
12068
3589
CREATE SEQUENCE pillarname_id_seq
12069
 
    START WITH 1
12070
3590
    INCREMENT BY 1
12071
3591
    NO MAXVALUE
12072
3592
    NO MINVALUE
12073
3593
    CACHE 1;
12074
3594
 
12075
 
 
12076
3595
ALTER SEQUENCE pillarname_id_seq OWNED BY pillarname.id;
12077
3596
 
12078
 
 
12079
3597
CREATE TABLE pocketchroot (
12080
3598
    id integer NOT NULL,
12081
3599
    distroarchseries integer,
12084
3602
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
12085
3603
);
12086
3604
 
12087
 
 
12088
 
COMMENT ON TABLE pocketchroot IS 'PocketChroots: Which chroot belongs to which pocket of which distroarchseries. Any given pocket of any given distroarchseries needs a specific chroot in order to be built. This table links it all together.';
12089
 
 
12090
 
 
12091
 
COMMENT ON COLUMN pocketchroot.distroarchseries IS 'Which distroarchseries this chroot applies to.';
12092
 
 
12093
 
 
12094
 
COMMENT ON COLUMN pocketchroot.pocket IS 'Which pocket of the distroarchseries this chroot applies to. Valid values are specified in dbschema.PackagePublishingPocket';
12095
 
 
12096
 
 
12097
 
COMMENT ON COLUMN pocketchroot.chroot IS 'The chroot used by the pocket of the distroarchseries.';
12098
 
 
12099
 
 
12100
3605
CREATE SEQUENCE pocketchroot_id_seq
12101
 
    START WITH 1
12102
3606
    INCREMENT BY 1
12103
3607
    NO MAXVALUE
12104
3608
    NO MINVALUE
12105
3609
    CACHE 1;
12106
3610
 
12107
 
 
12108
3611
ALTER SEQUENCE pocketchroot_id_seq OWNED BY pocketchroot.id;
12109
3612
 
 
3613
CREATE TABLE pocomment (
 
3614
    id integer NOT NULL,
 
3615
    potemplate integer NOT NULL,
 
3616
    pomsgid integer,
 
3617
    language integer,
 
3618
    potranslation integer,
 
3619
    commenttext text NOT NULL,
 
3620
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
 
3621
    person integer
 
3622
);
 
3623
 
 
3624
CREATE SEQUENCE pocomment_id_seq
 
3625
    INCREMENT BY 1
 
3626
    NO MAXVALUE
 
3627
    NO MINVALUE
 
3628
    CACHE 1;
 
3629
 
 
3630
ALTER SEQUENCE pocomment_id_seq OWNED BY pocomment.id;
12110
3631
 
12111
3632
CREATE TABLE poexportrequest (
12112
3633
    id integer NOT NULL,
12117
3638
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
12118
3639
);
12119
3640
 
12120
 
 
12121
 
COMMENT ON TABLE poexportrequest IS 'A request from a user that a PO template or a PO file be exported
12122
 
asynchronously.';
12123
 
 
12124
 
 
12125
 
COMMENT ON COLUMN poexportrequest.person IS 'The person who made the request.';
12126
 
 
12127
 
 
12128
 
COMMENT ON COLUMN poexportrequest.potemplate IS 'The PO template being requested.';
12129
 
 
12130
 
 
12131
 
COMMENT ON COLUMN poexportrequest.pofile IS 'The PO file being requested, or NULL.';
12132
 
 
12133
 
 
12134
 
COMMENT ON COLUMN poexportrequest.format IS 'The format the user would like the export to be in. See the RosettaFileFormat DB schema for possible values.';
12135
 
 
12136
 
 
12137
3641
CREATE SEQUENCE poexportrequest_id_seq
12138
 
    START WITH 1
12139
3642
    INCREMENT BY 1
12140
3643
    NO MAXVALUE
12141
3644
    NO MINVALUE
12142
3645
    CACHE 1;
12143
3646
 
12144
 
 
12145
3647
ALTER SEQUENCE poexportrequest_id_seq OWNED BY poexportrequest.id;
12146
3648
 
12147
 
 
12148
3649
CREATE TABLE pofile (
12149
3650
    id integer NOT NULL,
12150
3651
    potemplate integer NOT NULL,
12159
3660
    rosettacount integer NOT NULL,
12160
3661
    lastparsed timestamp without time zone,
12161
3662
    owner integer NOT NULL,
 
3663
    variant text,
12162
3664
    path text NOT NULL,
12163
3665
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
12164
3666
    from_sourcepackagename integer,
12165
3667
    unreviewed_count integer DEFAULT 0 NOT NULL,
12166
 
    date_changed timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
 
3668
    date_changed timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
 
3669
    CONSTRAINT valid_variant CHECK ((variant <> ''::text))
12167
3670
);
12168
3671
 
12169
 
 
12170
 
COMMENT ON TABLE pofile IS 'This table stores a PO file for a given PO template.';
12171
 
 
12172
 
 
12173
 
COMMENT ON COLUMN pofile.path IS 'The path (included the filename) inside the tree from where the content was imported.';
12174
 
 
12175
 
 
12176
 
COMMENT ON COLUMN pofile.from_sourcepackagename IS 'The sourcepackagename from where the last .po file came (only if it''s different from POFile.potemplate.sourcepackagename)';
12177
 
 
12178
 
 
12179
 
COMMENT ON COLUMN pofile.unreviewed_count IS 'Number of POTMsgSets with new,
12180
 
unreviewed TranslationMessages for this POFile.';
12181
 
 
12182
 
 
12183
3672
CREATE SEQUENCE pofile_id_seq
12184
 
    START WITH 1
12185
3673
    INCREMENT BY 1
12186
3674
    NO MAXVALUE
12187
3675
    NO MINVALUE
12188
3676
    CACHE 1;
12189
3677
 
12190
 
 
12191
3678
ALTER SEQUENCE pofile_id_seq OWNED BY pofile.id;
12192
3679
 
12193
 
 
12194
 
CREATE TABLE pofilestatsjob (
12195
 
    job integer NOT NULL,
12196
 
    pofile integer NOT NULL
12197
 
);
12198
 
 
12199
 
 
12200
3680
CREATE TABLE pofiletranslator (
12201
3681
    id integer NOT NULL,
12202
3682
    person integer NOT NULL,
12205
3685
    date_last_touched timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
12206
3686
);
12207
3687
 
12208
 
 
12209
 
COMMENT ON TABLE pofiletranslator IS 'A materialized view caching who has translated what pofile.';
12210
 
 
12211
 
 
12212
 
COMMENT ON COLUMN pofiletranslator.person IS 'The person who submitted the translation.';
12213
 
 
12214
 
 
12215
 
COMMENT ON COLUMN pofiletranslator.pofile IS 'The pofile the translation was submitted for.';
12216
 
 
12217
 
 
12218
 
COMMENT ON COLUMN pofiletranslator.latest_message IS 'Latest translation
12219
 
message added to the translation file.';
12220
 
 
12221
 
 
12222
 
COMMENT ON COLUMN pofiletranslator.date_last_touched IS 'When was added latest
12223
 
translation message.';
12224
 
 
12225
 
 
12226
3688
CREATE SEQUENCE pofiletranslator_id_seq
12227
 
    START WITH 1
12228
3689
    INCREMENT BY 1
12229
3690
    NO MAXVALUE
12230
3691
    NO MINVALUE
12231
3692
    CACHE 1;
12232
3693
 
12233
 
 
12234
3694
ALTER SEQUENCE pofiletranslator_id_seq OWNED BY pofiletranslator.id;
12235
3695
 
12236
 
 
12237
3696
CREATE TABLE poll (
12238
3697
    id integer NOT NULL,
12239
3698
    team integer NOT NULL,
12249
3708
    CONSTRAINT sane_dates CHECK ((dateopens < datecloses))
12250
3709
);
12251
3710
 
12252
 
 
12253
 
COMMENT ON TABLE poll IS 'The polls belonging to teams.';
12254
 
 
12255
 
 
12256
 
COMMENT ON COLUMN poll.team IS 'The team this poll belongs to';
12257
 
 
12258
 
 
12259
 
COMMENT ON COLUMN poll.name IS 'The unique name of this poll.';
12260
 
 
12261
 
 
12262
 
COMMENT ON COLUMN poll.title IS 'The title of this poll.';
12263
 
 
12264
 
 
12265
 
COMMENT ON COLUMN poll.dateopens IS 'The date and time when this poll opens.';
12266
 
 
12267
 
 
12268
 
COMMENT ON COLUMN poll.datecloses IS 'The date and time when this poll closes.';
12269
 
 
12270
 
 
12271
 
COMMENT ON COLUMN poll.proposition IS 'The proposition that is going to be voted.';
12272
 
 
12273
 
 
12274
 
COMMENT ON COLUMN poll.type IS 'The type of this poll (Simple, Preferential, etc).';
12275
 
 
12276
 
 
12277
 
COMMENT ON COLUMN poll.allowspoilt IS 'If people can spoil their votes.';
12278
 
 
12279
 
 
12280
 
COMMENT ON COLUMN poll.secrecy IS 'If people votes are SECRET (no one can see), ADMIN (team administrators can see) or PUBLIC (everyone can see).';
12281
 
 
12282
 
 
12283
3711
CREATE SEQUENCE poll_id_seq
12284
 
    START WITH 1
12285
3712
    INCREMENT BY 1
12286
3713
    NO MAXVALUE
12287
3714
    NO MINVALUE
12288
3715
    CACHE 1;
12289
3716
 
12290
 
 
12291
3717
ALTER SEQUENCE poll_id_seq OWNED BY poll.id;
12292
3718
 
12293
 
 
12294
3719
CREATE TABLE polloption (
12295
3720
    id integer NOT NULL,
12296
3721
    poll integer NOT NULL,
12300
3725
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
12301
3726
);
12302
3727
 
12303
 
 
12304
 
COMMENT ON TABLE polloption IS 'The options belonging to polls.';
12305
 
 
12306
 
 
12307
 
COMMENT ON COLUMN polloption.poll IS 'The poll this options belongs to.';
12308
 
 
12309
 
 
12310
 
COMMENT ON COLUMN polloption.name IS 'The name of this option.';
12311
 
 
12312
 
 
12313
 
COMMENT ON COLUMN polloption.title IS 'A short title for this option.';
12314
 
 
12315
 
 
12316
 
COMMENT ON COLUMN polloption.active IS 'If TRUE, people will be able to vote on this option. Otherwise they don''t.';
12317
 
 
12318
 
 
12319
3728
CREATE SEQUENCE polloption_id_seq
12320
 
    START WITH 1
12321
3729
    INCREMENT BY 1
12322
3730
    NO MAXVALUE
12323
3731
    NO MINVALUE
12324
3732
    CACHE 1;
12325
3733
 
12326
 
 
12327
3734
ALTER SEQUENCE polloption_id_seq OWNED BY polloption.id;
12328
3735
 
12329
 
 
12330
3736
CREATE TABLE pomsgid (
12331
3737
    id integer NOT NULL,
12332
3738
    msgid text NOT NULL
12333
3739
);
12334
3740
 
12335
 
 
12336
3741
CREATE SEQUENCE pomsgid_id_seq
12337
 
    START WITH 1
12338
3742
    INCREMENT BY 1
12339
3743
    NO MAXVALUE
12340
3744
    NO MINVALUE
12341
3745
    CACHE 1;
12342
3746
 
12343
 
 
12344
3747
ALTER SEQUENCE pomsgid_id_seq OWNED BY pomsgid.id;
12345
3748
 
 
3749
CREATE TABLE posubscription (
 
3750
    id integer NOT NULL,
 
3751
    person integer NOT NULL,
 
3752
    potemplate integer NOT NULL,
 
3753
    language integer,
 
3754
    notificationinterval interval,
 
3755
    lastnotified timestamp without time zone,
 
3756
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
 
3757
);
 
3758
 
 
3759
CREATE SEQUENCE posubscription_id_seq
 
3760
    INCREMENT BY 1
 
3761
    NO MAXVALUE
 
3762
    NO MINVALUE
 
3763
    CACHE 1;
 
3764
 
 
3765
ALTER SEQUENCE posubscription_id_seq OWNED BY posubscription.id;
12346
3766
 
12347
3767
CREATE TABLE potemplate (
12348
3768
    id integer NOT NULL,
12372
3792
    CONSTRAINT valid_link CHECK ((((productseries IS NULL) <> (distroseries IS NULL)) AND ((distroseries IS NULL) = (sourcepackagename IS NULL))))
12373
3793
);
12374
3794
 
12375
 
 
12376
 
COMMENT ON TABLE potemplate IS 'This table stores a pot file for a given product.';
12377
 
 
12378
 
 
12379
 
COMMENT ON COLUMN potemplate.path IS 'The path to the .pot source file inside the tarball tree, including the filename.';
12380
 
 
12381
 
 
12382
 
COMMENT ON COLUMN potemplate.sourcepackagename IS 'A reference to a sourcepackage name from where this POTemplate comes.';
12383
 
 
12384
 
 
12385
 
COMMENT ON COLUMN potemplate.distroseries IS 'A reference to the distribution from where this POTemplate comes.';
12386
 
 
12387
 
 
12388
 
COMMENT ON COLUMN potemplate.sourcepackageversion IS 'The sourcepackage version string from where this potemplate was imported last time with our buildd <-> Rosetta gateway.';
12389
 
 
12390
 
 
12391
 
COMMENT ON COLUMN potemplate.header IS 'The header of a .pot file when we import it. Most important info from it is POT-Creation-Date and custom headers.';
12392
 
 
12393
 
 
12394
 
COMMENT ON COLUMN potemplate.productseries IS 'A reference to a ProductSeries from where this POTemplate comes.';
12395
 
 
12396
 
 
12397
 
COMMENT ON COLUMN potemplate.from_sourcepackagename IS 'The sourcepackagename from where the last .pot file came (only if it''s different from POTemplate.sourcepackagename)';
12398
 
 
12399
 
 
12400
 
COMMENT ON COLUMN potemplate.source_file IS 'Reference to Librarian file storing the last uploaded template file.';
12401
 
 
12402
 
 
12403
 
COMMENT ON COLUMN potemplate.source_file_format IS 'File format for the Librarian file referenced in "source_file" column.';
12404
 
 
12405
 
 
12406
 
COMMENT ON COLUMN potemplate.name IS 'The name of the POTemplate set. It must be unique';
12407
 
 
12408
 
 
12409
 
COMMENT ON COLUMN potemplate.translation_domain IS 'The translation domain for this POTemplate';
12410
 
 
12411
 
 
12412
3795
CREATE SEQUENCE potemplate_id_seq
12413
 
    START WITH 1
12414
3796
    INCREMENT BY 1
12415
3797
    NO MAXVALUE
12416
3798
    NO MINVALUE
12417
3799
    CACHE 1;
12418
3800
 
12419
 
 
12420
3801
ALTER SEQUENCE potemplate_id_seq OWNED BY potemplate.id;
12421
3802
 
12422
 
 
12423
3803
CREATE TABLE potmsgset (
12424
3804
    id integer NOT NULL,
12425
3805
    msgid_singular integer NOT NULL,
 
3806
    sequence integer,
12426
3807
    potemplate integer,
12427
3808
    commenttext text,
12428
3809
    filereferences text,
12432
3813
    msgid_plural integer
12433
3814
);
12434
3815
 
12435
 
 
12436
 
COMMENT ON TABLE potmsgset IS 'This table is stores a collection of msgids
12437
 
without their translations and all kind of information associated to that set
12438
 
of messages that could be found in a potemplate file.';
12439
 
 
12440
 
 
12441
 
COMMENT ON COLUMN potmsgset.msgid_singular IS 'The singular msgid for this message.';
12442
 
 
12443
 
 
12444
 
COMMENT ON COLUMN potmsgset.potemplate IS 'The potemplate where this message set is stored.';
12445
 
 
12446
 
 
12447
 
COMMENT ON COLUMN potmsgset.commenttext IS 'The comment text that is associated to this message set.';
12448
 
 
12449
 
 
12450
 
COMMENT ON COLUMN potmsgset.filereferences IS 'The list of files and their line number where this message set was extracted from.';
12451
 
 
12452
 
 
12453
 
COMMENT ON COLUMN potmsgset.sourcecomment IS 'The comment that was extracted from the source code.';
12454
 
 
12455
 
 
12456
 
COMMENT ON COLUMN potmsgset.flagscomment IS 'The flags associated with this set (like c-format).';
12457
 
 
12458
 
 
12459
 
COMMENT ON COLUMN potmsgset.context IS 'Context uniquely defining a message when there are messages with same primemsgids.';
12460
 
 
12461
 
 
12462
 
COMMENT ON COLUMN potmsgset.msgid_plural IS 'The plural msgid for this message.';
12463
 
 
12464
 
 
12465
3816
CREATE TABLE translationtemplateitem (
12466
3817
    id integer NOT NULL,
12467
3818
    potemplate integer NOT NULL,
12470
3821
    CONSTRAINT translationtemplateitem_sequence_check CHECK ((sequence >= 0))
12471
3822
);
12472
3823
 
12473
 
 
12474
3824
CREATE VIEW potexport AS
12475
3825
    SELECT COALESCE((potmsgset.id)::text, 'X'::text) AS id, potemplate.productseries, potemplate.sourcepackagename, potemplate.distroseries, potemplate.id AS potemplate, potemplate.header AS template_header, potemplate.languagepack, translationtemplateitem.sequence, potmsgset.id AS potmsgset, potmsgset.commenttext AS comment, potmsgset.sourcecomment AS source_comment, potmsgset.filereferences AS file_references, potmsgset.flagscomment AS flags_comment, potmsgset.context, msgid_singular.msgid AS msgid_singular, msgid_plural.msgid AS msgid_plural FROM ((((potmsgset JOIN translationtemplateitem ON ((translationtemplateitem.potmsgset = potmsgset.id))) JOIN potemplate ON ((potemplate.id = translationtemplateitem.potemplate))) LEFT JOIN pomsgid msgid_singular ON ((potmsgset.msgid_singular = msgid_singular.id))) LEFT JOIN pomsgid msgid_plural ON ((potmsgset.msgid_plural = msgid_plural.id)));
12476
3826
 
12477
 
 
12478
3827
CREATE SEQUENCE potmsgset_id_seq
12479
 
    START WITH 1
12480
3828
    INCREMENT BY 1
12481
3829
    NO MAXVALUE
12482
3830
    NO MINVALUE
12483
3831
    CACHE 1;
12484
3832
 
12485
 
 
12486
3833
ALTER SEQUENCE potmsgset_id_seq OWNED BY potmsgset.id;
12487
3834
 
12488
 
 
12489
3835
CREATE TABLE potranslation (
12490
3836
    id integer NOT NULL,
12491
3837
    translation text NOT NULL
12492
 
)
12493
 
WITH (fillfactor=100);
12494
 
 
 
3838
);
12495
3839
 
12496
3840
CREATE SEQUENCE potranslation_id_seq
12497
 
    START WITH 1
12498
3841
    INCREMENT BY 1
12499
3842
    NO MAXVALUE
12500
3843
    NO MINVALUE
12501
3844
    CACHE 1;
12502
3845
 
12503
 
 
12504
3846
ALTER SEQUENCE potranslation_id_seq OWNED BY potranslation.id;
12505
3847
 
12506
 
 
12507
3848
CREATE TABLE previewdiff (
12508
3849
    id integer NOT NULL,
12509
3850
    source_revision_id text NOT NULL,
12513
3854
    conflicts text
12514
3855
);
12515
3856
 
12516
 
 
12517
 
COMMENT ON TABLE previewdiff IS 'Contains information about preview diffs, without duplicating information with BranchMergeProposal.';
12518
 
 
12519
 
 
12520
 
COMMENT ON COLUMN previewdiff.source_revision_id IS 'The source branch revision_id used to generate this diff.';
12521
 
 
12522
 
 
12523
 
COMMENT ON COLUMN previewdiff.target_revision_id IS 'The target branch revision_id used to generate this diff.';
12524
 
 
12525
 
 
12526
 
COMMENT ON COLUMN previewdiff.dependent_revision_id IS 'The dependant branch revision_id used to generate this diff.';
12527
 
 
12528
 
 
12529
 
COMMENT ON COLUMN previewdiff.diff IS 'The last Diff generated for this PreviewDiff.';
12530
 
 
12531
 
 
12532
 
COMMENT ON COLUMN previewdiff.conflicts IS 'The text description of any conflicts present.';
12533
 
 
12534
 
 
12535
3857
CREATE SEQUENCE previewdiff_id_seq
12536
 
    START WITH 1
12537
3858
    INCREMENT BY 1
12538
3859
    NO MAXVALUE
12539
3860
    NO MINVALUE
12540
3861
    CACHE 1;
12541
3862
 
12542
 
 
12543
3863
ALTER SEQUENCE previewdiff_id_seq OWNED BY previewdiff.id;
12544
3864
 
12545
 
 
12546
3865
CREATE TABLE processor (
12547
3866
    id integer NOT NULL,
12548
3867
    family integer NOT NULL,
12551
3870
    description text NOT NULL
12552
3871
);
12553
3872
 
12554
 
 
12555
 
COMMENT ON TABLE processor IS 'A single processor for which code might be compiled. For example, i386, P2, P3, P4, Itanium1, Itanium2... each processor belongs to a ProcessorFamily, and it might be that a package is compiled several times for a given Family, with different optimisation settings for each processor.';
12556
 
 
12557
 
 
12558
 
COMMENT ON COLUMN processor.family IS 'The ProcessorFamily for this Processor.';
12559
 
 
12560
 
 
12561
 
COMMENT ON COLUMN processor.name IS 'The name of this processor, for example, i386, Pentium, P2, P3, P4, Itanium, Itanium2, K7, Athlon, Opteron... it should be short and unique.';
12562
 
 
12563
 
 
12564
3873
CREATE SEQUENCE processor_id_seq
12565
 
    START WITH 1
12566
3874
    INCREMENT BY 1
12567
3875
    NO MAXVALUE
12568
3876
    NO MINVALUE
12569
3877
    CACHE 1;
12570
3878
 
12571
 
 
12572
3879
ALTER SEQUENCE processor_id_seq OWNED BY processor.id;
12573
3880
 
12574
 
 
12575
3881
CREATE TABLE processorfamily (
12576
3882
    id integer NOT NULL,
12577
3883
    name text NOT NULL,
12580
3886
    restricted boolean DEFAULT false NOT NULL
12581
3887
);
12582
3888
 
12583
 
 
12584
 
COMMENT ON TABLE processorfamily IS 'An architecture, that might consist of several actual processors. Different distributions call these architectures different things, so we have an "architecturetag" in DistroArchSeries that might be different to the architecture''s name.';
12585
 
 
12586
 
 
12587
 
COMMENT ON COLUMN processorfamily.name IS 'The name of the architecture. This is a short unix-style name such as i386 or amd64';
12588
 
 
12589
 
 
12590
 
COMMENT ON COLUMN processorfamily.title IS 'A title for the architecture. For example "Intel i386 Compatible".';
12591
 
 
12592
 
 
12593
 
COMMENT ON COLUMN processorfamily.description IS 'A description for this processor family. It might include any gotchas such as the fact that i386 does not necessarily mean that code would run on a 386... Ubuntu for example requires a 486.';
12594
 
 
12595
 
 
12596
3889
CREATE SEQUENCE processorfamily_id_seq
12597
 
    START WITH 1
12598
3890
    INCREMENT BY 1
12599
3891
    NO MAXVALUE
12600
3892
    NO MINVALUE
12601
3893
    CACHE 1;
12602
3894
 
12603
 
 
12604
3895
ALTER SEQUENCE processorfamily_id_seq OWNED BY processorfamily.id;
12605
3896
 
12606
 
 
12607
 
CREATE TABLE product (
12608
 
    id integer NOT NULL,
12609
 
    project integer,
12610
 
    owner integer NOT NULL,
12611
 
    name text NOT NULL,
12612
 
    displayname text NOT NULL,
12613
 
    title text NOT NULL,
12614
 
    summary text NOT NULL,
12615
 
    description text,
12616
 
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
12617
 
    homepageurl text,
12618
 
    screenshotsurl text,
12619
 
    wikiurl text,
12620
 
    listurl text,
12621
 
    programminglang text,
12622
 
    downloadurl text,
12623
 
    lastdoap text,
12624
 
    sourceforgeproject text,
12625
 
    freshmeatproject text,
12626
 
    reviewed boolean DEFAULT false NOT NULL,
12627
 
    active boolean DEFAULT true NOT NULL,
12628
 
    fti ts2.tsvector,
12629
 
    autoupdate boolean DEFAULT false NOT NULL,
12630
 
    translationgroup integer,
12631
 
    translationpermission integer DEFAULT 1 NOT NULL,
12632
 
    official_rosetta boolean DEFAULT false NOT NULL,
12633
 
    official_malone boolean DEFAULT false NOT NULL,
12634
 
    bug_supervisor integer,
12635
 
    security_contact integer,
12636
 
    driver integer,
12637
 
    bugtracker integer,
12638
 
    development_focus integer,
12639
 
    homepage_content text,
12640
 
    icon integer,
12641
 
    mugshot integer,
12642
 
    logo integer,
12643
 
    official_answers boolean DEFAULT false NOT NULL,
12644
 
    private_bugs boolean DEFAULT false NOT NULL,
12645
 
    private_specs boolean DEFAULT false NOT NULL,
12646
 
    license_info text,
12647
 
    official_blueprints boolean DEFAULT false NOT NULL,
12648
 
    enable_bug_expiration boolean DEFAULT false NOT NULL,
12649
 
    bug_reporting_guidelines text,
12650
 
    reviewer_whiteboard text,
12651
 
    license_approved boolean DEFAULT false NOT NULL,
12652
 
    registrant integer NOT NULL,
12653
 
    remote_product text,
12654
 
    translation_focus integer,
12655
 
    max_bug_heat integer,
12656
 
    date_next_suggest_packaging timestamp without time zone,
12657
 
    bug_reported_acknowledgement text,
12658
 
    answers_usage integer DEFAULT 10 NOT NULL,
12659
 
    blueprints_usage integer DEFAULT 10 NOT NULL,
12660
 
    translations_usage integer DEFAULT 10 NOT NULL,
12661
 
    enable_bugfiling_duplicate_search boolean DEFAULT true NOT NULL,
12662
 
    CONSTRAINT only_launchpad_has_expiration CHECK (((enable_bug_expiration IS FALSE) OR (official_malone IS TRUE))),
12663
 
    CONSTRAINT private_bugs_need_contact CHECK (((private_bugs IS FALSE) OR (bug_supervisor IS NOT NULL))),
12664
 
    CONSTRAINT valid_name CHECK (valid_name(name))
12665
 
);
12666
 
 
12667
 
 
12668
 
COMMENT ON TABLE product IS 'Product: a DOAP Product. This table stores core information about an open source product. In Launchpad, anything that can be shipped as a tarball would be a product, and in some cases there might be products for things that never actually ship, depending on the project. For example, most projects will have a ''website'' product, because that allows you to file a Malone bug against the project website. Note that these are not actual product releases, which are stored in the ProductRelease table.';
12669
 
 
12670
 
 
12671
 
COMMENT ON COLUMN product.project IS 'Every Product belongs to one and only one Project, which is referenced in this column.';
12672
 
 
12673
 
 
12674
 
COMMENT ON COLUMN product.owner IS 'The Product owner would typically be the person who created this product in Launchpad. But we will encourage the upstream maintainer of a product to become the owner in Launchpad. The Product owner can edit any aspect of the Product, as well as appointing people to specific roles with regard to the Product. Also, the owner can add a new ProductRelease and also edit Rosetta POTemplates associated with this product.';
12675
 
 
12676
 
 
12677
 
COMMENT ON COLUMN product.summary IS 'A brief summary of the product. This will be displayed in bold at the top of the product page, above the description.';
12678
 
 
12679
 
 
12680
 
COMMENT ON COLUMN product.description IS 'A detailed description of the product, highlighting primary features of the product that may be of interest to end-users. The description may also include links and other references to useful information on the web about this product. The description will be displayed on the product page, below the product summary.';
12681
 
 
12682
 
 
12683
 
COMMENT ON COLUMN product.listurl IS 'This is the URL where information about a mailing list for this Product can be found. The URL might point at a web archive or at the page where one can subscribe to the mailing list.';
12684
 
 
12685
 
 
12686
 
COMMENT ON COLUMN product.programminglang IS 'This field records, in plain text, the name of any significant programming languages used in this product. There are no rules, conventions or restrictions on this field at present, other than basic sanity. Examples might be "Python", "Python, C" and "Java".';
12687
 
 
12688
 
 
12689
 
COMMENT ON COLUMN product.downloadurl IS 'The download URL for a Product should be the best place to download that product, typically off the relevant Project web site. This should not point at the actual file, but at a web page with download information.';
12690
 
 
12691
 
 
12692
 
COMMENT ON COLUMN product.lastdoap IS 'This column stores a cached copy of the last DOAP description we saw for this product. See the Project.lastdoap field for more info.';
12693
 
 
12694
 
 
12695
 
COMMENT ON COLUMN product.sourceforgeproject IS 'The SourceForge project name for this product. This is not unique as SourceForge doesn''t use the same project/product structure as DOAP.';
12696
 
 
12697
 
 
12698
 
COMMENT ON COLUMN product.freshmeatproject IS 'The FreshMeat project name for this product. This is not unique as FreshMeat does not have the same project/product structure as DOAP';
12699
 
 
12700
 
 
12701
 
COMMENT ON COLUMN product.reviewed IS 'Whether or not someone at Canonical has reviewed this product.';
12702
 
 
12703
 
 
12704
 
COMMENT ON COLUMN product.active IS 'Whether or not this product should be considered active.';
12705
 
 
12706
 
 
12707
 
COMMENT ON COLUMN product.translationgroup IS 'The TranslationGroup that is responsible for translations for this product. Note that the Product may be part of a Project which also has a TranslationGroup, in which case the translators from both the product and project translation group have permission to edit the translations of this product.';
12708
 
 
12709
 
 
12710
 
COMMENT ON COLUMN product.translationpermission IS 'The level of openness of this product''s translation process. The enum lists different approaches to translation, from the very open (anybody can edit any translation in any language) to the completely closed (only designated translators can make any changes at all).';
12711
 
 
12712
 
 
12713
 
COMMENT ON COLUMN product.official_rosetta IS 'Whether or not this product upstream uses Rosetta for its official translation team and coordination. This is a useful indicator in terms of whether translations in Rosetta for this upstream will quickly move upstream.';
12714
 
 
12715
 
 
12716
 
COMMENT ON COLUMN product.official_malone IS 'Whether or not this product upstream uses Malone for an official bug tracker. This is useful to help indicate whether or not people are likely to pick up on bugs registered in Malone.';
12717
 
 
12718
 
 
12719
 
COMMENT ON COLUMN product.bug_supervisor IS 'Person who is responsible for managing bugs on this product.';
12720
 
 
12721
 
 
12722
 
COMMENT ON COLUMN product.security_contact IS 'The person or team who handles security-related issues in the product.';
12723
 
 
12724
 
 
12725
 
COMMENT ON COLUMN product.driver IS 'This is a driver for the overall product. This driver will be able to approve nominations of bugs and specs to any series in the product, including backporting to old stable series. You want the smallest group of "overall drivers" here, because you can add specific drivers to each series individually.';
12726
 
 
12727
 
 
12728
 
COMMENT ON COLUMN product.development_focus IS 'The product series that is the current focus of development.';
12729
 
 
12730
 
 
12731
 
COMMENT ON COLUMN product.homepage_content IS 'A home page for this product in the Launchpad.';
12732
 
 
12733
 
 
12734
 
COMMENT ON COLUMN product.icon IS 'The library file alias to a small image to be used as an icon whenever we are referring to a product.';
12735
 
 
12736
 
 
12737
 
COMMENT ON COLUMN product.mugshot IS 'The library file alias of a mugshot image to display as the branding of a product, on its home page.';
12738
 
 
12739
 
 
12740
 
COMMENT ON COLUMN product.logo IS 'The library file alias of a smaller version of this product''s mugshot.';
12741
 
 
12742
 
 
12743
 
COMMENT ON COLUMN product.official_answers IS 'Whether or not this product upstream uses Answers officialy. This is useful to help indicate whether or not that a question will receive an answer.';
12744
 
 
12745
 
 
12746
 
COMMENT ON COLUMN product.private_bugs IS 'Indicates whether bugs filed in this product are automatically marked as private.';
12747
 
 
12748
 
 
12749
 
COMMENT ON COLUMN product.private_specs IS 'Indicates whether specs filed in this product are automatically marked as private.';
12750
 
 
12751
 
 
12752
 
COMMENT ON COLUMN product.license_info IS 'Additional information about licenses that are not included in the License enumeration.';
12753
 
 
12754
 
 
12755
 
COMMENT ON COLUMN product.official_blueprints IS 'Whether or not this product upstream uses Blueprints officially. This is useful to help indicate whether or not the upstream project will be actively watching the blueprints in Launchpad.';
12756
 
 
12757
 
 
12758
 
COMMENT ON COLUMN product.enable_bug_expiration IS 'Indicates whether automatic bug expiration is enabled.';
12759
 
 
12760
 
 
12761
 
COMMENT ON COLUMN product.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on this product.';
12762
 
 
12763
 
 
12764
 
COMMENT ON COLUMN product.reviewer_whiteboard IS 'A whiteboard for Launchpad admins, registry experts and the project owners to capture the state of current issues with the project.';
12765
 
 
12766
 
 
12767
 
COMMENT ON COLUMN product.license_approved IS 'The Other/Open Source license has been approved by an administrator.';
12768
 
 
12769
 
 
12770
 
COMMENT ON COLUMN product.registrant IS 'The Product registrant is the Person who created the product in Launchpad.  It is set at creation and is never changed thereafter.';
12771
 
 
12772
 
 
12773
 
COMMENT ON COLUMN product.remote_product IS 'The ID of this product on its remote bug tracker.';
12774
 
 
12775
 
 
12776
 
COMMENT ON COLUMN product.translation_focus IS 'The ProductSeries that should get the translation effort focus.';
12777
 
 
12778
 
 
12779
 
COMMENT ON COLUMN product.max_bug_heat IS 'The highest heat value across bugs for this product.';
12780
 
 
12781
 
 
12782
 
COMMENT ON COLUMN product.date_next_suggest_packaging IS 'The date when Launchpad can resume suggesting Ubuntu packages that the project provides.';
12783
 
 
12784
 
 
12785
 
COMMENT ON COLUMN product.bug_reported_acknowledgement IS 'A message of acknowledgement to display to a bug reporter after they''ve reported a new bug.';
12786
 
 
12787
 
 
12788
 
COMMENT ON COLUMN product.enable_bugfiling_duplicate_search IS 'Enable/disable a search for posiible duplicates when a bug is filed.';
12789
 
 
12790
 
 
12791
3897
CREATE SEQUENCE product_id_seq
12792
 
    START WITH 1
12793
3898
    INCREMENT BY 1
12794
3899
    NO MAXVALUE
12795
3900
    NO MINVALUE
12796
3901
    CACHE 1;
12797
3902
 
12798
 
 
12799
3903
ALTER SEQUENCE product_id_seq OWNED BY product.id;
12800
3904
 
 
3905
CREATE TABLE productbounty (
 
3906
    id integer NOT NULL,
 
3907
    bounty integer NOT NULL,
 
3908
    product integer NOT NULL,
 
3909
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
 
3910
);
 
3911
 
 
3912
CREATE SEQUENCE productbounty_id_seq
 
3913
    INCREMENT BY 1
 
3914
    NO MAXVALUE
 
3915
    NO MINVALUE
 
3916
    CACHE 1;
 
3917
 
 
3918
ALTER SEQUENCE productbounty_id_seq OWNED BY productbounty.id;
 
3919
 
 
3920
CREATE TABLE productcvsmodule (
 
3921
    id integer NOT NULL,
 
3922
    product integer NOT NULL,
 
3923
    anonroot text NOT NULL,
 
3924
    module text NOT NULL,
 
3925
    weburl text,
 
3926
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
 
3927
);
 
3928
 
 
3929
CREATE SEQUENCE productcvsmodule_id_seq
 
3930
    INCREMENT BY 1
 
3931
    NO MAXVALUE
 
3932
    NO MINVALUE
 
3933
    CACHE 1;
 
3934
 
 
3935
ALTER SEQUENCE productcvsmodule_id_seq OWNED BY productcvsmodule.id;
12801
3936
 
12802
3937
CREATE TABLE productlicense (
12803
3938
    id integer NOT NULL,
12805
3940
    license integer NOT NULL
12806
3941
);
12807
3942
 
12808
 
 
12809
 
COMMENT ON TABLE productlicense IS 'The licenses that cover the software for a product.';
12810
 
 
12811
 
 
12812
 
COMMENT ON COLUMN productlicense.product IS 'Foreign key to the product that has licenses associated with it.';
12813
 
 
12814
 
 
12815
 
COMMENT ON COLUMN productlicense.license IS 'An integer referencing a value in the License enumeration in product.py';
12816
 
 
12817
 
 
12818
3943
CREATE SEQUENCE productlicense_id_seq
12819
 
    START WITH 1
12820
3944
    INCREMENT BY 1
12821
3945
    NO MAXVALUE
12822
3946
    NO MINVALUE
12823
3947
    CACHE 1;
12824
3948
 
12825
 
 
12826
3949
ALTER SEQUENCE productlicense_id_seq OWNED BY productlicense.id;
12827
3950
 
12828
 
 
12829
3951
CREATE TABLE productrelease (
12830
3952
    id integer NOT NULL,
12831
3953
    datereleased timestamp without time zone NOT NULL,
12836
3958
    milestone integer NOT NULL
12837
3959
);
12838
3960
 
12839
 
 
12840
 
COMMENT ON TABLE productrelease IS 'A Product Release. This is table stores information about a specific ''upstream'' software release, like Apache 2.0.49 or Evolution 1.5.4.';
12841
 
 
12842
 
 
12843
 
COMMENT ON COLUMN productrelease.datereleased IS 'The date when this version of the product was released.';
12844
 
 
12845
 
 
12846
 
COMMENT ON COLUMN productrelease.release_notes IS 'Description of changes in this product release.';
12847
 
 
12848
 
 
12849
 
COMMENT ON COLUMN productrelease.changelog IS 'Detailed description of changes in this product release.';
12850
 
 
12851
 
 
12852
 
COMMENT ON COLUMN productrelease.owner IS 'The person who created this product release.';
12853
 
 
12854
 
 
12855
 
COMMENT ON COLUMN productrelease.datecreated IS 'The timestamp when this product release was created.';
12856
 
 
12857
 
 
12858
 
COMMENT ON COLUMN productrelease.milestone IS 'The milestone for this product release. This is scheduled to become a NOT NULL column, so every product release will be linked to a unique milestone.';
12859
 
 
12860
 
 
12861
3961
CREATE SEQUENCE productrelease_id_seq
12862
 
    START WITH 1
12863
3962
    INCREMENT BY 1
12864
3963
    NO MAXVALUE
12865
3964
    NO MINVALUE
12866
3965
    CACHE 1;
12867
3966
 
12868
 
 
12869
3967
ALTER SEQUENCE productrelease_id_seq OWNED BY productrelease.id;
12870
3968
 
12871
 
 
12872
3969
CREATE TABLE productreleasefile (
12873
3970
    productrelease integer NOT NULL,
12874
3971
    libraryfile integer NOT NULL,
12881
3978
    signature integer
12882
3979
);
12883
3980
 
12884
 
 
12885
 
COMMENT ON TABLE productreleasefile IS 'Links a ProductRelease to one or more files in the Librarian.';
12886
 
 
12887
 
 
12888
 
COMMENT ON COLUMN productreleasefile.productrelease IS 'This is the product release this file is associated with';
12889
 
 
12890
 
 
12891
 
COMMENT ON COLUMN productreleasefile.libraryfile IS 'This is the librarian entry';
12892
 
 
12893
 
 
12894
 
COMMENT ON COLUMN productreleasefile.filetype IS 'An enum of what kind of file this is. Code tarballs are marked for special treatment (importing into bzr)';
12895
 
 
12896
 
 
12897
 
COMMENT ON COLUMN productreleasefile.description IS 'A description of what the file contains';
12898
 
 
12899
 
 
12900
 
COMMENT ON COLUMN productreleasefile.uploader IS 'The person who uploaded this file.';
12901
 
 
12902
 
 
12903
 
COMMENT ON COLUMN productreleasefile.date_uploaded IS 'The date this file was uploaded.';
12904
 
 
12905
 
 
12906
 
COMMENT ON COLUMN productreleasefile.signature IS 'This is the signature of the librarian entry as uploaded by the user.';
12907
 
 
12908
 
 
12909
3981
CREATE SEQUENCE productreleasefile_id_seq
12910
 
    START WITH 1
12911
3982
    INCREMENT BY 1
12912
3983
    NO MAXVALUE
12913
3984
    NO MINVALUE
12914
3985
    CACHE 1;
12915
3986
 
12916
 
 
12917
3987
ALTER SEQUENCE productreleasefile_id_seq OWNED BY productreleasefile.id;
12918
3988
 
12919
 
 
12920
3989
CREATE TABLE productseries (
12921
3990
    id integer NOT NULL,
12922
3991
    product integer NOT NULL,
12935
4004
    CONSTRAINT valid_releasefileglob CHECK (valid_absolute_url(releasefileglob))
12936
4005
);
12937
4006
 
12938
 
 
12939
 
COMMENT ON TABLE productseries IS 'A ProductSeries is a set of product releases that are related to a specific version of the product. Typically, each major release of the product starts a new ProductSeries. These often map to a branch in the revision control system of the project, such as "2_0_STABLE". A few conventional Series names are "head" for releases of the HEAD branch, "1.0" for releases with version numbers like "1.0.0" and "1.0.1".  Each product has at least one ProductSeries';
12940
 
 
12941
 
 
12942
 
COMMENT ON COLUMN productseries.name IS 'The name of the ProductSeries is like a unix name, it should not contain any spaces and should start with a letter or number. Good examples are "2.0", "3.0", "head" and "development".';
12943
 
 
12944
 
 
12945
 
COMMENT ON COLUMN productseries.summary IS 'A summary of this Product Series. A good example would include the date the series was initiated and whether this is the current recommended series for people to use. The summary is usually displayed at the top of the page, in bold, just beneath the title and above the description, if there is a description field.';
12946
 
 
12947
 
 
12948
 
COMMENT ON COLUMN productseries.releasefileglob IS 'A fileglob that lets us
12949
 
see which URLs are potentially new upstream tarball releases. For example:
12950
 
http://ftp.gnu.org/gnu/libtool/libtool-1.5.*.gz.';
12951
 
 
12952
 
 
12953
 
COMMENT ON COLUMN productseries.releaseverstyle IS 'An enum giving the style
12954
 
of this product series release version numbering system.  The options are
12955
 
documented in dbschema.UpstreamReleaseVersionStyle.  Most applications use
12956
 
Gnu style numbering, but there are other alternatives.';
12957
 
 
12958
 
 
12959
 
COMMENT ON COLUMN productseries.driver IS 'This is a person or team who can approve spes and bugs for implementation or fixing in this specific series. Note that the product drivers and project drivers can also do this for any series in the product or project, so use this only for the specific team responsible for this specific series.';
12960
 
 
12961
 
 
12962
 
COMMENT ON COLUMN productseries.status IS 'The current status of this productseries.';
12963
 
 
12964
 
 
12965
 
COMMENT ON COLUMN productseries.translations_autoimport_mode IS 'Level of
12966
 
translations imports from codehosting branch: None, templates only, templates
12967
 
and translations. See TranslationsBranchImportMode.';
12968
 
 
12969
 
 
12970
 
COMMENT ON COLUMN productseries.branch IS 'The branch for this product
12971
 
series.';
12972
 
 
12973
 
 
12974
 
COMMENT ON COLUMN productseries.translations_branch IS 'Branch to push translations updates to.';
12975
 
 
12976
 
 
12977
4007
CREATE SEQUENCE productseries_id_seq
12978
 
    START WITH 1
12979
4008
    INCREMENT BY 1
12980
4009
    NO MAXVALUE
12981
4010
    NO MINVALUE
12982
4011
    CACHE 1;
12983
4012
 
12984
 
 
12985
4013
ALTER SEQUENCE productseries_id_seq OWNED BY productseries.id;
12986
4014
 
 
4015
CREATE TABLE productseriescodeimport (
 
4016
    id integer NOT NULL,
 
4017
    productseries integer NOT NULL,
 
4018
    codeimport integer NOT NULL
 
4019
);
 
4020
 
 
4021
CREATE SEQUENCE productseriescodeimport_id_seq
 
4022
    INCREMENT BY 1
 
4023
    NO MAXVALUE
 
4024
    NO MINVALUE
 
4025
    CACHE 1;
 
4026
 
 
4027
ALTER SEQUENCE productseriescodeimport_id_seq OWNED BY productseriescodeimport.id;
 
4028
 
 
4029
CREATE TABLE productsvnmodule (
 
4030
    id integer NOT NULL,
 
4031
    product integer NOT NULL,
 
4032
    locationurl text NOT NULL,
 
4033
    weburl text,
 
4034
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
 
4035
);
 
4036
 
 
4037
CREATE SEQUENCE productsvnmodule_id_seq
 
4038
    INCREMENT BY 1
 
4039
    NO MAXVALUE
 
4040
    NO MINVALUE
 
4041
    CACHE 1;
 
4042
 
 
4043
ALTER SEQUENCE productsvnmodule_id_seq OWNED BY productsvnmodule.id;
12987
4044
 
12988
4045
CREATE TABLE project (
12989
4046
    id integer NOT NULL,
13018
4075
    CONSTRAINT valid_name CHECK (valid_name(name))
13019
4076
);
13020
4077
 
13021
 
 
13022
 
COMMENT ON TABLE project IS 'Project: A DOAP Project. This table is the core of the DOAP section of the Launchpad database. It contains details of a single open source Project and is the anchor point for products, potemplates, and translationefforts.';
13023
 
 
13024
 
 
13025
 
COMMENT ON COLUMN project.owner IS 'The owner of the project will initially be the person who creates this Project in the system. We will encourage upstream project leaders to take on this role. The Project owner is able to edit the project.';
13026
 
 
13027
 
 
13028
 
COMMENT ON COLUMN project.name IS 'A short lowercase name uniquely identifying the product. Use cases include being used as a key in URL traversal.';
13029
 
 
13030
 
 
13031
 
COMMENT ON COLUMN project.summary IS 'A brief summary of this project. This
13032
 
will be displayed in bold text just above the description and below the
13033
 
title. It should be a single paragraph of not more than 80 words.';
13034
 
 
13035
 
 
13036
 
COMMENT ON COLUMN project.description IS 'A detailed description of this
13037
 
project. This should primarily be focused on the organisational aspects of
13038
 
the project, such as the people involved and the structures that the project
13039
 
uses to govern itself. It might refer to the primary products of the project
13040
 
but the detailed descriptions of those products should be in the
13041
 
Product.description field, not here. So, for example, useful information
13042
 
such as the dates the project was started and the way the project
13043
 
coordinates itself are suitable here.';
13044
 
 
13045
 
 
13046
 
COMMENT ON COLUMN project.homepageurl IS 'The home page URL of this project. Note that this could well be the home page of the main product of this project as well, if the project is too small to have a separate home page for project and product.';
13047
 
 
13048
 
 
13049
 
COMMENT ON COLUMN project.wikiurl IS 'This is the URL of a wiki that includes information about the project. It might be a page in a bigger wiki, or it might be the top page of a wiki devoted to this project.';
13050
 
 
13051
 
 
13052
 
COMMENT ON COLUMN project.lastdoap IS 'This column stores a cached copy of the last DOAP description we saw for this project. We cache the last DOAP fragment for this project because there may be some aspects of it which we are unable to represent in the database (such as multiple homepageurl''s instead of just a single homepageurl) and storing the DOAP file allows us to re-parse it later and recover this information when our database model has been updated appropriately.';
13053
 
 
13054
 
 
13055
 
COMMENT ON COLUMN project.sourceforgeproject IS 'The SourceForge project name for this project. This is not unique as SourceForge doesn''t use the same project/product structure as DOAP.';
13056
 
 
13057
 
 
13058
 
COMMENT ON COLUMN project.freshmeatproject IS 'The FreshMeat project name for this project. This is not unique as FreshMeat does not have the same project/product structure as DOAP';
13059
 
 
13060
 
 
13061
 
COMMENT ON COLUMN project.reviewed IS 'Whether or not someone at Canonical has reviewed this project.';
13062
 
 
13063
 
 
13064
 
COMMENT ON COLUMN project.active IS 'Whether or not this project should be considered active.';
13065
 
 
13066
 
 
13067
 
COMMENT ON COLUMN project.translationgroup IS 'The translation group that has permission to edit translations across all products in this project. Note that individual products may have their own translationgroup, in which case those translators will also have permission to edit translations for that product.';
13068
 
 
13069
 
 
13070
 
COMMENT ON COLUMN project.translationpermission IS 'The level of openness of
13071
 
this project''s translation process. The enum lists different approaches to
13072
 
translation, from the very open (anybody can edit any translation in any
13073
 
language) to the completely closed (only designated translators can make any
13074
 
changes at all).';
13075
 
 
13076
 
 
13077
 
COMMENT ON COLUMN project.driver IS 'This person or team has the ability to approve specs as goals for any series in any product in the project. Similarly, this person or team can approve bugs as targets for fixing in any series, or backporting of fixes to any series.';
13078
 
 
13079
 
 
13080
 
COMMENT ON COLUMN project.homepage_content IS 'A home page for this project in the Launchpad.';
13081
 
 
13082
 
 
13083
 
COMMENT ON COLUMN project.icon IS 'The library file alias to a small image to be used as an icon whenever we are referring to a project.';
13084
 
 
13085
 
 
13086
 
COMMENT ON COLUMN project.mugshot IS 'The library file alias of a mugshot image to display as the branding of a project, on its home page.';
13087
 
 
13088
 
 
13089
 
COMMENT ON COLUMN project.logo IS 'The library file alias of a smaller version of this product''s mugshot.';
13090
 
 
13091
 
 
13092
 
COMMENT ON COLUMN project.bug_reporting_guidelines IS 'Guidelines to the end user for reporting bugs on products in this project.';
13093
 
 
13094
 
 
13095
 
COMMENT ON COLUMN project.reviewer_whiteboard IS 'A whiteboard for Launchpad admins, registry experts and the project owners to capture the state of current issues with the project.';
13096
 
 
13097
 
 
13098
 
COMMENT ON COLUMN project.registrant IS 'The registrant is the Person who created the project in Launchpad.  It is set at creation and is never changed thereafter.';
13099
 
 
13100
 
 
13101
 
COMMENT ON COLUMN project.max_bug_heat IS 'The highest heat value across bugs for products in this project.';
13102
 
 
13103
 
 
13104
 
COMMENT ON COLUMN project.bug_reported_acknowledgement IS 'A message of acknowledgement to display to a bug reporter after they''ve reported a new bug.';
13105
 
 
13106
 
 
13107
4078
CREATE SEQUENCE project_id_seq
13108
 
    START WITH 1
13109
4079
    INCREMENT BY 1
13110
4080
    NO MAXVALUE
13111
4081
    NO MINVALUE
13112
4082
    CACHE 1;
13113
4083
 
13114
 
 
13115
4084
ALTER SEQUENCE project_id_seq OWNED BY project.id;
13116
4085
 
13117
 
 
13118
 
CREATE TABLE publisherconfig (
13119
 
    id integer NOT NULL,
13120
 
    distribution integer NOT NULL,
13121
 
    root_dir text NOT NULL,
13122
 
    base_url text NOT NULL,
13123
 
    copy_base_url text NOT NULL
13124
 
);
13125
 
 
13126
 
 
13127
 
CREATE SEQUENCE publisherconfig_id_seq
13128
 
    START WITH 1
13129
 
    INCREMENT BY 1
13130
 
    NO MAXVALUE
13131
 
    NO MINVALUE
13132
 
    CACHE 1;
13133
 
 
13134
 
 
13135
 
ALTER SEQUENCE publisherconfig_id_seq OWNED BY publisherconfig.id;
13136
 
 
 
4086
CREATE TABLE projectbounty (
 
4087
    id integer NOT NULL,
 
4088
    bounty integer NOT NULL,
 
4089
    project integer NOT NULL,
 
4090
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
 
4091
);
 
4092
 
 
4093
CREATE SEQUENCE projectbounty_id_seq
 
4094
    INCREMENT BY 1
 
4095
    NO MAXVALUE
 
4096
    NO MINVALUE
 
4097
    CACHE 1;
 
4098
 
 
4099
ALTER SEQUENCE projectbounty_id_seq OWNED BY projectbounty.id;
 
4100
 
 
4101
CREATE TABLE projectrelationship (
 
4102
    id integer NOT NULL,
 
4103
    subject integer NOT NULL,
 
4104
    label integer NOT NULL,
 
4105
    object integer NOT NULL
 
4106
);
 
4107
 
 
4108
CREATE SEQUENCE projectrelationship_id_seq
 
4109
    INCREMENT BY 1
 
4110
    NO MAXVALUE
 
4111
    NO MINVALUE
 
4112
    CACHE 1;
 
4113
 
 
4114
ALTER SEQUENCE projectrelationship_id_seq OWNED BY projectrelationship.id;
 
4115
 
 
4116
CREATE TABLE pushmirroraccess (
 
4117
    id integer NOT NULL,
 
4118
    name text NOT NULL,
 
4119
    person integer,
 
4120
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
 
4121
);
 
4122
 
 
4123
CREATE SEQUENCE pushmirroraccess_id_seq
 
4124
    INCREMENT BY 1
 
4125
    NO MAXVALUE
 
4126
    NO MINVALUE
 
4127
    CACHE 1;
 
4128
 
 
4129
ALTER SEQUENCE pushmirroraccess_id_seq OWNED BY pushmirroraccess.id;
13137
4130
 
13138
4131
CREATE TABLE question (
13139
4132
    id integer NOT NULL,
13163
4156
    CONSTRAINT sourcepackagename_needs_distro CHECK (((sourcepackagename IS NULL) OR (distribution IS NOT NULL)))
13164
4157
);
13165
4158
 
13166
 
 
13167
 
COMMENT ON TABLE question IS 'A question, or support request, for a distribution or for an application. Such questions are created by end users who need support on a particular feature or package or product.';
13168
 
 
13169
 
 
13170
 
COMMENT ON COLUMN question.assignee IS 'The person who has been assigned to resolve this question. Note that there is no requirement that every question be assigned somebody. Anybody can chip in to help resolve a question, and if they think they have done so we call them the "answerer".';
13171
 
 
13172
 
 
13173
 
COMMENT ON COLUMN question.answerer IS 'The person who last claimed to have "solved" this support question, giving a response that the owner believe should be sufficient to close the question. This will move the status of the question to "SOLVED". Note that the only person who can actually set the status to SOLVED is the person who asked the question.';
13174
 
 
13175
 
 
13176
 
COMMENT ON COLUMN question.product IS 'The upstream product to which this quesiton is related. Note that a quesiton MUST be linked either to a product, or to a distribution.';
13177
 
 
13178
 
 
13179
 
COMMENT ON COLUMN question.distribution IS 'The distribution for which a question was filed. Note that a request MUST be linked either to a product or a distribution.';
13180
 
 
13181
 
 
13182
 
COMMENT ON COLUMN question.sourcepackagename IS 'An optional source package name. This only makes sense if the question is bound to a distribution.';
13183
 
 
13184
 
 
13185
 
COMMENT ON COLUMN question.datelastquery IS 'The date we last saw a comment from the requester (owner).';
13186
 
 
13187
 
 
13188
 
COMMENT ON COLUMN question.dateaccepted IS 'The date we "confirmed" or "accepted" this question. It is usually set to the date of the first response by someone other than the requester. This allows us to track the time between first request and first response.';
13189
 
 
13190
 
 
13191
 
COMMENT ON COLUMN question.datedue IS 'The date this question is "due", if such a date can be established. Usually this will be set automatically on the basis of a support contract SLA commitment.';
13192
 
 
13193
 
 
13194
 
COMMENT ON COLUMN question.datelastresponse IS 'The date we last saw a comment from somebody other than the requester.';
13195
 
 
13196
 
 
13197
 
COMMENT ON COLUMN question.date_solved IS 'The date this question was last marked as solved by the requester (owner). The requester either found a solution, or accepted an answer from another user.';
13198
 
 
13199
 
 
13200
 
COMMENT ON COLUMN question.dateclosed IS 'The date the requester marked this question CLOSED.';
13201
 
 
13202
 
 
13203
 
COMMENT ON COLUMN question.whiteboard IS 'A general status whiteboard. This is a scratch space to which arbitrary data can be added (there is only one constant whiteboard with no history). It is displayed at the top of the question. So its a useful way for projects to add their own semantics or metadata to the Answer Tracker.';
13204
 
 
13205
 
 
13206
 
COMMENT ON COLUMN question.answer IS 'The QuestionMessage that was accepted by the submitter as the "answer" to the question';
13207
 
 
13208
 
 
13209
 
COMMENT ON COLUMN question.language IS 'The language of the question''s title and description.';
13210
 
 
13211
 
 
13212
 
COMMENT ON COLUMN question.faq IS 'The FAQ document that contains the long answer to this question.';
13213
 
 
13214
 
 
13215
4159
CREATE SEQUENCE question_id_seq
13216
 
    START WITH 1
13217
4160
    INCREMENT BY 1
13218
4161
    NO MAXVALUE
13219
4162
    NO MINVALUE
13220
4163
    CACHE 1;
13221
4164
 
13222
 
 
13223
4165
ALTER SEQUENCE question_id_seq OWNED BY question.id;
13224
4166
 
13225
 
 
13226
4167
CREATE TABLE questionbug (
13227
4168
    id integer NOT NULL,
13228
4169
    question integer NOT NULL,
13230
4171
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
13231
4172
);
13232
4173
 
13233
 
 
13234
 
COMMENT ON TABLE questionbug IS 'A link between a question and a bug, showing that the bug is somehow related to this question.';
13235
 
 
13236
 
 
13237
4174
CREATE SEQUENCE questionbug_id_seq
13238
 
    START WITH 1
13239
4175
    INCREMENT BY 1
13240
4176
    NO MAXVALUE
13241
4177
    NO MINVALUE
13242
4178
    CACHE 1;
13243
4179
 
13244
 
 
13245
4180
ALTER SEQUENCE questionbug_id_seq OWNED BY questionbug.id;
13246
4181
 
13247
 
 
13248
 
CREATE TABLE questionjob (
13249
 
    id integer NOT NULL,
13250
 
    job integer NOT NULL,
13251
 
    job_type integer NOT NULL,
13252
 
    question integer NOT NULL,
13253
 
    json_data text
13254
 
);
13255
 
 
13256
 
 
13257
 
COMMENT ON TABLE questionjob IS 'Contains references to jobs regarding questions.';
13258
 
 
13259
 
 
13260
 
COMMENT ON COLUMN questionjob.job IS 'A reference to a row in the Job table that has all the common job details.';
13261
 
 
13262
 
 
13263
 
COMMENT ON COLUMN questionjob.job_type IS 'The type of job, such as new-answer-notification.';
13264
 
 
13265
 
 
13266
 
COMMENT ON COLUMN questionjob.question IS 'The newly added question message.';
13267
 
 
13268
 
 
13269
 
COMMENT ON COLUMN questionjob.json_data IS 'Data that is specific to the type of job, normally stores text to append to email notifications.';
13270
 
 
13271
 
 
13272
 
CREATE SEQUENCE questionjob_id_seq
13273
 
    START WITH 1
13274
 
    INCREMENT BY 1
13275
 
    NO MAXVALUE
13276
 
    NO MINVALUE
13277
 
    CACHE 1;
13278
 
 
13279
 
 
13280
 
ALTER SEQUENCE questionjob_id_seq OWNED BY questionjob.id;
13281
 
 
13282
 
 
13283
4182
CREATE TABLE questionmessage (
13284
4183
    id integer NOT NULL,
13285
4184
    question integer NOT NULL,
13286
4185
    message integer NOT NULL,
13287
4186
    action integer NOT NULL,
13288
 
    new_status integer NOT NULL,
13289
 
    owner integer NOT NULL
 
4187
    new_status integer NOT NULL
13290
4188
);
13291
4189
 
13292
 
 
13293
 
COMMENT ON TABLE questionmessage IS 'A link between a question and a message. This means that the message will be displayed on the question page.';
13294
 
 
13295
 
 
13296
 
COMMENT ON COLUMN questionmessage.action IS 'The action on the question that was done with this message. This is a value from the QuestionAction enum.';
13297
 
 
13298
 
 
13299
 
COMMENT ON COLUMN questionmessage.new_status IS 'The status of the question after this message.';
13300
 
 
13301
 
 
13302
4190
CREATE SEQUENCE questionmessage_id_seq
13303
 
    START WITH 1
13304
4191
    INCREMENT BY 1
13305
4192
    NO MAXVALUE
13306
4193
    NO MINVALUE
13307
4194
    CACHE 1;
13308
4195
 
13309
 
 
13310
4196
ALTER SEQUENCE questionmessage_id_seq OWNED BY questionmessage.id;
13311
4197
 
13312
 
 
13313
4198
CREATE TABLE questionreopening (
13314
4199
    id integer NOT NULL,
13315
4200
    question integer NOT NULL,
13320
4205
    priorstate integer NOT NULL
13321
4206
);
13322
4207
 
13323
 
 
13324
 
COMMENT ON TABLE questionreopening IS 'A record of the times when a question was re-opened. In each case we store the time that it happened, the person who did it, and the person who had previously answered / rejected the question.';
13325
 
 
13326
 
 
13327
 
COMMENT ON COLUMN questionreopening.reopener IS 'The person who reopened the question.';
13328
 
 
13329
 
 
13330
 
COMMENT ON COLUMN questionreopening.answerer IS 'The person who was previously listed as the answerer of the question.';
13331
 
 
13332
 
 
13333
 
COMMENT ON COLUMN questionreopening.priorstate IS 'The state of the question before it was reopened. You can reopen a question that is ANSWERED, or CLOSED, or REJECTED.';
13334
 
 
13335
 
 
13336
4208
CREATE SEQUENCE questionreopening_id_seq
13337
 
    START WITH 1
13338
4209
    INCREMENT BY 1
13339
4210
    NO MAXVALUE
13340
4211
    NO MINVALUE
13341
4212
    CACHE 1;
13342
4213
 
13343
 
 
13344
4214
ALTER SEQUENCE questionreopening_id_seq OWNED BY questionreopening.id;
13345
4215
 
13346
 
 
13347
4216
CREATE TABLE questionsubscription (
13348
4217
    id integer NOT NULL,
13349
4218
    question integer NOT NULL,
13351
4220
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
13352
4221
);
13353
4222
 
13354
 
 
13355
 
COMMENT ON TABLE questionsubscription IS 'A subscription of a person to a particular question.';
13356
 
 
13357
 
 
13358
4223
CREATE SEQUENCE questionsubscription_id_seq
13359
 
    START WITH 1
13360
4224
    INCREMENT BY 1
13361
4225
    NO MAXVALUE
13362
4226
    NO MINVALUE
13363
4227
    CACHE 1;
13364
4228
 
13365
 
 
13366
4229
ALTER SEQUENCE questionsubscription_id_seq OWNED BY questionsubscription.id;
13367
4230
 
13368
 
 
13369
 
CREATE TABLE revision (
 
4231
CREATE TABLE requestedcds (
13370
4232
    id integer NOT NULL,
13371
 
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
13372
 
    log_body text NOT NULL,
13373
 
    revision_author integer NOT NULL,
13374
 
    gpgkey integer,
13375
 
    revision_id text NOT NULL,
13376
 
    revision_date timestamp without time zone,
13377
 
    karma_allocated boolean DEFAULT false
 
4233
    request integer NOT NULL,
 
4234
    quantity integer NOT NULL,
 
4235
    flavour integer NOT NULL,
 
4236
    distroseries integer NOT NULL,
 
4237
    architecture integer NOT NULL,
 
4238
    quantityapproved integer NOT NULL,
 
4239
    CONSTRAINT quantity_is_positive CHECK ((quantity >= 0)),
 
4240
    CONSTRAINT quantityapproved_is_positive CHECK ((quantityapproved >= 0))
13378
4241
);
13379
 
ALTER TABLE ONLY revision ALTER COLUMN revision_author SET STATISTICS 500;
13380
 
ALTER TABLE ONLY revision ALTER COLUMN revision_date SET STATISTICS 500;
13381
 
 
 
4242
 
 
4243
CREATE SEQUENCE requestedcds_id_seq
 
4244
    INCREMENT BY 1
 
4245
    NO MAXVALUE
 
4246
    NO MINVALUE
 
4247
    CACHE 1;
 
4248
 
 
4249
ALTER SEQUENCE requestedcds_id_seq OWNED BY requestedcds.id;
13382
4250
 
13383
4251
CREATE SEQUENCE revision_id_seq
13384
 
    START WITH 1
13385
4252
    INCREMENT BY 1
13386
4253
    NO MAXVALUE
13387
4254
    NO MINVALUE
13388
4255
    CACHE 1;
13389
4256
 
13390
 
 
13391
4257
ALTER SEQUENCE revision_id_seq OWNED BY revision.id;
13392
4258
 
13393
 
 
13394
4259
CREATE TABLE revisionauthor (
13395
4260
    id integer NOT NULL,
13396
4261
    name text NOT NULL,
13398
4263
    person integer
13399
4264
);
13400
4265
 
13401
 
 
13402
 
COMMENT ON TABLE revisionauthor IS 'All distinct authors for revisions.';
13403
 
 
13404
 
 
13405
 
COMMENT ON COLUMN revisionauthor.name IS 'The exact text extracted from the branch revision.';
13406
 
 
13407
 
 
13408
 
COMMENT ON COLUMN revisionauthor.email IS 'A valid email address extracted from the name.  This email address may or may not be associated with a Launchpad user at this stage.';
13409
 
 
13410
 
 
13411
 
COMMENT ON COLUMN revisionauthor.person IS 'The Launchpad person that has a verified email address that matches the email address of the revision author.';
13412
 
 
13413
 
 
13414
4266
CREATE SEQUENCE revisionauthor_id_seq
13415
 
    START WITH 1
13416
4267
    INCREMENT BY 1
13417
4268
    NO MAXVALUE
13418
4269
    NO MINVALUE
13419
4270
    CACHE 1;
13420
4271
 
13421
 
 
13422
4272
ALTER SEQUENCE revisionauthor_id_seq OWNED BY revisionauthor.id;
13423
4273
 
13424
 
 
13425
4274
CREATE TABLE revisioncache (
13426
4275
    id integer NOT NULL,
13427
4276
    revision integer NOT NULL,
13434
4283
    CONSTRAINT valid_target CHECK ((((distroseries IS NULL) = (sourcepackagename IS NULL)) AND (((distroseries IS NULL) AND (product IS NULL)) OR ((distroseries IS NULL) <> (product IS NULL)))))
13435
4284
);
13436
4285
 
13437
 
 
13438
 
COMMENT ON TABLE revisioncache IS 'A cache of revisions where the revision date is in the last 30 days.';
13439
 
 
13440
 
 
13441
 
COMMENT ON COLUMN revisioncache.revision IS 'A reference to the actual revision.';
13442
 
 
13443
 
 
13444
 
COMMENT ON COLUMN revisioncache.revision_author IS 'A refernce to the revision author for the revision.';
13445
 
 
13446
 
 
13447
 
COMMENT ON COLUMN revisioncache.revision_date IS 'The date the revision was made.  Should be within 30 days of today (or the cleanup code is not cleaning up).';
13448
 
 
13449
 
 
13450
 
COMMENT ON COLUMN revisioncache.product IS 'The product that the revision is found in (if it is indeed in a particular product).';
13451
 
 
13452
 
 
13453
 
COMMENT ON COLUMN revisioncache.distroseries IS 'The distroseries for which a source package branch contains the revision.';
13454
 
 
13455
 
 
13456
 
COMMENT ON COLUMN revisioncache.sourcepackagename IS 'The sourcepackagename for which a source package branch contains the revision.';
13457
 
 
13458
 
 
13459
 
COMMENT ON COLUMN revisioncache.private IS 'True if the revision is only found in private branches, False if it can be found in a non-private branch.';
13460
 
 
13461
 
 
13462
4286
CREATE SEQUENCE revisioncache_id_seq
13463
 
    START WITH 1
13464
4287
    INCREMENT BY 1
13465
4288
    NO MAXVALUE
13466
4289
    NO MINVALUE
13467
4290
    CACHE 1;
13468
4291
 
13469
 
 
13470
4292
ALTER SEQUENCE revisioncache_id_seq OWNED BY revisioncache.id;
13471
4293
 
 
4294
CREATE VIEW revisionnumber AS
 
4295
    SELECT branchrevision.id, branchrevision.sequence, branchrevision.branch, branchrevision.revision FROM branchrevision;
13472
4296
 
13473
4297
CREATE TABLE revisionparent (
13474
4298
    id integer NOT NULL,
13477
4301
    parent_id text NOT NULL
13478
4302
);
13479
4303
 
13480
 
 
13481
4304
CREATE SEQUENCE revisionparent_id_seq
13482
 
    START WITH 1
13483
4305
    INCREMENT BY 1
13484
4306
    NO MAXVALUE
13485
4307
    NO MINVALUE
13486
4308
    CACHE 1;
13487
4309
 
13488
 
 
13489
4310
ALTER SEQUENCE revisionparent_id_seq OWNED BY revisionparent.id;
13490
4311
 
13491
 
 
13492
4312
CREATE TABLE revisionproperty (
13493
4313
    id integer NOT NULL,
13494
4314
    revision integer NOT NULL,
13496
4316
    value text NOT NULL
13497
4317
);
13498
4318
 
13499
 
 
13500
 
COMMENT ON TABLE revisionproperty IS 'A collection of name and value pairs that appear on a revision.';
13501
 
 
13502
 
 
13503
 
COMMENT ON COLUMN revisionproperty.revision IS 'The revision which has properties.';
13504
 
 
13505
 
 
13506
 
COMMENT ON COLUMN revisionproperty.name IS 'The name of the property.';
13507
 
 
13508
 
 
13509
 
COMMENT ON COLUMN revisionproperty.value IS 'The value of the property.';
13510
 
 
13511
 
 
13512
4319
CREATE SEQUENCE revisionproperty_id_seq
13513
 
    START WITH 1
13514
4320
    INCREMENT BY 1
13515
4321
    NO MAXVALUE
13516
4322
    NO MINVALUE
13517
4323
    CACHE 1;
13518
4324
 
13519
 
 
13520
4325
ALTER SEQUENCE revisionproperty_id_seq OWNED BY revisionproperty.id;
13521
4326
 
13522
 
 
13523
4327
CREATE TABLE scriptactivity (
13524
4328
    id integer NOT NULL,
13525
4329
    name text NOT NULL,
13528
4332
    date_completed timestamp without time zone NOT NULL
13529
4333
);
13530
4334
 
13531
 
 
13532
 
COMMENT ON TABLE scriptactivity IS 'Records of successful runs of scripts ';
13533
 
 
13534
 
 
13535
 
COMMENT ON COLUMN scriptactivity.name IS 'The name of the script';
13536
 
 
13537
 
 
13538
 
COMMENT ON COLUMN scriptactivity.hostname IS 'The hostname of the machine where the script was run';
13539
 
 
13540
 
 
13541
 
COMMENT ON COLUMN scriptactivity.date_started IS 'The date at which the script started';
13542
 
 
13543
 
 
13544
 
COMMENT ON COLUMN scriptactivity.date_completed IS 'The date at which the script completed';
13545
 
 
13546
 
 
13547
4335
CREATE SEQUENCE scriptactivity_id_seq
13548
 
    START WITH 1
13549
4336
    INCREMENT BY 1
13550
4337
    NO MAXVALUE
13551
4338
    NO MINVALUE
13552
4339
    CACHE 1;
13553
4340
 
13554
 
 
13555
4341
ALTER SEQUENCE scriptactivity_id_seq OWNED BY scriptactivity.id;
13556
4342
 
13557
 
 
13558
4343
CREATE TABLE section (
13559
4344
    id integer NOT NULL,
13560
4345
    name text NOT NULL
13561
4346
);
13562
4347
 
13563
 
 
13564
 
COMMENT ON TABLE section IS 'Known sections in Launchpad';
13565
 
 
13566
 
 
13567
 
COMMENT ON COLUMN section.name IS 'Section name text';
13568
 
 
13569
 
 
13570
4348
CREATE SEQUENCE section_id_seq
13571
 
    START WITH 1
13572
4349
    INCREMENT BY 1
13573
4350
    NO MAXVALUE
13574
4351
    NO MINVALUE
13575
4352
    CACHE 1;
13576
4353
 
13577
 
 
13578
4354
ALTER SEQUENCE section_id_seq OWNED BY section.id;
13579
4355
 
13580
 
 
13581
4356
CREATE TABLE sectionselection (
13582
4357
    id integer NOT NULL,
13583
4358
    distroseries integer NOT NULL,
13585
4360
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
13586
4361
);
13587
4362
 
13588
 
 
13589
 
COMMENT ON TABLE sectionselection IS 'Allowed sections in a given distroseries.';
13590
 
 
13591
 
 
13592
 
COMMENT ON COLUMN sectionselection.distroseries IS 'Refers to the distroseries in question.';
13593
 
 
13594
 
 
13595
 
COMMENT ON COLUMN sectionselection.section IS 'Refers to the section in question.';
13596
 
 
13597
 
 
13598
4363
CREATE SEQUENCE sectionselection_id_seq
13599
 
    START WITH 1
13600
4364
    INCREMENT BY 1
13601
4365
    NO MAXVALUE
13602
4366
    NO MINVALUE
13603
4367
    CACHE 1;
13604
4368
 
13605
 
 
13606
4369
ALTER SEQUENCE sectionselection_id_seq OWNED BY sectionselection.id;
13607
4370
 
13608
 
 
13609
4371
CREATE TABLE seriessourcepackagebranch (
13610
4372
    id integer NOT NULL,
13611
4373
    distroseries integer NOT NULL,
13616
4378
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
13617
4379
);
13618
4380
 
13619
 
 
13620
 
COMMENT ON TABLE seriessourcepackagebranch IS 'Link between branches and distribution suite.';
13621
 
 
13622
 
 
13623
 
COMMENT ON COLUMN seriessourcepackagebranch.distroseries IS 'The distroseries the branch is linked to.';
13624
 
 
13625
 
 
13626
 
COMMENT ON COLUMN seriessourcepackagebranch.pocket IS 'The pocket the branch is linked to.';
13627
 
 
13628
 
 
13629
 
COMMENT ON COLUMN seriessourcepackagebranch.sourcepackagename IS 'The sourcepackagename the branch is linked to.';
13630
 
 
13631
 
 
13632
 
COMMENT ON COLUMN seriessourcepackagebranch.branch IS 'The branch being linked to a distribution suite.';
13633
 
 
13634
 
 
13635
 
COMMENT ON COLUMN seriessourcepackagebranch.registrant IS 'The person who registered this link.';
13636
 
 
13637
 
 
13638
 
COMMENT ON COLUMN seriessourcepackagebranch.date_created IS 'The date this link was created.';
13639
 
 
13640
 
 
13641
4381
CREATE SEQUENCE seriessourcepackagebranch_id_seq
13642
 
    START WITH 1
13643
4382
    INCREMENT BY 1
13644
4383
    NO MAXVALUE
13645
4384
    NO MINVALUE
13646
4385
    CACHE 1;
13647
4386
 
13648
 
 
13649
4387
ALTER SEQUENCE seriessourcepackagebranch_id_seq OWNED BY seriessourcepackagebranch.id;
13650
4388
 
 
4389
CREATE TABLE shipitreport (
 
4390
    id integer NOT NULL,
 
4391
    datecreated timestamp without time zone NOT NULL,
 
4392
    csvfile integer NOT NULL
 
4393
);
 
4394
 
 
4395
CREATE SEQUENCE shipitreport_id_seq
 
4396
    INCREMENT BY 1
 
4397
    NO MAXVALUE
 
4398
    NO MINVALUE
 
4399
    CACHE 1;
 
4400
 
 
4401
ALTER SEQUENCE shipitreport_id_seq OWNED BY shipitreport.id;
 
4402
 
 
4403
CREATE TABLE shipitsurvey (
 
4404
    id integer NOT NULL,
 
4405
    account integer NOT NULL,
 
4406
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
 
4407
    exported boolean DEFAULT false NOT NULL
 
4408
);
 
4409
 
 
4410
CREATE SEQUENCE shipitsurvey_id_seq
 
4411
    INCREMENT BY 1
 
4412
    NO MAXVALUE
 
4413
    NO MINVALUE
 
4414
    CACHE 1;
 
4415
 
 
4416
ALTER SEQUENCE shipitsurvey_id_seq OWNED BY shipitsurvey.id;
 
4417
 
 
4418
CREATE TABLE shipitsurveyanswer (
 
4419
    id integer NOT NULL,
 
4420
    answer text NOT NULL
 
4421
);
 
4422
 
 
4423
CREATE SEQUENCE shipitsurveyanswer_id_seq
 
4424
    INCREMENT BY 1
 
4425
    NO MAXVALUE
 
4426
    NO MINVALUE
 
4427
    CACHE 1;
 
4428
 
 
4429
ALTER SEQUENCE shipitsurveyanswer_id_seq OWNED BY shipitsurveyanswer.id;
 
4430
 
 
4431
CREATE TABLE shipitsurveyquestion (
 
4432
    id integer NOT NULL,
 
4433
    question text NOT NULL
 
4434
);
 
4435
 
 
4436
CREATE SEQUENCE shipitsurveyquestion_id_seq
 
4437
    INCREMENT BY 1
 
4438
    NO MAXVALUE
 
4439
    NO MINVALUE
 
4440
    CACHE 1;
 
4441
 
 
4442
ALTER SEQUENCE shipitsurveyquestion_id_seq OWNED BY shipitsurveyquestion.id;
 
4443
 
 
4444
CREATE TABLE shipitsurveyresult (
 
4445
    id integer NOT NULL,
 
4446
    survey integer NOT NULL,
 
4447
    question integer NOT NULL,
 
4448
    answer integer
 
4449
);
 
4450
 
 
4451
CREATE SEQUENCE shipitsurveyresult_id_seq
 
4452
    INCREMENT BY 1
 
4453
    NO MAXVALUE
 
4454
    NO MINVALUE
 
4455
    CACHE 1;
 
4456
 
 
4457
ALTER SEQUENCE shipitsurveyresult_id_seq OWNED BY shipitsurveyresult.id;
 
4458
 
 
4459
CREATE TABLE shipment (
 
4460
    id integer NOT NULL,
 
4461
    logintoken text NOT NULL,
 
4462
    shippingrun integer NOT NULL,
 
4463
    dateshipped timestamp without time zone,
 
4464
    shippingservice integer NOT NULL,
 
4465
    trackingcode text
 
4466
);
 
4467
 
 
4468
CREATE SEQUENCE shipment_id_seq
 
4469
    INCREMENT BY 1
 
4470
    NO MAXVALUE
 
4471
    NO MINVALUE
 
4472
    CACHE 1;
 
4473
 
 
4474
ALTER SEQUENCE shipment_id_seq OWNED BY shipment.id;
 
4475
 
 
4476
CREATE TABLE shippingrequest (
 
4477
    id integer NOT NULL,
 
4478
    recipient integer NOT NULL,
 
4479
    whoapproved integer,
 
4480
    whocancelled integer,
 
4481
    daterequested timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
 
4482
    reason text,
 
4483
    highpriority boolean DEFAULT false NOT NULL,
 
4484
    recipientdisplayname text NOT NULL,
 
4485
    addressline1 text NOT NULL,
 
4486
    addressline2 text,
 
4487
    organization text,
 
4488
    city text NOT NULL,
 
4489
    province text,
 
4490
    country integer NOT NULL,
 
4491
    postcode text,
 
4492
    phone text,
 
4493
    fti ts2.tsvector,
 
4494
    shipment integer,
 
4495
    status integer NOT NULL,
 
4496
    normalized_address text NOT NULL,
 
4497
    type integer,
 
4498
    is_admin_request boolean DEFAULT false NOT NULL,
 
4499
    CONSTRAINT enforce_shipped_status CHECK (((status <> 4) OR (shipment IS NOT NULL))),
 
4500
    CONSTRAINT printable_addresses CHECK (is_printable_ascii((((((((COALESCE(recipientdisplayname, ''::text) || COALESCE(addressline1, ''::text)) || COALESCE(addressline2, ''::text)) || COALESCE(organization, ''::text)) || COALESCE(city, ''::text)) || COALESCE(province, ''::text)) || COALESCE(postcode, ''::text)) || COALESCE(phone, ''::text))))
 
4501
);
 
4502
 
 
4503
CREATE SEQUENCE shippingrequest_id_seq
 
4504
    INCREMENT BY 1
 
4505
    NO MAXVALUE
 
4506
    NO MINVALUE
 
4507
    CACHE 1;
 
4508
 
 
4509
ALTER SEQUENCE shippingrequest_id_seq OWNED BY shippingrequest.id;
 
4510
 
 
4511
CREATE TABLE shippingrun (
 
4512
    id integer NOT NULL,
 
4513
    datecreated timestamp without time zone NOT NULL,
 
4514
    sentforshipping boolean DEFAULT false NOT NULL,
 
4515
    csvfile integer,
 
4516
    requests_count integer NOT NULL
 
4517
);
 
4518
 
 
4519
CREATE SEQUENCE shippingrun_id_seq
 
4520
    INCREMENT BY 1
 
4521
    NO MAXVALUE
 
4522
    NO MINVALUE
 
4523
    CACHE 1;
 
4524
 
 
4525
ALTER SEQUENCE shippingrun_id_seq OWNED BY shippingrun.id;
13651
4526
 
13652
4527
CREATE TABLE signedcodeofconduct (
13653
4528
    id integer NOT NULL,
13660
4535
    admincomment text
13661
4536
);
13662
4537
 
13663
 
 
13664
4538
CREATE SEQUENCE signedcodeofconduct_id_seq
13665
 
    START WITH 1
13666
4539
    INCREMENT BY 1
13667
4540
    NO MAXVALUE
13668
4541
    NO MINVALUE
13669
4542
    CACHE 1;
13670
4543
 
13671
 
 
13672
4544
ALTER SEQUENCE signedcodeofconduct_id_seq OWNED BY signedcodeofconduct.id;
13673
4545
 
13674
 
 
13675
4546
CREATE TABLE sourcepackagepublishinghistory (
13676
4547
    id integer NOT NULL,
13677
4548
    sourcepackagerelease integer NOT NULL,
13689
4560
    pocket integer DEFAULT 0 NOT NULL,
13690
4561
    archive integer NOT NULL,
13691
4562
    removed_by integer,
13692
 
    removal_comment text,
13693
 
    ancestor integer,
13694
 
    sourcepackagename integer,
13695
 
    creator integer
 
4563
    removal_comment text
13696
4564
);
13697
4565
 
13698
 
 
13699
 
COMMENT ON TABLE sourcepackagepublishinghistory IS 'SourcePackagePublishingHistory: The history of a SourcePackagePublishing record. This table represents the lifetime of a publishing record from inception to deletion. Records are never removed from here and in time the publishing table may become a view onto this table. A column being NULL indicates there''s no data for that state transition. E.g. a package which is removed without being superseded won''t have datesuperseded or supersededby filled in.';
13700
 
 
13701
 
 
13702
 
COMMENT ON COLUMN sourcepackagepublishinghistory.sourcepackagerelease IS 'The sourcepackagerelease being published.';
13703
 
 
13704
 
 
13705
 
COMMENT ON COLUMN sourcepackagepublishinghistory.distroseries IS 'The distroseries into which the sourcepackagerelease is being published.';
13706
 
 
13707
 
 
13708
 
COMMENT ON COLUMN sourcepackagepublishinghistory.status IS 'The current status of the publishing.';
13709
 
 
13710
 
 
13711
 
COMMENT ON COLUMN sourcepackagepublishinghistory.component IS 'The component into which the publishing takes place.';
13712
 
 
13713
 
 
13714
 
COMMENT ON COLUMN sourcepackagepublishinghistory.section IS 'The section into which the publishing takes place.';
13715
 
 
13716
 
 
13717
 
COMMENT ON COLUMN sourcepackagepublishinghistory.datecreated IS 'The date/time on which the publishing record was created.';
13718
 
 
13719
 
 
13720
 
COMMENT ON COLUMN sourcepackagepublishinghistory.datepublished IS 'The date/time on which the source was actually published into an archive.';
13721
 
 
13722
 
 
13723
 
COMMENT ON COLUMN sourcepackagepublishinghistory.datesuperseded IS 'The date/time on which the source was superseded by a new source.';
13724
 
 
13725
 
 
13726
 
COMMENT ON COLUMN sourcepackagepublishinghistory.supersededby IS 'The source which superseded this one.';
13727
 
 
13728
 
 
13729
 
COMMENT ON COLUMN sourcepackagepublishinghistory.datemadepending IS 'The date/time on which this publishing record was made to be pending removal from the archive.';
13730
 
 
13731
 
 
13732
 
COMMENT ON COLUMN sourcepackagepublishinghistory.scheduleddeletiondate IS 'The date/time at which the source is/was scheduled to be deleted.';
13733
 
 
13734
 
 
13735
 
COMMENT ON COLUMN sourcepackagepublishinghistory.dateremoved IS 'The date/time at which the source was actually deleted.';
13736
 
 
13737
 
 
13738
 
COMMENT ON COLUMN sourcepackagepublishinghistory.pocket IS 'The pocket into which this record is published. The RELEASE pocket (zero) provides behaviour as normal. Other pockets may append things to the distroseries name such as the UPDATES pocket (-updates), the SECURITY pocket (-security) and the PROPOSED pocket (-proposed)';
13739
 
 
13740
 
 
13741
 
COMMENT ON COLUMN sourcepackagepublishinghistory.archive IS 'The target archive for thi publishing record.';
13742
 
 
13743
 
 
13744
 
COMMENT ON COLUMN sourcepackagepublishinghistory.removed_by IS 'Person responsible for the removal.';
13745
 
 
13746
 
 
13747
 
COMMENT ON COLUMN sourcepackagepublishinghistory.removal_comment IS 'Reason why the publication was removed.';
13748
 
 
13749
 
 
13750
4566
CREATE TABLE sourcepackagereleasefile (
13751
4567
    sourcepackagerelease integer NOT NULL,
13752
4568
    libraryfile integer NOT NULL,
13754
4570
    id integer DEFAULT nextval(('sourcepackagereleasefile_id_seq'::text)::regclass) NOT NULL
13755
4571
);
13756
4572
 
13757
 
 
13758
 
COMMENT ON TABLE sourcepackagereleasefile IS 'SourcePackageReleaseFile: A soyuz source package release file. This table links sourcepackagereleasehistory records to the files which comprise the input.';
13759
 
 
13760
 
 
13761
 
COMMENT ON COLUMN sourcepackagereleasefile.sourcepackagerelease IS 'The sourcepackagerelease that this file belongs to';
13762
 
 
13763
 
 
13764
 
COMMENT ON COLUMN sourcepackagereleasefile.libraryfile IS 'The libraryfilealias embodying this file';
13765
 
 
13766
 
 
13767
 
COMMENT ON COLUMN sourcepackagereleasefile.filetype IS 'The type of the file. E.g. TAR, DIFF, DSC';
13768
 
 
13769
 
 
13770
4573
CREATE VIEW sourcepackagefilepublishing AS
13771
4574
    SELECT (((libraryfilealias.id)::text || '.'::text) || (securesourcepackagepublishinghistory.id)::text) AS id, distroseries.distribution, securesourcepackagepublishinghistory.id AS sourcepackagepublishing, sourcepackagereleasefile.libraryfile AS libraryfilealias, libraryfilealias.filename AS libraryfilealiasfilename, sourcepackagename.name AS sourcepackagename, component.name AS componentname, distroseries.name AS distroseriesname, securesourcepackagepublishinghistory.status AS publishingstatus, securesourcepackagepublishinghistory.pocket, securesourcepackagepublishinghistory.archive FROM ((((((sourcepackagepublishinghistory securesourcepackagepublishinghistory JOIN sourcepackagerelease ON ((securesourcepackagepublishinghistory.sourcepackagerelease = sourcepackagerelease.id))) JOIN sourcepackagename ON ((sourcepackagerelease.sourcepackagename = sourcepackagename.id))) JOIN sourcepackagereleasefile ON ((sourcepackagereleasefile.sourcepackagerelease = sourcepackagerelease.id))) JOIN libraryfilealias ON ((libraryfilealias.id = sourcepackagereleasefile.libraryfile))) JOIN distroseries ON ((securesourcepackagepublishinghistory.distroseries = distroseries.id))) JOIN component ON ((securesourcepackagepublishinghistory.component = component.id))) WHERE (securesourcepackagepublishinghistory.dateremoved IS NULL);
13772
4575
 
13773
 
 
13774
 
COMMENT ON VIEW sourcepackagefilepublishing IS 'This view is used mostly by Lucille while performing publishing and unpublishing operations. It lists all the files associated with a sourcepackagerelease and collates all the textual representations needed for publishing components etc to allow rapid queries from SQLObject.';
13775
 
 
13776
 
 
13777
4576
CREATE TABLE sourcepackageformatselection (
13778
4577
    id integer NOT NULL,
13779
4578
    distroseries integer NOT NULL,
13780
4579
    format integer NOT NULL
13781
4580
);
13782
4581
 
13783
 
 
13784
 
COMMENT ON TABLE sourcepackageformatselection IS 'Allowed source package formats for a given distroseries.';
13785
 
 
13786
 
 
13787
 
COMMENT ON COLUMN sourcepackageformatselection.distroseries IS 'Refers to the distroseries in question.';
13788
 
 
13789
 
 
13790
 
COMMENT ON COLUMN sourcepackageformatselection.format IS 'The SourcePackageFormat to allow.';
13791
 
 
13792
 
 
13793
4582
CREATE SEQUENCE sourcepackageformatselection_id_seq
13794
 
    START WITH 1
13795
4583
    INCREMENT BY 1
13796
4584
    NO MAXVALUE
13797
4585
    NO MINVALUE
13798
4586
    CACHE 1;
13799
4587
 
13800
 
 
13801
4588
ALTER SEQUENCE sourcepackageformatselection_id_seq OWNED BY sourcepackageformatselection.id;
13802
4589
 
13803
 
 
13804
4590
CREATE SEQUENCE sourcepackagename_id_seq
13805
 
    START WITH 1
13806
4591
    INCREMENT BY 1
13807
4592
    NO MAXVALUE
13808
4593
    NO MINVALUE
13809
4594
    CACHE 1;
13810
4595
 
13811
 
 
13812
4596
ALTER SEQUENCE sourcepackagename_id_seq OWNED BY sourcepackagename.id;
13813
4597
 
13814
 
 
13815
4598
CREATE SEQUENCE sourcepackagepublishinghistory_id_seq
13816
 
    START WITH 1
13817
4599
    INCREMENT BY 1
13818
4600
    NO MAXVALUE
13819
4601
    NO MINVALUE
13820
4602
    CACHE 1;
13821
4603
 
13822
 
 
13823
4604
ALTER SEQUENCE sourcepackagepublishinghistory_id_seq OWNED BY sourcepackagepublishinghistory.id;
13824
4605
 
13825
 
 
13826
4606
CREATE TABLE sourcepackagerecipe (
13827
4607
    id integer NOT NULL,
13828
4608
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
13830
4610
    registrant integer NOT NULL,
13831
4611
    owner integer NOT NULL,
13832
4612
    name text NOT NULL,
13833
 
    description text,
 
4613
    description text NOT NULL,
13834
4614
    build_daily boolean DEFAULT false NOT NULL,
13835
4615
    daily_build_archive integer,
13836
4616
    is_stale boolean DEFAULT true NOT NULL
13837
4617
);
13838
4618
 
13839
 
 
13840
 
COMMENT ON TABLE sourcepackagerecipe IS 'A recipe for assembling a source package from branches.';
13841
 
 
13842
 
 
13843
 
COMMENT ON COLUMN sourcepackagerecipe.registrant IS 'The person who created this recipe.';
13844
 
 
13845
 
 
13846
 
COMMENT ON COLUMN sourcepackagerecipe.owner IS 'The person or team who can edit this recipe.';
13847
 
 
13848
 
 
13849
 
COMMENT ON COLUMN sourcepackagerecipe.name IS 'The name of the recipe in the web/URL.';
13850
 
 
13851
 
 
13852
 
COMMENT ON COLUMN sourcepackagerecipe.build_daily IS 'If true, this recipe should be built daily.';
13853
 
 
13854
 
 
13855
 
COMMENT ON COLUMN sourcepackagerecipe.daily_build_archive IS 'The archive to build into for daily builds.';
13856
 
 
13857
 
 
13858
 
COMMENT ON COLUMN sourcepackagerecipe.is_stale IS 'True if this recipe has not been built since a branch was updated.';
13859
 
 
13860
 
 
13861
4619
CREATE SEQUENCE sourcepackagerecipe_id_seq
13862
 
    START WITH 1
13863
4620
    INCREMENT BY 1
13864
4621
    NO MAXVALUE
13865
4622
    NO MINVALUE
13866
4623
    CACHE 1;
13867
4624
 
13868
 
 
13869
4625
ALTER SEQUENCE sourcepackagerecipe_id_seq OWNED BY sourcepackagerecipe.id;
13870
4626
 
13871
 
 
13872
4627
CREATE TABLE sourcepackagerecipebuild (
13873
4628
    id integer NOT NULL,
13874
4629
    distroseries integer NOT NULL,
13875
4630
    requester integer NOT NULL,
13876
 
    recipe integer,
 
4631
    recipe integer NOT NULL,
13877
4632
    manifest integer,
13878
4633
    package_build integer NOT NULL
13879
4634
);
13880
4635
 
13881
 
 
13882
 
COMMENT ON TABLE sourcepackagerecipebuild IS 'The build record for the process of building a source package as described by a recipe.';
13883
 
 
13884
 
 
13885
 
COMMENT ON COLUMN sourcepackagerecipebuild.distroseries IS 'The distroseries the build was for.';
13886
 
 
13887
 
 
13888
 
COMMENT ON COLUMN sourcepackagerecipebuild.requester IS 'Who requested the build.';
13889
 
 
13890
 
 
13891
 
COMMENT ON COLUMN sourcepackagerecipebuild.recipe IS 'The recipe being processed.';
13892
 
 
13893
 
 
13894
 
COMMENT ON COLUMN sourcepackagerecipebuild.manifest IS 'The evaluated recipe that was built.';
13895
 
 
13896
 
 
13897
 
COMMENT ON COLUMN sourcepackagerecipebuild.package_build IS 'The package_build with the base information about this build.';
13898
 
 
13899
 
 
13900
4636
CREATE SEQUENCE sourcepackagerecipebuild_id_seq
13901
 
    START WITH 1
13902
4637
    INCREMENT BY 1
13903
4638
    NO MAXVALUE
13904
4639
    NO MINVALUE
13905
4640
    CACHE 1;
13906
4641
 
13907
 
 
13908
4642
ALTER SEQUENCE sourcepackagerecipebuild_id_seq OWNED BY sourcepackagerecipebuild.id;
13909
4643
 
13910
 
 
13911
4644
CREATE TABLE sourcepackagerecipebuildjob (
13912
4645
    id integer NOT NULL,
13913
4646
    job integer NOT NULL,
13914
 
    sourcepackage_recipe_build integer NOT NULL
 
4647
    sourcepackage_recipe_build integer
13915
4648
);
13916
4649
 
13917
 
 
13918
 
COMMENT ON TABLE sourcepackagerecipebuildjob IS 'The link between a SourcePackageRecipeBuild row and a Job row to schedule a build of a source package recipe.';
13919
 
 
13920
 
 
13921
 
COMMENT ON COLUMN sourcepackagerecipebuildjob.sourcepackage_recipe_build IS 'The build record describing the package being built.';
13922
 
 
13923
 
 
13924
4650
CREATE SEQUENCE sourcepackagerecipebuildjob_id_seq
13925
 
    START WITH 1
13926
4651
    INCREMENT BY 1
13927
4652
    NO MAXVALUE
13928
4653
    NO MINVALUE
13929
4654
    CACHE 1;
13930
4655
 
13931
 
 
13932
4656
ALTER SEQUENCE sourcepackagerecipebuildjob_id_seq OWNED BY sourcepackagerecipebuildjob.id;
13933
4657
 
13934
 
 
13935
4658
CREATE TABLE sourcepackagerecipedata (
13936
4659
    id integer NOT NULL,
13937
4660
    base_branch integer NOT NULL,
13943
4666
    CONSTRAINT sourcepackagerecipedata__recipe_or_build_is_not_null CHECK (((sourcepackage_recipe IS NULL) <> (sourcepackage_recipe_build IS NULL)))
13944
4667
);
13945
4668
 
13946
 
 
13947
 
COMMENT ON TABLE sourcepackagerecipedata IS 'The database representation of a BaseRecipeBranch from bzr-builder.  Exactly one of sourcepackage_recipe or sourcepackage_recipe_build will be non-NULL.';
13948
 
 
13949
 
 
13950
 
COMMENT ON COLUMN sourcepackagerecipedata.base_branch IS 'The branch the recipe is based on.';
13951
 
 
13952
 
 
13953
 
COMMENT ON COLUMN sourcepackagerecipedata.recipe_format IS 'The format version of the recipe.';
13954
 
 
13955
 
 
13956
 
COMMENT ON COLUMN sourcepackagerecipedata.deb_version_template IS 'The template for the revision number of the build.';
13957
 
 
13958
 
 
13959
 
COMMENT ON COLUMN sourcepackagerecipedata.revspec IS 'The revision from base_branch to use.';
13960
 
 
13961
 
 
13962
 
COMMENT ON COLUMN sourcepackagerecipedata.sourcepackage_recipe IS 'The recipe that this data is for.';
13963
 
 
13964
 
 
13965
 
COMMENT ON COLUMN sourcepackagerecipedata.sourcepackage_recipe_build IS 'The build that resulted in this manifest.';
13966
 
 
13967
 
 
13968
4669
CREATE SEQUENCE sourcepackagerecipedata_id_seq
13969
 
    START WITH 1
13970
4670
    INCREMENT BY 1
13971
4671
    NO MAXVALUE
13972
4672
    NO MINVALUE
13973
4673
    CACHE 1;
13974
4674
 
13975
 
 
13976
4675
ALTER SEQUENCE sourcepackagerecipedata_id_seq OWNED BY sourcepackagerecipedata.id;
13977
4676
 
13978
 
 
13979
4677
CREATE TABLE sourcepackagerecipedatainstruction (
13980
4678
    id integer NOT NULL,
13981
4679
    name text NOT NULL,
13987
4685
    directory text,
13988
4686
    recipe_data integer NOT NULL,
13989
4687
    parent_instruction integer,
13990
 
    source_directory text,
13991
 
    CONSTRAINT sourcepackagerecipedatainstruction__directory_not_null CHECK ((((type = 3) OR ((type = 1) AND (directory IS NULL))) OR ((type = 2) AND (directory IS NOT NULL)))),
13992
 
    CONSTRAINT sourcepackagerecipedatainstruction__source_directory_null CHECK ((((type = ANY (ARRAY[1, 2])) AND (source_directory IS NULL)) OR ((type = 3) AND (source_directory IS NOT NULL))))
 
4688
    CONSTRAINT sourcepackagerecipedatainstruction__directory_not_null CHECK ((((type = 1) AND (directory IS NULL)) OR ((type = 2) AND (directory IS NOT NULL))))
13993
4689
);
13994
4690
 
13995
 
 
13996
 
COMMENT ON TABLE sourcepackagerecipedatainstruction IS 'A line from the recipe, specifying a branch to nest or merge.';
13997
 
 
13998
 
 
13999
 
COMMENT ON COLUMN sourcepackagerecipedatainstruction.name IS 'The name of the instruction.';
14000
 
 
14001
 
 
14002
 
COMMENT ON COLUMN sourcepackagerecipedatainstruction.type IS 'The type of the instruction (MERGE == 1, NEST == 2).';
14003
 
 
14004
 
 
14005
 
COMMENT ON COLUMN sourcepackagerecipedatainstruction.comment IS 'The comment from the recipe about this instruction.';
14006
 
 
14007
 
 
14008
 
COMMENT ON COLUMN sourcepackagerecipedatainstruction.line_number IS 'The line number of the instruction in the recipe.';
14009
 
 
14010
 
 
14011
 
COMMENT ON COLUMN sourcepackagerecipedatainstruction.branch IS 'The branch being merged or nested.';
14012
 
 
14013
 
 
14014
 
COMMENT ON COLUMN sourcepackagerecipedatainstruction.revspec IS 'The revision of the branch to use.';
14015
 
 
14016
 
 
14017
 
COMMENT ON COLUMN sourcepackagerecipedatainstruction.directory IS 'The location to nest at, if this is a nest/nest-part instruction.';
14018
 
 
14019
 
 
14020
 
COMMENT ON COLUMN sourcepackagerecipedatainstruction.recipe_data IS 'The SourcePackageRecipeData this instruction is part of.';
14021
 
 
14022
 
 
14023
 
COMMENT ON COLUMN sourcepackagerecipedatainstruction.parent_instruction IS 'The nested branch this instruction applies to, or NULL for a top-level instruction.';
14024
 
 
14025
 
 
14026
 
COMMENT ON COLUMN sourcepackagerecipedatainstruction.source_directory IS 'The location in the branch to nest, if this is a nest-part instruction.';
14027
 
 
14028
 
 
14029
4691
CREATE SEQUENCE sourcepackagerecipedatainstruction_id_seq
14030
 
    START WITH 1
14031
4692
    INCREMENT BY 1
14032
4693
    NO MAXVALUE
14033
4694
    NO MINVALUE
14034
4695
    CACHE 1;
14035
4696
 
14036
 
 
14037
4697
ALTER SEQUENCE sourcepackagerecipedatainstruction_id_seq OWNED BY sourcepackagerecipedatainstruction.id;
14038
4698
 
14039
 
 
14040
4699
CREATE TABLE sourcepackagerecipedistroseries (
14041
4700
    id integer NOT NULL,
14042
4701
    sourcepackagerecipe integer NOT NULL,
14043
4702
    distroseries integer NOT NULL
14044
4703
);
14045
4704
 
14046
 
 
14047
 
COMMENT ON TABLE sourcepackagerecipedistroseries IS 'Link table for sourcepackagerecipe and distroseries.';
14048
 
 
14049
 
 
14050
 
COMMENT ON COLUMN sourcepackagerecipedistroseries.sourcepackagerecipe IS 'The primary key of the SourcePackageRecipe.';
14051
 
 
14052
 
 
14053
 
COMMENT ON COLUMN sourcepackagerecipedistroseries.distroseries IS 'The primary key of the DistroSeries.';
14054
 
 
14055
 
 
14056
4705
CREATE SEQUENCE sourcepackagerecipedistroseries_id_seq
14057
 
    START WITH 1
14058
4706
    INCREMENT BY 1
14059
4707
    NO MAXVALUE
14060
4708
    NO MINVALUE
14061
4709
    CACHE 1;
14062
4710
 
14063
 
 
14064
4711
ALTER SEQUENCE sourcepackagerecipedistroseries_id_seq OWNED BY sourcepackagerecipedistroseries.id;
14065
4712
 
14066
 
 
14067
4713
CREATE SEQUENCE sourcepackagerelease_id_seq
14068
 
    START WITH 1
14069
4714
    INCREMENT BY 1
14070
4715
    NO MAXVALUE
14071
4716
    NO MINVALUE
14072
4717
    CACHE 1;
14073
4718
 
14074
 
 
14075
4719
ALTER SEQUENCE sourcepackagerelease_id_seq OWNED BY sourcepackagerelease.id;
14076
4720
 
14077
 
 
14078
4721
CREATE SEQUENCE sourcepackagereleasefile_id_seq
14079
 
    START WITH 1
14080
4722
    INCREMENT BY 1
14081
4723
    NO MAXVALUE
14082
4724
    NO MINVALUE
14083
4725
    CACHE 1;
14084
4726
 
14085
 
 
14086
4727
ALTER SEQUENCE sourcepackagereleasefile_id_seq OWNED BY sourcepackagereleasefile.id;
14087
4728
 
14088
 
 
14089
4729
CREATE TABLE specification (
14090
4730
    id integer NOT NULL,
14091
4731
    name text NOT NULL,
14134
4774
    CONSTRAINT valid_url CHECK (valid_absolute_url(specurl))
14135
4775
);
14136
4776
 
14137
 
 
14138
 
COMMENT ON TABLE specification IS 'A feature specification. At the moment we do not store the actual specification, we store a URL for the spec, which is managed in a wiki somewhere else. We store the overall state of the spec, as well as queueing information about who needs to review the spec, and why.';
14139
 
 
14140
 
 
14141
 
COMMENT ON COLUMN specification.assignee IS 'The person who has been assigned to implement this specification.';
14142
 
 
14143
 
 
14144
 
COMMENT ON COLUMN specification.drafter IS 'The person who has been asked to draft this specification. They are responsible for getting the spec to "approved" state.';
14145
 
 
14146
 
 
14147
 
COMMENT ON COLUMN specification.approver IS 'The person who is responsible for approving the specification in due course, and who will probably be required to review the code itself when it is being implemented.';
14148
 
 
14149
 
 
14150
 
COMMENT ON COLUMN specification.product IS 'The product for which this is a feature specification. The specification must be connected either to a product, or to a distribution.';
14151
 
 
14152
 
 
14153
 
COMMENT ON COLUMN specification.productseries IS 'This is an indicator that the specification is planned, or targeted, for implementation in a given product series. It is not necessary to target a spec to a series, but it is a useful way of showing which specs are planned to implement for a given series.';
14154
 
 
14155
 
 
14156
 
COMMENT ON COLUMN specification.distribution IS 'The distribution for which this is a feature specification. The specification must be connected either to a product, or to a distribution.';
14157
 
 
14158
 
 
14159
 
COMMENT ON COLUMN specification.distroseries IS 'If this is not NULL, then it means that the release managers have targeted this feature to be released in the given distroseries. It is not necessary to target a distroseries, but this is a useful way of know which specifications are, for example, BreezyGoals.';
14160
 
 
14161
 
 
14162
 
COMMENT ON COLUMN specification.milestone IS 'This is an indicator that the feature defined in this specification is expected to be delivered for a given milestone. Note that milestones are not necessarily releases, they are a way of identifying a point in time and grouping bugs and features around that.';
14163
 
 
14164
 
 
14165
 
COMMENT ON COLUMN specification.definition_status IS 'An enum called SpecificationDefinitionStatus that shows what the current status (new, draft, implemented etc) the spec is currently in.';
14166
 
 
14167
 
 
14168
 
COMMENT ON COLUMN specification.priority IS 'An enum that gives the implementation priority (low, medium, high, emergency) of the feature defined in this specification.';
14169
 
 
14170
 
 
14171
 
COMMENT ON COLUMN specification.specurl IS 'The URL where the specification itself can be found. This is usually a wiki page somewhere.';
14172
 
 
14173
 
 
14174
 
COMMENT ON COLUMN specification.whiteboard IS 'As long as the specification is somewhere else (i.e. not in Launchpad) it will be useful to have a place to hold some arbitrary message or status flags that have meaning to the project, not Launchpad. This whiteboard is just the place for it.';
14175
 
 
14176
 
 
14177
 
COMMENT ON COLUMN specification.superseded_by IS 'The specification which replaced this specification.';
14178
 
 
14179
 
 
14180
 
COMMENT ON COLUMN specification.implementation_status IS 'The implementation status of this specification. This field is used to track the actual delivery of the feature (implementing the spec), as opposed to the definition of expected behaviour (writing the spec).';
14181
 
 
14182
 
 
14183
 
COMMENT ON COLUMN specification.goalstatus IS 'Whether or not the drivers for the goal product series or distro release have accepted this specification as a goal.';
14184
 
 
14185
 
 
14186
 
COMMENT ON COLUMN specification.goal_proposer IS 'The person who proposed this spec as a goal for the productseries or distroseries.';
14187
 
 
14188
 
 
14189
 
COMMENT ON COLUMN specification.date_goal_proposed IS 'The date the spec was proposed as a goal.';
14190
 
 
14191
 
 
14192
 
COMMENT ON COLUMN specification.goal_decider IS 'The person who approved or declined this goal.';
14193
 
 
14194
 
 
14195
 
COMMENT ON COLUMN specification.date_goal_decided IS 'The date this goal was accepted or declined.';
14196
 
 
14197
 
 
14198
 
COMMENT ON COLUMN specification.completer IS 'The person who changed the state of the spec in such a way that it was determined to be completed.';
14199
 
 
14200
 
 
14201
 
COMMENT ON COLUMN specification.date_completed IS 'The date this specification was completed or marked obsolete. This lets us chart the progress of a project (or a release) over time in terms of features implemented.';
14202
 
 
14203
 
 
14204
 
COMMENT ON COLUMN specification.private IS 'Specification is private.';
14205
 
 
14206
 
 
14207
 
COMMENT ON CONSTRAINT specification_completion_fully_recorded_chk ON specification IS 'A constraint that ensures, where we have a date_completed, that we also have a completer. This means that the resolution was fully recorded.';
14208
 
 
14209
 
 
14210
4777
CREATE SEQUENCE specification_id_seq
14211
 
    START WITH 1
14212
4778
    INCREMENT BY 1
14213
4779
    NO MAXVALUE
14214
4780
    NO MINVALUE
14215
4781
    CACHE 1;
14216
4782
 
14217
 
 
14218
4783
ALTER SEQUENCE specification_id_seq OWNED BY specification.id;
14219
4784
 
14220
 
 
14221
4785
CREATE TABLE specificationbranch (
14222
4786
    id integer NOT NULL,
14223
4787
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
14227
4791
    registrant integer NOT NULL
14228
4792
);
14229
4793
 
14230
 
 
14231
 
COMMENT ON TABLE specificationbranch IS 'A branch related to a specification, most likely a branch for implementing the specification.  It is possible to have multiple branches for a given specification especially in the situation where the specification requires modifying multiple products.';
14232
 
 
14233
 
 
14234
 
COMMENT ON COLUMN specificationbranch.specification IS 'The specification associated with this branch.';
14235
 
 
14236
 
 
14237
 
COMMENT ON COLUMN specificationbranch.branch IS 'The branch associated to the specification.';
14238
 
 
14239
 
 
14240
 
COMMENT ON COLUMN specificationbranch.registrant IS 'The person who linked the specification to the branch.';
14241
 
 
14242
 
 
14243
4794
CREATE SEQUENCE specificationbranch_id_seq
14244
 
    START WITH 1
14245
4795
    INCREMENT BY 1
14246
4796
    NO MAXVALUE
14247
4797
    NO MINVALUE
14248
4798
    CACHE 1;
14249
4799
 
14250
 
 
14251
4800
ALTER SEQUENCE specificationbranch_id_seq OWNED BY specificationbranch.id;
14252
4801
 
14253
 
 
14254
4802
CREATE TABLE specificationbug (
14255
4803
    id integer NOT NULL,
14256
4804
    specification integer NOT NULL,
14257
4805
    bug integer NOT NULL
14258
4806
);
14259
4807
 
14260
 
 
14261
 
COMMENT ON TABLE specificationbug IS 'A table linking a specification and a bug. This is used to provide for easy navigation from bugs to related specs, and vice versa.';
14262
 
 
14263
 
 
14264
4808
CREATE SEQUENCE specificationbug_id_seq
14265
 
    START WITH 1
14266
4809
    INCREMENT BY 1
14267
4810
    NO MAXVALUE
14268
4811
    NO MINVALUE
14269
4812
    CACHE 1;
14270
4813
 
14271
 
 
14272
4814
ALTER SEQUENCE specificationbug_id_seq OWNED BY specificationbug.id;
14273
4815
 
14274
 
 
14275
4816
CREATE TABLE specificationdependency (
14276
4817
    id integer NOT NULL,
14277
4818
    specification integer NOT NULL,
14280
4821
    CONSTRAINT specificationdependency_not_self CHECK ((specification <> dependency))
14281
4822
);
14282
4823
 
14283
 
 
14284
 
COMMENT ON TABLE specificationdependency IS 'A table that stores information about which specification needs to be implemented before another specification can be implemented. We can create a chain of dependencies, and use that information for scheduling and prioritisation of work.';
14285
 
 
14286
 
 
14287
 
COMMENT ON COLUMN specificationdependency.specification IS 'The spec for which we are creating a dependency.';
14288
 
 
14289
 
 
14290
 
COMMENT ON COLUMN specificationdependency.dependency IS 'The spec on which it is dependant.';
14291
 
 
14292
 
 
14293
4824
CREATE SEQUENCE specificationdependency_id_seq
14294
 
    START WITH 1
14295
4825
    INCREMENT BY 1
14296
4826
    NO MAXVALUE
14297
4827
    NO MINVALUE
14298
4828
    CACHE 1;
14299
4829
 
14300
 
 
14301
4830
ALTER SEQUENCE specificationdependency_id_seq OWNED BY specificationdependency.id;
14302
4831
 
14303
 
 
14304
4832
CREATE TABLE specificationfeedback (
14305
4833
    id integer NOT NULL,
14306
4834
    specification integer NOT NULL,
14310
4838
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
14311
4839
);
14312
4840
 
14313
 
 
14314
 
COMMENT ON TABLE specificationfeedback IS 'A table representing a review request of a specification, from one user to another, with an optional message.';
14315
 
 
14316
 
 
14317
 
COMMENT ON COLUMN specificationfeedback.reviewer IS 'The person who has been asked to do the review.';
14318
 
 
14319
 
 
14320
 
COMMENT ON COLUMN specificationfeedback.requester IS 'The person who made the request.';
14321
 
 
14322
 
 
14323
 
COMMENT ON COLUMN specificationfeedback.queuemsg IS 'An optional text message for the reviewer, from the requester.';
14324
 
 
14325
 
 
14326
4841
CREATE SEQUENCE specificationfeedback_id_seq
14327
 
    START WITH 1
14328
4842
    INCREMENT BY 1
14329
4843
    NO MAXVALUE
14330
4844
    NO MINVALUE
14331
4845
    CACHE 1;
14332
4846
 
14333
 
 
14334
4847
ALTER SEQUENCE specificationfeedback_id_seq OWNED BY specificationfeedback.id;
14335
4848
 
14336
 
 
14337
4849
CREATE TABLE specificationmessage (
14338
4850
    id integer NOT NULL,
14339
4851
    specification integer,
14341
4853
    visible boolean DEFAULT true NOT NULL
14342
4854
);
14343
4855
 
14344
 
 
14345
 
COMMENT ON TABLE specificationmessage IS 'Comments and discussion on a Specification.';
14346
 
 
14347
 
 
14348
4856
CREATE SEQUENCE specificationmessage_id_seq
14349
 
    START WITH 1
14350
4857
    INCREMENT BY 1
14351
4858
    NO MAXVALUE
14352
4859
    NO MINVALUE
14353
4860
    CACHE 1;
14354
4861
 
14355
 
 
14356
4862
ALTER SEQUENCE specificationmessage_id_seq OWNED BY specificationmessage.id;
14357
4863
 
14358
 
 
14359
4864
CREATE TABLE specificationsubscription (
14360
4865
    id integer NOT NULL,
14361
4866
    specification integer NOT NULL,
14364
4869
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
14365
4870
);
14366
4871
 
14367
 
 
14368
 
COMMENT ON TABLE specificationsubscription IS 'A table capturing a subscription of a person to a specification.';
14369
 
 
14370
 
 
14371
 
COMMENT ON COLUMN specificationsubscription.essential IS 'A field that indicates whether or not this person is essential to discussions on the planned feature. This is used by the meeting scheduler to ensure that all the essential people are at any automatically scheduled BOFs discussing that spec.';
14372
 
 
14373
 
 
14374
4872
CREATE SEQUENCE specificationsubscription_id_seq
14375
 
    START WITH 1
14376
4873
    INCREMENT BY 1
14377
4874
    NO MAXVALUE
14378
4875
    NO MINVALUE
14379
4876
    CACHE 1;
14380
4877
 
14381
 
 
14382
4878
ALTER SEQUENCE specificationsubscription_id_seq OWNED BY specificationsubscription.id;
14383
4879
 
14384
 
 
14385
4880
CREATE TABLE spokenin (
14386
4881
    language integer NOT NULL,
14387
4882
    country integer NOT NULL,
14388
4883
    id integer DEFAULT nextval(('spokenin_id_seq'::text)::regclass) NOT NULL
14389
4884
);
14390
4885
 
14391
 
 
14392
4886
CREATE SEQUENCE spokenin_id_seq
14393
 
    START WITH 1
14394
4887
    INCREMENT BY 1
14395
4888
    NO MAXVALUE
14396
4889
    NO MINVALUE
14397
4890
    CACHE 1;
14398
4891
 
14399
 
 
14400
4892
ALTER SEQUENCE spokenin_id_seq OWNED BY spokenin.id;
14401
4893
 
14402
 
 
14403
4894
CREATE TABLE sprint (
14404
4895
    id integer NOT NULL,
14405
4896
    owner integer NOT NULL,
14420
4911
    CONSTRAINT sprint_starts_before_ends CHECK ((time_starts < time_ends))
14421
4912
);
14422
4913
 
14423
 
 
14424
 
COMMENT ON TABLE sprint IS 'A meeting, sprint or conference. This is a convenient way to keep track of a collection of specs that will be discussed, and the people that will be attending.';
14425
 
 
14426
 
 
14427
 
COMMENT ON COLUMN sprint.time_zone IS 'The timezone of the sprint, stored in text format from the Olsen database names, like "US/Eastern".';
14428
 
 
14429
 
 
14430
 
COMMENT ON COLUMN sprint.driver IS 'The driver (together with the registrant or owner) is responsible for deciding which topics will be accepted onto the agenda of the sprint.';
14431
 
 
14432
 
 
14433
 
COMMENT ON COLUMN sprint.homepage_content IS 'A home page for this sprint in the Launchpad.';
14434
 
 
14435
 
 
14436
 
COMMENT ON COLUMN sprint.icon IS 'The library file alias to a small image to be used as an icon whenever we are referring to a sprint.';
14437
 
 
14438
 
 
14439
 
COMMENT ON COLUMN sprint.mugshot IS 'The library file alias of a mugshot image to display as the branding of a sprint, on its home page.';
14440
 
 
14441
 
 
14442
 
COMMENT ON COLUMN sprint.logo IS 'The library file alias of a smaller version of this sprint''s mugshot.';
14443
 
 
14444
 
 
14445
4914
CREATE SEQUENCE sprint_id_seq
14446
 
    START WITH 1
14447
4915
    INCREMENT BY 1
14448
4916
    NO MAXVALUE
14449
4917
    NO MINVALUE
14450
4918
    CACHE 1;
14451
4919
 
14452
 
 
14453
4920
ALTER SEQUENCE sprint_id_seq OWNED BY sprint.id;
14454
4921
 
14455
 
 
14456
4922
CREATE TABLE sprintattendance (
14457
4923
    id integer NOT NULL,
14458
4924
    attendee integer NOT NULL,
14464
4930
    CONSTRAINT sprintattendance_starts_before_ends CHECK ((time_starts < time_ends))
14465
4931
);
14466
4932
 
14467
 
 
14468
 
COMMENT ON TABLE sprintattendance IS 'The record that someone will be attending a particular sprint or meeting.';
14469
 
 
14470
 
 
14471
 
COMMENT ON COLUMN sprintattendance.attendee IS 'The person attending the sprint.';
14472
 
 
14473
 
 
14474
 
COMMENT ON COLUMN sprintattendance.sprint IS 'The sprint the person is attending.';
14475
 
 
14476
 
 
14477
 
COMMENT ON COLUMN sprintattendance.time_starts IS 'The time from which the person will be available to participate in meetings at the sprint.';
14478
 
 
14479
 
 
14480
 
COMMENT ON COLUMN sprintattendance.time_ends IS 'The time of departure from the sprint or conference - this is the last time at which the person is available for meetings during the sprint.';
14481
 
 
14482
 
 
14483
 
COMMENT ON COLUMN sprintattendance.is_physical IS 'Is the person physically attending the sprint';
14484
 
 
14485
 
 
14486
4933
CREATE SEQUENCE sprintattendance_id_seq
14487
 
    START WITH 1
14488
4934
    INCREMENT BY 1
14489
4935
    NO MAXVALUE
14490
4936
    NO MINVALUE
14491
4937
    CACHE 1;
14492
4938
 
14493
 
 
14494
4939
ALTER SEQUENCE sprintattendance_id_seq OWNED BY sprintattendance.id;
14495
4940
 
14496
 
 
14497
4941
CREATE TABLE sprintspecification (
14498
4942
    id integer NOT NULL,
14499
4943
    sprint integer NOT NULL,
14507
4951
    CONSTRAINT sprintspecification_decision_recorded CHECK (((status = 30) OR ((decider IS NOT NULL) AND (date_decided IS NOT NULL))))
14508
4952
);
14509
4953
 
14510
 
 
14511
 
COMMENT ON TABLE sprintspecification IS 'The link between a sprint and a specification, so that we know which specs are going to be discussed at which sprint.';
14512
 
 
14513
 
 
14514
 
COMMENT ON COLUMN sprintspecification.status IS 'Whether or not the spec has been approved on the agenda for this sprint.';
14515
 
 
14516
 
 
14517
 
COMMENT ON COLUMN sprintspecification.whiteboard IS 'A place to store comments specifically related to this spec being on the agenda of this meeting.';
14518
 
 
14519
 
 
14520
 
COMMENT ON COLUMN sprintspecification.registrant IS 'The person who nominated this specification for the agenda of the sprint.';
14521
 
 
14522
 
 
14523
 
COMMENT ON COLUMN sprintspecification.decider IS 'The person who approved or declined this specification for the sprint agenda.';
14524
 
 
14525
 
 
14526
 
COMMENT ON COLUMN sprintspecification.date_decided IS 'The date this specification was approved or declined for the agenda.';
14527
 
 
14528
 
 
14529
4954
CREATE SEQUENCE sprintspecification_id_seq
14530
 
    START WITH 1
14531
4955
    INCREMENT BY 1
14532
4956
    NO MAXVALUE
14533
4957
    NO MINVALUE
14534
4958
    CACHE 1;
14535
4959
 
14536
 
 
14537
4960
ALTER SEQUENCE sprintspecification_id_seq OWNED BY sprintspecification.id;
14538
4961
 
14539
 
 
14540
4962
CREATE TABLE sshkey (
14541
4963
    id integer NOT NULL,
14542
4964
    person integer,
14546
4968
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
14547
4969
);
14548
4970
 
14549
 
 
14550
4971
CREATE SEQUENCE sshkey_id_seq
14551
 
    START WITH 1
14552
4972
    INCREMENT BY 1
14553
4973
    NO MAXVALUE
14554
4974
    NO MINVALUE
14555
4975
    CACHE 1;
14556
4976
 
14557
 
 
14558
4977
ALTER SEQUENCE sshkey_id_seq OWNED BY sshkey.id;
14559
4978
 
 
4979
CREATE TABLE standardshipitrequest (
 
4980
    id integer NOT NULL,
 
4981
    quantityx86 integer NOT NULL,
 
4982
    quantityppc integer NOT NULL,
 
4983
    quantityamd64 integer NOT NULL,
 
4984
    isdefault boolean DEFAULT false NOT NULL,
 
4985
    flavour integer NOT NULL,
 
4986
    description text,
 
4987
    CONSTRAINT quantityamd64_is_positive CHECK ((quantityamd64 >= 0)),
 
4988
    CONSTRAINT quantityppc_is_positive CHECK ((quantityppc >= 0)),
 
4989
    CONSTRAINT quantityx86_is_positive CHECK ((quantityx86 >= 0))
 
4990
);
 
4991
 
 
4992
CREATE SEQUENCE standardshipitrequest_id_seq
 
4993
    INCREMENT BY 1
 
4994
    NO MAXVALUE
 
4995
    NO MINVALUE
 
4996
    CACHE 1;
 
4997
 
 
4998
ALTER SEQUENCE standardshipitrequest_id_seq OWNED BY standardshipitrequest.id;
 
4999
 
 
5000
CREATE TABLE staticdiff (
 
5001
    id integer NOT NULL,
 
5002
    from_revision_id text NOT NULL,
 
5003
    to_revision_id text NOT NULL,
 
5004
    diff integer NOT NULL
 
5005
);
 
5006
 
 
5007
CREATE SEQUENCE staticdiff_id_seq
 
5008
    INCREMENT BY 1
 
5009
    NO MAXVALUE
 
5010
    NO MINVALUE
 
5011
    CACHE 1;
 
5012
 
 
5013
ALTER SEQUENCE staticdiff_id_seq OWNED BY staticdiff.id;
14560
5014
 
14561
5015
CREATE TABLE structuralsubscription (
14562
5016
    id integer NOT NULL,
14569
5023
    sourcepackagename integer,
14570
5024
    subscriber integer NOT NULL,
14571
5025
    subscribed_by integer NOT NULL,
 
5026
    bug_notification_level integer NOT NULL,
 
5027
    blueprint_notification_level integer NOT NULL,
14572
5028
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
14573
5029
    date_last_updated timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
14574
5030
    CONSTRAINT one_target CHECK ((null_count(ARRAY[product, productseries, project, distroseries, distribution, milestone]) = 5)),
14575
5031
    CONSTRAINT sourcepackagename_requires_distribution CHECK (((sourcepackagename IS NULL) OR (distribution IS NOT NULL)))
14576
5032
);
14577
5033
 
14578
 
 
14579
 
COMMENT ON TABLE structuralsubscription IS 'A subscription to notifications about a Launchpad structure';
14580
 
 
14581
 
 
14582
 
COMMENT ON COLUMN structuralsubscription.product IS 'The subscription`s target, when it is a product.';
14583
 
 
14584
 
 
14585
 
COMMENT ON COLUMN structuralsubscription.productseries IS 'The subscription`s target, when it is a product series.';
14586
 
 
14587
 
 
14588
 
COMMENT ON COLUMN structuralsubscription.project IS 'The subscription`s target, when it is a project.';
14589
 
 
14590
 
 
14591
 
COMMENT ON COLUMN structuralsubscription.milestone IS 'The subscription`s target, when it is a milestone.';
14592
 
 
14593
 
 
14594
 
COMMENT ON COLUMN structuralsubscription.distribution IS 'The subscription`s target, when it is a distribution.';
14595
 
 
14596
 
 
14597
 
COMMENT ON COLUMN structuralsubscription.distroseries IS 'The subscription`s target, when it is a distribution series.';
14598
 
 
14599
 
 
14600
 
COMMENT ON COLUMN structuralsubscription.sourcepackagename IS 'The subscription`s target, when it is a source-package';
14601
 
 
14602
 
 
14603
 
COMMENT ON COLUMN structuralsubscription.subscriber IS 'The person subscribed.';
14604
 
 
14605
 
 
14606
 
COMMENT ON COLUMN structuralsubscription.subscribed_by IS 'The person initiating the subscription.';
14607
 
 
14608
 
 
14609
 
COMMENT ON COLUMN structuralsubscription.date_created IS 'The date on which this subscription was created.';
14610
 
 
14611
 
 
14612
 
COMMENT ON COLUMN structuralsubscription.date_last_updated IS 'The date on which this subscription was last updated.';
14613
 
 
14614
 
 
14615
5034
CREATE SEQUENCE structuralsubscription_id_seq
14616
 
    START WITH 1
14617
5035
    INCREMENT BY 1
14618
5036
    NO MAXVALUE
14619
5037
    NO MINVALUE
14620
5038
    CACHE 1;
14621
5039
 
14622
 
 
14623
5040
ALTER SEQUENCE structuralsubscription_id_seq OWNED BY structuralsubscription.id;
14624
5041
 
14625
 
 
14626
 
CREATE TABLE subunitstream (
14627
 
    id integer NOT NULL,
14628
 
    uploader integer NOT NULL,
14629
 
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
14630
 
    branch integer NOT NULL,
14631
 
    stream integer NOT NULL
14632
 
);
14633
 
 
14634
 
 
14635
 
COMMENT ON TABLE subunitstream IS 'Raw gz compressed subunit streams.';
14636
 
 
14637
 
 
14638
 
COMMENT ON COLUMN subunitstream.uploader IS 'The account used to upload the stream.';
14639
 
 
14640
 
 
14641
 
COMMENT ON COLUMN subunitstream.date_created IS 'The date of the upload.';
14642
 
 
14643
 
 
14644
 
COMMENT ON COLUMN subunitstream.branch IS 'The branch which the stream was created on/for/with.';
14645
 
 
14646
 
 
14647
 
COMMENT ON COLUMN subunitstream.stream IS 'The library file alias which contains the stream content.';
14648
 
 
14649
 
 
14650
 
CREATE SEQUENCE subunitstream_id_seq
14651
 
    START WITH 1
14652
 
    INCREMENT BY 1
14653
 
    NO MAXVALUE
14654
 
    NO MINVALUE
14655
 
    CACHE 1;
14656
 
 
14657
 
 
14658
 
ALTER SEQUENCE subunitstream_id_seq OWNED BY subunitstream.id;
14659
 
 
14660
 
 
14661
5042
CREATE TABLE suggestivepotemplate (
14662
5043
    potemplate integer NOT NULL
14663
5044
);
14664
5045
 
14665
 
 
14666
 
COMMENT ON TABLE suggestivepotemplate IS 'Cache of POTemplates that can provide external translation suggestions.';
14667
 
 
14668
 
 
14669
5046
CREATE TABLE teammembership (
14670
5047
    id integer NOT NULL,
14671
5048
    person integer NOT NULL,
14688
5065
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
14689
5066
);
14690
5067
 
14691
 
 
14692
 
COMMENT ON TABLE teammembership IS 'The direct membership of a person on a given team.';
14693
 
 
14694
 
 
14695
 
COMMENT ON COLUMN teammembership.person IS 'The person.';
14696
 
 
14697
 
 
14698
 
COMMENT ON COLUMN teammembership.team IS 'The team.';
14699
 
 
14700
 
 
14701
 
COMMENT ON COLUMN teammembership.status IS 'The state of the membership.';
14702
 
 
14703
 
 
14704
 
COMMENT ON COLUMN teammembership.date_joined IS 'The date this membership was made active for the first time.';
14705
 
 
14706
 
 
14707
 
COMMENT ON COLUMN teammembership.date_expires IS 'The date this membership will expire, if any.';
14708
 
 
14709
 
 
14710
 
COMMENT ON COLUMN teammembership.last_changed_by IS 'The person who reviewed the last change to this membership.';
14711
 
 
14712
 
 
14713
 
COMMENT ON COLUMN teammembership.last_change_comment IS 'The comment left by the reviewer for the change.';
14714
 
 
14715
 
 
14716
 
COMMENT ON COLUMN teammembership.proposed_by IS 'The user who proposed the person as member of the team.';
14717
 
 
14718
 
 
14719
 
COMMENT ON COLUMN teammembership.acknowledged_by IS 'The member (or someone acting on his behalf) who accepts an invitation to join a team';
14720
 
 
14721
 
 
14722
 
COMMENT ON COLUMN teammembership.reviewed_by IS 'The team admin who reviewed (approved/declined) the membership.';
14723
 
 
14724
 
 
14725
 
COMMENT ON COLUMN teammembership.date_proposed IS 'The date of the proposal.';
14726
 
 
14727
 
 
14728
 
COMMENT ON COLUMN teammembership.date_last_changed IS 'The date this membership was last changed.';
14729
 
 
14730
 
 
14731
 
COMMENT ON COLUMN teammembership.date_acknowledged IS 'The date of acknowledgement.';
14732
 
 
14733
 
 
14734
 
COMMENT ON COLUMN teammembership.date_reviewed IS 'The date the membership was
14735
 
approved/declined.';
14736
 
 
14737
 
 
14738
 
COMMENT ON COLUMN teammembership.proponent_comment IS 'The comment left by the proponent.';
14739
 
 
14740
 
 
14741
 
COMMENT ON COLUMN teammembership.acknowledger_comment IS 'The comment left by the person who acknowledged the membership.';
14742
 
 
14743
 
 
14744
 
COMMENT ON COLUMN teammembership.reviewer_comment IS 'The comment left by the approver.';
14745
 
 
14746
 
 
14747
 
COMMENT ON COLUMN teammembership.date_created IS 'The date this membership was created.';
14748
 
 
14749
 
 
14750
5068
CREATE SEQUENCE teammembership_id_seq
14751
 
    START WITH 1
14752
5069
    INCREMENT BY 1
14753
5070
    NO MAXVALUE
14754
5071
    NO MINVALUE
14755
5072
    CACHE 1;
14756
5073
 
14757
 
 
14758
5074
ALTER SEQUENCE teammembership_id_seq OWNED BY teammembership.id;
14759
5075
 
14760
 
 
14761
5076
CREATE TABLE teamparticipation (
14762
5077
    id integer NOT NULL,
14763
5078
    team integer NOT NULL,
14764
5079
    person integer NOT NULL
14765
5080
);
14766
5081
 
14767
 
 
14768
 
COMMENT ON TABLE teamparticipation IS 'The participation of a person on a team, which can be a direct or indirect membership.';
14769
 
 
14770
 
 
14771
 
COMMENT ON COLUMN teamparticipation.team IS 'The team.';
14772
 
 
14773
 
 
14774
 
COMMENT ON COLUMN teamparticipation.person IS 'The member.';
14775
 
 
14776
 
 
14777
5082
CREATE SEQUENCE teamparticipation_id_seq
14778
 
    START WITH 1
14779
5083
    INCREMENT BY 1
14780
5084
    NO MAXVALUE
14781
5085
    NO MINVALUE
14782
5086
    CACHE 1;
14783
5087
 
14784
 
 
14785
5088
ALTER SEQUENCE teamparticipation_id_seq OWNED BY teamparticipation.id;
14786
5089
 
14787
 
 
14788
5090
CREATE TABLE temporaryblobstorage (
14789
5091
    id integer NOT NULL,
14790
5092
    uuid text NOT NULL,
14792
5094
    file_alias integer NOT NULL
14793
5095
);
14794
5096
 
14795
 
 
14796
5097
CREATE SEQUENCE temporaryblobstorage_id_seq
14797
 
    START WITH 1
14798
5098
    INCREMENT BY 1
14799
5099
    NO MAXVALUE
14800
5100
    NO MINVALUE
14801
5101
    CACHE 1;
14802
5102
 
14803
 
 
14804
5103
ALTER SEQUENCE temporaryblobstorage_id_seq OWNED BY temporaryblobstorage.id;
14805
5104
 
14806
 
 
14807
5105
CREATE TABLE translationgroup (
14808
5106
    id integer NOT NULL,
14809
5107
    name text NOT NULL,
14814
5112
    translation_guide_url text
14815
5113
);
14816
5114
 
14817
 
 
14818
 
COMMENT ON TABLE translationgroup IS 'This represents an organised translation group that spans multiple languages. Effectively it consists of a list of people (pointers to Person), and each Person is associated with a Language. So, for each TranslationGroup we can ask the question "in this TranslationGroup, who is responsible for translating into Arabic?", for example.';
14819
 
 
14820
 
 
14821
 
COMMENT ON COLUMN translationgroup.translation_guide_url IS 'URL with documentation about general rules for translation work done by this translation group.';
14822
 
 
14823
 
 
14824
5115
CREATE SEQUENCE translationgroup_id_seq
14825
 
    START WITH 1
14826
5116
    INCREMENT BY 1
14827
5117
    NO MAXVALUE
14828
5118
    NO MINVALUE
14829
5119
    CACHE 1;
14830
5120
 
14831
 
 
14832
5121
ALTER SEQUENCE translationgroup_id_seq OWNED BY translationgroup.id;
14833
5122
 
14834
 
 
14835
5123
CREATE TABLE translationimportqueueentry (
14836
5124
    id integer NOT NULL,
14837
5125
    path text NOT NULL,
14841
5129
    distroseries integer,
14842
5130
    sourcepackagename integer,
14843
5131
    productseries integer,
14844
 
    by_maintainer boolean NOT NULL,
 
5132
    is_published boolean NOT NULL,
14845
5133
    pofile integer,
14846
5134
    potemplate integer,
14847
5135
    status integer DEFAULT 5 NOT NULL,
14851
5139
    CONSTRAINT valid_link CHECK ((((productseries IS NULL) <> (distroseries IS NULL)) AND ((distroseries IS NULL) = (sourcepackagename IS NULL))))
14852
5140
);
14853
5141
 
14854
 
 
14855
 
COMMENT ON TABLE translationimportqueueentry IS 'Queue with translatable resources pending to be imported into Rosetta.';
14856
 
 
14857
 
 
14858
 
COMMENT ON COLUMN translationimportqueueentry.path IS 'The path (included the filename) where this file was stored when we imported it.';
14859
 
 
14860
 
 
14861
 
COMMENT ON COLUMN translationimportqueueentry.content IS 'The file content that is being imported.';
14862
 
 
14863
 
 
14864
 
COMMENT ON COLUMN translationimportqueueentry.importer IS 'The person that did the import.';
14865
 
 
14866
 
 
14867
 
COMMENT ON COLUMN translationimportqueueentry.dateimported IS 'The timestamp when the import was done.';
14868
 
 
14869
 
 
14870
 
COMMENT ON COLUMN translationimportqueueentry.distroseries IS 'The distribution release related to this import.';
14871
 
 
14872
 
 
14873
 
COMMENT ON COLUMN translationimportqueueentry.sourcepackagename IS 'The source package name related to this import.';
14874
 
 
14875
 
 
14876
 
COMMENT ON COLUMN translationimportqueueentry.productseries IS 'The product series related to this import.';
14877
 
 
14878
 
 
14879
 
COMMENT ON COLUMN translationimportqueueentry.by_maintainer IS 'Notes whether is a published upload.';
14880
 
 
14881
 
 
14882
 
COMMENT ON COLUMN translationimportqueueentry.pofile IS 'Link to the POFile where this import will end.';
14883
 
 
14884
 
 
14885
 
COMMENT ON COLUMN translationimportqueueentry.potemplate IS 'Link to the POTemplate where this import will end.';
14886
 
 
14887
 
 
14888
 
COMMENT ON COLUMN translationimportqueueentry.status IS 'The status of the import: 1 Approved, 2 Imported, 3 Deleted, 4 Failed, 5 Needs Review, 6 Blocked.';
14889
 
 
14890
 
 
14891
 
COMMENT ON COLUMN translationimportqueueentry.date_status_changed IS 'The date when the status of this entry was changed.';
14892
 
 
14893
 
 
14894
 
COMMENT ON COLUMN translationimportqueueentry.format IS 'The file format of the content that is being imported.';
14895
 
 
14896
 
 
14897
 
COMMENT ON COLUMN translationimportqueueentry.error_output IS 'Error output from last import attempt.';
14898
 
 
14899
 
 
14900
5142
CREATE SEQUENCE translationimportqueueentry_id_seq
14901
 
    START WITH 1
14902
5143
    INCREMENT BY 1
14903
5144
    NO MAXVALUE
14904
5145
    NO MINVALUE
14905
5146
    CACHE 1;
14906
5147
 
14907
 
 
14908
5148
ALTER SEQUENCE translationimportqueueentry_id_seq OWNED BY translationimportqueueentry.id;
14909
5149
 
14910
 
 
14911
5150
CREATE TABLE translationmessage (
14912
5151
    id integer NOT NULL,
 
5152
    pofile integer,
14913
5153
    potmsgset integer NOT NULL,
14914
5154
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
14915
5155
    submitter integer NOT NULL,
14922
5162
    comment text,
14923
5163
    origin integer NOT NULL,
14924
5164
    validation_status integer DEFAULT 0 NOT NULL,
14925
 
    is_current_ubuntu boolean DEFAULT false NOT NULL,
 
5165
    is_current boolean DEFAULT false NOT NULL,
14926
5166
    is_fuzzy boolean DEFAULT false NOT NULL,
14927
 
    is_current_upstream boolean DEFAULT false NOT NULL,
 
5167
    is_imported boolean DEFAULT false NOT NULL,
14928
5168
    was_obsolete_in_last_import boolean DEFAULT false NOT NULL,
14929
5169
    was_fuzzy_in_last_import boolean DEFAULT false NOT NULL,
14930
5170
    msgstr4 integer,
14931
5171
    msgstr5 integer,
14932
5172
    potemplate integer,
14933
5173
    language integer,
 
5174
    variant text,
14934
5175
    CONSTRAINT translationmessage__reviewer__date_reviewed__valid CHECK (((reviewer IS NULL) = (date_reviewed IS NULL)))
14935
5176
);
14936
5177
 
14937
 
 
14938
 
COMMENT ON TABLE translationmessage IS 'This table stores a concrete
14939
 
translation for a POTMsgSet message. It knows who, when and where did it,
14940
 
and whether it was reviewed by someone and when was it reviewed.';
14941
 
 
14942
 
 
14943
 
COMMENT ON COLUMN translationmessage.potmsgset IS 'The template message which
14944
 
this translation message is a translation of.';
14945
 
 
14946
 
 
14947
 
COMMENT ON COLUMN translationmessage.date_created IS 'The date we saw this
14948
 
translation first.';
14949
 
 
14950
 
 
14951
 
COMMENT ON COLUMN translationmessage.submitter IS 'The person that made
14952
 
the submission through the web to Launchpad, or the last translator on the
14953
 
translation file that we are processing, or the person who uploaded that
14954
 
pofile to Launchpad. In short, our best guess as to the person who is
14955
 
contributing that translation.';
14956
 
 
14957
 
 
14958
 
COMMENT ON COLUMN translationmessage.date_reviewed IS 'The date when this
14959
 
message was reviewed for last time.';
14960
 
 
14961
 
 
14962
 
COMMENT ON COLUMN translationmessage.reviewer IS 'The person who did the
14963
 
review and accepted current translations.';
14964
 
 
14965
 
 
14966
 
COMMENT ON COLUMN translationmessage.msgstr0 IS 'Translation for plural form 0
14967
 
(if any).';
14968
 
 
14969
 
 
14970
 
COMMENT ON COLUMN translationmessage.msgstr1 IS 'Translation for plural form 1
14971
 
(if any).';
14972
 
 
14973
 
 
14974
 
COMMENT ON COLUMN translationmessage.msgstr2 IS 'Translation for plural form 2
14975
 
(if any).';
14976
 
 
14977
 
 
14978
 
COMMENT ON COLUMN translationmessage.msgstr3 IS 'Translation for plural form 3
14979
 
(if any).';
14980
 
 
14981
 
 
14982
 
COMMENT ON COLUMN translationmessage.comment IS 'Text of translator
14983
 
comment from the translation file.';
14984
 
 
14985
 
 
14986
 
COMMENT ON COLUMN translationmessage.origin IS 'The source of this
14987
 
translation. This indicates whether the translation was in a translation file
14988
 
that we parsed (probably one published in a package or branch or tarball), in
14989
 
which case its value will be 1, or was submitted through the web, in which
14990
 
case its value will be 2.';
14991
 
 
14992
 
 
14993
 
COMMENT ON COLUMN translationmessage.validation_status IS 'Whether we have
14994
 
validated this translation. Being 0 the value that says this row has not been
14995
 
validated yet, 1 the value that says it is correct and 2 the value noting that
14996
 
there was an unknown error with the validation.';
14997
 
 
14998
 
 
14999
 
COMMENT ON COLUMN translationmessage.is_current_ubuntu IS 'Whether this translation
15000
 
is being used in Launchpad.';
15001
 
 
15002
 
 
15003
 
COMMENT ON COLUMN translationmessage.is_fuzzy IS 'Whether this translation
15004
 
must be checked before use it.';
15005
 
 
15006
 
 
15007
 
COMMENT ON COLUMN translationmessage.is_current_upstream IS 'Whether this translation
15008
 
is being used in latest imported file.';
15009
 
 
15010
 
 
15011
 
COMMENT ON COLUMN translationmessage.was_obsolete_in_last_import IS 'Whether
15012
 
this translation was obsolete in last imported file.';
15013
 
 
15014
 
 
15015
 
COMMENT ON COLUMN translationmessage.was_fuzzy_in_last_import IS 'Whether this
15016
 
imported translation must be checked before use it.';
15017
 
 
15018
 
 
15019
5178
CREATE SEQUENCE translationmessage_id_seq
15020
 
    START WITH 1
15021
5179
    INCREMENT BY 1
15022
5180
    NO MAXVALUE
15023
5181
    NO MINVALUE
15024
5182
    CACHE 1;
15025
5183
 
15026
 
 
15027
5184
ALTER SEQUENCE translationmessage_id_seq OWNED BY translationmessage.id;
15028
5185
 
15029
 
 
15030
5186
CREATE TABLE translationrelicensingagreement (
15031
5187
    id integer NOT NULL,
15032
5188
    person integer NOT NULL,
15034
5190
    date_decided timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
15035
5191
);
15036
5192
 
15037
 
 
15038
 
COMMENT ON TABLE translationrelicensingagreement IS 'Who of translation contributors wants their translations relicensed and who does not.';
15039
 
 
15040
 
 
15041
 
COMMENT ON COLUMN translationrelicensingagreement.person IS 'A translator which has submitted their answer.';
15042
 
 
15043
 
 
15044
 
COMMENT ON COLUMN translationrelicensingagreement.allow_relicensing IS 'Does this person want their translations relicensed under BSD.';
15045
 
 
15046
 
 
15047
 
COMMENT ON COLUMN translationrelicensingagreement.date_decided IS 'Date when the last change of opinion was registered.';
15048
 
 
15049
 
 
15050
5193
CREATE SEQUENCE translationrelicensingagreement_id_seq
15051
 
    START WITH 1
15052
5194
    INCREMENT BY 1
15053
5195
    NO MAXVALUE
15054
5196
    NO MINVALUE
15055
5197
    CACHE 1;
15056
5198
 
15057
 
 
15058
5199
ALTER SEQUENCE translationrelicensingagreement_id_seq OWNED BY translationrelicensingagreement.id;
15059
5200
 
15060
 
 
15061
5201
CREATE SEQUENCE translationtemplateitem_id_seq
15062
 
    START WITH 1
15063
5202
    INCREMENT BY 1
15064
5203
    NO MAXVALUE
15065
5204
    NO MINVALUE
15066
5205
    CACHE 1;
15067
5206
 
15068
 
 
15069
5207
ALTER SEQUENCE translationtemplateitem_id_seq OWNED BY translationtemplateitem.id;
15070
5208
 
15071
 
 
15072
 
CREATE TABLE translationtemplatesbuild (
15073
 
    id integer NOT NULL,
15074
 
    build_farm_job integer NOT NULL,
15075
 
    branch integer NOT NULL
15076
 
);
15077
 
 
15078
 
 
15079
 
COMMENT ON TABLE translationtemplatesbuild IS 'Build-farm record of a translation templates build.';
15080
 
 
15081
 
 
15082
 
COMMENT ON COLUMN translationtemplatesbuild.build_farm_job IS 'Associated BuildFarmJob.';
15083
 
 
15084
 
 
15085
 
COMMENT ON COLUMN translationtemplatesbuild.branch IS 'Branch to build templates out of.';
15086
 
 
15087
 
 
15088
 
CREATE SEQUENCE translationtemplatesbuild_id_seq
15089
 
    START WITH 1
15090
 
    INCREMENT BY 1
15091
 
    NO MAXVALUE
15092
 
    NO MINVALUE
15093
 
    CACHE 1;
15094
 
 
15095
 
 
15096
 
ALTER SEQUENCE translationtemplatesbuild_id_seq OWNED BY translationtemplatesbuild.id;
15097
 
 
15098
 
 
15099
5209
CREATE TABLE translator (
15100
5210
    id integer NOT NULL,
15101
5211
    translationgroup integer NOT NULL,
15105
5215
    style_guide_url text
15106
5216
);
15107
5217
 
15108
 
 
15109
 
COMMENT ON TABLE translator IS 'A translator is a person in a TranslationGroup who is responsible for a particular language. At the moment, there can only be one person in a TranslationGroup who is the Translator for a particular language. If you want multiple people, then create a launchpad team and assign that team to the language.';
15110
 
 
15111
 
 
15112
 
COMMENT ON COLUMN translator.translationgroup IS 'The TranslationGroup for which this Translator is working.';
15113
 
 
15114
 
 
15115
 
COMMENT ON COLUMN translator.language IS 'The language for which this Translator is responsible in this TranslationGroup. Note that the same person may be responsible for multiple languages, but any given language can only have one Translator within the TranslationGroup.';
15116
 
 
15117
 
 
15118
 
COMMENT ON COLUMN translator.translator IS 'The Person who is responsible for this language in this translation group.';
15119
 
 
15120
 
 
15121
 
COMMENT ON COLUMN translator.style_guide_url IS 'URL with translation style guide of a particular translation team.';
15122
 
 
15123
 
 
15124
5218
CREATE SEQUENCE translator_id_seq
15125
 
    START WITH 1
15126
5219
    INCREMENT BY 1
15127
5220
    NO MAXVALUE
15128
5221
    NO MINVALUE
15129
5222
    CACHE 1;
15130
5223
 
15131
 
 
15132
5224
ALTER SEQUENCE translator_id_seq OWNED BY translator.id;
15133
5225
 
15134
 
 
15135
5226
CREATE TABLE usertouseremail (
15136
5227
    id integer NOT NULL,
15137
5228
    sender integer NOT NULL,
15141
5232
    message_id text NOT NULL
15142
5233
);
15143
5234
 
15144
 
 
15145
 
COMMENT ON TABLE usertouseremail IS 'A log of all direct user-to-user email contacts that have gone through Launchpad.';
15146
 
 
15147
 
 
15148
 
COMMENT ON COLUMN usertouseremail.sender IS 'The person sending this email.';
15149
 
 
15150
 
 
15151
 
COMMENT ON COLUMN usertouseremail.recipient IS 'The person receiving this email.';
15152
 
 
15153
 
 
15154
 
COMMENT ON COLUMN usertouseremail.date_sent IS 'The date the email was sent.';
15155
 
 
15156
 
 
15157
 
COMMENT ON COLUMN usertouseremail.subject IS 'The Subject: header.';
15158
 
 
15159
 
 
15160
 
COMMENT ON COLUMN usertouseremail.message_id IS 'The Message-ID: header.';
15161
 
 
15162
 
 
15163
5235
CREATE SEQUENCE usertouseremail_id_seq
15164
 
    START WITH 1
15165
5236
    INCREMENT BY 1
15166
5237
    NO MAXVALUE
15167
5238
    NO MINVALUE
15168
5239
    CACHE 1;
15169
5240
 
15170
 
 
15171
5241
ALTER SEQUENCE usertouseremail_id_seq OWNED BY usertouseremail.id;
15172
5242
 
15173
 
 
15174
5243
CREATE VIEW validpersoncache AS
15175
5244
    SELECT emailaddress.person AS id FROM emailaddress, account WHERE ((((emailaddress.account = account.id) AND (emailaddress.person IS NOT NULL)) AND (emailaddress.status = 4)) AND (account.status = 20));
15176
5245
 
15177
 
 
15178
 
COMMENT ON VIEW validpersoncache IS 'A materialized view listing the Person.ids of all valid people (but not teams).';
15179
 
 
15180
 
 
15181
5246
CREATE VIEW validpersonorteamcache AS
15182
5247
    SELECT person.id FROM ((person LEFT JOIN emailaddress ON ((person.id = emailaddress.person))) LEFT JOIN account ON ((emailaddress.account = account.id))) WHERE (((person.teamowner IS NOT NULL) AND (person.merged IS NULL)) OR (((person.teamowner IS NULL) AND (account.status = 20)) AND (emailaddress.status = 4)));
15183
5248
 
15184
 
 
15185
5249
CREATE TABLE vote (
15186
5250
    id integer NOT NULL,
15187
5251
    person integer,
15191
5255
    token text NOT NULL
15192
5256
);
15193
5257
 
15194
 
 
15195
 
COMMENT ON TABLE vote IS 'The table where we store the actual votes of people.  It may or may not have a reference to the person who voted, depending on the poll''s secrecy.';
15196
 
 
15197
 
 
15198
 
COMMENT ON COLUMN vote.person IS 'The person who voted. It''s NULL for secret polls.';
15199
 
 
15200
 
 
15201
 
COMMENT ON COLUMN vote.poll IS 'The poll for which this vote applies.';
15202
 
 
15203
 
 
15204
 
COMMENT ON COLUMN vote.preference IS 'Used to identify in what order the options were chosen by a given user (in case of preferential voting).';
15205
 
 
15206
 
 
15207
 
COMMENT ON COLUMN vote.option IS 'The choosen option.';
15208
 
 
15209
 
 
15210
 
COMMENT ON COLUMN vote.token IS 'A unique token that''s give to the user so he can change his vote later.';
15211
 
 
15212
 
 
15213
5258
CREATE SEQUENCE vote_id_seq
15214
 
    START WITH 1
15215
5259
    INCREMENT BY 1
15216
5260
    NO MAXVALUE
15217
5261
    NO MINVALUE
15218
5262
    CACHE 1;
15219
5263
 
15220
 
 
15221
5264
ALTER SEQUENCE vote_id_seq OWNED BY vote.id;
15222
5265
 
15223
 
 
15224
5266
CREATE TABLE votecast (
15225
5267
    id integer NOT NULL,
15226
5268
    person integer NOT NULL,
15227
5269
    poll integer NOT NULL
15228
5270
);
15229
5271
 
15230
 
 
15231
 
COMMENT ON TABLE votecast IS 'Here we store who has already voted in a poll, to ensure they do not vote again, and potentially to notify people that they may still vote.';
15232
 
 
15233
 
 
15234
 
COMMENT ON COLUMN votecast.person IS 'The person who voted.';
15235
 
 
15236
 
 
15237
 
COMMENT ON COLUMN votecast.poll IS 'The poll in which this person voted.';
15238
 
 
15239
 
 
15240
5272
CREATE SEQUENCE votecast_id_seq
15241
 
    START WITH 1
15242
5273
    INCREMENT BY 1
15243
5274
    NO MAXVALUE
15244
5275
    NO MINVALUE
15245
5276
    CACHE 1;
15246
5277
 
15247
 
 
15248
5278
ALTER SEQUENCE votecast_id_seq OWNED BY votecast.id;
15249
5279
 
 
5280
CREATE TABLE webserviceban (
 
5281
    id integer NOT NULL,
 
5282
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()),
 
5283
    person integer,
 
5284
    consumer integer,
 
5285
    token integer,
 
5286
    ip inet,
 
5287
    active boolean DEFAULT true,
 
5288
    CONSTRAINT at_least_one_spec CHECK (((ip IS NOT NULL) OR (null_count(ARRAY[person, consumer, token]) < 3))),
 
5289
    CONSTRAINT person_or_consumer_or_token_or_none CHECK ((null_count(ARRAY[person, consumer, token]) >= 2))
 
5290
);
 
5291
 
 
5292
CREATE SEQUENCE webserviceban_id_seq
 
5293
    INCREMENT BY 1
 
5294
    NO MAXVALUE
 
5295
    NO MINVALUE
 
5296
    CACHE 1;
 
5297
 
 
5298
ALTER SEQUENCE webserviceban_id_seq OWNED BY webserviceban.id;
15250
5299
 
15251
5300
CREATE TABLE wikiname (
15252
5301
    id integer NOT NULL,
15255
5304
    wikiname text NOT NULL
15256
5305
);
15257
5306
 
15258
 
 
15259
5307
CREATE SEQUENCE wikiname_id_seq
15260
 
    START WITH 1
15261
5308
    INCREMENT BY 1
15262
5309
    NO MAXVALUE
15263
5310
    NO MINVALUE
15264
5311
    CACHE 1;
15265
5312
 
15266
 
 
15267
5313
ALTER SEQUENCE wikiname_id_seq OWNED BY wikiname.id;
15268
5314
 
15269
 
 
15270
 
ALTER TABLE accesspolicy ALTER COLUMN id SET DEFAULT nextval('accesspolicy_id_seq'::regclass);
15271
 
 
15272
 
 
15273
 
ALTER TABLE accesspolicyartifact ALTER COLUMN id SET DEFAULT nextval('accesspolicyartifact_id_seq'::regclass);
15274
 
 
15275
 
 
15276
 
ALTER TABLE accesspolicygrant ALTER COLUMN id SET DEFAULT nextval('accesspolicygrant_id_seq'::regclass);
15277
 
 
15278
 
 
15279
5315
ALTER TABLE account ALTER COLUMN id SET DEFAULT nextval('account_id_seq'::regclass);
15280
5316
 
15281
 
 
15282
5317
ALTER TABLE accountpassword ALTER COLUMN id SET DEFAULT nextval('accountpassword_id_seq'::regclass);
15283
5318
 
15284
 
 
15285
5319
ALTER TABLE announcement ALTER COLUMN id SET DEFAULT nextval('announcement_id_seq'::regclass);
15286
5320
 
15287
 
 
15288
5321
ALTER TABLE answercontact ALTER COLUMN id SET DEFAULT nextval('answercontact_id_seq'::regclass);
15289
5322
 
15290
 
 
15291
5323
ALTER TABLE apportjob ALTER COLUMN id SET DEFAULT nextval('apportjob_id_seq'::regclass);
15292
5324
 
15293
 
 
15294
5325
ALTER TABLE archive ALTER COLUMN id SET DEFAULT nextval('archive_id_seq'::regclass);
15295
5326
 
15296
 
 
15297
5327
ALTER TABLE archivearch ALTER COLUMN id SET DEFAULT nextval('archivearch_id_seq'::regclass);
15298
5328
 
15299
 
 
15300
5329
ALTER TABLE archiveauthtoken ALTER COLUMN id SET DEFAULT nextval('archiveauthtoken_id_seq'::regclass);
15301
5330
 
15302
 
 
15303
5331
ALTER TABLE archivedependency ALTER COLUMN id SET DEFAULT nextval('archivedependency_id_seq'::regclass);
15304
5332
 
15305
 
 
15306
5333
ALTER TABLE archivejob ALTER COLUMN id SET DEFAULT nextval('archivejob_id_seq'::regclass);
15307
5334
 
15308
 
 
15309
5335
ALTER TABLE archivepermission ALTER COLUMN id SET DEFAULT nextval('archivepermission_id_seq'::regclass);
15310
5336
 
15311
 
 
15312
5337
ALTER TABLE archivesubscriber ALTER COLUMN id SET DEFAULT nextval('archivesubscriber_id_seq'::regclass);
15313
5338
 
 
5339
ALTER TABLE authtoken ALTER COLUMN id SET DEFAULT nextval('authtoken_id_seq'::regclass);
15314
5340
 
15315
5341
ALTER TABLE binarypackagebuild ALTER COLUMN id SET DEFAULT nextval('binarypackagebuild_id_seq'::regclass);
15316
5342
 
15317
 
 
15318
5343
ALTER TABLE binarypackagename ALTER COLUMN id SET DEFAULT nextval('binarypackagename_id_seq'::regclass);
15319
5344
 
15320
 
 
15321
 
ALTER TABLE binarypackagepath ALTER COLUMN id SET DEFAULT nextval('binarypackagepath_id_seq'::regclass);
15322
 
 
15323
 
 
15324
5345
ALTER TABLE binarypackagepublishinghistory ALTER COLUMN id SET DEFAULT nextval('binarypackagepublishinghistory_id_seq'::regclass);
15325
5346
 
15326
 
 
15327
5347
ALTER TABLE binarypackagerelease ALTER COLUMN id SET DEFAULT nextval('binarypackagerelease_id_seq'::regclass);
15328
5348
 
15329
 
 
15330
5349
ALTER TABLE binarypackagereleasedownloadcount ALTER COLUMN id SET DEFAULT nextval('binarypackagereleasedownloadcount_id_seq'::regclass);
15331
5350
 
 
5351
ALTER TABLE bounty ALTER COLUMN id SET DEFAULT nextval('bounty_id_seq'::regclass);
 
5352
 
 
5353
ALTER TABLE bountymessage ALTER COLUMN id SET DEFAULT nextval('bountymessage_id_seq'::regclass);
 
5354
 
 
5355
ALTER TABLE bountysubscription ALTER COLUMN id SET DEFAULT nextval('bountysubscription_id_seq'::regclass);
15332
5356
 
15333
5357
ALTER TABLE branch ALTER COLUMN id SET DEFAULT nextval('branch_id_seq'::regclass);
15334
5358
 
15335
 
 
15336
5359
ALTER TABLE branchjob ALTER COLUMN id SET DEFAULT nextval('branchjob_id_seq'::regclass);
15337
5360
 
15338
 
 
15339
5361
ALTER TABLE branchmergeproposal ALTER COLUMN id SET DEFAULT nextval('branchmergeproposal_id_seq'::regclass);
15340
5362
 
15341
 
 
15342
5363
ALTER TABLE branchmergeproposaljob ALTER COLUMN id SET DEFAULT nextval('branchmergeproposaljob_id_seq'::regclass);
15343
5364
 
15344
 
 
15345
 
ALTER TABLE branchmergequeue ALTER COLUMN id SET DEFAULT nextval('branchmergequeue_id_seq'::regclass);
15346
 
 
 
5365
ALTER TABLE branchmergerobot ALTER COLUMN id SET DEFAULT nextval('branchmergerobot_id_seq'::regclass);
 
5366
 
 
5367
ALTER TABLE branchrevision ALTER COLUMN id SET DEFAULT nextval('branchrevision_id_seq'::regclass);
15347
5368
 
15348
5369
ALTER TABLE branchsubscription ALTER COLUMN id SET DEFAULT nextval('branchsubscription_id_seq'::regclass);
15349
5370
 
15350
 
 
15351
5371
ALTER TABLE branchvisibilitypolicy ALTER COLUMN id SET DEFAULT nextval('branchvisibilitypolicy_id_seq'::regclass);
15352
5372
 
15353
 
 
15354
5373
ALTER TABLE bug ALTER COLUMN id SET DEFAULT nextval('bug_id_seq'::regclass);
15355
5374
 
15356
 
 
15357
5375
ALTER TABLE bugactivity ALTER COLUMN id SET DEFAULT nextval('bugactivity_id_seq'::regclass);
15358
5376
 
15359
 
 
15360
5377
ALTER TABLE bugaffectsperson ALTER COLUMN id SET DEFAULT nextval('bugaffectsperson_id_seq'::regclass);
15361
5378
 
15362
 
 
15363
5379
ALTER TABLE bugattachment ALTER COLUMN id SET DEFAULT nextval('bugattachment_id_seq'::regclass);
15364
5380
 
15365
 
 
15366
5381
ALTER TABLE bugbranch ALTER COLUMN id SET DEFAULT nextval('bugbranch_id_seq'::regclass);
15367
5382
 
15368
 
 
15369
5383
ALTER TABLE bugcve ALTER COLUMN id SET DEFAULT nextval('bugcve_id_seq'::regclass);
15370
5384
 
15371
 
 
15372
5385
ALTER TABLE bugjob ALTER COLUMN id SET DEFAULT nextval('bugjob_id_seq'::regclass);
15373
5386
 
15374
 
 
15375
5387
ALTER TABLE bugmessage ALTER COLUMN id SET DEFAULT nextval('bugmessage_id_seq'::regclass);
15376
5388
 
15377
 
 
15378
5389
ALTER TABLE bugnomination ALTER COLUMN id SET DEFAULT nextval('bugnomination_id_seq'::regclass);
15379
5390
 
15380
 
 
15381
5391
ALTER TABLE bugnotification ALTER COLUMN id SET DEFAULT nextval('bugnotification_id_seq'::regclass);
15382
5392
 
15383
 
 
15384
5393
ALTER TABLE bugnotificationattachment ALTER COLUMN id SET DEFAULT nextval('bugnotificationattachment_id_seq'::regclass);
15385
5394
 
15386
 
 
15387
5395
ALTER TABLE bugnotificationrecipient ALTER COLUMN id SET DEFAULT nextval('bugnotificationrecipient_id_seq'::regclass);
15388
5396
 
 
5397
ALTER TABLE bugpackageinfestation ALTER COLUMN id SET DEFAULT nextval('bugpackageinfestation_id_seq'::regclass);
 
5398
 
 
5399
ALTER TABLE bugproductinfestation ALTER COLUMN id SET DEFAULT nextval('bugproductinfestation_id_seq'::regclass);
15389
5400
 
15390
5401
ALTER TABLE bugsubscription ALTER COLUMN id SET DEFAULT nextval('bugsubscription_id_seq'::regclass);
15391
5402
 
15392
 
 
15393
 
ALTER TABLE bugsubscriptionfilter ALTER COLUMN id SET DEFAULT nextval('bugsubscriptionfilter_id_seq'::regclass);
15394
 
 
15395
 
 
15396
 
ALTER TABLE bugsubscriptionfilterimportance ALTER COLUMN id SET DEFAULT nextval('bugsubscriptionfilterimportance_id_seq'::regclass);
15397
 
 
15398
 
 
15399
 
ALTER TABLE bugsubscriptionfilterstatus ALTER COLUMN id SET DEFAULT nextval('bugsubscriptionfilterstatus_id_seq'::regclass);
15400
 
 
15401
 
 
15402
 
ALTER TABLE bugsubscriptionfiltertag ALTER COLUMN id SET DEFAULT nextval('bugsubscriptionfiltertag_id_seq'::regclass);
15403
 
 
15404
 
 
15405
 
ALTER TABLE bugsummary ALTER COLUMN id SET DEFAULT nextval('bugsummary_id_seq'::regclass);
15406
 
 
15407
 
 
15408
 
ALTER TABLE bugsummaryjournal ALTER COLUMN id SET DEFAULT nextval('bugsummaryjournal_id_seq'::regclass);
15409
 
 
15410
 
 
15411
5403
ALTER TABLE bugtag ALTER COLUMN id SET DEFAULT nextval('bugtag_id_seq'::regclass);
15412
5404
 
15413
 
 
15414
5405
ALTER TABLE bugtask ALTER COLUMN id SET DEFAULT nextval('bugtask_id_seq'::regclass);
15415
5406
 
15416
 
 
15417
5407
ALTER TABLE bugtracker ALTER COLUMN id SET DEFAULT nextval('bugtracker_id_seq'::regclass);
15418
5408
 
15419
 
 
15420
5409
ALTER TABLE bugtrackeralias ALTER COLUMN id SET DEFAULT nextval('bugtrackeralias_id_seq'::regclass);
15421
5410
 
15422
 
 
15423
 
ALTER TABLE bugtrackercomponent ALTER COLUMN id SET DEFAULT nextval('bugtrackercomponent_id_seq'::regclass);
15424
 
 
15425
 
 
15426
 
ALTER TABLE bugtrackercomponentgroup ALTER COLUMN id SET DEFAULT nextval('bugtrackercomponentgroup_id_seq'::regclass);
15427
 
 
15428
 
 
15429
5411
ALTER TABLE bugtrackerperson ALTER COLUMN id SET DEFAULT nextval('bugtrackerperson_id_seq'::regclass);
15430
5412
 
15431
 
 
15432
5413
ALTER TABLE bugwatch ALTER COLUMN id SET DEFAULT nextval('bugwatch_id_seq'::regclass);
15433
5414
 
15434
 
 
15435
5415
ALTER TABLE bugwatchactivity ALTER COLUMN id SET DEFAULT nextval('bugwatchactivity_id_seq'::regclass);
15436
5416
 
15437
 
 
15438
5417
ALTER TABLE builder ALTER COLUMN id SET DEFAULT nextval('builder_id_seq'::regclass);
15439
5418
 
15440
 
 
15441
5419
ALTER TABLE buildfarmjob ALTER COLUMN id SET DEFAULT nextval('buildfarmjob_id_seq'::regclass);
15442
5420
 
15443
 
 
15444
5421
ALTER TABLE buildpackagejob ALTER COLUMN id SET DEFAULT nextval('buildpackagejob_id_seq'::regclass);
15445
5422
 
15446
 
 
15447
5423
ALTER TABLE buildqueue ALTER COLUMN id SET DEFAULT nextval('buildqueue_id_seq'::regclass);
15448
5424
 
15449
 
 
15450
5425
ALTER TABLE codeimport ALTER COLUMN id SET DEFAULT nextval('codeimport_id_seq'::regclass);
15451
5426
 
15452
 
 
15453
5427
ALTER TABLE codeimportevent ALTER COLUMN id SET DEFAULT nextval('codeimportevent_id_seq'::regclass);
15454
5428
 
15455
 
 
15456
5429
ALTER TABLE codeimporteventdata ALTER COLUMN id SET DEFAULT nextval('codeimporteventdata_id_seq'::regclass);
15457
5430
 
15458
 
 
15459
5431
ALTER TABLE codeimportjob ALTER COLUMN id SET DEFAULT nextval('codeimportjob_id_seq'::regclass);
15460
5432
 
15461
 
 
15462
5433
ALTER TABLE codeimportmachine ALTER COLUMN id SET DEFAULT nextval('codeimportmachine_id_seq'::regclass);
15463
5434
 
15464
 
 
15465
5435
ALTER TABLE codeimportresult ALTER COLUMN id SET DEFAULT nextval('codeimportresult_id_seq'::regclass);
15466
5436
 
15467
 
 
15468
5437
ALTER TABLE codereviewmessage ALTER COLUMN id SET DEFAULT nextval('codereviewmessage_id_seq'::regclass);
15469
5438
 
15470
 
 
15471
5439
ALTER TABLE codereviewvote ALTER COLUMN id SET DEFAULT nextval('codereviewvote_id_seq'::regclass);
15472
5440
 
15473
 
 
15474
5441
ALTER TABLE commercialsubscription ALTER COLUMN id SET DEFAULT nextval('commercialsubscription_id_seq'::regclass);
15475
5442
 
15476
 
 
15477
5443
ALTER TABLE component ALTER COLUMN id SET DEFAULT nextval('component_id_seq'::regclass);
15478
5444
 
15479
 
 
15480
5445
ALTER TABLE componentselection ALTER COLUMN id SET DEFAULT nextval('componentselection_id_seq'::regclass);
15481
5446
 
15482
 
 
15483
5447
ALTER TABLE continent ALTER COLUMN id SET DEFAULT nextval('continent_id_seq'::regclass);
15484
5448
 
15485
 
 
15486
5449
ALTER TABLE country ALTER COLUMN id SET DEFAULT nextval('country_id_seq'::regclass);
15487
5450
 
15488
 
 
15489
5451
ALTER TABLE customlanguagecode ALTER COLUMN id SET DEFAULT nextval('customlanguagecode_id_seq'::regclass);
15490
5452
 
15491
 
 
15492
5453
ALTER TABLE cve ALTER COLUMN id SET DEFAULT nextval('cve_id_seq'::regclass);
15493
5454
 
15494
 
 
15495
5455
ALTER TABLE cvereference ALTER COLUMN id SET DEFAULT nextval('cvereference_id_seq'::regclass);
15496
5456
 
15497
 
 
15498
5457
ALTER TABLE diff ALTER COLUMN id SET DEFAULT nextval('diff_id_seq'::regclass);
15499
5458
 
15500
 
 
15501
5459
ALTER TABLE distribution ALTER COLUMN id SET DEFAULT nextval('distribution_id_seq'::regclass);
15502
5460
 
15503
 
 
15504
 
ALTER TABLE distributionjob ALTER COLUMN id SET DEFAULT nextval('distributionjob_id_seq'::regclass);
15505
 
 
 
5461
ALTER TABLE distributionbounty ALTER COLUMN id SET DEFAULT nextval('distributionbounty_id_seq'::regclass);
15506
5462
 
15507
5463
ALTER TABLE distributionmirror ALTER COLUMN id SET DEFAULT nextval('distributionmirror_id_seq'::regclass);
15508
5464
 
15509
 
 
15510
5465
ALTER TABLE distributionsourcepackage ALTER COLUMN id SET DEFAULT nextval('distributionsourcepackage_id_seq'::regclass);
15511
5466
 
15512
 
 
15513
5467
ALTER TABLE distributionsourcepackagecache ALTER COLUMN id SET DEFAULT nextval('distributionsourcepackagecache_id_seq'::regclass);
15514
5468
 
15515
 
 
15516
5469
ALTER TABLE distroarchseries ALTER COLUMN id SET DEFAULT nextval('distroarchseries_id_seq'::regclass);
15517
5470
 
 
5471
ALTER TABLE distrocomponentuploader ALTER COLUMN id SET DEFAULT nextval('distrocomponentuploader_id_seq'::regclass);
15518
5472
 
15519
5473
ALTER TABLE distroseries ALTER COLUMN id SET DEFAULT nextval('distroseries_id_seq'::regclass);
15520
5474
 
15521
 
 
15522
 
ALTER TABLE distroseriesdifference ALTER COLUMN id SET DEFAULT nextval('distroseriesdifference_id_seq'::regclass);
15523
 
 
15524
 
 
15525
 
ALTER TABLE distroseriesdifferencemessage ALTER COLUMN id SET DEFAULT nextval('distroseriesdifferencemessage_id_seq'::regclass);
15526
 
 
15527
 
 
15528
5475
ALTER TABLE distroserieslanguage ALTER COLUMN id SET DEFAULT nextval('distroserieslanguage_id_seq'::regclass);
15529
5476
 
15530
 
 
15531
5477
ALTER TABLE distroseriespackagecache ALTER COLUMN id SET DEFAULT nextval('distroseriespackagecache_id_seq'::regclass);
15532
5478
 
15533
 
 
15534
 
ALTER TABLE distroseriesparent ALTER COLUMN id SET DEFAULT nextval('distroseriesparent_id_seq'::regclass);
15535
 
 
15536
 
 
15537
5479
ALTER TABLE emailaddress ALTER COLUMN id SET DEFAULT nextval('emailaddress_id_seq'::regclass);
15538
5480
 
15539
 
 
15540
5481
ALTER TABLE entitlement ALTER COLUMN id SET DEFAULT nextval('entitlement_id_seq'::regclass);
15541
5482
 
15542
 
 
15543
5483
ALTER TABLE faq ALTER COLUMN id SET DEFAULT nextval('faq_id_seq'::regclass);
15544
5484
 
15545
 
 
15546
5485
ALTER TABLE featuredproject ALTER COLUMN id SET DEFAULT nextval('featuredproject_id_seq'::regclass);
15547
5486
 
15548
 
 
15549
 
ALTER TABLE featureflagchangelogentry ALTER COLUMN id SET DEFAULT nextval('featureflagchangelogentry_id_seq'::regclass);
15550
 
 
15551
 
 
15552
5487
ALTER TABLE flatpackagesetinclusion ALTER COLUMN id SET DEFAULT nextval('flatpackagesetinclusion_id_seq'::regclass);
15553
5488
 
15554
 
 
15555
5489
ALTER TABLE fticache ALTER COLUMN id SET DEFAULT nextval('fticache_id_seq'::regclass);
15556
5490
 
15557
 
 
15558
5491
ALTER TABLE gpgkey ALTER COLUMN id SET DEFAULT nextval('gpgkey_id_seq'::regclass);
15559
5492
 
15560
 
 
15561
5493
ALTER TABLE hwdevice ALTER COLUMN id SET DEFAULT nextval('hwdevice_id_seq'::regclass);
15562
5494
 
15563
 
 
15564
5495
ALTER TABLE hwdeviceclass ALTER COLUMN id SET DEFAULT nextval('hwdeviceclass_id_seq'::regclass);
15565
5496
 
15566
 
 
15567
5497
ALTER TABLE hwdevicedriverlink ALTER COLUMN id SET DEFAULT nextval('hwdevicedriverlink_id_seq'::regclass);
15568
5498
 
15569
 
 
15570
5499
ALTER TABLE hwdevicenamevariant ALTER COLUMN id SET DEFAULT nextval('hwdevicenamevariant_id_seq'::regclass);
15571
5500
 
15572
 
 
15573
5501
ALTER TABLE hwdmihandle ALTER COLUMN id SET DEFAULT nextval('hwdmihandle_id_seq'::regclass);
15574
5502
 
15575
 
 
15576
5503
ALTER TABLE hwdmivalue ALTER COLUMN id SET DEFAULT nextval('hwdmivalue_id_seq'::regclass);
15577
5504
 
15578
 
 
15579
5505
ALTER TABLE hwdriver ALTER COLUMN id SET DEFAULT nextval('hwdriver_id_seq'::regclass);
15580
5506
 
15581
 
 
15582
5507
ALTER TABLE hwsubmission ALTER COLUMN id SET DEFAULT nextval('hwsubmission_id_seq'::regclass);
15583
5508
 
15584
 
 
15585
5509
ALTER TABLE hwsubmissionbug ALTER COLUMN id SET DEFAULT nextval('hwsubmissionbug_id_seq'::regclass);
15586
5510
 
15587
 
 
15588
5511
ALTER TABLE hwsubmissiondevice ALTER COLUMN id SET DEFAULT nextval('hwsubmissiondevice_id_seq'::regclass);
15589
5512
 
15590
 
 
15591
5513
ALTER TABLE hwsystemfingerprint ALTER COLUMN id SET DEFAULT nextval('hwsystemfingerprint_id_seq'::regclass);
15592
5514
 
15593
 
 
15594
5515
ALTER TABLE hwtest ALTER COLUMN id SET DEFAULT nextval('hwtest_id_seq'::regclass);
15595
5516
 
15596
 
 
15597
5517
ALTER TABLE hwtestanswer ALTER COLUMN id SET DEFAULT nextval('hwtestanswer_id_seq'::regclass);
15598
5518
 
15599
 
 
15600
5519
ALTER TABLE hwtestanswerchoice ALTER COLUMN id SET DEFAULT nextval('hwtestanswerchoice_id_seq'::regclass);
15601
5520
 
15602
 
 
15603
5521
ALTER TABLE hwtestanswercount ALTER COLUMN id SET DEFAULT nextval('hwtestanswercount_id_seq'::regclass);
15604
5522
 
15605
 
 
15606
5523
ALTER TABLE hwtestanswercountdevice ALTER COLUMN id SET DEFAULT nextval('hwtestanswercountdevice_id_seq'::regclass);
15607
5524
 
15608
 
 
15609
5525
ALTER TABLE hwtestanswerdevice ALTER COLUMN id SET DEFAULT nextval('hwtestanswerdevice_id_seq'::regclass);
15610
5526
 
15611
 
 
15612
5527
ALTER TABLE hwvendorid ALTER COLUMN id SET DEFAULT nextval('hwvendorid_id_seq'::regclass);
15613
5528
 
15614
 
 
15615
5529
ALTER TABLE hwvendorname ALTER COLUMN id SET DEFAULT nextval('hwvendorname_id_seq'::regclass);
15616
5530
 
15617
 
 
15618
 
ALTER TABLE incrementaldiff ALTER COLUMN id SET DEFAULT nextval('incrementaldiff_id_seq'::regclass);
15619
 
 
15620
 
 
15621
5531
ALTER TABLE ircid ALTER COLUMN id SET DEFAULT nextval('ircid_id_seq'::regclass);
15622
5532
 
15623
 
 
15624
5533
ALTER TABLE jabberid ALTER COLUMN id SET DEFAULT nextval('jabberid_id_seq'::regclass);
15625
5534
 
15626
 
 
15627
5535
ALTER TABLE job ALTER COLUMN id SET DEFAULT nextval('job_id_seq'::regclass);
15628
5536
 
15629
 
 
15630
5537
ALTER TABLE karma ALTER COLUMN id SET DEFAULT nextval('karma_id_seq'::regclass);
15631
5538
 
15632
 
 
15633
5539
ALTER TABLE karmaaction ALTER COLUMN id SET DEFAULT nextval('karmaaction_id_seq'::regclass);
15634
5540
 
15635
 
 
15636
5541
ALTER TABLE karmacache ALTER COLUMN id SET DEFAULT nextval('karmacache_id_seq'::regclass);
15637
5542
 
15638
 
 
15639
5543
ALTER TABLE karmacategory ALTER COLUMN id SET DEFAULT nextval('karmacategory_id_seq'::regclass);
15640
5544
 
15641
 
 
15642
5545
ALTER TABLE karmatotalcache ALTER COLUMN id SET DEFAULT nextval('karmatotalcache_id_seq'::regclass);
15643
5546
 
15644
 
 
15645
5547
ALTER TABLE language ALTER COLUMN id SET DEFAULT nextval('language_id_seq'::regclass);
15646
5548
 
15647
 
 
15648
5549
ALTER TABLE languagepack ALTER COLUMN id SET DEFAULT nextval('languagepack_id_seq'::regclass);
15649
5550
 
15650
 
 
15651
 
ALTER TABLE launchpaddatabaseupdatelog ALTER COLUMN id SET DEFAULT nextval('launchpaddatabaseupdatelog_id_seq'::regclass);
15652
 
 
15653
 
 
15654
5551
ALTER TABLE launchpadstatistic ALTER COLUMN id SET DEFAULT nextval('launchpadstatistic_id_seq'::regclass);
15655
5552
 
15656
 
 
15657
5553
ALTER TABLE libraryfilealias ALTER COLUMN id SET DEFAULT nextval('libraryfilealias_id_seq'::regclass);
15658
5554
 
15659
 
 
15660
5555
ALTER TABLE libraryfilecontent ALTER COLUMN id SET DEFAULT nextval('libraryfilecontent_id_seq'::regclass);
15661
5556
 
15662
 
 
15663
5557
ALTER TABLE libraryfiledownloadcount ALTER COLUMN id SET DEFAULT nextval('libraryfiledownloadcount_id_seq'::regclass);
15664
5558
 
15665
 
 
15666
5559
ALTER TABLE logintoken ALTER COLUMN id SET DEFAULT nextval('logintoken_id_seq'::regclass);
15667
5560
 
15668
 
 
15669
5561
ALTER TABLE mailinglist ALTER COLUMN id SET DEFAULT nextval('mailinglist_id_seq'::regclass);
15670
5562
 
 
5563
ALTER TABLE mailinglistban ALTER COLUMN id SET DEFAULT nextval('mailinglistban_id_seq'::regclass);
15671
5564
 
15672
5565
ALTER TABLE mailinglistsubscription ALTER COLUMN id SET DEFAULT nextval('mailinglistsubscription_id_seq'::regclass);
15673
5566
 
 
5567
ALTER TABLE mentoringoffer ALTER COLUMN id SET DEFAULT nextval('mentoringoffer_id_seq'::regclass);
15674
5568
 
15675
5569
ALTER TABLE mergedirectivejob ALTER COLUMN id SET DEFAULT nextval('mergedirectivejob_id_seq'::regclass);
15676
5570
 
15677
 
 
15678
5571
ALTER TABLE message ALTER COLUMN id SET DEFAULT nextval('message_id_seq'::regclass);
15679
5572
 
15680
 
 
15681
5573
ALTER TABLE messageapproval ALTER COLUMN id SET DEFAULT nextval('messageapproval_id_seq'::regclass);
15682
5574
 
15683
 
 
15684
5575
ALTER TABLE messagechunk ALTER COLUMN id SET DEFAULT nextval('messagechunk_id_seq'::regclass);
15685
5576
 
15686
 
 
15687
5577
ALTER TABLE milestone ALTER COLUMN id SET DEFAULT nextval('milestone_id_seq'::regclass);
15688
5578
 
15689
 
 
15690
5579
ALTER TABLE mirror ALTER COLUMN id SET DEFAULT nextval('mirror_id_seq'::regclass);
15691
5580
 
15692
 
 
15693
5581
ALTER TABLE mirrorcdimagedistroseries ALTER COLUMN id SET DEFAULT nextval('mirrorcdimagedistroseries_id_seq'::regclass);
15694
5582
 
15695
 
 
15696
5583
ALTER TABLE mirrorcontent ALTER COLUMN id SET DEFAULT nextval('mirrorcontent_id_seq'::regclass);
15697
5584
 
15698
 
 
15699
5585
ALTER TABLE mirrordistroarchseries ALTER COLUMN id SET DEFAULT nextval('mirrordistroarchseries_id_seq'::regclass);
15700
5586
 
15701
 
 
15702
5587
ALTER TABLE mirrordistroseriessource ALTER COLUMN id SET DEFAULT nextval('mirrordistroseriessource_id_seq'::regclass);
15703
5588
 
15704
 
 
15705
5589
ALTER TABLE mirrorproberecord ALTER COLUMN id SET DEFAULT nextval('mirrorproberecord_id_seq'::regclass);
15706
5590
 
15707
 
 
15708
5591
ALTER TABLE mirrorsourcecontent ALTER COLUMN id SET DEFAULT nextval('mirrorsourcecontent_id_seq'::regclass);
15709
5592
 
15710
 
 
15711
5593
ALTER TABLE nameblacklist ALTER COLUMN id SET DEFAULT nextval('nameblacklist_id_seq'::regclass);
15712
5594
 
15713
 
 
15714
5595
ALTER TABLE oauthaccesstoken ALTER COLUMN id SET DEFAULT nextval('oauthaccesstoken_id_seq'::regclass);
15715
5596
 
15716
 
 
15717
5597
ALTER TABLE oauthconsumer ALTER COLUMN id SET DEFAULT nextval('oauthconsumer_id_seq'::regclass);
15718
5598
 
 
5599
ALTER TABLE oauthnonce ALTER COLUMN id SET DEFAULT nextval('oauthnonce_id_seq'::regclass);
15719
5600
 
15720
5601
ALTER TABLE oauthrequesttoken ALTER COLUMN id SET DEFAULT nextval('oauthrequesttoken_id_seq'::regclass);
15721
5602
 
15722
 
 
15723
5603
ALTER TABLE officialbugtag ALTER COLUMN id SET DEFAULT nextval('officialbugtag_id_seq'::regclass);
15724
5604
 
 
5605
ALTER TABLE openidrpconfig ALTER COLUMN id SET DEFAULT nextval('openidrpconfig_id_seq'::regclass);
 
5606
 
 
5607
ALTER TABLE openidrpsummary ALTER COLUMN id SET DEFAULT nextval('openidrpsummary_id_seq'::regclass);
 
5608
 
 
5609
ALTER TABLE packagebugsupervisor ALTER COLUMN id SET DEFAULT nextval('packagebugsupervisor_id_seq'::regclass);
15725
5610
 
15726
5611
ALTER TABLE packagebuild ALTER COLUMN id SET DEFAULT nextval('packagebuild_id_seq'::regclass);
15727
5612
 
15728
 
 
15729
 
ALTER TABLE packagecopyjob ALTER COLUMN id SET DEFAULT nextval('packagecopyjob_id_seq'::regclass);
15730
 
 
15731
 
 
15732
5613
ALTER TABLE packagecopyrequest ALTER COLUMN id SET DEFAULT nextval('packagecopyrequest_id_seq'::regclass);
15733
5614
 
15734
 
 
15735
5615
ALTER TABLE packagediff ALTER COLUMN id SET DEFAULT nextval('packagediff_id_seq'::regclass);
15736
5616
 
 
5617
ALTER TABLE packageselection ALTER COLUMN id SET DEFAULT nextval('packageselection_id_seq'::regclass);
15737
5618
 
15738
5619
ALTER TABLE packageset ALTER COLUMN id SET DEFAULT nextval('packageset_id_seq'::regclass);
15739
5620
 
15740
 
 
15741
5621
ALTER TABLE packagesetgroup ALTER COLUMN id SET DEFAULT nextval('packagesetgroup_id_seq'::regclass);
15742
5622
 
15743
 
 
15744
5623
ALTER TABLE packagesetinclusion ALTER COLUMN id SET DEFAULT nextval('packagesetinclusion_id_seq'::regclass);
15745
5624
 
15746
 
 
15747
5625
ALTER TABLE packagesetsources ALTER COLUMN id SET DEFAULT nextval('packagesetsources_id_seq'::regclass);
15748
5626
 
15749
 
 
15750
5627
ALTER TABLE packageupload ALTER COLUMN id SET DEFAULT nextval('packageupload_id_seq'::regclass);
15751
5628
 
15752
 
 
15753
5629
ALTER TABLE packageuploadbuild ALTER COLUMN id SET DEFAULT nextval('packageuploadbuild_id_seq'::regclass);
15754
5630
 
15755
 
 
15756
5631
ALTER TABLE packageuploadcustom ALTER COLUMN id SET DEFAULT nextval('packageuploadcustom_id_seq'::regclass);
15757
5632
 
15758
 
 
15759
5633
ALTER TABLE packageuploadsource ALTER COLUMN id SET DEFAULT nextval('packageuploadsource_id_seq'::regclass);
15760
5634
 
15761
 
 
15762
 
ALTER TABLE packagingjob ALTER COLUMN id SET DEFAULT nextval('packagingjob_id_seq'::regclass);
15763
 
 
15764
 
 
15765
5635
ALTER TABLE parsedapachelog ALTER COLUMN id SET DEFAULT nextval('parsedapachelog_id_seq'::regclass);
15766
5636
 
15767
 
 
15768
5637
ALTER TABLE person ALTER COLUMN id SET DEFAULT nextval('person_id_seq'::regclass);
15769
5638
 
15770
 
 
15771
5639
ALTER TABLE personlanguage ALTER COLUMN id SET DEFAULT nextval('personlanguage_id_seq'::regclass);
15772
5640
 
15773
 
 
15774
5641
ALTER TABLE personlocation ALTER COLUMN id SET DEFAULT nextval('personlocation_id_seq'::regclass);
15775
5642
 
15776
 
 
15777
5643
ALTER TABLE personnotification ALTER COLUMN id SET DEFAULT nextval('personnotification_id_seq'::regclass);
15778
5644
 
15779
 
 
15780
 
ALTER TABLE persontransferjob ALTER COLUMN id SET DEFAULT nextval('persontransferjob_id_seq'::regclass);
15781
 
 
15782
 
 
15783
5645
ALTER TABLE pillarname ALTER COLUMN id SET DEFAULT nextval('pillarname_id_seq'::regclass);
15784
5646
 
15785
 
 
15786
5647
ALTER TABLE pocketchroot ALTER COLUMN id SET DEFAULT nextval('pocketchroot_id_seq'::regclass);
15787
5648
 
 
5649
ALTER TABLE pocomment ALTER COLUMN id SET DEFAULT nextval('pocomment_id_seq'::regclass);
15788
5650
 
15789
5651
ALTER TABLE poexportrequest ALTER COLUMN id SET DEFAULT nextval('poexportrequest_id_seq'::regclass);
15790
5652
 
15791
 
 
15792
5653
ALTER TABLE pofile ALTER COLUMN id SET DEFAULT nextval('pofile_id_seq'::regclass);
15793
5654
 
15794
 
 
15795
5655
ALTER TABLE pofiletranslator ALTER COLUMN id SET DEFAULT nextval('pofiletranslator_id_seq'::regclass);
15796
5656
 
15797
 
 
15798
5657
ALTER TABLE poll ALTER COLUMN id SET DEFAULT nextval('poll_id_seq'::regclass);
15799
5658
 
15800
 
 
15801
5659
ALTER TABLE polloption ALTER COLUMN id SET DEFAULT nextval('polloption_id_seq'::regclass);
15802
5660
 
15803
 
 
15804
5661
ALTER TABLE pomsgid ALTER COLUMN id SET DEFAULT nextval('pomsgid_id_seq'::regclass);
15805
5662
 
 
5663
ALTER TABLE posubscription ALTER COLUMN id SET DEFAULT nextval('posubscription_id_seq'::regclass);
15806
5664
 
15807
5665
ALTER TABLE potemplate ALTER COLUMN id SET DEFAULT nextval('potemplate_id_seq'::regclass);
15808
5666
 
15809
 
 
15810
5667
ALTER TABLE potmsgset ALTER COLUMN id SET DEFAULT nextval('potmsgset_id_seq'::regclass);
15811
5668
 
15812
 
 
15813
5669
ALTER TABLE potranslation ALTER COLUMN id SET DEFAULT nextval('potranslation_id_seq'::regclass);
15814
5670
 
15815
 
 
15816
5671
ALTER TABLE previewdiff ALTER COLUMN id SET DEFAULT nextval('previewdiff_id_seq'::regclass);
15817
5672
 
15818
 
 
15819
5673
ALTER TABLE processor ALTER COLUMN id SET DEFAULT nextval('processor_id_seq'::regclass);
15820
5674
 
15821
 
 
15822
5675
ALTER TABLE processorfamily ALTER COLUMN id SET DEFAULT nextval('processorfamily_id_seq'::regclass);
15823
5676
 
15824
 
 
15825
5677
ALTER TABLE product ALTER COLUMN id SET DEFAULT nextval('product_id_seq'::regclass);
15826
5678
 
 
5679
ALTER TABLE productbounty ALTER COLUMN id SET DEFAULT nextval('productbounty_id_seq'::regclass);
 
5680
 
 
5681
ALTER TABLE productcvsmodule ALTER COLUMN id SET DEFAULT nextval('productcvsmodule_id_seq'::regclass);
15827
5682
 
15828
5683
ALTER TABLE productlicense ALTER COLUMN id SET DEFAULT nextval('productlicense_id_seq'::regclass);
15829
5684
 
15830
 
 
15831
5685
ALTER TABLE productrelease ALTER COLUMN id SET DEFAULT nextval('productrelease_id_seq'::regclass);
15832
5686
 
15833
 
 
15834
5687
ALTER TABLE productseries ALTER COLUMN id SET DEFAULT nextval('productseries_id_seq'::regclass);
15835
5688
 
 
5689
ALTER TABLE productseriescodeimport ALTER COLUMN id SET DEFAULT nextval('productseriescodeimport_id_seq'::regclass);
 
5690
 
 
5691
ALTER TABLE productsvnmodule ALTER COLUMN id SET DEFAULT nextval('productsvnmodule_id_seq'::regclass);
15836
5692
 
15837
5693
ALTER TABLE project ALTER COLUMN id SET DEFAULT nextval('project_id_seq'::regclass);
15838
5694
 
15839
 
 
15840
 
ALTER TABLE publisherconfig ALTER COLUMN id SET DEFAULT nextval('publisherconfig_id_seq'::regclass);
15841
 
 
 
5695
ALTER TABLE projectbounty ALTER COLUMN id SET DEFAULT nextval('projectbounty_id_seq'::regclass);
 
5696
 
 
5697
ALTER TABLE projectrelationship ALTER COLUMN id SET DEFAULT nextval('projectrelationship_id_seq'::regclass);
 
5698
 
 
5699
ALTER TABLE pushmirroraccess ALTER COLUMN id SET DEFAULT nextval('pushmirroraccess_id_seq'::regclass);
15842
5700
 
15843
5701
ALTER TABLE question ALTER COLUMN id SET DEFAULT nextval('question_id_seq'::regclass);
15844
5702
 
15845
 
 
15846
5703
ALTER TABLE questionbug ALTER COLUMN id SET DEFAULT nextval('questionbug_id_seq'::regclass);
15847
5704
 
15848
 
 
15849
 
ALTER TABLE questionjob ALTER COLUMN id SET DEFAULT nextval('questionjob_id_seq'::regclass);
15850
 
 
15851
 
 
15852
5705
ALTER TABLE questionmessage ALTER COLUMN id SET DEFAULT nextval('questionmessage_id_seq'::regclass);
15853
5706
 
15854
 
 
15855
5707
ALTER TABLE questionreopening ALTER COLUMN id SET DEFAULT nextval('questionreopening_id_seq'::regclass);
15856
5708
 
15857
 
 
15858
5709
ALTER TABLE questionsubscription ALTER COLUMN id SET DEFAULT nextval('questionsubscription_id_seq'::regclass);
15859
5710
 
 
5711
ALTER TABLE requestedcds ALTER COLUMN id SET DEFAULT nextval('requestedcds_id_seq'::regclass);
15860
5712
 
15861
5713
ALTER TABLE revision ALTER COLUMN id SET DEFAULT nextval('revision_id_seq'::regclass);
15862
5714
 
15863
 
 
15864
5715
ALTER TABLE revisionauthor ALTER COLUMN id SET DEFAULT nextval('revisionauthor_id_seq'::regclass);
15865
5716
 
15866
 
 
15867
5717
ALTER TABLE revisioncache ALTER COLUMN id SET DEFAULT nextval('revisioncache_id_seq'::regclass);
15868
5718
 
15869
 
 
15870
5719
ALTER TABLE revisionparent ALTER COLUMN id SET DEFAULT nextval('revisionparent_id_seq'::regclass);
15871
5720
 
15872
 
 
15873
5721
ALTER TABLE revisionproperty ALTER COLUMN id SET DEFAULT nextval('revisionproperty_id_seq'::regclass);
15874
5722
 
15875
 
 
15876
5723
ALTER TABLE scriptactivity ALTER COLUMN id SET DEFAULT nextval('scriptactivity_id_seq'::regclass);
15877
5724
 
15878
 
 
15879
5725
ALTER TABLE section ALTER COLUMN id SET DEFAULT nextval('section_id_seq'::regclass);
15880
5726
 
15881
 
 
15882
5727
ALTER TABLE sectionselection ALTER COLUMN id SET DEFAULT nextval('sectionselection_id_seq'::regclass);
15883
5728
 
15884
 
 
15885
5729
ALTER TABLE seriessourcepackagebranch ALTER COLUMN id SET DEFAULT nextval('seriessourcepackagebranch_id_seq'::regclass);
15886
5730
 
 
5731
ALTER TABLE shipitreport ALTER COLUMN id SET DEFAULT nextval('shipitreport_id_seq'::regclass);
 
5732
 
 
5733
ALTER TABLE shipitsurvey ALTER COLUMN id SET DEFAULT nextval('shipitsurvey_id_seq'::regclass);
 
5734
 
 
5735
ALTER TABLE shipitsurveyanswer ALTER COLUMN id SET DEFAULT nextval('shipitsurveyanswer_id_seq'::regclass);
 
5736
 
 
5737
ALTER TABLE shipitsurveyquestion ALTER COLUMN id SET DEFAULT nextval('shipitsurveyquestion_id_seq'::regclass);
 
5738
 
 
5739
ALTER TABLE shipitsurveyresult ALTER COLUMN id SET DEFAULT nextval('shipitsurveyresult_id_seq'::regclass);
 
5740
 
 
5741
ALTER TABLE shipment ALTER COLUMN id SET DEFAULT nextval('shipment_id_seq'::regclass);
 
5742
 
 
5743
ALTER TABLE shippingrequest ALTER COLUMN id SET DEFAULT nextval('shippingrequest_id_seq'::regclass);
 
5744
 
 
5745
ALTER TABLE shippingrun ALTER COLUMN id SET DEFAULT nextval('shippingrun_id_seq'::regclass);
15887
5746
 
15888
5747
ALTER TABLE signedcodeofconduct ALTER COLUMN id SET DEFAULT nextval('signedcodeofconduct_id_seq'::regclass);
15889
5748
 
15890
 
 
15891
5749
ALTER TABLE sourcepackageformatselection ALTER COLUMN id SET DEFAULT nextval('sourcepackageformatselection_id_seq'::regclass);
15892
5750
 
15893
 
 
15894
5751
ALTER TABLE sourcepackagename ALTER COLUMN id SET DEFAULT nextval('sourcepackagename_id_seq'::regclass);
15895
5752
 
15896
 
 
15897
5753
ALTER TABLE sourcepackagepublishinghistory ALTER COLUMN id SET DEFAULT nextval('sourcepackagepublishinghistory_id_seq'::regclass);
15898
5754
 
15899
 
 
15900
5755
ALTER TABLE sourcepackagerecipe ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipe_id_seq'::regclass);
15901
5756
 
15902
 
 
15903
5757
ALTER TABLE sourcepackagerecipebuild ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipebuild_id_seq'::regclass);
15904
5758
 
15905
 
 
15906
5759
ALTER TABLE sourcepackagerecipebuildjob ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipebuildjob_id_seq'::regclass);
15907
5760
 
15908
 
 
15909
5761
ALTER TABLE sourcepackagerecipedata ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedata_id_seq'::regclass);
15910
5762
 
15911
 
 
15912
5763
ALTER TABLE sourcepackagerecipedatainstruction ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedatainstruction_id_seq'::regclass);
15913
5764
 
15914
 
 
15915
5765
ALTER TABLE sourcepackagerecipedistroseries ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedistroseries_id_seq'::regclass);
15916
5766
 
15917
 
 
15918
5767
ALTER TABLE sourcepackagerelease ALTER COLUMN id SET DEFAULT nextval('sourcepackagerelease_id_seq'::regclass);
15919
5768
 
15920
 
 
15921
5769
ALTER TABLE specification ALTER COLUMN id SET DEFAULT nextval('specification_id_seq'::regclass);
15922
5770
 
15923
 
 
15924
5771
ALTER TABLE specificationbranch ALTER COLUMN id SET DEFAULT nextval('specificationbranch_id_seq'::regclass);
15925
5772
 
15926
 
 
15927
5773
ALTER TABLE specificationbug ALTER COLUMN id SET DEFAULT nextval('specificationbug_id_seq'::regclass);
15928
5774
 
15929
 
 
15930
5775
ALTER TABLE specificationdependency ALTER COLUMN id SET DEFAULT nextval('specificationdependency_id_seq'::regclass);
15931
5776
 
15932
 
 
15933
5777
ALTER TABLE specificationfeedback ALTER COLUMN id SET DEFAULT nextval('specificationfeedback_id_seq'::regclass);
15934
5778
 
15935
 
 
15936
5779
ALTER TABLE specificationmessage ALTER COLUMN id SET DEFAULT nextval('specificationmessage_id_seq'::regclass);
15937
5780
 
15938
 
 
15939
5781
ALTER TABLE specificationsubscription ALTER COLUMN id SET DEFAULT nextval('specificationsubscription_id_seq'::regclass);
15940
5782
 
15941
 
 
15942
5783
ALTER TABLE sprint ALTER COLUMN id SET DEFAULT nextval('sprint_id_seq'::regclass);
15943
5784
 
15944
 
 
15945
5785
ALTER TABLE sprintattendance ALTER COLUMN id SET DEFAULT nextval('sprintattendance_id_seq'::regclass);
15946
5786
 
15947
 
 
15948
5787
ALTER TABLE sprintspecification ALTER COLUMN id SET DEFAULT nextval('sprintspecification_id_seq'::regclass);
15949
5788
 
15950
 
 
15951
5789
ALTER TABLE sshkey ALTER COLUMN id SET DEFAULT nextval('sshkey_id_seq'::regclass);
15952
5790
 
 
5791
ALTER TABLE standardshipitrequest ALTER COLUMN id SET DEFAULT nextval('standardshipitrequest_id_seq'::regclass);
 
5792
 
 
5793
ALTER TABLE staticdiff ALTER COLUMN id SET DEFAULT nextval('staticdiff_id_seq'::regclass);
15953
5794
 
15954
5795
ALTER TABLE structuralsubscription ALTER COLUMN id SET DEFAULT nextval('structuralsubscription_id_seq'::regclass);
15955
5796
 
15956
 
 
15957
 
ALTER TABLE subunitstream ALTER COLUMN id SET DEFAULT nextval('subunitstream_id_seq'::regclass);
15958
 
 
15959
 
 
15960
5797
ALTER TABLE teammembership ALTER COLUMN id SET DEFAULT nextval('teammembership_id_seq'::regclass);
15961
5798
 
15962
 
 
15963
5799
ALTER TABLE teamparticipation ALTER COLUMN id SET DEFAULT nextval('teamparticipation_id_seq'::regclass);
15964
5800
 
15965
 
 
15966
5801
ALTER TABLE temporaryblobstorage ALTER COLUMN id SET DEFAULT nextval('temporaryblobstorage_id_seq'::regclass);
15967
5802
 
15968
 
 
15969
5803
ALTER TABLE translationgroup ALTER COLUMN id SET DEFAULT nextval('translationgroup_id_seq'::regclass);
15970
5804
 
15971
 
 
15972
5805
ALTER TABLE translationimportqueueentry ALTER COLUMN id SET DEFAULT nextval('translationimportqueueentry_id_seq'::regclass);
15973
5806
 
15974
 
 
15975
5807
ALTER TABLE translationmessage ALTER COLUMN id SET DEFAULT nextval('translationmessage_id_seq'::regclass);
15976
5808
 
15977
 
 
15978
5809
ALTER TABLE translationrelicensingagreement ALTER COLUMN id SET DEFAULT nextval('translationrelicensingagreement_id_seq'::regclass);
15979
5810
 
15980
 
 
15981
5811
ALTER TABLE translationtemplateitem ALTER COLUMN id SET DEFAULT nextval('translationtemplateitem_id_seq'::regclass);
15982
5812
 
15983
 
 
15984
 
ALTER TABLE translationtemplatesbuild ALTER COLUMN id SET DEFAULT nextval('translationtemplatesbuild_id_seq'::regclass);
15985
 
 
15986
 
 
15987
5813
ALTER TABLE translator ALTER COLUMN id SET DEFAULT nextval('translator_id_seq'::regclass);
15988
5814
 
15989
 
 
15990
5815
ALTER TABLE usertouseremail ALTER COLUMN id SET DEFAULT nextval('usertouseremail_id_seq'::regclass);
15991
5816
 
15992
 
 
15993
5817
ALTER TABLE vote ALTER COLUMN id SET DEFAULT nextval('vote_id_seq'::regclass);
15994
5818
 
15995
 
 
15996
5819
ALTER TABLE votecast ALTER COLUMN id SET DEFAULT nextval('votecast_id_seq'::regclass);
15997
5820
 
 
5821
ALTER TABLE webserviceban ALTER COLUMN id SET DEFAULT nextval('webserviceban_id_seq'::regclass);
15998
5822
 
15999
5823
ALTER TABLE wikiname ALTER COLUMN id SET DEFAULT nextval('wikiname_id_seq'::regclass);
16000
5824
 
16001
 
 
16002
 
ALTER TABLE ONLY accesspolicy
16003
 
    ADD CONSTRAINT accesspolicy_pkey PRIMARY KEY (id);
16004
 
 
16005
 
 
16006
 
ALTER TABLE ONLY accesspolicyartifact
16007
 
    ADD CONSTRAINT accesspolicyartifact_pkey PRIMARY KEY (id);
16008
 
 
16009
 
 
16010
 
ALTER TABLE ONLY accesspolicygrant
16011
 
    ADD CONSTRAINT accesspolicygrant_pkey PRIMARY KEY (id);
16012
 
 
 
5825
ALTER TABLE ONLY account
 
5826
    ADD CONSTRAINT account_openid_identifier_key UNIQUE (openid_identifier);
16013
5827
 
16014
5828
ALTER TABLE ONLY account
16015
5829
    ADD CONSTRAINT account_pkey PRIMARY KEY (id);
16016
5830
 
16017
 
 
16018
5831
ALTER TABLE ONLY accountpassword
16019
5832
    ADD CONSTRAINT accountpassword_account_key UNIQUE (account);
16020
5833
 
16021
 
 
16022
5834
ALTER TABLE ONLY accountpassword
16023
5835
    ADD CONSTRAINT accountpassword_pkey PRIMARY KEY (id);
16024
5836
 
16025
 
 
16026
5837
ALTER TABLE ONLY announcement
16027
5838
    ADD CONSTRAINT announcement_pkey PRIMARY KEY (id);
16028
5839
 
16029
 
 
16030
5840
ALTER TABLE ONLY apportjob
16031
5841
    ADD CONSTRAINT apportjob__job__key UNIQUE (job);
16032
5842
 
16033
 
 
16034
5843
ALTER TABLE ONLY apportjob
16035
5844
    ADD CONSTRAINT apportjob_pkey PRIMARY KEY (id);
16036
5845
 
16037
5846
ALTER TABLE apportjob CLUSTER ON apportjob_pkey;
16038
5847
 
16039
 
 
16040
5848
ALTER TABLE ONLY archive
16041
5849
    ADD CONSTRAINT archive_pkey PRIMARY KEY (id);
16042
5850
 
16043
 
 
16044
5851
ALTER TABLE ONLY archivearch
16045
5852
    ADD CONSTRAINT archivearch__processorfamily__archive__key UNIQUE (processorfamily, archive);
16046
5853
 
16047
 
 
16048
5854
ALTER TABLE ONLY archivearch
16049
5855
    ADD CONSTRAINT archivearch_pkey PRIMARY KEY (id);
16050
5856
 
16051
 
 
16052
5857
ALTER TABLE ONLY archiveauthtoken
16053
5858
    ADD CONSTRAINT archiveauthtoken_pkey PRIMARY KEY (id);
16054
5859
 
16055
 
 
16056
5860
ALTER TABLE ONLY archiveauthtoken
16057
5861
    ADD CONSTRAINT archiveauthtoken_token_key UNIQUE (token);
16058
5862
 
16059
 
 
16060
5863
ALTER TABLE ONLY archivedependency
16061
5864
    ADD CONSTRAINT archivedependency__unique UNIQUE (archive, dependency);
16062
5865
 
16063
 
 
16064
5866
ALTER TABLE ONLY archivedependency
16065
5867
    ADD CONSTRAINT archivedependency_pkey PRIMARY KEY (id);
16066
5868
 
16067
 
 
16068
5869
ALTER TABLE ONLY archivejob
16069
5870
    ADD CONSTRAINT archivejob__job__key UNIQUE (job);
16070
5871
 
16071
 
 
16072
5872
ALTER TABLE ONLY archivejob
16073
5873
    ADD CONSTRAINT archivejob_pkey PRIMARY KEY (id);
16074
5874
 
16075
 
 
16076
5875
ALTER TABLE ONLY archivepermission
16077
5876
    ADD CONSTRAINT archivepermission_pkey PRIMARY KEY (id);
16078
5877
 
16079
 
 
16080
5878
ALTER TABLE ONLY archivesubscriber
16081
5879
    ADD CONSTRAINT archivesubscriber_pkey PRIMARY KEY (id);
16082
5880
 
16083
 
 
16084
5881
ALTER TABLE ONLY revisionauthor
16085
5882
    ADD CONSTRAINT archuserid_archuserid_key UNIQUE (name);
16086
5883
 
16087
 
 
16088
5884
ALTER TABLE ONLY revisionauthor
16089
5885
    ADD CONSTRAINT archuserid_pkey PRIMARY KEY (id);
16090
5886
 
 
5887
ALTER TABLE ONLY authtoken
 
5888
    ADD CONSTRAINT authtoken__token__key UNIQUE (token);
 
5889
 
 
5890
ALTER TABLE ONLY authtoken
 
5891
    ADD CONSTRAINT authtoken_pkey PRIMARY KEY (id);
16091
5892
 
16092
5893
ALTER TABLE ONLY binarypackagerelease
16093
5894
    ADD CONSTRAINT binarypackage_pkey PRIMARY KEY (id);
16094
5895
 
16095
 
 
16096
5896
ALTER TABLE ONLY binarypackagebuild
16097
5897
    ADD CONSTRAINT binarypackagebuild_pkey PRIMARY KEY (id);
16098
5898
 
16099
 
 
16100
5899
ALTER TABLE ONLY binarypackagefile
16101
5900
    ADD CONSTRAINT binarypackagefile_pkey PRIMARY KEY (id);
16102
5901
 
16103
 
 
16104
5902
ALTER TABLE ONLY binarypackagename
16105
5903
    ADD CONSTRAINT binarypackagename_name_key UNIQUE (name);
16106
5904
 
16107
 
 
16108
5905
ALTER TABLE ONLY binarypackagename
16109
5906
    ADD CONSTRAINT binarypackagename_pkey PRIMARY KEY (id);
16110
5907
 
16111
 
 
16112
 
ALTER TABLE ONLY binarypackagepath
16113
 
    ADD CONSTRAINT binarypackagepath_path_key UNIQUE (path);
16114
 
 
16115
 
 
16116
 
ALTER TABLE ONLY binarypackagepath
16117
 
    ADD CONSTRAINT binarypackagepath_pkey PRIMARY KEY (id);
16118
 
 
16119
 
 
16120
5908
ALTER TABLE ONLY binarypackagerelease
16121
5909
    ADD CONSTRAINT binarypackagerelease_binarypackagename_key UNIQUE (binarypackagename, build, version);
16122
5910
 
 
5911
ALTER TABLE binarypackagerelease CLUSTER ON binarypackagerelease_binarypackagename_key;
16123
5912
 
16124
5913
ALTER TABLE ONLY binarypackagerelease
16125
5914
    ADD CONSTRAINT binarypackagerelease_build_name_uniq UNIQUE (build, binarypackagename);
16126
5915
 
16127
 
 
16128
 
ALTER TABLE ONLY binarypackagereleasecontents
16129
 
    ADD CONSTRAINT binarypackagereleasecontents_pkey PRIMARY KEY (binarypackagerelease, binarypackagepath);
16130
 
 
16131
 
 
16132
5916
ALTER TABLE ONLY binarypackagereleasedownloadcount
16133
5917
    ADD CONSTRAINT binarypackagereleasedownloadcount__archive__binary_package_rele UNIQUE (archive, binary_package_release, day, country);
16134
5918
 
16135
 
 
16136
5919
ALTER TABLE ONLY binarypackagereleasedownloadcount
16137
5920
    ADD CONSTRAINT binarypackagereleasedownloadcount_pkey PRIMARY KEY (id);
16138
5921
 
 
5922
ALTER TABLE ONLY bounty
 
5923
    ADD CONSTRAINT bounty_name_key UNIQUE (name);
 
5924
 
 
5925
ALTER TABLE ONLY bounty
 
5926
    ADD CONSTRAINT bounty_pkey PRIMARY KEY (id);
 
5927
 
 
5928
ALTER TABLE ONLY bountymessage
 
5929
    ADD CONSTRAINT bountymessage_message_bounty_uniq UNIQUE (message, bounty);
 
5930
 
 
5931
ALTER TABLE ONLY bountymessage
 
5932
    ADD CONSTRAINT bountymessage_pkey PRIMARY KEY (id);
 
5933
 
 
5934
ALTER TABLE ONLY bountysubscription
 
5935
    ADD CONSTRAINT bountysubscription_person_key UNIQUE (person, bounty);
 
5936
 
 
5937
ALTER TABLE ONLY bountysubscription
 
5938
    ADD CONSTRAINT bountysubscription_pkey PRIMARY KEY (id);
16139
5939
 
16140
5940
ALTER TABLE ONLY branch
16141
5941
    ADD CONSTRAINT branch__unique_name__key UNIQUE (unique_name);
16142
5942
 
16143
 
 
16144
5943
ALTER TABLE ONLY branch
16145
5944
    ADD CONSTRAINT branch_pkey PRIMARY KEY (id);
16146
5945
 
16147
 
 
16148
5946
ALTER TABLE ONLY branch
16149
5947
    ADD CONSTRAINT branch_url_unique UNIQUE (url);
16150
5948
 
16151
 
 
16152
5949
ALTER TABLE ONLY branchjob
16153
5950
    ADD CONSTRAINT branchjob_job_key UNIQUE (job);
16154
5951
 
16155
 
 
16156
5952
ALTER TABLE ONLY branchjob
16157
5953
    ADD CONSTRAINT branchjob_pkey PRIMARY KEY (id);
16158
5954
 
16159
5955
ALTER TABLE branchjob CLUSTER ON branchjob_pkey;
16160
5956
 
16161
 
 
16162
5957
ALTER TABLE ONLY branchmergeproposal
16163
5958
    ADD CONSTRAINT branchmergeproposal_pkey PRIMARY KEY (id);
16164
5959
 
16165
 
 
16166
5960
ALTER TABLE ONLY branchmergeproposaljob
16167
5961
    ADD CONSTRAINT branchmergeproposaljob_job_key UNIQUE (job);
16168
5962
 
16169
 
 
16170
5963
ALTER TABLE ONLY branchmergeproposaljob
16171
5964
    ADD CONSTRAINT branchmergeproposaljob_pkey PRIMARY KEY (id);
16172
5965
 
16173
 
 
16174
 
ALTER TABLE ONLY branchmergequeue
16175
 
    ADD CONSTRAINT branchmergequeue_pkey PRIMARY KEY (id);
16176
 
 
 
5966
ALTER TABLE ONLY branchmergerobot
 
5967
    ADD CONSTRAINT branchmergerobot_name_key UNIQUE (name);
 
5968
 
 
5969
ALTER TABLE ONLY branchmergerobot
 
5970
    ADD CONSTRAINT branchmergerobot_pkey PRIMARY KEY (id);
16177
5971
 
16178
5972
ALTER TABLE ONLY branchsubscription
16179
5973
    ADD CONSTRAINT branchsubscription__person__branch__key UNIQUE (person, branch);
16180
5974
 
16181
 
 
16182
5975
ALTER TABLE ONLY branchsubscription
16183
5976
    ADD CONSTRAINT branchsubscription_pkey PRIMARY KEY (id);
16184
5977
 
16185
 
 
16186
5978
ALTER TABLE ONLY branchvisibilitypolicy
16187
5979
    ADD CONSTRAINT branchvisibilitypolicy_pkey PRIMARY KEY (id);
16188
5980
 
16189
 
 
16190
5981
ALTER TABLE ONLY bugbranch
16191
5982
    ADD CONSTRAINT bug_branch_unique UNIQUE (bug, branch);
16192
5983
 
 
5984
ALTER TABLE ONLY bug
 
5985
    ADD CONSTRAINT bug_name_key UNIQUE (name);
16193
5986
 
16194
5987
ALTER TABLE ONLY bug
16195
5988
    ADD CONSTRAINT bug_pkey PRIMARY KEY (id);
16196
5989
 
16197
 
 
16198
5990
ALTER TABLE ONLY bugactivity
16199
5991
    ADD CONSTRAINT bugactivity_pkey PRIMARY KEY (id);
16200
5992
 
16201
 
 
16202
5993
ALTER TABLE ONLY bugaffectsperson
16203
5994
    ADD CONSTRAINT bugaffectsperson_bug_person_uniq UNIQUE (bug, person);
16204
5995
 
16205
 
 
16206
5996
ALTER TABLE ONLY bugaffectsperson
16207
5997
    ADD CONSTRAINT bugaffectsperson_pkey PRIMARY KEY (id);
16208
5998
 
16209
 
 
16210
5999
ALTER TABLE ONLY bugattachment
16211
6000
    ADD CONSTRAINT bugattachment_pkey PRIMARY KEY (id);
16212
6001
 
16213
 
 
16214
6002
ALTER TABLE ONLY bugbranch
16215
6003
    ADD CONSTRAINT bugbranch_pkey PRIMARY KEY (id);
16216
6004
 
16217
 
 
16218
6005
ALTER TABLE ONLY bugcve
16219
6006
    ADD CONSTRAINT bugcve_bug_cve_uniq UNIQUE (bug, cve);
16220
6007
 
16221
 
 
16222
6008
ALTER TABLE ONLY bugcve
16223
6009
    ADD CONSTRAINT bugcve_pkey PRIMARY KEY (id);
16224
6010
 
16225
 
 
16226
6011
ALTER TABLE ONLY bugjob
16227
6012
    ADD CONSTRAINT bugjob__job__key UNIQUE (job);
16228
6013
 
16229
 
 
16230
6014
ALTER TABLE ONLY bugjob
16231
6015
    ADD CONSTRAINT bugjob_pkey PRIMARY KEY (id);
16232
6016
 
16233
6017
ALTER TABLE bugjob CLUSTER ON bugjob_pkey;
16234
6018
 
16235
 
 
16236
 
ALTER TABLE ONLY bugmessage
16237
 
    ADD CONSTRAINT bugmessage__bug__index__key UNIQUE (bug, index);
16238
 
 
16239
 
 
16240
6019
ALTER TABLE ONLY bugmessage
16241
6020
    ADD CONSTRAINT bugmessage__bug__message__key UNIQUE (bug, message);
16242
6021
 
16243
 
 
16244
6022
ALTER TABLE ONLY bugmessage
16245
6023
    ADD CONSTRAINT bugmessage__bugwatch__remote_comment_id__key UNIQUE (bugwatch, remote_comment_id);
16246
6024
 
16247
 
 
16248
6025
ALTER TABLE ONLY bugmessage
16249
6026
    ADD CONSTRAINT bugmessage_pkey PRIMARY KEY (id);
16250
6027
 
16251
 
 
16252
 
ALTER TABLE ONLY bugmute
16253
 
    ADD CONSTRAINT bugmute_pkey PRIMARY KEY (person, bug);
16254
 
 
16255
 
 
16256
6028
ALTER TABLE ONLY bugnomination
16257
6029
    ADD CONSTRAINT bugnomination_pkey PRIMARY KEY (id);
16258
6030
 
16259
 
 
16260
6031
ALTER TABLE ONLY bugnotification
16261
6032
    ADD CONSTRAINT bugnotification__bug__message__unq UNIQUE (bug, message);
16262
6033
 
16263
 
 
16264
6034
ALTER TABLE ONLY bugnotification
16265
6035
    ADD CONSTRAINT bugnotification_pkey PRIMARY KEY (id);
16266
6036
 
 
6037
ALTER TABLE bugnotification CLUSTER ON bugnotification_pkey;
16267
6038
 
16268
6039
ALTER TABLE ONLY bugnotificationarchive
16269
6040
    ADD CONSTRAINT bugnotificationarchive__bug__message__key UNIQUE (bug, message);
16270
6041
 
16271
 
 
16272
6042
ALTER TABLE ONLY bugnotificationarchive
16273
6043
    ADD CONSTRAINT bugnotificationarchive_pk PRIMARY KEY (id);
16274
6044
 
16275
 
 
16276
6045
ALTER TABLE ONLY bugnotificationattachment
16277
6046
    ADD CONSTRAINT bugnotificationattachment_pkey PRIMARY KEY (id);
16278
6047
 
16279
 
 
16280
 
ALTER TABLE ONLY bugnotificationfilter
16281
 
    ADD CONSTRAINT bugnotificationfilter_pkey PRIMARY KEY (bug_notification, bug_subscription_filter);
16282
 
 
16283
 
 
16284
6048
ALTER TABLE ONLY bugnotificationrecipient
16285
6049
    ADD CONSTRAINT bugnotificationrecipient__bug_notificaion__person__key UNIQUE (bug_notification, person);
16286
6050
 
16287
 
 
16288
6051
ALTER TABLE ONLY bugnotificationrecipient
16289
6052
    ADD CONSTRAINT bugnotificationrecipient_pkey PRIMARY KEY (id);
16290
6053
 
16291
 
 
16292
6054
ALTER TABLE ONLY bugnotificationrecipientarchive
16293
6055
    ADD CONSTRAINT bugnotificationrecipientarchive_pk PRIMARY KEY (id);
16294
6056
 
 
6057
ALTER TABLE ONLY bugpackageinfestation
 
6058
    ADD CONSTRAINT bugpackageinfestation_bug_key UNIQUE (bug, sourcepackagerelease);
 
6059
 
 
6060
ALTER TABLE ONLY bugpackageinfestation
 
6061
    ADD CONSTRAINT bugpackageinfestation_pkey PRIMARY KEY (id);
 
6062
 
 
6063
ALTER TABLE ONLY bugproductinfestation
 
6064
    ADD CONSTRAINT bugproductinfestation_bug_key UNIQUE (bug, productrelease);
 
6065
 
 
6066
ALTER TABLE ONLY bugproductinfestation
 
6067
    ADD CONSTRAINT bugproductinfestation_pkey PRIMARY KEY (id);
16295
6068
 
16296
6069
ALTER TABLE ONLY bugsubscription
16297
6070
    ADD CONSTRAINT bugsubscription_pkey PRIMARY KEY (id);
16298
6071
 
16299
 
 
16300
 
ALTER TABLE ONLY bugsubscriptionfilter
16301
 
    ADD CONSTRAINT bugsubscriptionfilter_pkey PRIMARY KEY (id);
16302
 
 
16303
 
 
16304
 
ALTER TABLE ONLY bugsubscriptionfilterimportance
16305
 
    ADD CONSTRAINT bugsubscriptionfilterimportance_pkey PRIMARY KEY (id);
16306
 
 
16307
 
 
16308
 
ALTER TABLE ONLY bugsubscriptionfiltermute
16309
 
    ADD CONSTRAINT bugsubscriptionfiltermute_pkey PRIMARY KEY (person, filter);
16310
 
 
16311
 
 
16312
 
ALTER TABLE ONLY bugsubscriptionfilterstatus
16313
 
    ADD CONSTRAINT bugsubscriptionfilterstatus_pkey PRIMARY KEY (id);
16314
 
 
16315
 
 
16316
 
ALTER TABLE ONLY bugsubscriptionfiltertag
16317
 
    ADD CONSTRAINT bugsubscriptionfiltertag_pkey PRIMARY KEY (id);
16318
 
 
16319
 
 
16320
 
ALTER TABLE ONLY bugsummary
16321
 
    ADD CONSTRAINT bugsummary_pkey PRIMARY KEY (id);
16322
 
 
16323
 
 
16324
 
ALTER TABLE ONLY bugsummaryjournal
16325
 
    ADD CONSTRAINT bugsummaryjournal_pkey PRIMARY KEY (id);
16326
 
 
16327
 
 
16328
6072
ALTER TABLE ONLY bugtracker
16329
6073
    ADD CONSTRAINT bugsystem_pkey PRIMARY KEY (id);
16330
6074
 
16331
 
 
16332
6075
ALTER TABLE ONLY bugtag
16333
6076
    ADD CONSTRAINT bugtag__tag__bug__key UNIQUE (tag, bug);
16334
6077
 
16335
 
 
16336
6078
ALTER TABLE ONLY bugtag
16337
6079
    ADD CONSTRAINT bugtag_pkey PRIMARY KEY (id);
16338
6080
 
16339
 
 
16340
6081
ALTER TABLE ONLY bugtask
16341
6082
    ADD CONSTRAINT bugtask_pkey PRIMARY KEY (id);
16342
6083
 
16343
 
 
16344
6084
ALTER TABLE ONLY bugtrackeralias
16345
6085
    ADD CONSTRAINT bugtracker__base_url__key UNIQUE (base_url);
16346
6086
 
16347
 
 
16348
6087
ALTER TABLE ONLY bugtrackeralias
16349
6088
    ADD CONSTRAINT bugtrackeralias_pkey PRIMARY KEY (id);
16350
6089
 
16351
 
 
16352
 
ALTER TABLE ONLY bugtrackercomponent
16353
 
    ADD CONSTRAINT bugtrackercomponent__component_group__name__key UNIQUE (component_group, name);
16354
 
 
16355
 
 
16356
 
ALTER TABLE ONLY bugtrackercomponent
16357
 
    ADD CONSTRAINT bugtrackercomponent__disto__spn__key UNIQUE (distribution, source_package_name);
16358
 
 
16359
 
 
16360
 
ALTER TABLE ONLY bugtrackercomponent
16361
 
    ADD CONSTRAINT bugtrackercomponent_pkey PRIMARY KEY (id);
16362
 
 
16363
 
 
16364
 
ALTER TABLE ONLY bugtrackercomponentgroup
16365
 
    ADD CONSTRAINT bugtrackercomponentgroup__bug_tracker__name__key UNIQUE (bug_tracker, name);
16366
 
 
16367
 
 
16368
 
ALTER TABLE ONLY bugtrackercomponentgroup
16369
 
    ADD CONSTRAINT bugtrackercomponentgroup_pkey PRIMARY KEY (id);
16370
 
 
16371
 
 
16372
6090
ALTER TABLE ONLY bugtrackerperson
16373
6091
    ADD CONSTRAINT bugtrackerperson__bugtracker__name__key UNIQUE (bugtracker, name);
16374
6092
 
16375
 
 
16376
6093
ALTER TABLE ONLY bugtrackerperson
16377
6094
    ADD CONSTRAINT bugtrackerperson_pkey PRIMARY KEY (id);
16378
6095
 
16379
 
 
16380
6096
ALTER TABLE ONLY bugwatch
16381
6097
    ADD CONSTRAINT bugwatch_bugtask_target UNIQUE (id, bug);
16382
6098
 
16383
 
 
16384
6099
ALTER TABLE ONLY bugwatch
16385
6100
    ADD CONSTRAINT bugwatch_pkey PRIMARY KEY (id);
16386
6101
 
16387
 
 
16388
6102
ALTER TABLE ONLY bugwatchactivity
16389
6103
    ADD CONSTRAINT bugwatchactivity_pkey PRIMARY KEY (id);
16390
6104
 
16391
 
 
16392
6105
ALTER TABLE ONLY builder
16393
6106
    ADD CONSTRAINT builder_pkey PRIMARY KEY (id);
16394
6107
 
16395
 
 
16396
6108
ALTER TABLE ONLY builder
16397
6109
    ADD CONSTRAINT builder_url_key UNIQUE (url);
16398
6110
 
16399
 
 
16400
6111
ALTER TABLE ONLY buildfarmjob
16401
6112
    ADD CONSTRAINT buildfarmjob_pkey PRIMARY KEY (id);
16402
6113
 
16403
 
 
16404
6114
ALTER TABLE ONLY buildpackagejob
16405
6115
    ADD CONSTRAINT buildpackagejob__build__key UNIQUE (build);
16406
6116
 
16407
 
 
16408
6117
ALTER TABLE ONLY buildpackagejob
16409
6118
    ADD CONSTRAINT buildpackagejob__job__key UNIQUE (job);
16410
6119
 
16411
 
 
16412
6120
ALTER TABLE ONLY buildpackagejob
16413
6121
    ADD CONSTRAINT buildpackagejob_pkey PRIMARY KEY (id);
16414
6122
 
16415
 
 
16416
6123
ALTER TABLE ONLY buildqueue
16417
6124
    ADD CONSTRAINT buildqueue__job__key UNIQUE (job);
16418
6125
 
16419
 
 
16420
6126
ALTER TABLE ONLY buildqueue
16421
6127
    ADD CONSTRAINT buildqueue_pkey PRIMARY KEY (id);
16422
6128
 
16423
 
 
16424
6129
ALTER TABLE ONLY revision
16425
6130
    ADD CONSTRAINT changeset_pkey PRIMARY KEY (id);
16426
6131
 
16427
 
 
16428
6132
ALTER TABLE ONLY codeimport
16429
6133
    ADD CONSTRAINT codeimport_branch_key UNIQUE (branch);
16430
6134
 
16431
 
 
16432
6135
ALTER TABLE ONLY codeimport
16433
6136
    ADD CONSTRAINT codeimport_pkey PRIMARY KEY (id);
16434
6137
 
16435
 
 
16436
6138
ALTER TABLE ONLY codeimportevent
16437
6139
    ADD CONSTRAINT codeimportevent_pkey PRIMARY KEY (id);
16438
6140
 
16439
 
 
16440
6141
ALTER TABLE ONLY codeimporteventdata
16441
6142
    ADD CONSTRAINT codeimporteventdata__event__data_type__key UNIQUE (event, data_type);
16442
6143
 
16443
 
 
16444
6144
ALTER TABLE ONLY codeimporteventdata
16445
6145
    ADD CONSTRAINT codeimporteventdata_pkey PRIMARY KEY (id);
16446
6146
 
16447
 
 
16448
6147
ALTER TABLE ONLY codeimportjob
16449
6148
    ADD CONSTRAINT codeimportjob__code_import__key UNIQUE (code_import);
16450
6149
 
16451
 
 
16452
6150
ALTER TABLE ONLY codeimportjob
16453
6151
    ADD CONSTRAINT codeimportjob_pkey PRIMARY KEY (id);
16454
6152
 
16455
 
 
16456
6153
ALTER TABLE ONLY codeimportmachine
16457
6154
    ADD CONSTRAINT codeimportmachine_hostname_key UNIQUE (hostname);
16458
6155
 
16459
 
 
16460
6156
ALTER TABLE ONLY codeimportmachine
16461
6157
    ADD CONSTRAINT codeimportmachine_pkey PRIMARY KEY (id);
16462
6158
 
16463
 
 
16464
6159
ALTER TABLE ONLY codeimportresult
16465
6160
    ADD CONSTRAINT codeimportresult_pkey PRIMARY KEY (id);
16466
6161
 
16467
 
 
16468
6162
ALTER TABLE ONLY codereviewmessage
16469
6163
    ADD CONSTRAINT codereviewmessage__branch_merge_proposal__id_key UNIQUE (branch_merge_proposal, id);
16470
6164
 
16471
 
 
16472
6165
ALTER TABLE ONLY codereviewmessage
16473
6166
    ADD CONSTRAINT codereviewmessage_message_key UNIQUE (message);
16474
6167
 
16475
 
 
16476
6168
ALTER TABLE ONLY codereviewmessage
16477
6169
    ADD CONSTRAINT codereviewmessage_pkey PRIMARY KEY (id);
16478
6170
 
16479
 
 
16480
6171
ALTER TABLE ONLY codereviewvote
16481
6172
    ADD CONSTRAINT codereviewvote_pkey PRIMARY KEY (id);
16482
6173
 
16483
 
 
16484
6174
ALTER TABLE ONLY commercialsubscription
16485
6175
    ADD CONSTRAINT commercialsubscription_pkey PRIMARY KEY (id);
16486
6176
 
16487
 
 
16488
6177
ALTER TABLE ONLY component
16489
6178
    ADD CONSTRAINT component_name_key UNIQUE (name);
16490
6179
 
16491
 
 
16492
6180
ALTER TABLE ONLY component
16493
6181
    ADD CONSTRAINT component_pkey PRIMARY KEY (id);
16494
6182
 
16495
 
 
16496
6183
ALTER TABLE ONLY componentselection
16497
6184
    ADD CONSTRAINT componentselection__distroseries__component__key UNIQUE (distroseries, component);
16498
6185
 
16499
 
 
16500
6186
ALTER TABLE ONLY componentselection
16501
6187
    ADD CONSTRAINT componentselection_pkey PRIMARY KEY (id);
16502
6188
 
16503
 
 
16504
6189
ALTER TABLE ONLY continent
16505
6190
    ADD CONSTRAINT continent_code_key UNIQUE (code);
16506
6191
 
16507
 
 
16508
6192
ALTER TABLE ONLY continent
16509
6193
    ADD CONSTRAINT continent_name_key UNIQUE (name);
16510
6194
 
16511
 
 
16512
6195
ALTER TABLE ONLY continent
16513
6196
    ADD CONSTRAINT continent_pkey PRIMARY KEY (id);
16514
6197
 
16515
 
 
16516
6198
ALTER TABLE ONLY country
16517
6199
    ADD CONSTRAINT country_code2_uniq UNIQUE (iso3166code2);
16518
6200
 
16519
 
 
16520
6201
ALTER TABLE ONLY country
16521
6202
    ADD CONSTRAINT country_code3_uniq UNIQUE (iso3166code3);
16522
6203
 
16523
 
 
16524
6204
ALTER TABLE ONLY country
16525
6205
    ADD CONSTRAINT country_name_uniq UNIQUE (name);
16526
6206
 
16527
 
 
16528
6207
ALTER TABLE ONLY country
16529
6208
    ADD CONSTRAINT country_pkey PRIMARY KEY (id);
16530
6209
 
16531
 
 
16532
6210
ALTER TABLE ONLY customlanguagecode
16533
6211
    ADD CONSTRAINT customlanguagecode_pkey PRIMARY KEY (id);
16534
6212
 
16535
 
 
16536
6213
ALTER TABLE ONLY cve
16537
6214
    ADD CONSTRAINT cve_pkey PRIMARY KEY (id);
16538
6215
 
16539
 
 
16540
6216
ALTER TABLE ONLY cve
16541
6217
    ADD CONSTRAINT cve_sequence_uniq UNIQUE (sequence);
16542
6218
 
16543
 
 
16544
6219
ALTER TABLE ONLY cvereference
16545
6220
    ADD CONSTRAINT cvereference_pkey PRIMARY KEY (id);
16546
6221
 
16547
 
 
16548
6222
ALTER TABLE ONLY databasecpustats
16549
6223
    ADD CONSTRAINT databasecpustats_pkey PRIMARY KEY (date_created, username);
16550
6224
 
16551
 
 
16552
 
ALTER TABLE ONLY databasediskutilization
16553
 
    ADD CONSTRAINT databasediskutilization_pkey PRIMARY KEY (date_created, sort);
16554
 
 
16555
 
 
16556
6225
ALTER TABLE ONLY databasereplicationlag
16557
6226
    ADD CONSTRAINT databasereplicationlag_pkey PRIMARY KEY (node);
16558
6227
 
16559
 
 
16560
6228
ALTER TABLE ONLY databasetablestats
16561
6229
    ADD CONSTRAINT databasetablestats_pkey PRIMARY KEY (date_created, schemaname, relname);
16562
6230
 
16563
6231
ALTER TABLE databasetablestats CLUSTER ON databasetablestats_pkey;
16564
6232
 
16565
 
 
16566
6233
ALTER TABLE ONLY diff
16567
6234
    ADD CONSTRAINT diff_pkey PRIMARY KEY (id);
16568
6235
 
16569
 
 
16570
6236
ALTER TABLE ONLY distribution
16571
6237
    ADD CONSTRAINT distribution_name_key UNIQUE (name);
16572
6238
 
16573
 
 
16574
6239
ALTER TABLE ONLY distribution
16575
6240
    ADD CONSTRAINT distribution_pkey PRIMARY KEY (id);
16576
6241
 
16577
 
 
16578
 
ALTER TABLE ONLY distributionjob
16579
 
    ADD CONSTRAINT distributionjob__job__key UNIQUE (job);
16580
 
 
16581
 
 
16582
 
ALTER TABLE ONLY distributionjob
16583
 
    ADD CONSTRAINT distributionjob_pkey PRIMARY KEY (id);
16584
 
 
 
6242
ALTER TABLE ONLY distributionbounty
 
6243
    ADD CONSTRAINT distributionbounty_bounty_distribution_uniq UNIQUE (bounty, distribution);
 
6244
 
 
6245
ALTER TABLE ONLY distributionbounty
 
6246
    ADD CONSTRAINT distributionbounty_pkey PRIMARY KEY (id);
16585
6247
 
16586
6248
ALTER TABLE ONLY distributionmirror
16587
6249
    ADD CONSTRAINT distributionmirror_ftp_base_url_key UNIQUE (ftp_base_url);
16588
6250
 
16589
 
 
16590
6251
ALTER TABLE ONLY distributionmirror
16591
6252
    ADD CONSTRAINT distributionmirror_http_base_url_key UNIQUE (http_base_url);
16592
6253
 
16593
 
 
16594
6254
ALTER TABLE ONLY distributionmirror
16595
6255
    ADD CONSTRAINT distributionmirror_name_key UNIQUE (name);
16596
6256
 
16597
 
 
16598
6257
ALTER TABLE ONLY distributionmirror
16599
6258
    ADD CONSTRAINT distributionmirror_pkey PRIMARY KEY (id);
16600
6259
 
16601
 
 
16602
6260
ALTER TABLE ONLY distributionmirror
16603
6261
    ADD CONSTRAINT distributionmirror_rsync_base_url_key UNIQUE (rsync_base_url);
16604
6262
 
16605
 
 
16606
6263
ALTER TABLE ONLY distributionsourcepackage
16607
6264
    ADD CONSTRAINT distributionpackage__sourcepackagename__distribution__key UNIQUE (sourcepackagename, distribution);
16608
6265
 
16609
6266
ALTER TABLE distributionsourcepackage CLUSTER ON distributionpackage__sourcepackagename__distribution__key;
16610
6267
 
16611
 
 
16612
6268
ALTER TABLE ONLY distributionsourcepackage
16613
6269
    ADD CONSTRAINT distributionsourcepackage_pkey PRIMARY KEY (id);
16614
6270
 
16615
 
 
16616
6271
ALTER TABLE ONLY distributionsourcepackagecache
16617
6272
    ADD CONSTRAINT distributionsourcepackagecache__distribution__sourcepackagename UNIQUE (distribution, sourcepackagename, archive);
16618
6273
 
16619
 
 
16620
6274
ALTER TABLE ONLY distributionsourcepackagecache
16621
6275
    ADD CONSTRAINT distributionsourcepackagecache_pkey PRIMARY KEY (id);
16622
6276
 
16623
 
 
16624
6277
ALTER TABLE ONLY distroarchseries
16625
6278
    ADD CONSTRAINT distroarchrelease_pkey PRIMARY KEY (id);
16626
6279
 
16627
 
 
16628
6280
ALTER TABLE ONLY distroarchseries
16629
6281
    ADD CONSTRAINT distroarchseries__architecturetag__distroseries__key UNIQUE (architecturetag, distroseries);
16630
6282
 
16631
 
 
16632
6283
ALTER TABLE ONLY distroarchseries
16633
6284
    ADD CONSTRAINT distroarchseries__processorfamily__distroseries__key UNIQUE (processorfamily, distroseries);
16634
6285
 
16635
 
 
16636
 
ALTER TABLE ONLY distroseries
16637
 
    ADD CONSTRAINT distrorelease__distribution__name__key UNIQUE (distribution, name);
16638
 
 
 
6286
ALTER TABLE ONLY distrocomponentuploader
 
6287
    ADD CONSTRAINT distrocomponentuploader_distro_component_uniq UNIQUE (distribution, component);
 
6288
 
 
6289
ALTER TABLE ONLY distrocomponentuploader
 
6290
    ADD CONSTRAINT distrocomponentuploader_pkey PRIMARY KEY (id);
 
6291
 
 
6292
ALTER TABLE ONLY distroseries
 
6293
    ADD CONSTRAINT distrorelease_distribution_key UNIQUE (distribution, name);
 
6294
 
 
6295
ALTER TABLE ONLY distroseries
 
6296
    ADD CONSTRAINT distrorelease_distro_release_unique UNIQUE (distribution, id);
16639
6297
 
16640
6298
ALTER TABLE ONLY distroseries
16641
6299
    ADD CONSTRAINT distrorelease_pkey PRIMARY KEY (id);
16642
6300
 
16643
 
 
16644
6301
ALTER TABLE ONLY distroserieslanguage
16645
6302
    ADD CONSTRAINT distroreleaselanguage_distrorelease_language_uniq UNIQUE (distroseries, language);
16646
6303
 
16647
 
 
16648
6304
ALTER TABLE ONLY distroserieslanguage
16649
6305
    ADD CONSTRAINT distroreleaselanguage_pkey PRIMARY KEY (id);
16650
6306
 
16651
 
 
16652
6307
ALTER TABLE ONLY distroseriespackagecache
16653
6308
    ADD CONSTRAINT distroreleasepackagecache_pkey PRIMARY KEY (id);
16654
6309
 
16655
 
 
16656
6310
ALTER TABLE ONLY packageupload
16657
6311
    ADD CONSTRAINT distroreleasequeue_pkey PRIMARY KEY (id);
16658
6312
 
16659
 
 
16660
6313
ALTER TABLE ONLY packageuploadbuild
16661
6314
    ADD CONSTRAINT distroreleasequeuebuild__distroreleasequeue__build__unique UNIQUE (packageupload, build);
16662
6315
 
16663
 
 
16664
6316
ALTER TABLE ONLY packageuploadbuild
16665
6317
    ADD CONSTRAINT distroreleasequeuebuild_pkey PRIMARY KEY (id);
16666
6318
 
16667
 
 
16668
6319
ALTER TABLE ONLY packageuploadcustom
16669
6320
    ADD CONSTRAINT distroreleasequeuecustom_pkey PRIMARY KEY (id);
16670
6321
 
16671
 
 
16672
6322
ALTER TABLE ONLY packageuploadsource
16673
6323
    ADD CONSTRAINT distroreleasequeuesource_pkey PRIMARY KEY (id);
16674
6324
 
16675
 
 
16676
 
ALTER TABLE ONLY distroseries
16677
 
    ADD CONSTRAINT distroseries__distribution__id__key UNIQUE (distribution, id);
16678
 
 
16679
 
 
16680
 
ALTER TABLE ONLY distroseriesdifference
16681
 
    ADD CONSTRAINT distroseriesdifference__derived_series__parent_series__source_p UNIQUE (derived_series, parent_series, source_package_name);
16682
 
 
16683
 
 
16684
 
ALTER TABLE ONLY distroseriesdifference
16685
 
    ADD CONSTRAINT distroseriesdifference_pkey PRIMARY KEY (id);
16686
 
 
16687
 
 
16688
 
ALTER TABLE ONLY distroseriesdifferencemessage
16689
 
    ADD CONSTRAINT distroseriesdifferencemessage_message_key UNIQUE (message);
16690
 
 
16691
 
 
16692
 
ALTER TABLE ONLY distroseriesdifferencemessage
16693
 
    ADD CONSTRAINT distroseriesdifferencemessage_pkey PRIMARY KEY (id);
16694
 
 
16695
 
 
16696
6325
ALTER TABLE ONLY distroseriespackagecache
16697
6326
    ADD CONSTRAINT distroseriespackagecache__distroseries__binarypackagename__arch UNIQUE (distroseries, binarypackagename, archive);
16698
6327
 
16699
 
 
16700
 
ALTER TABLE ONLY distroseriesparent
16701
 
    ADD CONSTRAINT distroseriesparent_pkey PRIMARY KEY (id);
16702
 
 
16703
 
 
16704
6328
ALTER TABLE ONLY emailaddress
16705
6329
    ADD CONSTRAINT emailaddress_pkey PRIMARY KEY (id);
16706
6330
 
16707
 
 
16708
6331
ALTER TABLE ONLY entitlement
16709
6332
    ADD CONSTRAINT entitlement_pkey PRIMARY KEY (id);
16710
6333
 
16711
 
 
16712
6334
ALTER TABLE ONLY faq
16713
6335
    ADD CONSTRAINT faq_pkey PRIMARY KEY (id);
16714
6336
 
16715
 
 
16716
6337
ALTER TABLE ONLY featureflag
16717
6338
    ADD CONSTRAINT feature_flag_pkey PRIMARY KEY (scope, flag);
16718
6339
 
16719
 
 
16720
6340
ALTER TABLE ONLY featureflag
16721
6341
    ADD CONSTRAINT feature_flag_unique_priority_per_flag UNIQUE (flag, priority);
16722
6342
 
16723
 
 
16724
6343
ALTER TABLE ONLY featuredproject
16725
6344
    ADD CONSTRAINT featuredproject_pkey PRIMARY KEY (id);
16726
6345
 
16727
 
 
16728
 
ALTER TABLE ONLY featureflagchangelogentry
16729
 
    ADD CONSTRAINT featureflagchangelogentry_pkey PRIMARY KEY (id);
16730
 
 
16731
 
 
16732
6346
ALTER TABLE ONLY flatpackagesetinclusion
16733
6347
    ADD CONSTRAINT flatpackagesetinclusion__parent__child__key UNIQUE (parent, child);
16734
6348
 
16735
 
 
16736
6349
ALTER TABLE ONLY flatpackagesetinclusion
16737
6350
    ADD CONSTRAINT flatpackagesetinclusion_pkey PRIMARY KEY (id);
16738
6351
 
16739
 
 
16740
6352
ALTER TABLE ONLY fticache
16741
6353
    ADD CONSTRAINT fticache_pkey PRIMARY KEY (id);
16742
6354
 
16743
 
 
16744
6355
ALTER TABLE ONLY fticache
16745
6356
    ADD CONSTRAINT fticache_tablename_key UNIQUE (tablename);
16746
6357
 
16747
 
 
16748
6358
ALTER TABLE ONLY gpgkey
16749
6359
    ADD CONSTRAINT gpgkey_fingerprint_key UNIQUE (fingerprint);
16750
6360
 
16751
 
 
16752
6361
ALTER TABLE ONLY gpgkey
16753
6362
    ADD CONSTRAINT gpgkey_owner_key UNIQUE (owner, id);
16754
6363
 
16755
 
 
16756
6364
ALTER TABLE ONLY gpgkey
16757
6365
    ADD CONSTRAINT gpgkey_pkey PRIMARY KEY (id);
16758
6366
 
16759
 
 
16760
6367
ALTER TABLE ONLY hwdevice
16761
6368
    ADD CONSTRAINT hwdevice__bus_vendor_id__bus_product_id__variant__key UNIQUE (bus_vendor_id, bus_product_id, variant);
16762
6369
 
16763
 
 
16764
6370
ALTER TABLE ONLY hwdevice
16765
6371
    ADD CONSTRAINT hwdevice_pkey PRIMARY KEY (id);
16766
6372
 
16767
 
 
16768
6373
ALTER TABLE ONLY hwdeviceclass
16769
6374
    ADD CONSTRAINT hwdeviceclass_pkey PRIMARY KEY (id);
16770
6375
 
16771
 
 
16772
6376
ALTER TABLE ONLY hwdevicedriverlink
16773
6377
    ADD CONSTRAINT hwdevicedriverlink_pkey PRIMARY KEY (id);
16774
6378
 
16775
 
 
16776
6379
ALTER TABLE ONLY hwdevicenamevariant
16777
6380
    ADD CONSTRAINT hwdevicenamevariant__vendor_name__product_name__device__key UNIQUE (vendor_name, product_name, device);
16778
6381
 
16779
 
 
16780
6382
ALTER TABLE ONLY hwdevicenamevariant
16781
6383
    ADD CONSTRAINT hwdevicenamevariant_pkey PRIMARY KEY (id);
16782
6384
 
16783
 
 
16784
6385
ALTER TABLE ONLY hwdmihandle
16785
6386
    ADD CONSTRAINT hwdmihandle_pkey PRIMARY KEY (id);
16786
6387
 
16787
 
 
16788
6388
ALTER TABLE ONLY hwdmivalue
16789
6389
    ADD CONSTRAINT hwdmivalue_pkey PRIMARY KEY (id);
16790
6390
 
16791
 
 
16792
6391
ALTER TABLE ONLY hwdriver
16793
6392
    ADD CONSTRAINT hwdriver__package_name__name__key UNIQUE (package_name, name);
16794
6393
 
16795
 
 
16796
6394
ALTER TABLE ONLY hwdriver
16797
6395
    ADD CONSTRAINT hwdriver_pkey PRIMARY KEY (id);
16798
6396
 
16799
 
 
16800
6397
ALTER TABLE ONLY hwsubmission
16801
6398
    ADD CONSTRAINT hwsubmission__submission_key__key UNIQUE (submission_key);
16802
6399
 
16803
 
 
16804
6400
ALTER TABLE ONLY hwsubmission
16805
6401
    ADD CONSTRAINT hwsubmission_pkey PRIMARY KEY (id);
16806
6402
 
16807
 
 
16808
6403
ALTER TABLE ONLY hwsubmissionbug
16809
6404
    ADD CONSTRAINT hwsubmissionbug__submission__bug__key UNIQUE (submission, bug);
16810
6405
 
16811
 
 
16812
6406
ALTER TABLE ONLY hwsubmissionbug
16813
6407
    ADD CONSTRAINT hwsubmissionbug_pkey PRIMARY KEY (id);
16814
6408
 
16815
 
 
16816
6409
ALTER TABLE ONLY hwsubmissiondevice
16817
6410
    ADD CONSTRAINT hwsubmissiondevice_pkey PRIMARY KEY (id);
16818
6411
 
16819
 
 
16820
6412
ALTER TABLE ONLY hwsystemfingerprint
16821
6413
    ADD CONSTRAINT hwsystemfingerprint__fingerprint__key UNIQUE (fingerprint);
16822
6414
 
16823
 
 
16824
6415
ALTER TABLE ONLY hwsystemfingerprint
16825
6416
    ADD CONSTRAINT hwsystemfingerprint_pkey PRIMARY KEY (id);
16826
6417
 
16827
 
 
16828
6418
ALTER TABLE ONLY hwtest
16829
6419
    ADD CONSTRAINT hwtest_pkey PRIMARY KEY (id);
16830
6420
 
16831
 
 
16832
6421
ALTER TABLE ONLY hwtestanswer
16833
6422
    ADD CONSTRAINT hwtestanswer_pkey PRIMARY KEY (id);
16834
6423
 
16835
 
 
16836
6424
ALTER TABLE ONLY hwtestanswerchoice
16837
6425
    ADD CONSTRAINT hwtestanswerchoice__choice__test__key UNIQUE (choice, test);
16838
6426
 
16839
 
 
16840
6427
ALTER TABLE ONLY hwtestanswerchoice
16841
6428
    ADD CONSTRAINT hwtestanswerchoice__test__id__key UNIQUE (test, id);
16842
6429
 
16843
 
 
16844
6430
ALTER TABLE ONLY hwtestanswerchoice
16845
6431
    ADD CONSTRAINT hwtestanswerchoice_pkey PRIMARY KEY (id);
16846
6432
 
16847
 
 
16848
6433
ALTER TABLE ONLY hwtestanswercount
16849
6434
    ADD CONSTRAINT hwtestanswercount_pkey PRIMARY KEY (id);
16850
6435
 
16851
 
 
16852
6436
ALTER TABLE ONLY hwtestanswercountdevice
16853
6437
    ADD CONSTRAINT hwtestanswercountdevice__answer__device_driver__key UNIQUE (answer, device_driver);
16854
6438
 
16855
 
 
16856
6439
ALTER TABLE ONLY hwtestanswercountdevice
16857
6440
    ADD CONSTRAINT hwtestanswercountdevice_pkey PRIMARY KEY (id);
16858
6441
 
16859
 
 
16860
6442
ALTER TABLE ONLY hwtestanswerdevice
16861
6443
    ADD CONSTRAINT hwtestanswerdevice__answer__device_driver__key UNIQUE (answer, device_driver);
16862
6444
 
16863
 
 
16864
6445
ALTER TABLE ONLY hwtestanswerdevice
16865
6446
    ADD CONSTRAINT hwtestanswerdevice_pkey PRIMARY KEY (id);
16866
6447
 
16867
 
 
16868
6448
ALTER TABLE ONLY hwvendorid
16869
6449
    ADD CONSTRAINT hwvendorid__bus_vendor_id__vendor_name__key UNIQUE (bus, vendor_id_for_bus, vendor_name);
16870
6450
 
16871
 
 
16872
6451
ALTER TABLE ONLY hwvendorid
16873
6452
    ADD CONSTRAINT hwvendorid_pkey PRIMARY KEY (id);
16874
6453
 
16875
 
 
16876
6454
ALTER TABLE ONLY hwvendorname
16877
6455
    ADD CONSTRAINT hwvendorname_pkey PRIMARY KEY (id);
16878
6456
 
16879
 
 
16880
 
ALTER TABLE ONLY incrementaldiff
16881
 
    ADD CONSTRAINT incrementaldiff_pkey PRIMARY KEY (id);
16882
 
 
16883
 
 
16884
6457
ALTER TABLE ONLY ircid
16885
6458
    ADD CONSTRAINT ircid_pkey PRIMARY KEY (id);
16886
6459
 
16887
 
 
16888
6460
ALTER TABLE ONLY jabberid
16889
6461
    ADD CONSTRAINT jabberid_jabberid_key UNIQUE (jabberid);
16890
6462
 
16891
 
 
16892
6463
ALTER TABLE ONLY jabberid
16893
6464
    ADD CONSTRAINT jabberid_pkey PRIMARY KEY (id);
16894
6465
 
16895
 
 
16896
6466
ALTER TABLE ONLY job
16897
6467
    ADD CONSTRAINT job__status__id__key UNIQUE (status, id);
16898
6468
 
16899
 
 
16900
6469
ALTER TABLE ONLY job
16901
6470
    ADD CONSTRAINT job_pkey PRIMARY KEY (id);
16902
6471
 
16903
6472
ALTER TABLE job CLUSTER ON job_pkey;
16904
6473
 
16905
 
 
16906
6474
ALTER TABLE ONLY karma
16907
6475
    ADD CONSTRAINT karma_pkey PRIMARY KEY (id);
16908
6476
 
16909
 
 
16910
6477
ALTER TABLE ONLY karmaaction
16911
6478
    ADD CONSTRAINT karmaaction_name_uniq UNIQUE (name);
16912
6479
 
16913
 
 
16914
6480
ALTER TABLE ONLY karmaaction
16915
6481
    ADD CONSTRAINT karmaaction_pkey PRIMARY KEY (id);
16916
6482
 
16917
 
 
16918
6483
ALTER TABLE ONLY karmacache
16919
6484
    ADD CONSTRAINT karmacache_pkey PRIMARY KEY (id);
16920
6485
 
16921
 
 
16922
6486
ALTER TABLE ONLY karmacategory
16923
6487
    ADD CONSTRAINT karmacategory_pkey PRIMARY KEY (id);
16924
6488
 
16925
 
 
16926
6489
ALTER TABLE ONLY karmatotalcache
16927
6490
    ADD CONSTRAINT karmatotalcache_person_key UNIQUE (person);
16928
6491
 
16929
 
 
16930
6492
ALTER TABLE ONLY karmatotalcache
16931
6493
    ADD CONSTRAINT karmatotalcache_pkey PRIMARY KEY (id);
16932
6494
 
16933
 
 
16934
6495
ALTER TABLE ONLY language
16935
6496
    ADD CONSTRAINT language_code_key UNIQUE (code);
16936
6497
 
16937
 
 
16938
6498
ALTER TABLE ONLY language
16939
6499
    ADD CONSTRAINT language_pkey PRIMARY KEY (id);
16940
6500
 
16941
 
 
16942
6501
ALTER TABLE ONLY languagepack
16943
6502
    ADD CONSTRAINT languagepack_pkey PRIMARY KEY (id);
16944
6503
 
16945
 
 
16946
6504
ALTER TABLE ONLY launchpaddatabaserevision
16947
6505
    ADD CONSTRAINT launchpaddatabaserevision_pkey PRIMARY KEY (major, minor, patch);
16948
6506
 
16949
 
 
16950
 
ALTER TABLE ONLY launchpaddatabaseupdatelog
16951
 
    ADD CONSTRAINT launchpaddatabaseupdatelog_pkey PRIMARY KEY (id);
16952
 
 
16953
 
 
16954
6507
ALTER TABLE ONLY launchpadstatistic
16955
6508
    ADD CONSTRAINT launchpadstatistic_pkey PRIMARY KEY (id);
16956
6509
 
16957
 
 
16958
6510
ALTER TABLE ONLY launchpadstatistic
16959
6511
    ADD CONSTRAINT launchpadstatistics_uniq_name UNIQUE (name);
16960
6512
 
16961
 
 
16962
6513
ALTER TABLE ONLY libraryfilealias
16963
6514
    ADD CONSTRAINT libraryfilealias_pkey PRIMARY KEY (id);
16964
6515
 
16965
6516
ALTER TABLE libraryfilealias CLUSTER ON libraryfilealias_pkey;
16966
6517
 
16967
 
 
16968
6518
ALTER TABLE ONLY libraryfilecontent
16969
6519
    ADD CONSTRAINT libraryfilecontent_pkey PRIMARY KEY (id);
16970
6520
 
16971
6521
ALTER TABLE libraryfilecontent CLUSTER ON libraryfilecontent_pkey;
16972
6522
 
16973
 
 
16974
6523
ALTER TABLE ONLY libraryfiledownloadcount
16975
6524
    ADD CONSTRAINT libraryfiledownloadcount__libraryfilealias__day__country__key UNIQUE (libraryfilealias, day, country);
16976
6525
 
16977
 
 
16978
6526
ALTER TABLE ONLY libraryfiledownloadcount
16979
6527
    ADD CONSTRAINT libraryfiledownloadcount_pkey PRIMARY KEY (id);
16980
6528
 
16981
 
 
16982
6529
ALTER TABLE ONLY logintoken
16983
6530
    ADD CONSTRAINT logintoken_pkey PRIMARY KEY (id);
16984
6531
 
16985
 
 
16986
6532
ALTER TABLE ONLY logintoken
16987
6533
    ADD CONSTRAINT logintoken_token_key UNIQUE (token);
16988
6534
 
16989
 
 
16990
6535
ALTER TABLE ONLY lp_account
16991
6536
    ADD CONSTRAINT lp_account__openid_identifier__key UNIQUE (openid_identifier);
16992
6537
 
16993
 
 
16994
6538
ALTER TABLE ONLY lp_account
16995
6539
    ADD CONSTRAINT lp_account_pkey PRIMARY KEY (id);
16996
6540
 
16997
 
 
16998
 
ALTER TABLE ONLY lp_openididentifier
16999
 
    ADD CONSTRAINT lp_openididentifier_pkey PRIMARY KEY (identifier);
17000
 
 
17001
 
 
17002
6541
ALTER TABLE ONLY lp_person
17003
6542
    ADD CONSTRAINT lp_person__account__key UNIQUE (account);
17004
6543
 
17005
 
 
17006
6544
ALTER TABLE ONLY lp_person
17007
6545
    ADD CONSTRAINT lp_person__name__key UNIQUE (name);
17008
6546
 
17009
 
 
17010
6547
ALTER TABLE ONLY lp_person
17011
6548
    ADD CONSTRAINT lp_person_pkey PRIMARY KEY (id);
17012
6549
 
17013
 
 
17014
6550
ALTER TABLE ONLY lp_personlocation
17015
6551
    ADD CONSTRAINT lp_personlocation__person__key UNIQUE (person);
17016
6552
 
17017
 
 
17018
6553
ALTER TABLE ONLY lp_personlocation
17019
6554
    ADD CONSTRAINT lp_personlocation_pkey PRIMARY KEY (id);
17020
6555
 
17021
 
 
17022
6556
ALTER TABLE ONLY lp_teamparticipation
17023
6557
    ADD CONSTRAINT lp_teamparticipation_pkey PRIMARY KEY (id);
17024
6558
 
17025
 
 
17026
6559
ALTER TABLE ONLY lp_teamparticipation
17027
6560
    ADD CONSTRAINT lp_teamperticipation__team__person__key UNIQUE (team, person);
17028
6561
 
17029
 
 
17030
6562
ALTER TABLE ONLY mailinglist
17031
6563
    ADD CONSTRAINT mailinglist_pkey PRIMARY KEY (id);
17032
6564
 
17033
 
 
17034
6565
ALTER TABLE ONLY mailinglist
17035
6566
    ADD CONSTRAINT mailinglist_team_key UNIQUE (team);
17036
6567
 
 
6568
ALTER TABLE ONLY mailinglistban
 
6569
    ADD CONSTRAINT mailinglistban_pkey PRIMARY KEY (id);
17037
6570
 
17038
6571
ALTER TABLE ONLY mailinglistsubscription
17039
6572
    ADD CONSTRAINT mailinglistsubscription_pkey PRIMARY KEY (id);
17040
6573
 
17041
 
 
17042
6574
ALTER TABLE ONLY teammembership
17043
6575
    ADD CONSTRAINT membership_person_key UNIQUE (person, team);
17044
6576
 
17045
 
 
17046
6577
ALTER TABLE ONLY teammembership
17047
6578
    ADD CONSTRAINT membership_pkey PRIMARY KEY (id);
17048
6579
 
 
6580
ALTER TABLE ONLY mentoringoffer
 
6581
    ADD CONSTRAINT mentoringoffer_pkey PRIMARY KEY (id);
17049
6582
 
17050
6583
ALTER TABLE ONLY mergedirectivejob
17051
6584
    ADD CONSTRAINT mergedirectivejob_job_key UNIQUE (job);
17052
6585
 
17053
 
 
17054
6586
ALTER TABLE ONLY mergedirectivejob
17055
6587
    ADD CONSTRAINT mergedirectivejob_pkey PRIMARY KEY (id);
17056
6588
 
17057
 
 
17058
6589
ALTER TABLE ONLY message
17059
6590
    ADD CONSTRAINT message_pkey PRIMARY KEY (id);
17060
6591
 
17061
 
ALTER TABLE message CLUSTER ON message_pkey;
17062
 
 
17063
 
 
17064
6592
ALTER TABLE ONLY messageapproval
17065
6593
    ADD CONSTRAINT messageapproval_pkey PRIMARY KEY (id);
17066
6594
 
17067
 
 
17068
6595
ALTER TABLE ONLY messagechunk
17069
6596
    ADD CONSTRAINT messagechunk_message_idx UNIQUE (message, sequence);
17070
6597
 
17071
 
 
17072
6598
ALTER TABLE ONLY messagechunk
17073
6599
    ADD CONSTRAINT messagechunk_pkey PRIMARY KEY (id);
17074
6600
 
17075
 
 
17076
6601
ALTER TABLE ONLY milestone
17077
6602
    ADD CONSTRAINT milestone_distribution_id_key UNIQUE (distribution, id);
17078
6603
 
17079
 
 
17080
6604
ALTER TABLE ONLY milestone
17081
6605
    ADD CONSTRAINT milestone_name_distribution_key UNIQUE (name, distribution);
17082
6606
 
17083
 
 
17084
6607
ALTER TABLE ONLY milestone
17085
6608
    ADD CONSTRAINT milestone_name_product_key UNIQUE (name, product);
17086
6609
 
17087
 
 
17088
6610
ALTER TABLE ONLY milestone
17089
6611
    ADD CONSTRAINT milestone_pkey PRIMARY KEY (id);
17090
6612
 
17091
6613
ALTER TABLE milestone CLUSTER ON milestone_pkey;
17092
6614
 
17093
 
 
17094
6615
ALTER TABLE ONLY milestone
17095
6616
    ADD CONSTRAINT milestone_product_id_key UNIQUE (product, id);
17096
6617
 
17097
 
 
17098
6618
ALTER TABLE ONLY mirror
17099
6619
    ADD CONSTRAINT mirror_name_key UNIQUE (name);
17100
6620
 
17101
 
 
17102
6621
ALTER TABLE ONLY mirror
17103
6622
    ADD CONSTRAINT mirror_pkey PRIMARY KEY (id);
17104
6623
 
17105
 
 
17106
6624
ALTER TABLE ONLY mirrorcdimagedistroseries
17107
6625
    ADD CONSTRAINT mirrorcdimagedistrorelease_pkey PRIMARY KEY (id);
17108
6626
 
17109
 
 
17110
6627
ALTER TABLE ONLY mirrorcdimagedistroseries
17111
6628
    ADD CONSTRAINT mirrorcdimagedistroseries__unq UNIQUE (distroseries, flavour, distribution_mirror);
17112
6629
 
17113
 
 
17114
6630
ALTER TABLE ONLY mirrorcontent
17115
6631
    ADD CONSTRAINT mirrorcontent_pkey PRIMARY KEY (id);
17116
6632
 
17117
 
 
17118
6633
ALTER TABLE ONLY mirrordistroarchseries
17119
6634
    ADD CONSTRAINT mirrordistroarchrelease_pkey PRIMARY KEY (id);
17120
6635
 
17121
 
 
17122
6636
ALTER TABLE ONLY mirrordistroseriessource
17123
6637
    ADD CONSTRAINT mirrordistroreleasesource_pkey PRIMARY KEY (id);
17124
6638
 
17125
 
 
17126
6639
ALTER TABLE ONLY mirrorproberecord
17127
6640
    ADD CONSTRAINT mirrorproberecord_pkey PRIMARY KEY (id);
17128
6641
 
17129
 
 
17130
6642
ALTER TABLE ONLY mirrorsourcecontent
17131
6643
    ADD CONSTRAINT mirrorsourcecontent_pkey PRIMARY KEY (id);
17132
6644
 
17133
 
 
17134
6645
ALTER TABLE ONLY nameblacklist
17135
6646
    ADD CONSTRAINT nameblacklist__regexp__key UNIQUE (regexp);
17136
6647
 
17137
 
 
17138
6648
ALTER TABLE ONLY nameblacklist
17139
6649
    ADD CONSTRAINT nameblacklist_pkey PRIMARY KEY (id);
17140
6650
 
17141
 
 
17142
6651
ALTER TABLE ONLY oauthaccesstoken
17143
6652
    ADD CONSTRAINT oauthaccesstoken_key_key UNIQUE (key);
17144
6653
 
17145
 
 
17146
6654
ALTER TABLE ONLY oauthaccesstoken
17147
6655
    ADD CONSTRAINT oauthaccesstoken_pkey PRIMARY KEY (id);
17148
6656
 
17149
 
 
17150
6657
ALTER TABLE ONLY oauthconsumer
17151
6658
    ADD CONSTRAINT oauthconsumer_key_key UNIQUE (key);
17152
6659
 
17153
 
 
17154
6660
ALTER TABLE ONLY oauthconsumer
17155
6661
    ADD CONSTRAINT oauthconsumer_pkey PRIMARY KEY (id);
17156
6662
 
17157
 
 
17158
 
ALTER TABLE ONLY oauthnonce
17159
 
    ADD CONSTRAINT oauthnonce_pkey PRIMARY KEY (access_token, request_timestamp, nonce);
17160
 
 
 
6663
ALTER TABLE ONLY oauthnonce
 
6664
    ADD CONSTRAINT oauthnonce__access_token__request_timestamp__nonce__key UNIQUE (access_token, request_timestamp, nonce);
 
6665
 
 
6666
ALTER TABLE ONLY oauthnonce
 
6667
    ADD CONSTRAINT oauthnonce_pkey PRIMARY KEY (id);
 
6668
 
 
6669
ALTER TABLE oauthnonce CLUSTER ON oauthnonce_pkey;
17161
6670
 
17162
6671
ALTER TABLE ONLY oauthrequesttoken
17163
6672
    ADD CONSTRAINT oauthrequesttoken_key_key UNIQUE (key);
17164
6673
 
17165
 
 
17166
6674
ALTER TABLE ONLY oauthrequesttoken
17167
6675
    ADD CONSTRAINT oauthrequesttoken_pkey PRIMARY KEY (id);
17168
6676
 
17169
 
 
17170
6677
ALTER TABLE ONLY officialbugtag
17171
6678
    ADD CONSTRAINT officialbugtag_pkey PRIMARY KEY (id);
17172
6679
 
 
6680
ALTER TABLE ONLY openidassociation
 
6681
    ADD CONSTRAINT openidassociation_pkey PRIMARY KEY (server_url, handle);
17173
6682
 
17174
6683
ALTER TABLE ONLY openidconsumerassociation
17175
6684
    ADD CONSTRAINT openidconsumerassociation_pkey PRIMARY KEY (server_url, handle);
17176
6685
 
17177
 
 
17178
6686
ALTER TABLE ONLY openidconsumernonce
17179
6687
    ADD CONSTRAINT openidconsumernonce_pkey PRIMARY KEY (server_url, "timestamp", salt);
17180
6688
 
17181
 
 
17182
 
ALTER TABLE ONLY openididentifier
17183
 
    ADD CONSTRAINT openididentifier_pkey PRIMARY KEY (identifier);
17184
 
 
17185
 
 
17186
 
ALTER TABLE ONLY branchmergequeue
17187
 
    ADD CONSTRAINT owner_name UNIQUE (owner, name);
17188
 
 
 
6689
ALTER TABLE ONLY openidrpconfig
 
6690
    ADD CONSTRAINT openidrpconfig_pkey PRIMARY KEY (id);
 
6691
 
 
6692
ALTER TABLE ONLY openidrpsummary
 
6693
    ADD CONSTRAINT openidrpsummary__account__trust_root__openid_identifier__key UNIQUE (account, trust_root, openid_identifier);
 
6694
 
 
6695
ALTER TABLE ONLY openidrpsummary
 
6696
    ADD CONSTRAINT openidrpsummary_pkey PRIMARY KEY (id);
 
6697
 
 
6698
ALTER TABLE ONLY packagebugsupervisor
 
6699
    ADD CONSTRAINT packagebugsupervisor__sourcepackagename__distribution__key UNIQUE (sourcepackagename, distribution);
 
6700
 
 
6701
ALTER TABLE ONLY packagebugsupervisor
 
6702
    ADD CONSTRAINT packagebugsupervisor_pkey PRIMARY KEY (id);
17189
6703
 
17190
6704
ALTER TABLE ONLY packagebuild
17191
6705
    ADD CONSTRAINT packagebuild_pkey PRIMARY KEY (id);
17192
6706
 
17193
 
 
17194
 
ALTER TABLE ONLY packagecopyjob
17195
 
    ADD CONSTRAINT packagecopyjob__job__key UNIQUE (job);
17196
 
 
17197
 
 
17198
 
ALTER TABLE ONLY packagecopyjob
17199
 
    ADD CONSTRAINT packagecopyjob_pkey PRIMARY KEY (id);
17200
 
 
17201
 
 
17202
6707
ALTER TABLE ONLY packagecopyrequest
17203
6708
    ADD CONSTRAINT packagecopyrequest_pkey PRIMARY KEY (id);
17204
6709
 
17205
 
 
17206
6710
ALTER TABLE ONLY packagediff
17207
6711
    ADD CONSTRAINT packagediff_pkey PRIMARY KEY (id);
17208
6712
 
17209
 
 
17210
6713
ALTER TABLE ONLY packagesetinclusion
17211
6714
    ADD CONSTRAINT packagepayerinclusion__parent__child__key UNIQUE (parent, child);
17212
6715
 
17213
 
 
17214
6716
ALTER TABLE ONLY binarypackagepublishinghistory
17215
6717
    ADD CONSTRAINT packagepublishinghistory_pkey PRIMARY KEY (id);
17216
6718
 
 
6719
ALTER TABLE ONLY packageselection
 
6720
    ADD CONSTRAINT packageselection_pkey PRIMARY KEY (id);
17217
6721
 
17218
6722
ALTER TABLE ONLY packageset
17219
6723
    ADD CONSTRAINT packageset__name__distroseries__key UNIQUE (name, distroseries);
17220
6724
 
17221
 
 
17222
6725
ALTER TABLE ONLY packageset
17223
6726
    ADD CONSTRAINT packageset_pkey PRIMARY KEY (id);
17224
6727
 
17225
 
 
17226
6728
ALTER TABLE ONLY packagesetgroup
17227
6729
    ADD CONSTRAINT packagesetgroup_pkey PRIMARY KEY (id);
17228
6730
 
17229
 
 
17230
6731
ALTER TABLE ONLY packagesetinclusion
17231
6732
    ADD CONSTRAINT packagesetinclusion_pkey PRIMARY KEY (id);
17232
6733
 
17233
 
 
17234
6734
ALTER TABLE ONLY packagesetsources
17235
6735
    ADD CONSTRAINT packagesetsources__packageset__sourcepackagename__key UNIQUE (packageset, sourcepackagename);
17236
6736
 
17237
 
 
17238
6737
ALTER TABLE ONLY packagesetsources
17239
6738
    ADD CONSTRAINT packagesetsources_pkey PRIMARY KEY (id);
17240
6739
 
17241
 
 
17242
6740
ALTER TABLE ONLY packageuploadsource
17243
6741
    ADD CONSTRAINT packageuploadsource__packageupload__key UNIQUE (packageupload);
17244
6742
 
17245
 
 
17246
6743
ALTER TABLE ONLY packaging
17247
6744
    ADD CONSTRAINT packaging__distroseries__sourcepackagename__key UNIQUE (distroseries, sourcepackagename);
17248
6745
 
17249
 
 
17250
6746
ALTER TABLE ONLY packaging
17251
6747
    ADD CONSTRAINT packaging_pkey PRIMARY KEY (id);
17252
6748
 
17253
 
 
17254
 
ALTER TABLE ONLY packagingjob
17255
 
    ADD CONSTRAINT packagingjob_pkey PRIMARY KEY (id);
17256
 
 
17257
 
 
17258
6749
ALTER TABLE ONLY parsedapachelog
17259
6750
    ADD CONSTRAINT parsedapachelog_pkey PRIMARY KEY (id);
17260
6751
 
17261
 
 
17262
6752
ALTER TABLE ONLY person
17263
6753
    ADD CONSTRAINT person__account__key UNIQUE (account);
17264
6754
 
17265
 
 
17266
6755
ALTER TABLE ONLY person
17267
6756
    ADD CONSTRAINT person__name__key UNIQUE (name);
17268
6757
 
17269
 
 
17270
6758
ALTER TABLE ONLY person
17271
6759
    ADD CONSTRAINT person_pkey PRIMARY KEY (id);
17272
6760
 
17273
6761
ALTER TABLE person CLUSTER ON person_pkey;
17274
6762
 
17275
 
 
17276
6763
ALTER TABLE ONLY personlanguage
17277
6764
    ADD CONSTRAINT personlanguage_person_key UNIQUE (person, language);
17278
6765
 
17279
 
 
17280
6766
ALTER TABLE ONLY personlanguage
17281
6767
    ADD CONSTRAINT personlanguage_pkey PRIMARY KEY (id);
17282
6768
 
17283
 
 
17284
6769
ALTER TABLE ONLY personlocation
17285
6770
    ADD CONSTRAINT personlocation_person_key UNIQUE (person);
17286
6771
 
17287
 
 
17288
6772
ALTER TABLE ONLY personlocation
17289
6773
    ADD CONSTRAINT personlocation_pkey PRIMARY KEY (id);
17290
6774
 
17291
 
 
17292
6775
ALTER TABLE ONLY personnotification
17293
6776
    ADD CONSTRAINT personnotification_pkey PRIMARY KEY (id);
17294
6777
 
17295
 
 
17296
 
ALTER TABLE ONLY personsettings
17297
 
    ADD CONSTRAINT personsettings_pkey PRIMARY KEY (person);
17298
 
 
17299
 
 
17300
 
ALTER TABLE ONLY persontransferjob
17301
 
    ADD CONSTRAINT persontransferjob_job_key UNIQUE (job);
17302
 
 
17303
 
 
17304
 
ALTER TABLE ONLY persontransferjob
17305
 
    ADD CONSTRAINT persontransferjob_pkey PRIMARY KEY (id);
17306
 
 
17307
 
 
17308
6778
ALTER TABLE ONLY pillarname
17309
6779
    ADD CONSTRAINT pillarname_name_key UNIQUE (name);
17310
6780
 
17311
 
 
17312
6781
ALTER TABLE ONLY pillarname
17313
6782
    ADD CONSTRAINT pillarname_pkey PRIMARY KEY (id);
17314
6783
 
17315
6784
ALTER TABLE pillarname CLUSTER ON pillarname_pkey;
17316
6785
 
17317
 
 
17318
6786
ALTER TABLE ONLY pocketchroot
17319
6787
    ADD CONSTRAINT pocketchroot_distroarchrelease_key UNIQUE (distroarchseries, pocket);
17320
6788
 
17321
 
 
17322
6789
ALTER TABLE ONLY pocketchroot
17323
6790
    ADD CONSTRAINT pocketchroot_pkey PRIMARY KEY (id);
17324
6791
 
 
6792
ALTER TABLE ONLY pocomment
 
6793
    ADD CONSTRAINT pocomment_pkey PRIMARY KEY (id);
17325
6794
 
17326
6795
ALTER TABLE ONLY poexportrequest
17327
6796
    ADD CONSTRAINT poexportrequest_pkey PRIMARY KEY (id);
17328
6797
 
17329
 
 
17330
6798
ALTER TABLE ONLY pofile
17331
6799
    ADD CONSTRAINT pofile_pkey PRIMARY KEY (id);
17332
6800
 
17333
 
 
17334
 
ALTER TABLE ONLY pofilestatsjob
17335
 
    ADD CONSTRAINT pofilestatsjob_pkey PRIMARY KEY (job);
17336
 
 
17337
 
 
17338
6801
ALTER TABLE ONLY pofiletranslator
17339
6802
    ADD CONSTRAINT pofiletranslator__person__pofile__key UNIQUE (person, pofile);
17340
6803
 
17341
6804
ALTER TABLE pofiletranslator CLUSTER ON pofiletranslator__person__pofile__key;
17342
6805
 
17343
 
 
17344
6806
ALTER TABLE ONLY pofiletranslator
17345
6807
    ADD CONSTRAINT pofiletranslator_pkey PRIMARY KEY (id);
17346
6808
 
17347
 
 
17348
6809
ALTER TABLE ONLY poll
17349
6810
    ADD CONSTRAINT poll_pkey PRIMARY KEY (id);
17350
6811
 
17351
 
 
17352
6812
ALTER TABLE ONLY poll
17353
6813
    ADD CONSTRAINT poll_team_key UNIQUE (team, name);
17354
6814
 
17355
 
 
17356
6815
ALTER TABLE ONLY polloption
17357
6816
    ADD CONSTRAINT polloption_name_key UNIQUE (name, poll);
17358
6817
 
17359
 
 
17360
6818
ALTER TABLE ONLY polloption
17361
6819
    ADD CONSTRAINT polloption_pkey PRIMARY KEY (id);
17362
6820
 
17363
 
 
17364
6821
ALTER TABLE ONLY polloption
17365
6822
    ADD CONSTRAINT polloption_poll_key UNIQUE (poll, id);
17366
6823
 
17367
 
 
17368
6824
ALTER TABLE ONLY pomsgid
17369
6825
    ADD CONSTRAINT pomsgid_pkey PRIMARY KEY (id);
17370
6826
 
 
6827
ALTER TABLE ONLY posubscription
 
6828
    ADD CONSTRAINT posubscription_person_key UNIQUE (person, potemplate, language);
 
6829
 
 
6830
ALTER TABLE ONLY posubscription
 
6831
    ADD CONSTRAINT posubscription_pkey PRIMARY KEY (id);
17371
6832
 
17372
6833
ALTER TABLE ONLY potemplate
17373
6834
    ADD CONSTRAINT potemplate_pkey PRIMARY KEY (id);
17374
6835
 
17375
 
 
17376
6836
ALTER TABLE ONLY potmsgset
17377
6837
    ADD CONSTRAINT potmsgset_pkey PRIMARY KEY (id);
17378
6838
 
17379
 
 
17380
6839
ALTER TABLE ONLY potranslation
17381
6840
    ADD CONSTRAINT potranslation_pkey PRIMARY KEY (id);
17382
6841
 
17383
 
 
17384
6842
ALTER TABLE ONLY previewdiff
17385
6843
    ADD CONSTRAINT previewdiff_pkey PRIMARY KEY (id);
17386
6844
 
17387
 
 
17388
6845
ALTER TABLE ONLY processor
17389
6846
    ADD CONSTRAINT processor_name_key UNIQUE (name);
17390
6847
 
17391
 
 
17392
6848
ALTER TABLE ONLY processor
17393
6849
    ADD CONSTRAINT processor_pkey PRIMARY KEY (id);
17394
6850
 
17395
 
 
17396
6851
ALTER TABLE ONLY processorfamily
17397
6852
    ADD CONSTRAINT processorfamily_name_key UNIQUE (name);
17398
6853
 
17399
 
 
17400
6854
ALTER TABLE ONLY processorfamily
17401
6855
    ADD CONSTRAINT processorfamily_pkey PRIMARY KEY (id);
17402
6856
 
17403
 
 
17404
6857
ALTER TABLE ONLY product
17405
6858
    ADD CONSTRAINT product_name_key UNIQUE (name);
17406
6859
 
17407
 
ALTER TABLE product CLUSTER ON product_name_key;
17408
 
 
17409
 
 
17410
6860
ALTER TABLE ONLY product
17411
6861
    ADD CONSTRAINT product_pkey PRIMARY KEY (id);
17412
6862
 
 
6863
ALTER TABLE ONLY productbounty
 
6864
    ADD CONSTRAINT productbounty_bounty_key UNIQUE (bounty, product);
 
6865
 
 
6866
ALTER TABLE ONLY productbounty
 
6867
    ADD CONSTRAINT productbounty_pkey PRIMARY KEY (id);
 
6868
 
 
6869
ALTER TABLE ONLY productcvsmodule
 
6870
    ADD CONSTRAINT productcvsmodule_pkey PRIMARY KEY (id);
17413
6871
 
17414
6872
ALTER TABLE ONLY productlicense
17415
6873
    ADD CONSTRAINT productlicense__product__license__key UNIQUE (product, license);
17416
6874
 
17417
 
 
17418
6875
ALTER TABLE ONLY productlicense
17419
6876
    ADD CONSTRAINT productlicense_pkey PRIMARY KEY (id);
17420
6877
 
17421
 
 
17422
6878
ALTER TABLE ONLY productrelease
17423
6879
    ADD CONSTRAINT productrelease_milestone_key UNIQUE (milestone);
17424
6880
 
17425
 
 
17426
6881
ALTER TABLE ONLY productrelease
17427
6882
    ADD CONSTRAINT productrelease_pkey PRIMARY KEY (id);
17428
6883
 
17429
6884
ALTER TABLE productrelease CLUSTER ON productrelease_pkey;
17430
6885
 
17431
 
 
17432
6886
ALTER TABLE ONLY productreleasefile
17433
6887
    ADD CONSTRAINT productreleasefile_pkey PRIMARY KEY (id);
17434
6888
 
17435
 
 
17436
6889
ALTER TABLE ONLY productseries
17437
6890
    ADD CONSTRAINT productseries__product__name__key UNIQUE (product, name);
17438
6891
 
17439
6892
ALTER TABLE productseries CLUSTER ON productseries__product__name__key;
17440
6893
 
17441
 
 
17442
6894
ALTER TABLE ONLY productseries
17443
6895
    ADD CONSTRAINT productseries_pkey PRIMARY KEY (id);
17444
6896
 
17445
 
 
17446
6897
ALTER TABLE ONLY productseries
17447
6898
    ADD CONSTRAINT productseries_product_series_uniq UNIQUE (product, id);
17448
6899
 
 
6900
ALTER TABLE ONLY productseriescodeimport
 
6901
    ADD CONSTRAINT productseriescodeimport_codeimport_key UNIQUE (codeimport);
 
6902
 
 
6903
ALTER TABLE ONLY productseriescodeimport
 
6904
    ADD CONSTRAINT productseriescodeimport_pkey PRIMARY KEY (id);
 
6905
 
 
6906
ALTER TABLE ONLY productseriescodeimport
 
6907
    ADD CONSTRAINT productseriescodeimport_productseries_key UNIQUE (productseries);
 
6908
 
 
6909
ALTER TABLE ONLY productsvnmodule
 
6910
    ADD CONSTRAINT productsvnmodule_pkey PRIMARY KEY (id);
17449
6911
 
17450
6912
ALTER TABLE ONLY project
17451
6913
    ADD CONSTRAINT project_name_key UNIQUE (name);
17452
6914
 
17453
 
 
17454
6915
ALTER TABLE ONLY project
17455
6916
    ADD CONSTRAINT project_pkey PRIMARY KEY (id);
17456
6917
 
17457
6918
ALTER TABLE project CLUSTER ON project_pkey;
17458
6919
 
17459
 
 
17460
 
ALTER TABLE ONLY publisherconfig
17461
 
    ADD CONSTRAINT publisherconfig_pkey PRIMARY KEY (id);
17462
 
 
17463
 
 
17464
 
ALTER TABLE ONLY questionjob
17465
 
    ADD CONSTRAINT questionjob_job_key UNIQUE (job);
17466
 
 
17467
 
 
17468
 
ALTER TABLE ONLY questionjob
17469
 
    ADD CONSTRAINT questionjob_pkey PRIMARY KEY (id);
17470
 
 
 
6920
ALTER TABLE ONLY projectbounty
 
6921
    ADD CONSTRAINT projectbounty_bounty_key UNIQUE (bounty, project);
 
6922
 
 
6923
ALTER TABLE ONLY projectbounty
 
6924
    ADD CONSTRAINT projectbounty_pkey PRIMARY KEY (id);
 
6925
 
 
6926
ALTER TABLE ONLY projectrelationship
 
6927
    ADD CONSTRAINT projectrelationship_pkey PRIMARY KEY (id);
 
6928
 
 
6929
ALTER TABLE ONLY pushmirroraccess
 
6930
    ADD CONSTRAINT pushmirroraccess_name_key UNIQUE (name);
 
6931
 
 
6932
ALTER TABLE ONLY pushmirroraccess
 
6933
    ADD CONSTRAINT pushmirroraccess_pkey PRIMARY KEY (id);
 
6934
 
 
6935
ALTER TABLE ONLY requestedcds
 
6936
    ADD CONSTRAINT requestedcds__ds__arch__flav__request__key UNIQUE (distroseries, architecture, flavour, request);
 
6937
 
 
6938
ALTER TABLE ONLY requestedcds
 
6939
    ADD CONSTRAINT requestedcds_pkey PRIMARY KEY (id);
 
6940
 
 
6941
ALTER TABLE ONLY branchrevision
 
6942
    ADD CONSTRAINT revision__branch__revision__key UNIQUE (branch, revision);
17471
6943
 
17472
6944
ALTER TABLE ONLY revision
17473
6945
    ADD CONSTRAINT revision__id__revision_date__key UNIQUE (id, revision_date);
17474
6946
 
 
6947
ALTER TABLE ONLY branchrevision
 
6948
    ADD CONSTRAINT revision__revision__branch__key UNIQUE (revision, branch);
17475
6949
 
17476
6950
ALTER TABLE ONLY revision
17477
6951
    ADD CONSTRAINT revision_revision_id_unique UNIQUE (revision_id);
17478
6952
 
17479
 
 
17480
6953
ALTER TABLE ONLY revisioncache
17481
6954
    ADD CONSTRAINT revisioncache_pkey PRIMARY KEY (id);
17482
6955
 
 
6956
ALTER TABLE ONLY branchrevision
 
6957
    ADD CONSTRAINT revisionnumber_branch_id_unique UNIQUE (branch, id);
17483
6958
 
17484
6959
ALTER TABLE ONLY branchrevision
17485
6960
    ADD CONSTRAINT revisionnumber_branch_sequence_unique UNIQUE (branch, sequence);
17486
6961
 
17487
 
 
17488
6962
ALTER TABLE ONLY branchrevision
17489
 
    ADD CONSTRAINT revisionnumber_pkey PRIMARY KEY (revision, branch);
17490
 
 
 
6963
    ADD CONSTRAINT revisionnumber_pkey PRIMARY KEY (id);
17491
6964
 
17492
6965
ALTER TABLE ONLY revisionparent
17493
6966
    ADD CONSTRAINT revisionparent_pkey PRIMARY KEY (id);
17494
6967
 
17495
 
 
17496
6968
ALTER TABLE ONLY revisionparent
17497
6969
    ADD CONSTRAINT revisionparent_unique UNIQUE (revision, parent_id);
17498
6970
 
17499
 
 
17500
6971
ALTER TABLE ONLY revisionproperty
17501
6972
    ADD CONSTRAINT revisionproperty__revision__name__key UNIQUE (revision, name);
17502
6973
 
17503
 
 
17504
6974
ALTER TABLE ONLY revisionproperty
17505
6975
    ADD CONSTRAINT revisionproperty_pkey PRIMARY KEY (id);
17506
6976
 
17507
 
 
17508
6977
ALTER TABLE ONLY scriptactivity
17509
6978
    ADD CONSTRAINT scriptactivity_pkey PRIMARY KEY (id);
17510
6979
 
17511
 
 
17512
6980
ALTER TABLE ONLY section
17513
6981
    ADD CONSTRAINT section_name_key UNIQUE (name);
17514
6982
 
17515
 
 
17516
6983
ALTER TABLE ONLY section
17517
6984
    ADD CONSTRAINT section_pkey PRIMARY KEY (id);
17518
6985
 
17519
 
 
17520
6986
ALTER TABLE ONLY sectionselection
17521
6987
    ADD CONSTRAINT sectionselection_pkey PRIMARY KEY (id);
17522
6988
 
17523
 
 
17524
6989
ALTER TABLE ONLY seriessourcepackagebranch
17525
6990
    ADD CONSTRAINT seriessourcepackagebranch__ds__spn__pocket__key UNIQUE (distroseries, sourcepackagename, pocket);
17526
6991
 
17527
 
 
17528
6992
ALTER TABLE ONLY seriessourcepackagebranch
17529
6993
    ADD CONSTRAINT seriessourcepackagebranch_pkey PRIMARY KEY (id);
17530
6994
 
 
6995
ALTER TABLE ONLY shipitreport
 
6996
    ADD CONSTRAINT shipitreport_pkey PRIMARY KEY (id);
 
6997
 
 
6998
ALTER TABLE ONLY shipitsurvey
 
6999
    ADD CONSTRAINT shipitsurvey_pkey PRIMARY KEY (id);
 
7000
 
 
7001
ALTER TABLE ONLY shipitsurveyanswer
 
7002
    ADD CONSTRAINT shipitsurveyanswer_answer_key UNIQUE (answer);
 
7003
 
 
7004
ALTER TABLE ONLY shipitsurveyanswer
 
7005
    ADD CONSTRAINT shipitsurveyanswer_pkey PRIMARY KEY (id);
 
7006
 
 
7007
ALTER TABLE ONLY shipitsurveyquestion
 
7008
    ADD CONSTRAINT shipitsurveyquestion_pkey PRIMARY KEY (id);
 
7009
 
 
7010
ALTER TABLE ONLY shipitsurveyquestion
 
7011
    ADD CONSTRAINT shipitsurveyquestion_question_key UNIQUE (question);
 
7012
 
 
7013
ALTER TABLE ONLY shipitsurveyresult
 
7014
    ADD CONSTRAINT shipitsurveyresult_pkey PRIMARY KEY (id);
 
7015
 
 
7016
ALTER TABLE ONLY shipment
 
7017
    ADD CONSTRAINT shipment_logintoken_key UNIQUE (logintoken);
 
7018
 
 
7019
ALTER TABLE ONLY shipment
 
7020
    ADD CONSTRAINT shipment_pkey PRIMARY KEY (id);
 
7021
 
 
7022
ALTER TABLE ONLY shippingrequest
 
7023
    ADD CONSTRAINT shippingrequest_pkey PRIMARY KEY (id);
 
7024
 
 
7025
ALTER TABLE ONLY shippingrequest
 
7026
    ADD CONSTRAINT shippingrequest_shipment_key UNIQUE (shipment);
 
7027
 
 
7028
ALTER TABLE ONLY shippingrun
 
7029
    ADD CONSTRAINT shippingrun_csvfile_uniq UNIQUE (csvfile);
 
7030
 
 
7031
ALTER TABLE ONLY shippingrun
 
7032
    ADD CONSTRAINT shippingrun_pkey PRIMARY KEY (id);
17531
7033
 
17532
7034
ALTER TABLE ONLY signedcodeofconduct
17533
7035
    ADD CONSTRAINT signedcodeofconduct_pkey PRIMARY KEY (id);
17534
7036
 
 
7037
ALTER TABLE ONLY mentoringoffer
 
7038
    ADD CONSTRAINT single_offer_per_bug_key UNIQUE (bug, owner);
 
7039
 
 
7040
ALTER TABLE ONLY mentoringoffer
 
7041
    ADD CONSTRAINT single_offer_per_spec_key UNIQUE (specification, owner);
17535
7042
 
17536
7043
ALTER TABLE ONLY sourcepackageformatselection
17537
7044
    ADD CONSTRAINT sourceformatselection__distroseries__format__key UNIQUE (distroseries, format);
17538
7045
 
17539
 
 
17540
7046
ALTER TABLE ONLY sourcepackageformatselection
17541
7047
    ADD CONSTRAINT sourcepackageformatselection_pkey PRIMARY KEY (id);
17542
7048
 
17543
 
 
17544
7049
ALTER TABLE ONLY sourcepackagename
17545
7050
    ADD CONSTRAINT sourcepackagename_name_key UNIQUE (name);
17546
7051
 
17547
 
 
17548
7052
ALTER TABLE ONLY sourcepackagename
17549
7053
    ADD CONSTRAINT sourcepackagename_pkey PRIMARY KEY (id);
17550
7054
 
17551
 
 
17552
7055
ALTER TABLE ONLY sourcepackagepublishinghistory
17553
7056
    ADD CONSTRAINT sourcepackagepublishinghistory_pkey PRIMARY KEY (id);
17554
7057
 
17555
 
 
17556
7058
ALTER TABLE ONLY sourcepackagerecipe
17557
7059
    ADD CONSTRAINT sourcepackagerecipe__owner__name__key UNIQUE (owner, name);
17558
7060
 
17559
 
 
17560
7061
ALTER TABLE ONLY sourcepackagerecipedistroseries
17561
7062
    ADD CONSTRAINT sourcepackagerecipe_distroseries_unique UNIQUE (sourcepackagerecipe, distroseries);
17562
7063
 
17563
 
 
17564
7064
ALTER TABLE ONLY sourcepackagerecipe
17565
7065
    ADD CONSTRAINT sourcepackagerecipe_pkey PRIMARY KEY (id);
17566
7066
 
17567
 
 
17568
7067
ALTER TABLE ONLY sourcepackagerecipebuild
17569
7068
    ADD CONSTRAINT sourcepackagerecipebuild_pkey PRIMARY KEY (id);
17570
7069
 
17571
 
 
17572
7070
ALTER TABLE ONLY sourcepackagerecipebuildjob
17573
7071
    ADD CONSTRAINT sourcepackagerecipebuildjob__job__key UNIQUE (job);
17574
7072
 
17575
 
 
17576
7073
ALTER TABLE ONLY sourcepackagerecipebuildjob
17577
7074
    ADD CONSTRAINT sourcepackagerecipebuildjob__sourcepackage_recipe_build__key UNIQUE (sourcepackage_recipe_build);
17578
7075
 
17579
 
 
17580
7076
ALTER TABLE ONLY sourcepackagerecipebuildjob
17581
7077
    ADD CONSTRAINT sourcepackagerecipebuildjob_pkey PRIMARY KEY (id);
17582
7078
 
17583
 
 
17584
7079
ALTER TABLE ONLY sourcepackagerecipedata
17585
7080
    ADD CONSTRAINT sourcepackagerecipedata_pkey PRIMARY KEY (id);
17586
7081
 
17587
 
 
17588
7082
ALTER TABLE ONLY sourcepackagerecipedatainstruction
17589
7083
    ADD CONSTRAINT sourcepackagerecipedatainstruction__name__recipe_data__key UNIQUE (name, recipe_data);
17590
7084
 
17591
 
 
17592
7085
ALTER TABLE ONLY sourcepackagerecipedatainstruction
17593
7086
    ADD CONSTRAINT sourcepackagerecipedatainstruction__recipe_data__line_number__k UNIQUE (recipe_data, line_number);
17594
7087
 
17595
 
 
17596
7088
ALTER TABLE ONLY sourcepackagerecipedatainstruction
17597
7089
    ADD CONSTRAINT sourcepackagerecipedatainstruction_pkey PRIMARY KEY (id);
17598
7090
 
17599
 
 
17600
7091
ALTER TABLE ONLY sourcepackagerecipedistroseries
17601
7092
    ADD CONSTRAINT sourcepackagerecipedistroseries_pkey PRIMARY KEY (id);
17602
7093
 
17603
 
 
17604
7094
ALTER TABLE ONLY sourcepackagerelease
17605
7095
    ADD CONSTRAINT sourcepackagerelease_pkey PRIMARY KEY (id);
17606
7096
 
17607
 
 
17608
7097
ALTER TABLE ONLY sourcepackagereleasefile
17609
7098
    ADD CONSTRAINT sourcepackagereleasefile_pkey PRIMARY KEY (id);
17610
7099
 
17611
 
 
17612
7100
ALTER TABLE ONLY specificationbug
17613
7101
    ADD CONSTRAINT specification_bug_uniq UNIQUE (specification, bug);
17614
7102
 
17615
 
 
17616
7103
ALTER TABLE ONLY specification
17617
7104
    ADD CONSTRAINT specification_distribution_name_uniq UNIQUE (distribution, name);
17618
7105
 
17619
 
 
17620
7106
ALTER TABLE ONLY specification
17621
7107
    ADD CONSTRAINT specification_pkey PRIMARY KEY (id);
17622
7108
 
17623
 
 
17624
7109
ALTER TABLE ONLY specification
17625
7110
    ADD CONSTRAINT specification_product_name_uniq UNIQUE (name, product);
17626
7111
 
17627
 
 
17628
7112
ALTER TABLE ONLY specification
17629
7113
    ADD CONSTRAINT specification_specurl_uniq UNIQUE (specurl);
17630
7114
 
17631
 
 
17632
7115
ALTER TABLE ONLY specificationbranch
17633
7116
    ADD CONSTRAINT specificationbranch__spec_branch_unique UNIQUE (branch, specification);
17634
7117
 
17635
 
 
17636
7118
ALTER TABLE ONLY specificationbranch
17637
7119
    ADD CONSTRAINT specificationbranch_pkey PRIMARY KEY (id);
17638
7120
 
17639
 
 
17640
7121
ALTER TABLE ONLY specificationbug
17641
7122
    ADD CONSTRAINT specificationbug_pkey PRIMARY KEY (id);
17642
7123
 
17643
 
 
17644
7124
ALTER TABLE ONLY specificationdependency
17645
7125
    ADD CONSTRAINT specificationdependency_pkey PRIMARY KEY (id);
17646
7126
 
17647
 
 
17648
7127
ALTER TABLE ONLY specificationdependency
17649
7128
    ADD CONSTRAINT specificationdependency_uniq UNIQUE (specification, dependency);
17650
7129
 
17651
 
 
17652
7130
ALTER TABLE ONLY specificationfeedback
17653
7131
    ADD CONSTRAINT specificationfeedback_pkey PRIMARY KEY (id);
17654
7132
 
17655
 
 
17656
7133
ALTER TABLE ONLY specificationmessage
17657
7134
    ADD CONSTRAINT specificationmessage__specification__message__key UNIQUE (specification, message);
17658
7135
 
17659
 
 
17660
7136
ALTER TABLE ONLY specificationmessage
17661
7137
    ADD CONSTRAINT specificationmessage_pkey PRIMARY KEY (id);
17662
7138
 
17663
 
 
17664
7139
ALTER TABLE ONLY specificationsubscription
17665
7140
    ADD CONSTRAINT specificationsubscription_pkey PRIMARY KEY (id);
17666
7141
 
17667
 
 
17668
7142
ALTER TABLE ONLY specificationsubscription
17669
7143
    ADD CONSTRAINT specificationsubscription_spec_person_uniq UNIQUE (specification, person);
17670
7144
 
17671
 
 
17672
7145
ALTER TABLE ONLY spokenin
17673
7146
    ADD CONSTRAINT spokenin__country__language__key UNIQUE (language, country);
17674
7147
 
17675
 
 
17676
7148
ALTER TABLE ONLY spokenin
17677
7149
    ADD CONSTRAINT spokenin_pkey PRIMARY KEY (id);
17678
7150
 
17679
 
 
17680
7151
ALTER TABLE ONLY sprint
17681
7152
    ADD CONSTRAINT sprint_name_uniq UNIQUE (name);
17682
7153
 
17683
 
 
17684
7154
ALTER TABLE ONLY sprint
17685
7155
    ADD CONSTRAINT sprint_pkey PRIMARY KEY (id);
17686
7156
 
17687
 
 
17688
7157
ALTER TABLE ONLY sprintattendance
17689
7158
    ADD CONSTRAINT sprintattendance_attendance_uniq UNIQUE (attendee, sprint);
17690
7159
 
17691
 
 
17692
7160
ALTER TABLE ONLY sprintattendance
17693
7161
    ADD CONSTRAINT sprintattendance_pkey PRIMARY KEY (id);
17694
7162
 
17695
 
 
17696
7163
ALTER TABLE ONLY sprintspecification
17697
7164
    ADD CONSTRAINT sprintspec_uniq UNIQUE (specification, sprint);
17698
7165
 
17699
 
 
17700
7166
ALTER TABLE ONLY sprintspecification
17701
7167
    ADD CONSTRAINT sprintspecification_pkey PRIMARY KEY (id);
17702
7168
 
17703
 
 
17704
7169
ALTER TABLE ONLY sshkey
17705
7170
    ADD CONSTRAINT sshkey_pkey PRIMARY KEY (id);
17706
7171
 
 
7172
ALTER TABLE ONLY standardshipitrequest
 
7173
    ADD CONSTRAINT standardshipitrequest_flavour_quantity_key UNIQUE (flavour, quantityx86, quantityppc, quantityamd64);
 
7174
 
 
7175
ALTER TABLE ONLY standardshipitrequest
 
7176
    ADD CONSTRAINT standardshipitrequest_pkey PRIMARY KEY (id);
 
7177
 
 
7178
ALTER TABLE ONLY staticdiff
 
7179
    ADD CONSTRAINT staticdiff_from_revision_id_key UNIQUE (from_revision_id, to_revision_id);
 
7180
 
 
7181
ALTER TABLE ONLY staticdiff
 
7182
    ADD CONSTRAINT staticdiff_pkey PRIMARY KEY (id);
17707
7183
 
17708
7184
ALTER TABLE ONLY structuralsubscription
17709
7185
    ADD CONSTRAINT structuralsubscription_pkey PRIMARY KEY (id);
17710
7186
 
17711
 
 
17712
 
ALTER TABLE ONLY subunitstream
17713
 
    ADD CONSTRAINT subunitstream_pkey PRIMARY KEY (id);
17714
 
 
17715
 
 
17716
7187
ALTER TABLE ONLY suggestivepotemplate
17717
7188
    ADD CONSTRAINT suggestivepotemplate_pkey PRIMARY KEY (potemplate);
17718
7189
 
17719
 
 
17720
7190
ALTER TABLE ONLY answercontact
17721
7191
    ADD CONSTRAINT supportcontact__distribution__sourcepackagename__person__key UNIQUE (distribution, sourcepackagename, person);
17722
7192
 
17723
 
 
17724
7193
ALTER TABLE ONLY answercontact
17725
7194
    ADD CONSTRAINT supportcontact__product__person__key UNIQUE (product, person);
17726
7195
 
17727
 
 
17728
7196
ALTER TABLE ONLY answercontact
17729
7197
    ADD CONSTRAINT supportcontact_pkey PRIMARY KEY (id);
17730
7198
 
17731
 
 
17732
7199
ALTER TABLE ONLY teamparticipation
17733
7200
    ADD CONSTRAINT teamparticipation_pkey PRIMARY KEY (id);
17734
7201
 
17735
 
 
17736
7202
ALTER TABLE ONLY teamparticipation
17737
7203
    ADD CONSTRAINT teamparticipation_team_key UNIQUE (team, person);
17738
7204
 
17739
 
 
17740
7205
ALTER TABLE ONLY temporaryblobstorage
17741
7206
    ADD CONSTRAINT temporaryblobstorage_file_alias_key UNIQUE (file_alias);
17742
7207
 
17743
 
 
17744
7208
ALTER TABLE ONLY temporaryblobstorage
17745
7209
    ADD CONSTRAINT temporaryblobstorage_pkey PRIMARY KEY (id);
17746
7210
 
17747
7211
ALTER TABLE temporaryblobstorage CLUSTER ON temporaryblobstorage_pkey;
17748
7212
 
17749
 
 
17750
7213
ALTER TABLE ONLY temporaryblobstorage
17751
7214
    ADD CONSTRAINT temporaryblobstorage_uuid_key UNIQUE (uuid);
17752
7215
 
17753
 
 
17754
7216
ALTER TABLE ONLY question
17755
7217
    ADD CONSTRAINT ticket_pkey PRIMARY KEY (id);
17756
7218
 
17757
 
 
17758
7219
ALTER TABLE ONLY questionbug
17759
7220
    ADD CONSTRAINT ticketbug_bug_ticket_uniq UNIQUE (bug, question);
17760
7221
 
17761
 
 
17762
7222
ALTER TABLE ONLY questionbug
17763
7223
    ADD CONSTRAINT ticketbug_pkey PRIMARY KEY (id);
17764
7224
 
17765
 
 
17766
7225
ALTER TABLE ONLY questionmessage
17767
7226
    ADD CONSTRAINT ticketmessage_message_ticket_uniq UNIQUE (message, question);
17768
7227
 
17769
 
 
17770
7228
ALTER TABLE ONLY questionmessage
17771
7229
    ADD CONSTRAINT ticketmessage_pkey PRIMARY KEY (id);
17772
7230
 
17773
 
 
17774
7231
ALTER TABLE ONLY questionreopening
17775
7232
    ADD CONSTRAINT ticketreopening_pkey PRIMARY KEY (id);
17776
7233
 
17777
 
 
17778
7234
ALTER TABLE ONLY questionsubscription
17779
7235
    ADD CONSTRAINT ticketsubscription_pkey PRIMARY KEY (id);
17780
7236
 
17781
 
 
17782
7237
ALTER TABLE ONLY questionsubscription
17783
7238
    ADD CONSTRAINT ticketsubscription_ticket_person_uniq UNIQUE (question, person);
17784
7239
 
17785
 
 
17786
7240
ALTER TABLE ONLY translator
17787
7241
    ADD CONSTRAINT translation_translationgroup_key UNIQUE (translationgroup, language);
17788
7242
 
17789
 
 
17790
7243
ALTER TABLE ONLY translationgroup
17791
7244
    ADD CONSTRAINT translationgroup_name_key UNIQUE (name);
17792
7245
 
17793
 
 
17794
7246
ALTER TABLE ONLY translationgroup
17795
7247
    ADD CONSTRAINT translationgroup_pkey PRIMARY KEY (id);
17796
7248
 
17797
 
 
17798
7249
ALTER TABLE ONLY translationimportqueueentry
17799
7250
    ADD CONSTRAINT translationimportqueueentry_pkey PRIMARY KEY (id);
17800
7251
 
17801
 
 
17802
7252
ALTER TABLE ONLY translationmessage
17803
7253
    ADD CONSTRAINT translationmessage_pkey PRIMARY KEY (id);
17804
7254
 
17805
 
 
17806
7255
ALTER TABLE ONLY translationrelicensingagreement
17807
7256
    ADD CONSTRAINT translationrelicensingagreement__person__key UNIQUE (person);
17808
7257
 
17809
 
 
17810
7258
ALTER TABLE ONLY translationrelicensingagreement
17811
7259
    ADD CONSTRAINT translationrelicensingagreement_pkey PRIMARY KEY (id);
17812
7260
 
17813
 
 
17814
7261
ALTER TABLE ONLY translationtemplateitem
17815
7262
    ADD CONSTRAINT translationtemplateitem_pkey PRIMARY KEY (id);
17816
7263
 
17817
 
 
17818
 
ALTER TABLE ONLY translationtemplatesbuild
17819
 
    ADD CONSTRAINT translationtemplatesbuild_pkey PRIMARY KEY (id);
17820
 
 
17821
 
 
17822
7264
ALTER TABLE ONLY translator
17823
7265
    ADD CONSTRAINT translator_pkey PRIMARY KEY (id);
17824
7266
 
17825
 
 
17826
7267
ALTER TABLE ONLY specificationfeedback
17827
7268
    ADD CONSTRAINT unique_spec_requestor_provider UNIQUE (specification, requester, reviewer);
17828
7269
 
17829
 
 
17830
7270
ALTER TABLE ONLY usertouseremail
17831
7271
    ADD CONSTRAINT usertouseremail_pkey PRIMARY KEY (id);
17832
7272
 
17833
 
 
17834
7273
ALTER TABLE ONLY vote
17835
7274
    ADD CONSTRAINT vote_pkey PRIMARY KEY (id);
17836
7275
 
17837
 
 
17838
7276
ALTER TABLE ONLY votecast
17839
7277
    ADD CONSTRAINT votecast_person_key UNIQUE (person, poll);
17840
7278
 
17841
 
 
17842
7279
ALTER TABLE ONLY votecast
17843
7280
    ADD CONSTRAINT votecast_pkey PRIMARY KEY (id);
17844
7281
 
 
7282
ALTER TABLE ONLY webserviceban
 
7283
    ADD CONSTRAINT webserviceban_pkey PRIMARY KEY (id);
17845
7284
 
17846
7285
ALTER TABLE ONLY wikiname
17847
7286
    ADD CONSTRAINT wikiname_pkey PRIMARY KEY (id);
17848
7287
 
17849
 
 
17850
7288
ALTER TABLE ONLY wikiname
17851
7289
    ADD CONSTRAINT wikiname_wikiname_key UNIQUE (wikiname, wiki);
17852
7290
 
17853
 
 
17854
 
CREATE UNIQUE INDEX accessartifactgrant__artifact__grantee__key ON accesspolicygrant USING btree (artifact, grantee) WHERE (artifact IS NOT NULL);
17855
 
 
17856
 
 
17857
 
CREATE UNIQUE INDEX accesspolicy__distribution__type__key ON accesspolicy USING btree (distribution, type) WHERE (distribution IS NOT NULL);
17858
 
 
17859
 
 
17860
 
CREATE UNIQUE INDEX accesspolicy__product__type__key ON accesspolicy USING btree (product, type) WHERE (product IS NOT NULL);
17861
 
 
17862
 
 
17863
 
CREATE UNIQUE INDEX accesspolicyartifact__branch__key ON accesspolicyartifact USING btree (branch) WHERE (branch IS NOT NULL);
17864
 
 
17865
 
 
17866
 
CREATE UNIQUE INDEX accesspolicyartifact__bug__key ON accesspolicyartifact USING btree (bug) WHERE (bug IS NOT NULL);
17867
 
 
17868
 
 
17869
 
CREATE INDEX accesspolicyartifact__policy__key ON accesspolicyartifact USING btree (policy);
17870
 
 
17871
 
 
17872
 
CREATE INDEX accesspolicygrant__grantee__idx ON accesspolicygrant USING btree (grantee);
17873
 
 
17874
 
 
17875
 
CREATE INDEX accesspolicygrant__grantor__idx ON accesspolicygrant USING btree (grantor);
17876
 
 
17877
 
 
17878
 
CREATE UNIQUE INDEX accesspolicygrant__policy__grantee__key ON accesspolicygrant USING btree (policy, grantee) WHERE (policy IS NOT NULL);
17879
 
 
 
7291
CREATE INDEX account__old_openid_identifier__idx ON account USING btree (old_openid_identifier);
17880
7292
 
17881
7293
CREATE INDEX announcement__distribution__active__idx ON announcement USING btree (distribution, active) WHERE (distribution IS NOT NULL);
17882
7294
 
17883
 
 
17884
7295
CREATE INDEX announcement__product__active__idx ON announcement USING btree (product, active) WHERE (product IS NOT NULL);
17885
7296
 
17886
 
 
17887
7297
CREATE INDEX announcement__project__active__idx ON announcement USING btree (project, active) WHERE (project IS NOT NULL);
17888
7298
 
17889
 
 
17890
7299
CREATE INDEX announcement__registrant__idx ON announcement USING btree (registrant);
17891
7300
 
17892
 
 
17893
7301
CREATE UNIQUE INDEX answercontact__distribution__person__key ON answercontact USING btree (distribution, person) WHERE (sourcepackagename IS NULL);
17894
7302
 
17895
 
 
17896
7303
CREATE INDEX answercontact__person__idx ON answercontact USING btree (person);
17897
7304
 
17898
 
 
17899
7305
CREATE INDEX apportjob__blob__idx ON apportjob USING btree (blob);
17900
7306
 
 
7307
CREATE INDEX archive__commercial__idx ON archive USING btree (commercial);
17901
7308
 
17902
7309
CREATE UNIQUE INDEX archive__distribution__purpose__key ON archive USING btree (distribution, purpose) WHERE (purpose = ANY (ARRAY[1, 4]));
17903
7310
 
17904
 
 
17905
7311
CREATE INDEX archive__owner__idx ON archive USING btree (owner);
17906
7312
 
17907
 
 
17908
7313
CREATE UNIQUE INDEX archive__owner__key ON archive USING btree (owner, distribution, name);
17909
7314
 
17910
 
 
17911
7315
CREATE INDEX archive__require_virtualized__idx ON archive USING btree (require_virtualized);
17912
7316
 
17913
 
 
17914
7317
CREATE INDEX archive__signing_key__idx ON archive USING btree (signing_key) WHERE (signing_key IS NOT NULL);
17915
7318
 
17916
 
 
17917
7319
CREATE INDEX archive__status__idx ON archive USING btree (status);
17918
7320
 
17919
 
 
17920
 
CREATE INDEX archive_fti ON archive USING gist (fti);
17921
 
 
 
7321
CREATE INDEX archive_fti ON archive USING gist (fti ts2.gist_tsvector_ops);
17922
7322
 
17923
7323
CREATE INDEX archiveauthtoken__archive__idx ON archiveauthtoken USING btree (archive);
17924
7324
 
17925
 
 
17926
7325
CREATE INDEX archiveauthtoken__date_created__idx ON archiveauthtoken USING btree (date_created);
17927
7326
 
17928
 
 
17929
7327
CREATE INDEX archiveauthtoken__person__idx ON archiveauthtoken USING btree (person);
17930
7328
 
17931
 
 
17932
7329
CREATE INDEX archivedependency__archive__idx ON archivedependency USING btree (archive);
17933
7330
 
17934
 
 
17935
7331
CREATE INDEX archivedependency__component__idx ON archivedependency USING btree (component);
17936
7332
 
17937
 
 
17938
7333
CREATE INDEX archivedependency__dependency__idx ON archivedependency USING btree (dependency);
17939
7334
 
17940
 
 
17941
7335
CREATE INDEX archivejob__archive__job_type__idx ON archivejob USING btree (archive, job_type);
17942
7336
 
17943
 
 
17944
7337
CREATE INDEX archivepermission__archive__component__permission__idx ON archivepermission USING btree (archive, component, permission);
17945
7338
 
17946
 
 
17947
7339
CREATE INDEX archivepermission__archive__sourcepackagename__permission__idx ON archivepermission USING btree (archive, sourcepackagename, permission);
17948
7340
 
17949
 
 
17950
7341
CREATE INDEX archivepermission__packageset__idx ON archivepermission USING btree (packageset) WHERE (packageset IS NOT NULL);
17951
7342
 
17952
 
 
17953
7343
CREATE INDEX archivepermission__person__archive__idx ON archivepermission USING btree (person, archive);
17954
7344
 
17955
 
 
17956
7345
CREATE INDEX archivesubscriber__archive__idx ON archivesubscriber USING btree (archive);
17957
7346
 
17958
 
 
17959
7347
CREATE INDEX archivesubscriber__cancelled_by__idx ON archivesubscriber USING btree (cancelled_by) WHERE (cancelled_by IS NOT NULL);
17960
7348
 
17961
 
 
17962
7349
CREATE INDEX archivesubscriber__date_created__idx ON archivesubscriber USING btree (date_created);
17963
7350
 
17964
 
 
17965
7351
CREATE INDEX archivesubscriber__date_expires__idx ON archivesubscriber USING btree (date_expires) WHERE (date_expires IS NOT NULL);
17966
7352
 
17967
 
 
17968
7353
CREATE INDEX archivesubscriber__registrant__idx ON archivesubscriber USING btree (registrant);
17969
7354
 
17970
 
 
17971
7355
CREATE INDEX archivesubscriber__subscriber__idx ON archivesubscriber USING btree (subscriber);
17972
7356
 
 
7357
CREATE INDEX authtoken__date_consumed__idx ON authtoken USING btree (date_consumed);
 
7358
 
 
7359
CREATE INDEX authtoken__date_created__idx ON authtoken USING btree (date_created);
 
7360
 
 
7361
CREATE INDEX authtoken__requester__idx ON authtoken USING btree (requester);
17973
7362
 
17974
7363
CREATE INDEX binarypackagebuild__distro_arch_series__idx ON binarypackagebuild USING btree (distro_arch_series);
17975
7364
 
17976
 
 
17977
7365
CREATE UNIQUE INDEX binarypackagebuild__package_build__idx ON binarypackagebuild USING btree (package_build);
17978
7366
 
17979
 
 
17980
7367
CREATE INDEX binarypackagebuild__source_package_release_idx ON binarypackagebuild USING btree (source_package_release);
17981
7368
 
17982
 
 
17983
7369
CREATE INDEX binarypackagefile_binarypackage_idx ON binarypackagefile USING btree (binarypackagerelease);
17984
7370
 
17985
 
 
17986
7371
CREATE INDEX binarypackagefile_libraryfile_idx ON binarypackagefile USING btree (libraryfile);
17987
7372
 
17988
 
 
17989
 
CREATE INDEX binarypackagepublishinghistory__binarypackagename__idx ON binarypackagepublishinghistory USING btree (binarypackagename);
17990
 
 
17991
 
 
17992
7373
CREATE UNIQUE INDEX binarypackagerelease__debug_package__key ON binarypackagerelease USING btree (debug_package);
17993
7374
 
17994
 
 
17995
 
CREATE INDEX binarypackagerelease__version__idx ON binarypackagerelease USING btree (version);
17996
 
 
17997
 
 
17998
7375
CREATE INDEX binarypackagerelease_build_idx ON binarypackagerelease USING btree (build);
17999
7376
 
18000
 
 
18001
 
CREATE INDEX binarypackagerelease_fti ON binarypackagerelease USING gist (fti);
18002
 
 
18003
 
 
18004
 
CREATE INDEX branch__access_policy__idx ON branch USING btree (access_policy);
18005
 
 
 
7377
CREATE INDEX binarypackagerelease_fti ON binarypackagerelease USING gist (fti ts2.gist_tsvector_ops);
 
7378
 
 
7379
CREATE INDEX binarypackagerelease_version_idx ON binarypackagerelease USING btree (version);
 
7380
 
 
7381
CREATE INDEX binarypackagerelease_version_sort ON binarypackagerelease USING btree (debversion_sort_key(version));
 
7382
 
 
7383
CREATE INDEX bounty__claimant__idx ON bounty USING btree (claimant);
 
7384
 
 
7385
CREATE INDEX bounty__owner__idx ON bounty USING btree (owner);
 
7386
 
 
7387
CREATE INDEX bounty__reviewer__idx ON bounty USING btree (reviewer);
 
7388
 
 
7389
CREATE INDEX bounty_usdvalue_idx ON bounty USING btree (usdvalue);
 
7390
 
 
7391
CREATE INDEX bountymessage_bounty_idx ON bountymessage USING btree (bounty);
18006
7392
 
18007
7393
CREATE INDEX branch__date_created__idx ON branch USING btree (date_created);
18008
7394
 
18009
 
 
18010
7395
CREATE UNIQUE INDEX branch__ds__spn__owner__name__key ON branch USING btree (distroseries, sourcepackagename, owner, name) WHERE (distroseries IS NOT NULL);
18011
7396
 
18012
 
 
18013
7397
CREATE INDEX branch__last_scanned__owner__idx ON branch USING btree (last_scanned, owner) WHERE (last_scanned IS NOT NULL);
18014
7398
 
18015
 
 
18016
 
CREATE INDEX branch__merge_queue__idx ON branch USING btree (merge_queue);
18017
 
 
18018
 
 
18019
7399
CREATE INDEX branch__next_mirror_time__idx ON branch USING btree (next_mirror_time) WHERE (next_mirror_time IS NOT NULL);
18020
7400
 
18021
 
 
18022
7401
CREATE UNIQUE INDEX branch__owner__name__key ON branch USING btree (owner, name) WHERE ((product IS NULL) AND (distroseries IS NULL));
18023
7402
 
18024
 
 
18025
7403
CREATE INDEX branch__owner_name__idx ON branch USING btree (owner_name);
18026
7404
 
18027
 
 
18028
7405
CREATE INDEX branch__private__idx ON branch USING btree (private);
18029
7406
 
18030
 
 
18031
7407
CREATE INDEX branch__product__id__idx ON branch USING btree (product, id);
18032
7408
 
18033
7409
ALTER TABLE branch CLUSTER ON branch__product__id__idx;
18034
7410
 
18035
 
 
18036
7411
CREATE UNIQUE INDEX branch__product__owner__name__key ON branch USING btree (product, owner, name) WHERE (product IS NOT NULL);
18037
7412
 
18038
 
 
18039
7413
CREATE INDEX branch__registrant__idx ON branch USING btree (registrant);
18040
7414
 
18041
 
 
18042
7415
CREATE INDEX branch__reviewer__idx ON branch USING btree (reviewer);
18043
7416
 
18044
 
 
18045
7417
CREATE INDEX branch__stacked_on__idx ON branch USING btree (stacked_on) WHERE (stacked_on IS NOT NULL);
18046
7418
 
18047
 
 
18048
7419
CREATE INDEX branch__target_suffix__idx ON branch USING btree (target_suffix);
18049
7420
 
18050
 
 
18051
 
CREATE INDEX branch__transitively_private__idx ON branch USING btree (transitively_private);
18052
 
 
18053
 
 
18054
7421
CREATE INDEX branch_author_idx ON branch USING btree (author);
18055
7422
 
18056
 
 
18057
7423
CREATE INDEX branch_owner_idx ON branch USING btree (owner);
18058
7424
 
18059
 
 
18060
7425
CREATE INDEX branchjob__branch__idx ON branchjob USING btree (branch);
18061
7426
 
18062
 
 
18063
7427
CREATE INDEX branchmergeproposal__dependent_branch__idx ON branchmergeproposal USING btree (dependent_branch);
18064
7428
 
18065
 
 
18066
7429
CREATE INDEX branchmergeproposal__merge_diff__idx ON branchmergeproposal USING btree (merge_diff);
18067
7430
 
18068
 
 
18069
7431
CREATE INDEX branchmergeproposal__merge_log_file__idx ON branchmergeproposal USING btree (merge_log_file);
18070
7432
 
18071
 
 
18072
7433
CREATE INDEX branchmergeproposal__merge_reporter__idx ON branchmergeproposal USING btree (merge_reporter) WHERE (merge_reporter IS NOT NULL);
18073
7434
 
18074
 
 
18075
7435
CREATE INDEX branchmergeproposal__merger__idx ON branchmergeproposal USING btree (merger);
18076
7436
 
18077
 
 
18078
7437
CREATE INDEX branchmergeproposal__queuer__idx ON branchmergeproposal USING btree (queuer);
18079
7438
 
18080
 
 
18081
7439
CREATE INDEX branchmergeproposal__registrant__idx ON branchmergeproposal USING btree (registrant);
18082
7440
 
 
7441
CREATE INDEX branchmergeproposal__review_diff__idx ON branchmergeproposal USING btree (review_diff);
18083
7442
 
18084
7443
CREATE INDEX branchmergeproposal__reviewer__idx ON branchmergeproposal USING btree (reviewer);
18085
7444
 
18086
 
 
18087
7445
CREATE INDEX branchmergeproposal__source_branch__idx ON branchmergeproposal USING btree (source_branch);
18088
7446
 
18089
 
 
18090
7447
CREATE INDEX branchmergeproposal__superseded_by__idx ON branchmergeproposal USING btree (superseded_by) WHERE (superseded_by IS NOT NULL);
18091
7448
 
18092
 
 
18093
7449
CREATE INDEX branchmergeproposal__target_branch__idx ON branchmergeproposal USING btree (target_branch);
18094
7450
 
18095
 
 
18096
7451
CREATE INDEX branchmergeproposaljob__branch_merge_proposal__idx ON branchmergeproposaljob USING btree (branch_merge_proposal);
18097
7452
 
18098
 
 
18099
 
CREATE INDEX branchmergequeue__registrant__idx ON branchmergequeue USING btree (registrant);
18100
 
 
 
7453
CREATE INDEX branchmergerobot__owner__idx ON branchmergerobot USING btree (owner);
 
7454
 
 
7455
CREATE INDEX branchmergerobot__registrant__idx ON branchmergerobot USING btree (registrant);
18101
7456
 
18102
7457
CREATE INDEX branchsubscription__branch__idx ON branchsubscription USING btree (branch);
18103
7458
 
18104
 
 
18105
7459
CREATE INDEX branchsubscription__subscribed_by__idx ON branchsubscription USING btree (subscribed_by);
18106
7460
 
18107
 
 
18108
7461
CREATE INDEX branchvisibilitypolicy__product__idx ON branchvisibilitypolicy USING btree (product) WHERE (product IS NOT NULL);
18109
7462
 
18110
 
 
18111
7463
CREATE INDEX branchvisibilitypolicy__project__idx ON branchvisibilitypolicy USING btree (project) WHERE (project IS NOT NULL);
18112
7464
 
18113
 
 
18114
7465
CREATE INDEX branchvisibilitypolicy__team__idx ON branchvisibilitypolicy USING btree (team) WHERE (team IS NOT NULL);
18115
7466
 
18116
 
 
18117
7467
CREATE UNIQUE INDEX branchvisibilitypolicy__unq ON branchvisibilitypolicy USING btree ((COALESCE(product, (-1))), (COALESCE(project, (-1))), (COALESCE(team, (-1))));
18118
7468
 
18119
 
 
18120
 
CREATE INDEX bug__access_policy__idx ON bug USING btree (access_policy);
18121
 
 
18122
 
 
18123
7469
CREATE INDEX bug__date_last_message__idx ON bug USING btree (date_last_message);
18124
7470
 
18125
 
 
18126
7471
CREATE INDEX bug__date_last_updated__idx ON bug USING btree (date_last_updated);
18127
7472
 
18128
7473
ALTER TABLE bug CLUSTER ON bug__date_last_updated__idx;
18129
7474
 
18130
 
 
18131
7475
CREATE INDEX bug__datecreated__idx ON bug USING btree (datecreated);
18132
7476
 
18133
 
 
18134
7477
CREATE INDEX bug__heat__idx ON bug USING btree (heat);
18135
7478
 
18136
 
 
18137
7479
CREATE INDEX bug__heat_last_updated__idx ON bug USING btree (heat_last_updated);
18138
7480
 
18139
 
 
18140
7481
CREATE INDEX bug__latest_patch_uploaded__idx ON bug USING btree (latest_patch_uploaded);
18141
7482
 
18142
 
 
18143
 
CREATE UNIQUE INDEX bug__name__key ON bug USING btree (name) WHERE (name IS NOT NULL);
18144
 
 
18145
 
 
18146
 
CREATE INDEX bug__new_patches__idx ON bug USING btree (id) WHERE ((latest_patch_uploaded IS NOT NULL) AND (duplicateof IS NULL));
18147
 
 
18148
 
 
18149
7483
CREATE INDEX bug__users_affected_count__idx ON bug USING btree (users_affected_count);
18150
7484
 
18151
 
 
18152
7485
CREATE INDEX bug__users_unaffected_count__idx ON bug USING btree (users_unaffected_count);
18153
7486
 
18154
 
 
18155
7487
CREATE INDEX bug__who_made_private__idx ON bug USING btree (who_made_private) WHERE (who_made_private IS NOT NULL);
18156
7488
 
18157
 
 
18158
7489
CREATE INDEX bug_duplicateof_idx ON bug USING btree (duplicateof);
18159
7490
 
18160
 
 
18161
7491
CREATE INDEX bug_fti ON bug USING gist (fti);
18162
7492
 
18163
 
 
18164
7493
CREATE INDEX bug_owner_idx ON bug USING btree (owner);
18165
7494
 
18166
 
 
18167
7495
CREATE INDEX bugactivity_bug_datechanged_idx ON bugactivity USING btree (bug, datechanged);
18168
7496
 
18169
 
 
18170
7497
CREATE INDEX bugactivity_datechanged_idx ON bugactivity USING btree (datechanged);
18171
7498
 
18172
 
 
18173
7499
CREATE INDEX bugactivity_person_datechanged_idx ON bugactivity USING btree (person, datechanged);
18174
7500
 
18175
 
 
18176
7501
CREATE INDEX bugaffectsperson__person__idx ON bugaffectsperson USING btree (person);
18177
7502
 
18178
 
 
18179
7503
CREATE INDEX bugattachment__bug__idx ON bugattachment USING btree (bug);
18180
7504
 
18181
 
 
18182
7505
CREATE INDEX bugattachment_libraryfile_idx ON bugattachment USING btree (libraryfile);
18183
7506
 
18184
 
 
18185
7507
CREATE INDEX bugattachment_message_idx ON bugattachment USING btree (message);
18186
7508
 
18187
 
 
18188
7509
CREATE INDEX bugbranch__registrant__idx ON bugbranch USING btree (registrant);
18189
7510
 
18190
 
 
18191
7511
CREATE INDEX bugcve_cve_index ON bugcve USING btree (cve);
18192
7512
 
18193
 
 
18194
7513
CREATE INDEX bugjob__bug__job_type__idx ON bugjob USING btree (bug, job_type);
18195
7514
 
18196
 
 
18197
 
CREATE INDEX bugmessage__owner__index__idx ON bugmessage USING btree (owner, index);
18198
 
 
18199
 
 
18200
7515
CREATE INDEX bugmessage_message_idx ON bugmessage USING btree (message);
18201
7516
 
18202
 
 
18203
 
CREATE INDEX bugmute__bug__idx ON bugmute USING btree (bug);
18204
 
 
18205
 
 
18206
7517
CREATE INDEX bugnomination__bug__idx ON bugnomination USING btree (bug);
18207
7518
 
18208
 
 
18209
7519
CREATE INDEX bugnomination__decider__idx ON bugnomination USING btree (decider) WHERE (decider IS NOT NULL);
18210
7520
 
18211
 
 
18212
7521
CREATE UNIQUE INDEX bugnomination__distroseries__bug__key ON bugnomination USING btree (distroseries, bug) WHERE (distroseries IS NOT NULL);
18213
7522
 
18214
 
 
18215
7523
CREATE INDEX bugnomination__owner__idx ON bugnomination USING btree (owner);
18216
7524
 
18217
 
 
18218
7525
CREATE UNIQUE INDEX bugnomination__productseries__bug__key ON bugnomination USING btree (productseries, bug) WHERE (productseries IS NOT NULL);
18219
7526
 
18220
 
 
18221
7527
CREATE INDEX bugnotification__date_emailed__idx ON bugnotification USING btree (date_emailed);
18222
7528
 
18223
 
ALTER TABLE bugnotification CLUSTER ON bugnotification__date_emailed__idx;
18224
 
 
18225
 
 
18226
7529
CREATE INDEX bugnotificationattachment__bug_notification__idx ON bugnotificationattachment USING btree (bug_notification);
18227
7530
 
18228
 
 
18229
7531
CREATE INDEX bugnotificationattachment__message__idx ON bugnotificationattachment USING btree (message);
18230
7532
 
18231
 
 
18232
 
CREATE INDEX bugnotificationfilter__bug_subscription_filter__idx ON bugnotificationfilter USING btree (bug_subscription_filter);
18233
 
 
18234
 
 
18235
7533
CREATE INDEX bugnotificationrecipient__person__idx ON bugnotificationrecipient USING btree (person);
18236
7534
 
18237
 
 
18238
7535
CREATE INDEX bugnotificationrecipientarchive__bug_notification__idx ON bugnotificationrecipientarchive USING btree (bug_notification);
18239
7536
 
18240
 
 
18241
7537
CREATE INDEX bugnotificationrecipientarchive__person__idx ON bugnotificationrecipientarchive USING btree (person);
18242
7538
 
 
7539
CREATE INDEX bugpackageinfestation__creator__idx ON bugpackageinfestation USING btree (creator);
 
7540
 
 
7541
CREATE INDEX bugpackageinfestation__lastmodifiedby__idx ON bugpackageinfestation USING btree (lastmodifiedby);
 
7542
 
 
7543
CREATE INDEX bugpackageinfestation__verifiedby__idx ON bugpackageinfestation USING btree (verifiedby);
 
7544
 
 
7545
CREATE INDEX bugproductinfestation__creator__idx ON bugproductinfestation USING btree (creator);
 
7546
 
 
7547
CREATE INDEX bugproductinfestation__lastmodifiedby__idx ON bugproductinfestation USING btree (lastmodifiedby);
 
7548
 
 
7549
CREATE INDEX bugproductinfestation__verifiedby__idx ON bugproductinfestation USING btree (verifiedby);
18243
7550
 
18244
7551
CREATE INDEX bugsubscription__subscribed_by__idx ON bugsubscription USING btree (subscribed_by);
18245
7552
 
18246
 
 
18247
7553
CREATE INDEX bugsubscription_bug_idx ON bugsubscription USING btree (bug);
18248
7554
 
18249
7555
ALTER TABLE bugsubscription CLUSTER ON bugsubscription_bug_idx;
18250
7556
 
18251
 
 
18252
7557
CREATE INDEX bugsubscription_person_idx ON bugsubscription USING btree (person);
18253
7558
 
18254
 
 
18255
 
CREATE INDEX bugsubscriptionfilter__bug_notification_level__idx ON bugsubscriptionfilter USING btree (bug_notification_level);
18256
 
 
18257
 
 
18258
 
CREATE INDEX bugsubscriptionfilter__structuralsubscription ON bugsubscriptionfilter USING btree (structuralsubscription);
18259
 
 
18260
 
 
18261
 
CREATE INDEX bugsubscriptionfilterimportance__filter__importance__idx ON bugsubscriptionfilterimportance USING btree (filter, importance);
18262
 
 
18263
 
 
18264
 
CREATE INDEX bugsubscriptionfiltermute__filter__idx ON bugsubscriptionfiltermute USING btree (filter);
18265
 
 
18266
 
 
18267
 
CREATE INDEX bugsubscriptionfilterstatus__filter__status__idx ON bugsubscriptionfilterstatus USING btree (filter, status);
18268
 
 
18269
 
 
18270
 
CREATE INDEX bugsubscriptionfiltertag__filter__tag__idx ON bugsubscriptionfiltertag USING btree (filter, tag);
18271
 
 
18272
 
 
18273
 
CREATE INDEX bugsummary__distribution__idx ON bugsummary USING btree (distribution) WHERE (distribution IS NOT NULL);
18274
 
 
18275
 
 
18276
 
CREATE UNIQUE INDEX bugsummary__distribution__unique ON bugsummary USING btree (distribution, status, importance, has_patch, fixed_upstream, (COALESCE(sourcepackagename, (-1))), (COALESCE(tag, ''::text)), (COALESCE(milestone, (-1))), (COALESCE(viewed_by, (-1)))) WHERE (distribution IS NOT NULL);
18277
 
 
18278
 
 
18279
 
CREATE INDEX bugsummary__distribution_count__idx ON bugsummary USING btree (distribution) WHERE ((sourcepackagename IS NULL) AND (tag IS NULL));
18280
 
 
18281
 
 
18282
 
CREATE INDEX bugsummary__distribution_tag_count__idx ON bugsummary USING btree (distribution) WHERE ((sourcepackagename IS NULL) AND (tag IS NOT NULL));
18283
 
 
18284
 
 
18285
 
CREATE INDEX bugsummary__distroseries__idx ON bugsummary USING btree (distroseries) WHERE (distroseries IS NOT NULL);
18286
 
 
18287
 
 
18288
 
CREATE UNIQUE INDEX bugsummary__distroseries__unique ON bugsummary USING btree (distroseries, status, importance, has_patch, fixed_upstream, (COALESCE(sourcepackagename, (-1))), (COALESCE(tag, ''::text)), (COALESCE(milestone, (-1))), (COALESCE(viewed_by, (-1)))) WHERE (distroseries IS NOT NULL);
18289
 
 
18290
 
 
18291
 
CREATE INDEX bugsummary__full__idx ON bugsummary USING btree (tag, status, product, productseries, distribution, distroseries, sourcepackagename, viewed_by, milestone, importance, has_patch, fixed_upstream);
18292
 
 
18293
 
 
18294
 
CREATE INDEX bugsummary__milestone__idx ON bugsummary USING btree (milestone) WHERE (milestone IS NOT NULL);
18295
 
 
18296
 
 
18297
 
CREATE INDEX bugsummary__nocount__idx ON bugsummary USING btree (count) WHERE (count = 0);
18298
 
 
18299
 
 
18300
 
CREATE INDEX bugsummary__product__idx ON bugsummary USING btree (product) WHERE (product IS NOT NULL);
18301
 
 
18302
 
 
18303
 
CREATE UNIQUE INDEX bugsummary__product__unique ON bugsummary USING btree (product, status, importance, has_patch, fixed_upstream, (COALESCE(tag, ''::text)), (COALESCE(milestone, (-1))), (COALESCE(viewed_by, (-1)))) WHERE (product IS NOT NULL);
18304
 
 
18305
 
 
18306
 
CREATE INDEX bugsummary__productseries__idx ON bugsummary USING btree (productseries) WHERE (productseries IS NOT NULL);
18307
 
 
18308
 
 
18309
 
CREATE UNIQUE INDEX bugsummary__productseries__unique ON bugsummary USING btree (productseries, status, importance, has_patch, fixed_upstream, (COALESCE(tag, ''::text)), (COALESCE(milestone, (-1))), (COALESCE(viewed_by, (-1)))) WHERE (productseries IS NOT NULL);
18310
 
 
18311
 
 
18312
 
CREATE INDEX bugsummary__status_count__idx ON bugsummary USING btree (status) WHERE ((sourcepackagename IS NULL) AND (tag IS NULL));
18313
 
 
18314
 
 
18315
 
CREATE INDEX bugsummary__tag_count__idx ON bugsummary USING btree (status) WHERE ((sourcepackagename IS NULL) AND (tag IS NOT NULL));
18316
 
 
18317
 
 
18318
 
CREATE INDEX bugsummary__viewed_by__idx ON bugsummary USING btree (viewed_by) WHERE (viewed_by IS NOT NULL);
18319
 
 
18320
 
 
18321
 
CREATE INDEX bugsummaryjournal__full__idx ON bugsummaryjournal USING btree (status, product, productseries, distribution, distroseries, sourcepackagename, viewed_by, milestone, tag);
18322
 
 
18323
 
 
18324
 
CREATE INDEX bugsummaryjournal__milestone__idx ON bugsummaryjournal USING btree (milestone) WHERE (milestone IS NOT NULL);
18325
 
 
18326
 
 
18327
 
CREATE INDEX bugsummaryjournal__viewed_by__idx ON bugsummaryjournal USING btree (viewed_by) WHERE (viewed_by IS NOT NULL);
18328
 
 
18329
 
 
18330
7559
CREATE INDEX bugtag__bug__idx ON bugtag USING btree (bug);
18331
7560
 
18332
 
 
18333
7561
CREATE INDEX bugtask__assignee__idx ON bugtask USING btree (assignee);
18334
7562
 
18335
 
 
18336
7563
CREATE INDEX bugtask__binarypackagename__idx ON bugtask USING btree (binarypackagename) WHERE (binarypackagename IS NOT NULL);
18337
7564
 
18338
 
 
18339
7565
CREATE INDEX bugtask__bug__idx ON bugtask USING btree (bug);
18340
7566
 
18341
 
 
18342
7567
CREATE INDEX bugtask__bugwatch__idx ON bugtask USING btree (bugwatch) WHERE (bugwatch IS NOT NULL);
18343
7568
 
18344
 
 
18345
 
CREATE INDEX bugtask__date_closed__id__idx2 ON bugtask USING btree (date_closed, id DESC);
18346
 
 
 
7569
CREATE UNIQUE INDEX bugtask__date_closed__id__idx ON bugtask USING btree (date_closed, id) WHERE (status = 30);
18347
7570
 
18348
7571
CREATE INDEX bugtask__date_incomplete__idx ON bugtask USING btree (date_incomplete) WHERE (date_incomplete IS NOT NULL);
18349
7572
 
18350
 
 
18351
7573
CREATE INDEX bugtask__datecreated__idx ON bugtask USING btree (datecreated);
18352
7574
 
18353
 
 
18354
 
CREATE INDEX bugtask__distribution__heat__id__idx ON bugtask USING btree (distribution, heat DESC, id) WHERE (distribution IS NOT NULL);
18355
 
 
18356
 
 
18357
7575
CREATE INDEX bugtask__distribution__sourcepackagename__idx ON bugtask USING btree (distribution, sourcepackagename);
18358
7576
 
18359
7577
ALTER TABLE bugtask CLUSTER ON bugtask__distribution__sourcepackagename__idx;
18360
7578
 
18361
 
 
18362
 
CREATE INDEX bugtask__distribution_sourcepackage__heat__idx ON bugtask USING btree (distribution, sourcepackagename, heat) WHERE (distribution IS NOT NULL);
18363
 
 
18364
 
 
18365
7579
CREATE INDEX bugtask__distroseries__sourcepackagename__idx ON bugtask USING btree (distroseries, sourcepackagename);
18366
7580
 
18367
 
 
18368
 
CREATE INDEX bugtask__distroseries_sourcepackage__heat__idx ON bugtask USING btree (distroseries, sourcepackagename, heat) WHERE (distroseries IS NOT NULL);
18369
 
 
18370
 
 
18371
7581
CREATE INDEX bugtask__milestone__idx ON bugtask USING btree (milestone);
18372
7582
 
18373
 
 
18374
7583
CREATE INDEX bugtask__owner__idx ON bugtask USING btree (owner);
18375
7584
 
18376
 
 
18377
7585
CREATE UNIQUE INDEX bugtask__product__bug__key ON bugtask USING btree (product, bug) WHERE (product IS NOT NULL);
18378
7586
 
18379
 
 
18380
 
CREATE INDEX bugtask__product__heat__id__idx ON bugtask USING btree (product, heat DESC, id) WHERE (product IS NOT NULL);
18381
 
 
18382
 
 
18383
7587
CREATE UNIQUE INDEX bugtask__productseries__bug__key ON bugtask USING btree (productseries, bug) WHERE (productseries IS NOT NULL);
18384
7588
 
18385
 
 
18386
 
CREATE INDEX bugtask__productseries__heat__idx ON bugtask USING btree (productseries, heat) WHERE (productseries IS NOT NULL);
18387
 
 
18388
 
 
18389
7589
CREATE INDEX bugtask__sourcepackagename__idx ON bugtask USING btree (sourcepackagename) WHERE (sourcepackagename IS NOT NULL);
18390
7590
 
18391
 
 
18392
7591
CREATE INDEX bugtask__status__idx ON bugtask USING btree (status);
18393
7592
 
18394
 
 
18395
7593
CREATE UNIQUE INDEX bugtask_distinct_sourcepackage_assignment ON bugtask USING btree (bug, (COALESCE(sourcepackagename, (-1))), (COALESCE(distroseries, (-1))), (COALESCE(distribution, (-1)))) WHERE ((product IS NULL) AND (productseries IS NULL));
18396
7594
 
18397
 
 
18398
 
CREATE INDEX bugtask_fti ON bugtask USING gist (fti);
18399
 
 
18400
 
 
18401
 
CREATE INDEX bugtask_importance_idx ON bugtask USING btree (importance, id DESC);
18402
 
 
 
7595
CREATE INDEX bugtask_fti ON bugtask USING gist (fti ts2.gist_tsvector_ops);
18403
7596
 
18404
7597
CREATE UNIQUE INDEX bugtracker_name_key ON bugtracker USING btree (name);
18405
7598
 
18406
 
 
18407
7599
CREATE INDEX bugtracker_owner_idx ON bugtracker USING btree (owner);
18408
7600
 
18409
 
 
18410
7601
CREATE INDEX bugtrackeralias__bugtracker__idx ON bugtrackeralias USING btree (bugtracker);
18411
7602
 
18412
 
 
18413
7603
CREATE INDEX bugtrackerperson__person__idx ON bugtrackerperson USING btree (person);
18414
7604
 
18415
 
 
18416
7605
CREATE INDEX bugwatch__lastchecked__idx ON bugwatch USING btree (lastchecked);
18417
7606
 
18418
 
 
18419
7607
CREATE INDEX bugwatch__next_check__idx ON bugwatch USING btree (next_check);
18420
7608
 
18421
 
 
18422
7609
CREATE INDEX bugwatch__remote_lp_bug_id__idx ON bugwatch USING btree (remote_lp_bug_id) WHERE (remote_lp_bug_id IS NOT NULL);
18423
7610
 
18424
 
 
18425
7611
CREATE INDEX bugwatch__remotebug__idx ON bugwatch USING btree (remotebug);
18426
7612
 
18427
 
 
18428
7613
CREATE INDEX bugwatch_bug_idx ON bugwatch USING btree (bug);
18429
7614
 
18430
 
 
18431
7615
CREATE INDEX bugwatch_bugtracker_idx ON bugwatch USING btree (bugtracker);
18432
7616
 
18433
 
 
18434
7617
CREATE INDEX bugwatch_datecreated_idx ON bugwatch USING btree (datecreated);
18435
7618
 
18436
 
 
18437
7619
CREATE INDEX bugwatch_owner_idx ON bugwatch USING btree (owner);
18438
7620
 
18439
 
 
18440
7621
CREATE INDEX bugwatchactivity__bug_watch__idx ON bugwatchactivity USING btree (bug_watch);
18441
7622
 
18442
7623
ALTER TABLE bugwatchactivity CLUSTER ON bugwatchactivity__bug_watch__idx;
18443
7624
 
 
7625
CREATE INDEX bugwatchactivity__date__idx ON bugwatchactivity USING btree (activity_date);
18444
7626
 
18445
7627
CREATE INDEX builder__owner__idx ON builder USING btree (owner);
18446
7628
 
18447
 
 
18448
7629
CREATE INDEX buildfarmjob__builder_and_status__idx ON buildfarmjob USING btree (builder, status);
18449
7630
 
18450
 
 
18451
7631
CREATE INDEX buildfarmjob__date_created__idx ON buildfarmjob USING btree (date_created);
18452
7632
 
18453
 
 
18454
7633
CREATE INDEX buildfarmjob__date_finished__idx ON buildfarmjob USING btree (date_finished);
18455
7634
 
18456
 
 
18457
7635
CREATE INDEX buildfarmjob__date_started__idx ON buildfarmjob USING btree (date_started);
18458
7636
 
18459
 
 
18460
7637
CREATE INDEX buildfarmjob__log__idx ON buildfarmjob USING btree (log) WHERE (log IS NOT NULL);
18461
7638
 
18462
 
 
18463
7639
CREATE INDEX buildfarmjob__status__idx ON buildfarmjob USING btree (status);
18464
7640
 
18465
 
 
18466
7641
CREATE UNIQUE INDEX buildqueue__builder__id__idx ON buildqueue USING btree (builder, id);
18467
7642
 
18468
7643
ALTER TABLE buildqueue CLUSTER ON buildqueue__builder__id__idx;
18469
7644
 
18470
 
 
18471
7645
CREATE UNIQUE INDEX buildqueue__builder__unq ON buildqueue USING btree (builder) WHERE (builder IS NOT NULL);
18472
7646
 
18473
 
 
18474
7647
CREATE INDEX buildqueue__job_type__idx ON buildqueue USING btree (job_type);
18475
7648
 
18476
 
 
18477
7649
CREATE INDEX buildqueue__processor__virtualized__idx ON buildqueue USING btree (processor, virtualized) WHERE (processor IS NOT NULL);
18478
7650
 
18479
 
 
18480
7651
CREATE INDEX changeset_datecreated_idx ON revision USING btree (date_created);
18481
7652
 
18482
 
 
18483
7653
CREATE INDEX codeimport__assignee__idx ON codeimport USING btree (assignee);
18484
7654
 
18485
 
 
18486
7655
CREATE UNIQUE INDEX codeimport__cvs_root__cvs_module__key ON codeimport USING btree (cvs_root, cvs_module) WHERE (cvs_root IS NOT NULL);
18487
7656
 
18488
 
 
18489
7657
CREATE INDEX codeimport__owner__idx ON codeimport USING btree (owner);
18490
7658
 
18491
 
 
18492
7659
CREATE INDEX codeimport__registrant__idx ON codeimport USING btree (registrant);
18493
7660
 
18494
 
 
18495
7661
CREATE UNIQUE INDEX codeimport__url__idx ON codeimport USING btree (url) WHERE (url IS NOT NULL);
18496
7662
 
18497
 
 
18498
7663
CREATE INDEX codeimportevent__code_import__date_created__id__idx ON codeimportevent USING btree (code_import, date_created, id);
18499
7664
 
18500
 
 
18501
7665
CREATE INDEX codeimportevent__date_created__id__idx ON codeimportevent USING btree (date_created, id);
18502
7666
 
18503
 
 
18504
7667
CREATE INDEX codeimportevent__message__date_created__idx ON codeimportevent USING btree (machine, date_created) WHERE (machine IS NOT NULL);
18505
7668
 
18506
 
 
18507
7669
CREATE INDEX codeimportevent__person__idx ON codeimportevent USING btree (person) WHERE (person IS NOT NULL);
18508
7670
 
18509
 
 
18510
7671
CREATE INDEX codeimportjob__code_import__date_created__idx ON codeimportjob USING btree (code_import, date_created);
18511
7672
 
18512
 
 
18513
7673
CREATE INDEX codeimportjob__machine__date_created__idx ON codeimportjob USING btree (machine, date_created);
18514
7674
 
18515
 
 
18516
7675
CREATE INDEX codeimportjob__requesting_user__idx ON codeimportjob USING btree (requesting_user);
18517
7676
 
18518
 
 
18519
7677
CREATE INDEX codeimportresult__code_import__date_created__idx ON codeimportresult USING btree (code_import, date_created);
18520
7678
 
18521
 
 
18522
7679
CREATE INDEX codeimportresult__log_file__idx ON codeimportresult USING btree (log_file);
18523
7680
 
18524
 
 
18525
7681
CREATE INDEX codeimportresult__machine__date_created__idx ON codeimportresult USING btree (machine, date_created);
18526
7682
 
18527
 
 
18528
7683
CREATE INDEX codeimportresult__requesting_user__idx ON codeimportresult USING btree (requesting_user);
18529
7684
 
18530
 
 
18531
7685
CREATE INDEX codereviewvote__branch_merge_proposal__idx ON codereviewvote USING btree (branch_merge_proposal);
18532
7686
 
18533
 
 
18534
7687
CREATE INDEX codereviewvote__registrant__idx ON codereviewvote USING btree (registrant);
18535
7688
 
18536
 
 
18537
7689
CREATE INDEX codereviewvote__reviewer__idx ON codereviewvote USING btree (reviewer);
18538
7690
 
18539
 
 
18540
7691
CREATE INDEX codereviewvote__vote_message__idx ON codereviewvote USING btree (vote_message);
18541
7692
 
18542
 
 
18543
7693
CREATE INDEX commercialsubscription__product__idx ON commercialsubscription USING btree (product);
18544
7694
 
18545
 
 
18546
7695
CREATE INDEX commercialsubscription__purchaser__idx ON commercialsubscription USING btree (purchaser);
18547
7696
 
18548
 
 
18549
7697
CREATE INDEX commercialsubscription__registrant__idx ON commercialsubscription USING btree (registrant);
18550
7698
 
18551
 
 
18552
7699
CREATE INDEX commercialsubscription__sales_system_id__idx ON commercialsubscription USING btree (sales_system_id);
18553
7700
 
18554
 
 
18555
7701
CREATE UNIQUE INDEX customlanguagecode__distribution__sourcepackagename__code__key ON customlanguagecode USING btree (distribution, sourcepackagename, language_code) WHERE (distribution IS NOT NULL);
18556
7702
 
18557
 
 
18558
7703
CREATE UNIQUE INDEX customlanguagecode__product__code__key ON customlanguagecode USING btree (product, language_code) WHERE (product IS NOT NULL);
18559
7704
 
18560
 
 
18561
7705
CREATE INDEX cve_datecreated_idx ON cve USING btree (datecreated);
18562
7706
 
18563
 
 
18564
7707
CREATE INDEX cve_datemodified_idx ON cve USING btree (datemodified);
18565
7708
 
18566
 
 
18567
 
CREATE INDEX cve_fti ON cve USING gist (fti);
18568
 
 
 
7709
CREATE INDEX cve_fti ON cve USING gist (fti ts2.gist_tsvector_ops);
18569
7710
 
18570
7711
CREATE INDEX cvereference_cve_idx ON cvereference USING btree (cve);
18571
7712
 
18572
 
 
18573
7713
CREATE INDEX diff__diff_text__idx ON diff USING btree (diff_text);
18574
7714
 
18575
 
 
18576
7715
CREATE INDEX distribution__bug_supervisor__idx ON distribution USING btree (bug_supervisor) WHERE (bug_supervisor IS NOT NULL);
18577
7716
 
18578
 
 
18579
7717
CREATE INDEX distribution__driver__idx ON distribution USING btree (driver);
18580
7718
 
18581
 
 
18582
7719
CREATE INDEX distribution__icon__idx ON distribution USING btree (icon) WHERE (icon IS NOT NULL);
18583
7720
 
18584
 
 
18585
7721
CREATE INDEX distribution__language_pack_admin__idx ON distribution USING btree (language_pack_admin);
18586
7722
 
18587
 
 
18588
7723
CREATE INDEX distribution__logo__idx ON distribution USING btree (logo) WHERE (logo IS NOT NULL);
18589
7724
 
18590
 
 
18591
7725
CREATE INDEX distribution__members__idx ON distribution USING btree (members);
18592
7726
 
18593
 
 
18594
7727
CREATE INDEX distribution__mirror_admin__idx ON distribution USING btree (mirror_admin);
18595
7728
 
18596
 
 
18597
7729
CREATE INDEX distribution__mugshot__idx ON distribution USING btree (mugshot) WHERE (mugshot IS NOT NULL);
18598
7730
 
18599
 
 
18600
7731
CREATE INDEX distribution__owner__idx ON distribution USING btree (owner);
18601
7732
 
18602
 
 
18603
 
CREATE INDEX distribution__registrant__idx ON distribution USING btree (registrant);
18604
 
 
18605
 
 
18606
7733
CREATE INDEX distribution__security_contact__idx ON distribution USING btree (security_contact);
18607
7734
 
18608
 
 
18609
7735
CREATE INDEX distribution__upload_admin__idx ON distribution USING btree (upload_admin);
18610
7736
 
18611
 
 
18612
 
CREATE INDEX distribution_fti ON distribution USING gist (fti);
18613
 
 
18614
 
 
18615
 
CREATE UNIQUE INDEX distribution_job__initialize_series__distroseries ON distributionjob USING btree (distroseries) WHERE (job_type = 1);
18616
 
 
 
7737
CREATE INDEX distribution_fti ON distribution USING gist (fti ts2.gist_tsvector_ops);
18617
7738
 
18618
7739
CREATE INDEX distribution_translationgroup_idx ON distribution USING btree (translationgroup);
18619
7740
 
 
7741
CREATE INDEX distributionbounty_distribution_idx ON distributionbounty USING btree (distribution);
18620
7742
 
18621
7743
CREATE UNIQUE INDEX distributionmirror__archive__distribution__country__key ON distributionmirror USING btree (distribution, country, content) WHERE ((country_dns_mirror IS TRUE) AND (content = 1));
18622
7744
 
18623
 
 
18624
7745
CREATE INDEX distributionmirror__country__status__idx ON distributionmirror USING btree (country, status);
18625
7746
 
18626
 
 
18627
7747
CREATE INDEX distributionmirror__owner__idx ON distributionmirror USING btree (owner);
18628
7748
 
18629
 
 
18630
7749
CREATE UNIQUE INDEX distributionmirror__releases__distribution__country__key ON distributionmirror USING btree (distribution, country, content) WHERE ((country_dns_mirror IS TRUE) AND (content = 2));
18631
7750
 
18632
 
 
18633
7751
CREATE INDEX distributionmirror__reviewer__idx ON distributionmirror USING btree (reviewer);
18634
7752
 
18635
 
 
18636
7753
CREATE INDEX distributionmirror__status__idx ON distributionmirror USING btree (status);
18637
7754
 
18638
 
 
18639
7755
CREATE INDEX distributionsourcepackagecache__archive__idx ON distributionsourcepackagecache USING btree (archive);
18640
7756
 
18641
 
 
18642
 
CREATE INDEX distributionsourcepackagecache_fti ON distributionsourcepackagecache USING gist (fti);
18643
 
 
 
7757
CREATE INDEX distributionsourcepackagecache_fti ON distributionsourcepackagecache USING gist (fti ts2.gist_tsvector_ops);
18644
7758
 
18645
7759
CREATE INDEX distroarchseries__distroseries__idx ON distroarchseries USING btree (distroseries);
18646
7760
 
18647
 
 
18648
7761
CREATE INDEX distroarchseries__owner__idx ON distroarchseries USING btree (owner);
18649
7762
 
 
7763
CREATE INDEX distrocomponentuploader_uploader_idx ON distrocomponentuploader USING btree (uploader);
18650
7764
 
18651
7765
CREATE INDEX distroseries__driver__idx ON distroseries USING btree (driver) WHERE (driver IS NOT NULL);
18652
7766
 
18653
 
 
18654
 
CREATE INDEX distroseries__registrant__idx ON distroseries USING btree (registrant);
18655
 
 
18656
 
 
18657
 
CREATE INDEX distroseriesdifference__base_version__idx ON distroseriesdifference USING btree (base_version);
18658
 
 
18659
 
 
18660
 
CREATE INDEX distroseriesdifference__difference_type__idx ON distroseriesdifference USING btree (difference_type);
18661
 
 
18662
 
 
18663
 
CREATE INDEX distroseriesdifference__package_diff__idx ON distroseriesdifference USING btree (package_diff);
18664
 
 
18665
 
 
18666
 
CREATE INDEX distroseriesdifference__parent_package_diff__idx ON distroseriesdifference USING btree (parent_package_diff);
18667
 
 
18668
 
 
18669
 
CREATE INDEX distroseriesdifference__parent_series__idx ON distroseriesdifference USING btree (parent_series);
18670
 
 
18671
 
 
18672
 
CREATE INDEX distroseriesdifference__parent_source_version__idx ON distroseriesdifference USING btree (parent_source_version);
18673
 
 
18674
 
 
18675
 
CREATE INDEX distroseriesdifference__source_package_name__idx ON distroseriesdifference USING btree (source_package_name);
18676
 
 
18677
 
 
18678
 
CREATE INDEX distroseriesdifference__source_version__idx ON distroseriesdifference USING btree (source_version);
18679
 
 
18680
 
 
18681
 
CREATE INDEX distroseriesdifference__status__idx ON distroseriesdifference USING btree (status);
18682
 
 
18683
 
 
18684
 
CREATE INDEX distroseriesdifferencemessage__distroseriesdifference__idx ON distroseriesdifferencemessage USING btree (distro_series_difference);
18685
 
 
 
7767
CREATE INDEX distroseries__owner__idx ON distroseries USING btree (owner);
18686
7768
 
18687
7769
CREATE INDEX distroseriespackagecache__archive__idx ON distroseriespackagecache USING btree (archive);
18688
7770
 
18689
 
 
18690
7771
CREATE INDEX distroseriespackagecache__distroseries__idx ON distroseriespackagecache USING btree (distroseries);
18691
7772
 
18692
 
 
18693
 
CREATE INDEX distroseriespackagecache_fti ON distroseriespackagecache USING gist (fti);
18694
 
 
18695
 
 
18696
 
CREATE INDEX distroseriesparent__derived_series__ordering__idx ON distroseriesparent USING btree (derived_series, ordering);
18697
 
 
18698
 
 
18699
 
CREATE INDEX distroseriesparent__parentseries__idx ON distroseriesparent USING btree (parent_series);
18700
 
 
 
7773
CREATE INDEX distroseriespackagecache_fti ON distroseriespackagecache USING gist (fti ts2.gist_tsvector_ops);
18701
7774
 
18702
7775
CREATE UNIQUE INDEX emailaddress__account__key ON emailaddress USING btree (account) WHERE ((status = 4) AND (account IS NOT NULL));
18703
7776
 
18704
 
 
18705
 
COMMENT ON INDEX emailaddress__account__key IS 'Ensures that an Account only has one preferred email address';
18706
 
 
18707
 
 
18708
7777
CREATE INDEX emailaddress__account__status__idx ON emailaddress USING btree (account, status);
18709
7778
 
18710
 
 
18711
7779
CREATE UNIQUE INDEX emailaddress__lower_email__key ON emailaddress USING btree (lower(email));
18712
7780
 
18713
 
 
18714
7781
CREATE UNIQUE INDEX emailaddress__person__key ON emailaddress USING btree (person) WHERE ((status = 4) AND (person IS NOT NULL));
18715
7782
 
18716
 
 
18717
 
COMMENT ON INDEX emailaddress__person__key IS 'Ensures that a Person only has one preferred email address';
18718
 
 
18719
 
 
18720
7783
CREATE INDEX emailaddress__person__status__idx ON emailaddress USING btree (person, status);
18721
7784
 
18722
 
 
18723
7785
CREATE INDEX entitlement__approved_by__idx ON entitlement USING btree (approved_by) WHERE (approved_by IS NOT NULL);
18724
7786
 
18725
 
 
18726
7787
CREATE INDEX entitlement__distribution__idx ON entitlement USING btree (distribution) WHERE (distribution IS NOT NULL);
18727
7788
 
18728
 
 
18729
7789
CREATE INDEX entitlement__person__idx ON entitlement USING btree (person);
18730
7790
 
18731
 
 
18732
7791
CREATE INDEX entitlement__product__idx ON entitlement USING btree (product) WHERE (product IS NOT NULL);
18733
7792
 
18734
 
 
18735
7793
CREATE INDEX entitlement__project__idx ON entitlement USING btree (project) WHERE (project IS NOT NULL);
18736
7794
 
18737
 
 
18738
7795
CREATE INDEX entitlement__registrant__idx ON entitlement USING btree (registrant) WHERE (registrant IS NOT NULL);
18739
7796
 
18740
 
 
18741
7797
CREATE INDEX entitlement_lookup_idx ON entitlement USING btree (entitlement_type, date_starts, date_expires, person, state);
18742
7798
 
18743
 
 
18744
7799
CREATE INDEX faq__distribution__idx ON faq USING btree (distribution) WHERE (distribution IS NOT NULL);
18745
7800
 
18746
 
 
18747
7801
CREATE INDEX faq__last_updated_by__idx ON faq USING btree (last_updated_by);
18748
7802
 
18749
 
 
18750
7803
CREATE INDEX faq__owner__idx ON faq USING btree (owner);
18751
7804
 
18752
 
 
18753
7805
CREATE INDEX faq__product__idx ON faq USING btree (product) WHERE (product IS NOT NULL);
18754
7806
 
18755
 
 
18756
 
CREATE INDEX faq_fti ON faq USING gist (fti);
18757
 
 
 
7807
CREATE INDEX faq_fti ON faq USING gist (fti ts2.gist_tsvector_ops);
18758
7808
 
18759
7809
CREATE INDEX featuredproject__pillar_name__idx ON featuredproject USING btree (pillar_name);
18760
7810
 
18761
 
 
18762
 
CREATE INDEX featureflagchangelogentry__person__idx ON featureflagchangelogentry USING btree (person);
18763
 
 
18764
 
 
18765
7811
CREATE INDEX flatpackagesetinclusion__child__idx ON flatpackagesetinclusion USING btree (child);
18766
7812
 
18767
 
 
18768
7813
CREATE INDEX hwdevice__bus_product_id__idx ON hwdevice USING btree (bus_product_id);
18769
7814
 
18770
 
 
18771
7815
CREATE UNIQUE INDEX hwdevice__bus_vendor_id__bus_product_id__key ON hwdevice USING btree (bus_vendor_id, bus_product_id) WHERE (variant IS NULL);
18772
7816
 
18773
 
 
18774
7817
CREATE INDEX hwdevice__name__idx ON hwdevice USING btree (name);
18775
7818
 
18776
 
 
18777
7819
CREATE UNIQUE INDEX hwdeviceclass__device__main_class__key ON hwdeviceclass USING btree (device, main_class) WHERE (sub_class IS NULL);
18778
7820
 
18779
 
 
18780
7821
CREATE UNIQUE INDEX hwdeviceclass__device__main_class__sub_class__key ON hwdeviceclass USING btree (device, main_class, sub_class) WHERE (sub_class IS NOT NULL);
18781
7822
 
18782
 
 
18783
7823
CREATE INDEX hwdeviceclass__main_class__idx ON hwdeviceclass USING btree (main_class);
18784
7824
 
18785
 
 
18786
7825
CREATE INDEX hwdeviceclass__sub_class__idx ON hwdeviceclass USING btree (sub_class);
18787
7826
 
18788
 
 
18789
7827
CREATE UNIQUE INDEX hwdevicedriverlink__device__driver__key ON hwdevicedriverlink USING btree (device, driver) WHERE (driver IS NOT NULL);
18790
7828
 
18791
 
 
18792
7829
CREATE INDEX hwdevicedriverlink__device__idx ON hwdevicedriverlink USING btree (device);
18793
7830
 
18794
 
 
18795
7831
CREATE UNIQUE INDEX hwdevicedriverlink__device__key ON hwdevicedriverlink USING btree (device) WHERE (driver IS NULL);
18796
7832
 
18797
 
 
18798
7833
CREATE INDEX hwdevicedriverlink__driver__idx ON hwdevicedriverlink USING btree (driver);
18799
7834
 
18800
 
 
18801
7835
CREATE INDEX hwdevicenamevariant__device__idx ON hwdevicenamevariant USING btree (device);
18802
7836
 
18803
 
 
18804
7837
CREATE INDEX hwdevicenamevariant__product_name__idx ON hwdevicenamevariant USING btree (product_name);
18805
7838
 
18806
 
 
18807
7839
CREATE INDEX hwdmihandle__submission__idx ON hwdmihandle USING btree (submission);
18808
7840
 
18809
 
 
18810
7841
CREATE INDEX hwdmivalue__hanlde__idx ON hwdmivalue USING btree (handle);
18811
7842
 
18812
 
 
18813
7843
CREATE INDEX hwdriver__name__idx ON hwdriver USING btree (name);
18814
7844
 
18815
 
 
18816
7845
CREATE UNIQUE INDEX hwdriver__name__key ON hwdriver USING btree (name) WHERE (package_name IS NULL);
18817
7846
 
18818
 
 
18819
 
CREATE INDEX hwsubmission__date_created__idx ON hwsubmission USING btree (date_created);
18820
 
 
18821
 
 
18822
 
CREATE INDEX hwsubmission__date_submitted__idx ON hwsubmission USING btree (date_submitted);
18823
 
 
18824
 
 
18825
7847
CREATE INDEX hwsubmission__lower_raw_emailaddress__idx ON hwsubmission USING btree (lower(raw_emailaddress));
18826
7848
 
18827
 
 
18828
7849
CREATE INDEX hwsubmission__owner__idx ON hwsubmission USING btree (owner);
18829
7850
 
18830
 
 
18831
7851
CREATE INDEX hwsubmission__raw_emailaddress__idx ON hwsubmission USING btree (raw_emailaddress);
18832
7852
 
18833
 
 
18834
7853
CREATE INDEX hwsubmission__raw_submission__idx ON hwsubmission USING btree (raw_submission);
18835
7854
 
18836
 
 
18837
7855
CREATE INDEX hwsubmission__status__idx ON hwsubmission USING btree (status);
18838
7856
 
18839
 
 
18840
7857
CREATE INDEX hwsubmission__system_fingerprint__idx ON hwsubmission USING btree (system_fingerprint);
18841
7858
 
18842
 
 
18843
7859
CREATE INDEX hwsubmissionbug__bug ON hwsubmissionbug USING btree (bug);
18844
7860
 
18845
 
 
18846
7861
CREATE INDEX hwsubmissiondevice__device_driver_link__idx ON hwsubmissiondevice USING btree (device_driver_link);
18847
7862
 
18848
 
 
18849
 
CREATE INDEX hwsubmissiondevice__parent__idx ON hwsubmissiondevice USING btree (parent);
18850
 
 
18851
 
 
18852
7863
CREATE INDEX hwsubmissiondevice__submission__idx ON hwsubmissiondevice USING btree (submission);
18853
7864
 
18854
 
 
18855
7865
CREATE UNIQUE INDEX hwtest__name__version__key ON hwtest USING btree (name, version) WHERE (namespace IS NULL);
18856
7866
 
18857
 
 
18858
7867
CREATE UNIQUE INDEX hwtest__namespace__name__version__key ON hwtest USING btree (namespace, name, version) WHERE (namespace IS NOT NULL);
18859
7868
 
18860
 
 
18861
7869
CREATE INDEX hwtestanswer__choice__idx ON hwtestanswer USING btree (choice);
18862
7870
 
18863
 
 
18864
7871
CREATE INDEX hwtestanswer__submission__idx ON hwtestanswer USING btree (submission);
18865
7872
 
18866
 
 
18867
7873
CREATE INDEX hwtestanswer__test__idx ON hwtestanswer USING btree (test);
18868
7874
 
18869
 
 
18870
7875
CREATE INDEX hwtestanswerchoice__test__idx ON hwtestanswerchoice USING btree (test);
18871
7876
 
18872
 
 
18873
7877
CREATE INDEX hwtestanswercount__choice__idx ON hwtestanswercount USING btree (choice);
18874
7878
 
18875
 
 
18876
7879
CREATE INDEX hwtestanswercount__distroarchrelease__idx ON hwtestanswercount USING btree (distroarchseries) WHERE (distroarchseries IS NOT NULL);
18877
7880
 
18878
 
 
18879
7881
CREATE INDEX hwtestanswercount__test__idx ON hwtestanswercount USING btree (test);
18880
7882
 
18881
 
 
18882
7883
CREATE INDEX hwtestanswercountdevice__device_driver__idx ON hwtestanswercountdevice USING btree (device_driver);
18883
7884
 
18884
 
 
18885
7885
CREATE INDEX hwtestanswerdevice__device_driver__idx ON hwtestanswerdevice USING btree (device_driver);
18886
7886
 
18887
 
 
18888
7887
CREATE INDEX hwvendorid__vendor_id_for_bus__idx ON hwvendorid USING btree (vendor_id_for_bus);
18889
7888
 
18890
 
 
18891
7889
CREATE INDEX hwvendorid__vendorname__idx ON hwvendorid USING btree (vendor_name);
18892
7890
 
18893
 
 
18894
7891
CREATE UNIQUE INDEX hwvendorname__lc_vendor_name__idx ON hwvendorname USING btree (ulower(name));
18895
7892
 
18896
 
 
18897
 
CREATE INDEX incrementaldiff__branch_merge_proposal__idx ON incrementaldiff USING btree (branch_merge_proposal);
18898
 
 
18899
 
 
18900
 
CREATE INDEX incrementaldiff__diff__idx ON incrementaldiff USING btree (diff);
18901
 
 
18902
 
 
18903
 
CREATE INDEX incrementaldiff__new_revision__idx ON incrementaldiff USING btree (new_revision);
18904
 
 
18905
 
 
18906
 
CREATE INDEX incrementaldiff__old_revision__idx ON incrementaldiff USING btree (old_revision);
18907
 
 
 
7893
CREATE INDEX hwvendorname__name__idx ON hwdriver USING btree (name);
18908
7894
 
18909
7895
CREATE INDEX ircid_person_idx ON ircid USING btree (person);
18910
7896
 
18911
 
 
18912
7897
CREATE INDEX jabberid_person_idx ON jabberid USING btree (person);
18913
7898
 
18914
 
 
18915
7899
CREATE INDEX job__date_finished__idx ON job USING btree (date_finished) WHERE (date_finished IS NOT NULL);
18916
7900
 
18917
 
 
18918
7901
CREATE INDEX job__lease_expires__idx ON job USING btree (lease_expires);
18919
7902
 
18920
 
 
18921
7903
CREATE INDEX job__requester__key ON job USING btree (requester) WHERE (requester IS NOT NULL);
18922
7904
 
18923
 
 
18924
7905
CREATE INDEX job__scheduled_start__idx ON job USING btree (scheduled_start);
18925
7906
 
18926
 
 
18927
7907
CREATE INDEX karma_person_datecreated_idx ON karma USING btree (person, datecreated);
18928
7908
 
18929
7909
ALTER TABLE karma CLUSTER ON karma_person_datecreated_idx;
18930
7910
 
18931
 
 
18932
7911
CREATE INDEX karmacache__category__karmavalue__idx ON karmacache USING btree (category, karmavalue) WHERE ((((category IS NOT NULL) AND (product IS NULL)) AND (project IS NULL)) AND (distribution IS NULL));
18933
7912
 
18934
 
 
18935
7913
CREATE INDEX karmacache__distribution__category__karmavalue__idx ON karmacache USING btree (distribution, category, karmavalue) WHERE (((category IS NOT NULL) AND (distribution IS NOT NULL)) AND (sourcepackagename IS NULL));
18936
7914
 
18937
 
 
18938
7915
CREATE INDEX karmacache__distribution__karmavalue__idx ON karmacache USING btree (distribution, karmavalue) WHERE (((category IS NULL) AND (distribution IS NOT NULL)) AND (sourcepackagename IS NULL));
18939
7916
 
18940
 
 
18941
7917
CREATE INDEX karmacache__karmavalue__idx ON karmacache USING btree (karmavalue) WHERE ((((category IS NULL) AND (product IS NULL)) AND (project IS NULL)) AND (distribution IS NULL));
18942
7918
 
18943
 
 
18944
7919
CREATE INDEX karmacache__person__category__idx ON karmacache USING btree (person, category);
18945
7920
 
18946
 
 
18947
7921
CREATE INDEX karmacache__product__category__karmavalue__idx ON karmacache USING btree (product, category, karmavalue) WHERE ((category IS NOT NULL) AND (product IS NOT NULL));
18948
7922
 
18949
 
 
18950
7923
CREATE INDEX karmacache__product__karmavalue__idx ON karmacache USING btree (product, karmavalue) WHERE ((category IS NULL) AND (product IS NOT NULL));
18951
7924
 
18952
 
 
18953
7925
CREATE INDEX karmacache__project__category__karmavalue__idx ON karmacache USING btree (project, category, karmavalue) WHERE (project IS NOT NULL);
18954
7926
 
18955
 
 
18956
7927
CREATE INDEX karmacache__project__karmavalue__idx ON karmacache USING btree (project, karmavalue) WHERE ((category IS NULL) AND (project IS NOT NULL));
18957
7928
 
18958
 
 
18959
7929
CREATE INDEX karmacache__sourcepackagename__category__karmavalue__idx ON karmacache USING btree (sourcepackagename, distribution, category, karmavalue) WHERE ((category IS NOT NULL) AND (sourcepackagename IS NOT NULL));
18960
7930
 
18961
 
 
18962
7931
CREATE INDEX karmacache__sourcepackagename__distribution__karmavalue__idx ON karmacache USING btree (sourcepackagename, distribution, karmavalue) WHERE (sourcepackagename IS NOT NULL);
18963
7932
 
18964
 
 
18965
7933
CREATE INDEX karmacache__sourcepackagename__karmavalue__idx ON karmacache USING btree (sourcepackagename, distribution, karmavalue) WHERE ((category IS NULL) AND (sourcepackagename IS NOT NULL));
18966
7934
 
18967
 
 
18968
7935
CREATE UNIQUE INDEX karmacache__unq ON karmacache USING btree (person, (COALESCE(product, (-1))), (COALESCE(sourcepackagename, (-1))), (COALESCE(project, (-1))), (COALESCE(category, (-1))), (COALESCE(distribution, (-1))));
18969
7936
 
18970
 
 
18971
7937
CREATE INDEX karmacache_person_idx ON karmacache USING btree (person);
18972
7938
 
18973
 
 
18974
7939
CREATE INDEX karmacache_top_in_category_idx ON karmacache USING btree (person, category, karmavalue) WHERE ((((product IS NULL) AND (project IS NULL)) AND (sourcepackagename IS NULL)) AND (distribution IS NULL));
18975
7940
 
18976
 
 
18977
7941
CREATE UNIQUE INDEX karmatotalcache_karma_total_person_idx ON karmatotalcache USING btree (karma_total, person);
18978
7942
 
18979
 
 
18980
7943
CREATE INDEX languagepack__file__idx ON languagepack USING btree (file);
18981
7944
 
18982
 
 
18983
7945
CREATE INDEX libraryfilealias__expires__idx ON libraryfilealias USING btree (expires);
18984
7946
 
18985
 
 
18986
 
CREATE INDEX libraryfilealias__expires_content_not_null_idx ON libraryfilealias USING btree (expires) WHERE (content IS NOT NULL);
18987
 
 
18988
 
 
18989
7947
CREATE INDEX libraryfilealias__filename__idx ON libraryfilealias USING btree (filename);
18990
7948
 
18991
 
 
18992
7949
CREATE INDEX libraryfilealias_content_idx ON libraryfilealias USING btree (content);
18993
7950
 
18994
 
 
18995
7951
CREATE INDEX libraryfilecontent__md5__idx ON libraryfilecontent USING btree (md5);
18996
7952
 
18997
 
 
18998
7953
CREATE INDEX libraryfilecontent__sha256__idx ON libraryfilecontent USING btree (sha256);
18999
7954
 
19000
 
 
19001
7955
CREATE INDEX libraryfilecontent_sha1_filesize_idx ON libraryfilecontent USING btree (sha1, filesize);
19002
7956
 
19003
 
 
19004
7957
CREATE INDEX logintoken_requester_idx ON logintoken USING btree (requester);
19005
7958
 
19006
 
 
19007
 
CREATE INDEX lp_openididentifier__account__idx ON lp_openididentifier USING btree (account);
19008
 
 
19009
 
 
19010
7959
CREATE INDEX lp_teamparticipation__person__idx ON lp_teamparticipation USING btree (person);
19011
7960
 
19012
 
 
19013
7961
CREATE INDEX mailinglist__date_registered__idx ON mailinglist USING btree (status, date_registered);
19014
7962
 
19015
 
 
19016
7963
CREATE INDEX mailinglist__registrant__idx ON mailinglist USING btree (registrant);
19017
7964
 
19018
 
 
19019
7965
CREATE INDEX mailinglist__reviewer__idx ON mailinglist USING btree (reviewer);
19020
7966
 
19021
 
 
19022
7967
CREATE UNIQUE INDEX mailinglist__team__status__key ON mailinglist USING btree (team, status);
19023
7968
 
 
7969
CREATE INDEX mailinglistban__banned_by__idx ON mailinglistban USING btree (banned_by);
 
7970
 
 
7971
CREATE INDEX mailinglistban__person__idx ON mailinglistban USING btree (person);
19024
7972
 
19025
7973
CREATE INDEX mailinglistsubscription__email_address__idx ON mailinglistsubscription USING btree (email_address) WHERE (email_address IS NOT NULL);
19026
7974
 
19027
 
 
19028
7975
CREATE INDEX mailinglistsubscription__mailing_list__idx ON mailinglistsubscription USING btree (mailing_list);
19029
7976
 
19030
 
 
19031
7977
CREATE UNIQUE INDEX mailinglistsubscription__person__mailing_list__key ON mailinglistsubscription USING btree (person, mailing_list);
19032
7978
 
 
7979
CREATE INDEX mentoringoffer__owner__idx ON mentoringoffer USING btree (owner);
 
7980
 
 
7981
CREATE INDEX mentoringoffer__team__idx ON mentoringoffer USING btree (team);
19033
7982
 
19034
7983
CREATE INDEX mergedirectivejob__merge_directive__idx ON mergedirectivejob USING btree (merge_directive);
19035
7984
 
19036
 
 
19037
 
CREATE INDEX message__datecreated__idx ON message USING btree (datecreated);
19038
 
 
19039
 
 
19040
 
CREATE INDEX message_fti ON message USING gist (fti);
19041
 
 
 
7985
CREATE INDEX message_fti ON message USING gist (fti ts2.gist_tsvector_ops);
19042
7986
 
19043
7987
CREATE INDEX message_owner_idx ON message USING btree (owner);
19044
7988
 
19045
 
 
19046
7989
CREATE INDEX message_parent_idx ON message USING btree (parent);
19047
7990
 
19048
 
 
19049
7991
CREATE INDEX message_raw_idx ON message USING btree (raw) WHERE (raw IS NOT NULL);
19050
7992
 
19051
 
 
19052
7993
CREATE INDEX message_rfc822msgid_idx ON message USING btree (rfc822msgid);
19053
7994
 
19054
 
 
19055
7995
CREATE INDEX messageapproval__disposed_by__idx ON messageapproval USING btree (disposed_by) WHERE (disposed_by IS NOT NULL);
19056
7996
 
19057
 
 
19058
7997
CREATE INDEX messageapproval__mailing_list__status__posted_date__idx ON messageapproval USING btree (mailing_list, status, posted_date);
19059
7998
 
19060
 
 
19061
7999
CREATE INDEX messageapproval__message__idx ON messageapproval USING btree (message);
19062
8000
 
19063
 
 
19064
8001
CREATE INDEX messageapproval__posted_by__idx ON messageapproval USING btree (posted_by);
19065
8002
 
19066
 
 
19067
8003
CREATE INDEX messageapproval__posted_message__idx ON messageapproval USING btree (posted_message);
19068
8004
 
19069
 
 
19070
8005
CREATE INDEX messagechunk_blob_idx ON messagechunk USING btree (blob) WHERE (blob IS NOT NULL);
19071
8006
 
19072
 
 
19073
 
CREATE INDEX messagechunk_fti ON messagechunk USING gist (fti);
19074
 
 
19075
 
 
19076
 
CREATE INDEX milestone_dateexpected_name_sort ON milestone USING btree (milestone_sort_key(dateexpected, name));
19077
 
 
 
8007
CREATE INDEX messagechunk_fti ON messagechunk USING gist (fti ts2.gist_tsvector_ops);
19078
8008
 
19079
8009
CREATE INDEX mirror__owner__idx ON mirror USING btree (owner);
19080
8010
 
19081
 
 
19082
8011
CREATE UNIQUE INDEX mirrordistroarchseries_uniq ON mirrordistroarchseries USING btree (distribution_mirror, distroarchseries, component, pocket);
19083
8012
 
19084
 
 
19085
8013
CREATE UNIQUE INDEX mirrordistroseriessource_uniq ON mirrordistroseriessource USING btree (distribution_mirror, distroseries, component, pocket);
19086
8014
 
19087
 
 
19088
8015
CREATE INDEX mirrorproberecord__date_created__idx ON mirrorproberecord USING btree (date_created);
19089
8016
 
19090
 
 
19091
8017
CREATE INDEX mirrorproberecord__distribution_mirror__date_created__idx ON mirrorproberecord USING btree (distribution_mirror, date_created);
19092
8018
 
19093
 
 
19094
8019
CREATE INDEX mirrorproberecord__log_file__idx ON mirrorproberecord USING btree (log_file) WHERE (log_file IS NOT NULL);
19095
8020
 
19096
 
 
19097
8021
CREATE INDEX oauthaccesstoken__consumer__idx ON oauthaccesstoken USING btree (consumer);
19098
8022
 
19099
 
 
19100
8023
CREATE INDEX oauthaccesstoken__date_expires__idx ON oauthaccesstoken USING btree (date_expires) WHERE (date_expires IS NOT NULL);
19101
8024
 
19102
 
 
19103
8025
CREATE INDEX oauthaccesstoken__distribution__sourcepackagename__idx ON oauthaccesstoken USING btree (distribution, sourcepackagename) WHERE (distribution IS NOT NULL);
19104
8026
 
19105
 
 
19106
8027
CREATE INDEX oauthaccesstoken__person__idx ON oauthaccesstoken USING btree (person);
19107
8028
 
19108
 
 
19109
8029
CREATE INDEX oauthaccesstoken__product__idx ON oauthaccesstoken USING btree (product) WHERE (product IS NOT NULL);
19110
8030
 
19111
 
 
19112
8031
CREATE INDEX oauthaccesstoken__project__idx ON oauthaccesstoken USING btree (project) WHERE (project IS NOT NULL);
19113
8032
 
19114
 
 
19115
8033
CREATE INDEX oauthnonce__access_token__idx ON oauthnonce USING btree (access_token);
19116
8034
 
19117
 
 
19118
8035
CREATE INDEX oauthnonce__request_timestamp__idx ON oauthnonce USING btree (request_timestamp);
19119
8036
 
19120
 
 
19121
8037
CREATE INDEX oauthrequesttoken__consumer__idx ON oauthrequesttoken USING btree (consumer);
19122
8038
 
19123
 
 
19124
8039
CREATE INDEX oauthrequesttoken__date_created__idx ON oauthrequesttoken USING btree (date_created);
19125
8040
 
19126
 
 
19127
8041
CREATE INDEX oauthrequesttoken__distribution__sourcepackagename__idx ON oauthrequesttoken USING btree (distribution, sourcepackagename) WHERE (distribution IS NOT NULL);
19128
8042
 
19129
 
 
19130
8043
CREATE INDEX oauthrequesttoken__person__idx ON oauthrequesttoken USING btree (person) WHERE (person IS NOT NULL);
19131
8044
 
19132
 
 
19133
8045
CREATE INDEX oauthrequesttoken__product__idx ON oauthrequesttoken USING btree (product) WHERE (product IS NOT NULL);
19134
8046
 
19135
 
 
19136
8047
CREATE INDEX oauthrequesttoken__project__idx ON oauthrequesttoken USING btree (project) WHERE (project IS NOT NULL);
19137
8048
 
19138
 
 
19139
8049
CREATE UNIQUE INDEX officialbugtag__distribution__tag__key ON officialbugtag USING btree (distribution, tag) WHERE (distribution IS NOT NULL);
19140
8050
 
19141
 
 
19142
8051
CREATE UNIQUE INDEX officialbugtag__product__tag__key ON officialbugtag USING btree (product, tag) WHERE (product IS NOT NULL);
19143
8052
 
19144
 
 
19145
8053
CREATE UNIQUE INDEX officialbugtag__project__tag__key ON officialbugtag USING btree (project, tag) WHERE (product IS NOT NULL);
19146
8054
 
19147
 
 
19148
 
CREATE INDEX openididentifier__account__idx ON openididentifier USING btree (account);
19149
 
 
 
8055
CREATE INDEX openidrpconfig__logo__idx ON openidrpconfig USING btree (logo);
 
8056
 
 
8057
CREATE UNIQUE INDEX openidrpconfig__trust_root__key ON openidrpconfig USING btree (trust_root);
 
8058
 
 
8059
CREATE INDEX openidrpsummary__openid_identifier__idx ON openidrpsummary USING btree (openid_identifier);
 
8060
 
 
8061
CREATE INDEX openidrpsummary__trust_root__idx ON openidrpsummary USING btree (trust_root);
 
8062
 
 
8063
CREATE INDEX packagebugsupervisor__bug_supervisor__idx ON packagebugsupervisor USING btree (bug_supervisor);
19150
8064
 
19151
8065
CREATE INDEX packagebuild__archive__idx ON packagebuild USING btree (archive);
19152
8066
 
19153
 
 
19154
8067
CREATE UNIQUE INDEX packagebuild__build_farm_job__idx ON packagebuild USING btree (build_farm_job);
19155
8068
 
19156
 
 
19157
8069
CREATE INDEX packagebuild__upload_log__idx ON packagebuild USING btree (upload_log) WHERE (upload_log IS NOT NULL);
19158
8070
 
19159
 
 
19160
 
CREATE UNIQUE INDEX packagecopyjob__job_type__target_ds__id__key ON packagecopyjob USING btree (job_type, target_distroseries, id);
19161
 
 
19162
 
 
19163
 
CREATE INDEX packagecopyjob__source ON packagecopyjob USING btree (source_archive);
19164
 
 
19165
 
 
19166
 
CREATE INDEX packagecopyjob__target ON packagecopyjob USING btree (target_archive, target_distroseries);
19167
 
 
19168
 
 
19169
8071
CREATE INDEX packagecopyrequest__datecreated__idx ON packagecopyrequest USING btree (date_created);
19170
8072
 
19171
 
 
19172
8073
CREATE INDEX packagecopyrequest__requester__idx ON packagecopyrequest USING btree (requester);
19173
8074
 
19174
 
 
19175
8075
CREATE INDEX packagecopyrequest__targetarchive__idx ON packagecopyrequest USING btree (target_archive);
19176
8076
 
19177
 
 
19178
8077
CREATE INDEX packagecopyrequest__targetdistroseries__idx ON packagecopyrequest USING btree (target_distroseries) WHERE (target_distroseries IS NOT NULL);
19179
8078
 
19180
 
 
19181
8079
CREATE INDEX packagediff__diff_content__idx ON packagediff USING btree (diff_content);
19182
8080
 
19183
 
 
19184
8081
CREATE INDEX packagediff__from_source__idx ON packagediff USING btree (from_source);
19185
8082
 
19186
 
 
19187
8083
CREATE INDEX packagediff__requester__idx ON packagediff USING btree (requester);
19188
8084
 
19189
 
 
19190
8085
CREATE INDEX packagediff__status__idx ON packagediff USING btree (status);
19191
8086
 
19192
 
 
19193
8087
CREATE INDEX packagediff__to_source__idx ON packagediff USING btree (to_source);
19194
8088
 
19195
 
 
19196
8089
CREATE INDEX packageset__distroseries__idx ON packageset USING btree (distroseries);
19197
8090
 
19198
 
 
19199
8091
CREATE INDEX packageset__owner__idx ON packageset USING btree (owner);
19200
8092
 
19201
 
 
19202
8093
CREATE INDEX packageset__packagesetgroup__idx ON packageset USING btree (packagesetgroup);
19203
8094
 
19204
 
 
19205
8095
CREATE INDEX packagesetgroup__owner__idx ON packagesetgroup USING btree (owner);
19206
8096
 
19207
 
 
19208
8097
CREATE INDEX packagesetinclusion__child__idx ON packagesetinclusion USING btree (child);
19209
8098
 
19210
 
 
19211
8099
CREATE INDEX packagesetsources__sourcepackagename__idx ON packagesetsources USING btree (sourcepackagename);
19212
8100
 
19213
 
 
19214
 
CREATE INDEX packageupload__archive__distroseries__status__idx ON packageupload USING btree (archive, distroseries, status);
19215
 
 
19216
 
 
19217
8101
CREATE INDEX packageupload__changesfile__idx ON packageupload USING btree (changesfile);
19218
8102
 
19219
 
 
19220
8103
CREATE INDEX packageupload__distroseries__key ON packageupload USING btree (distroseries);
19221
8104
 
19222
 
 
19223
8105
CREATE INDEX packageupload__distroseries__status__idx ON packageupload USING btree (distroseries, status);
19224
8106
 
19225
 
 
19226
 
CREATE INDEX packageupload__package_copy_job__idx ON packageupload USING btree (package_copy_job) WHERE (package_copy_job IS NOT NULL);
19227
 
 
19228
 
 
19229
8107
CREATE INDEX packageupload__signing_key__idx ON packageupload USING btree (signing_key);
19230
8108
 
19231
 
 
19232
8109
CREATE INDEX packageuploadbuild__build__idx ON packageuploadbuild USING btree (build);
19233
8110
 
19234
 
 
19235
8111
CREATE INDEX packageuploadcustom__libraryfilealias__idx ON packageuploadcustom USING btree (libraryfilealias);
19236
8112
 
19237
 
 
19238
8113
CREATE INDEX packageuploadcustom__packageupload__idx ON packageuploadcustom USING btree (packageupload);
19239
8114
 
19240
 
 
19241
8115
CREATE INDEX packageuploadsource__sourcepackagerelease__idx ON packageuploadsource USING btree (sourcepackagerelease);
19242
8116
 
 
8117
CREATE INDEX packaging__distroseries__sourcepackagename__idx ON packaging USING btree (distroseries, sourcepackagename);
19243
8118
 
19244
8119
CREATE INDEX packaging__owner__idx ON packaging USING btree (owner);
19245
8120
 
19246
 
 
19247
8121
CREATE INDEX packaging_sourcepackagename_idx ON packaging USING btree (sourcepackagename);
19248
8122
 
19249
 
 
19250
 
CREATE INDEX packagingjob__job__idx ON packagingjob USING btree (job);
19251
 
 
19252
 
 
19253
 
CREATE INDEX packagingjob__potemplate__idx ON packagingjob USING btree (potemplate);
19254
 
 
19255
 
 
19256
8123
CREATE INDEX parsedapachelog__first_line__idx ON parsedapachelog USING btree (first_line);
19257
8124
 
19258
 
 
19259
 
CREATE INDEX person__displayname__idx ON person USING btree (lower(displayname));
19260
 
 
19261
 
 
19262
8125
CREATE INDEX person__icon__idx ON person USING btree (icon) WHERE (icon IS NOT NULL);
19263
8126
 
19264
 
 
19265
8127
CREATE INDEX person__logo__idx ON person USING btree (logo) WHERE (logo IS NOT NULL);
19266
8128
 
19267
 
 
19268
8129
CREATE INDEX person__merged__idx ON person USING btree (merged) WHERE (merged IS NOT NULL);
19269
8130
 
19270
 
 
19271
8131
CREATE INDEX person__mugshot__idx ON person USING btree (mugshot) WHERE (mugshot IS NOT NULL);
19272
8132
 
19273
 
 
19274
8133
CREATE INDEX person__registrant__idx ON person USING btree (registrant);
19275
8134
 
19276
 
 
19277
8135
CREATE INDEX person__teamowner__idx ON person USING btree (teamowner) WHERE (teamowner IS NOT NULL);
19278
8136
 
19279
 
 
19280
8137
CREATE INDEX person_datecreated_idx ON person USING btree (datecreated);
19281
8138
 
19282
 
 
19283
 
CREATE INDEX person_fti ON person USING gist (fti);
19284
 
 
 
8139
CREATE INDEX person_fti ON person USING gist (fti ts2.gist_tsvector_ops);
19285
8140
 
19286
8141
CREATE INDEX person_sorting_idx ON person USING btree (person_sort_key(displayname, name));
19287
8142
 
19288
 
 
19289
8143
CREATE INDEX personlocation__last_modified_by__idx ON personlocation USING btree (last_modified_by);
19290
8144
 
19291
 
 
19292
8145
CREATE INDEX personnotification__date_emailed__idx ON personnotification USING btree (date_emailed);
19293
8146
 
19294
 
 
19295
8147
CREATE INDEX personnotification__person__idx ON personnotification USING btree (person);
19296
8148
 
19297
 
 
19298
 
CREATE INDEX persontransferjob__major_person__idx ON persontransferjob USING btree (major_person);
19299
 
 
19300
 
 
19301
 
CREATE INDEX persontransferjob__minor_person__idx ON persontransferjob USING btree (minor_person);
19302
 
 
19303
 
 
19304
8149
CREATE INDEX pillarname__alias_for__idx ON pillarname USING btree (alias_for) WHERE (alias_for IS NOT NULL);
19305
8150
 
19306
 
 
19307
8151
CREATE UNIQUE INDEX pillarname__distribution__key ON pillarname USING btree (distribution) WHERE (distribution IS NOT NULL);
19308
8152
 
19309
 
 
19310
8153
CREATE UNIQUE INDEX pillarname__product__key ON pillarname USING btree (product) WHERE (product IS NOT NULL);
19311
8154
 
19312
 
 
19313
8155
CREATE UNIQUE INDEX pillarname__project__key ON pillarname USING btree (project) WHERE (project IS NOT NULL);
19314
8156
 
19315
 
 
19316
8157
CREATE INDEX pocketchroot__chroot__idx ON pocketchroot USING btree (chroot);
19317
8158
 
 
8159
CREATE INDEX pocomment_person_idx ON pocomment USING btree (person);
19318
8160
 
19319
8161
CREATE INDEX poexportrequest__person__idx ON poexportrequest USING btree (person);
19320
8162
 
19321
 
 
19322
8163
CREATE UNIQUE INDEX poexportrequest_duplicate_key ON poexportrequest USING btree (potemplate, person, format, (COALESCE(pofile, (-1))));
19323
8164
 
19324
 
 
19325
8165
CREATE INDEX pofile__from_sourcepackagename__idx ON pofile USING btree (from_sourcepackagename) WHERE (from_sourcepackagename IS NOT NULL);
19326
8166
 
19327
 
 
19328
 
CREATE UNIQUE INDEX pofile__potemplate__language__idx ON pofile USING btree (potemplate, language);
19329
 
 
19330
 
 
19331
8167
CREATE UNIQUE INDEX pofile__potemplate__path__key ON pofile USING btree (potemplate, path);
19332
8168
 
19333
 
 
19334
8169
CREATE UNIQUE INDEX pofile__unreviewed_count__id__key ON pofile USING btree (unreviewed_count, id);
19335
8170
 
19336
 
 
19337
8171
CREATE INDEX pofile_datecreated_idx ON pofile USING btree (datecreated);
19338
8172
 
19339
 
 
19340
8173
CREATE INDEX pofile_language_idx ON pofile USING btree (language);
19341
8174
 
19342
 
 
19343
8175
CREATE INDEX pofile_lasttranslator_idx ON pofile USING btree (lasttranslator);
19344
8176
 
19345
 
 
19346
8177
CREATE INDEX pofile_owner_idx ON pofile USING btree (owner);
19347
8178
 
 
8179
CREATE UNIQUE INDEX pofile_template_and_language_idx ON pofile USING btree (potemplate, language, (COALESCE(variant, ''::text)));
 
8180
 
 
8181
ALTER TABLE pofile CLUSTER ON pofile_template_and_language_idx;
 
8182
 
 
8183
CREATE INDEX pofile_variant_idx ON pofile USING btree (variant);
19348
8184
 
19349
8185
CREATE INDEX pofiletranslator__date_last_touched__idx ON pofiletranslator USING btree (date_last_touched);
19350
8186
 
19351
 
 
19352
8187
CREATE INDEX pofiletranslator__latest_message__idx ON pofiletranslator USING btree (latest_message);
19353
8188
 
19354
 
 
19355
8189
CREATE INDEX pofiletranslator__pofile__idx ON pofiletranslator USING btree (pofile);
19356
8190
 
19357
 
 
19358
8191
CREATE INDEX polloption_poll_idx ON polloption USING btree (poll);
19359
8192
 
19360
 
 
19361
8193
CREATE UNIQUE INDEX pomsgid_msgid_key ON pomsgid USING btree (sha1(msgid));
19362
8194
 
19363
 
 
19364
8195
CREATE INDEX potemplate__date_last_updated__idx ON potemplate USING btree (date_last_updated);
19365
8196
 
19366
 
 
19367
8197
CREATE UNIQUE INDEX potemplate__distroseries__sourcepackagename__name__key ON potemplate USING btree (distroseries, sourcepackagename, name);
19368
8198
 
19369
 
 
19370
8199
CREATE INDEX potemplate__name__idx ON potemplate USING btree (name);
19371
8200
 
19372
 
 
19373
8201
CREATE UNIQUE INDEX potemplate__productseries__name__key ON potemplate USING btree (productseries, name);
19374
8202
 
19375
 
 
19376
8203
CREATE INDEX potemplate__source_file__idx ON potemplate USING btree (source_file) WHERE (source_file IS NOT NULL);
19377
8204
 
19378
 
 
19379
8205
CREATE INDEX potemplate_languagepack_idx ON potemplate USING btree (languagepack);
19380
8206
 
19381
 
 
19382
8207
CREATE INDEX potemplate_owner_idx ON potemplate USING btree (owner);
19383
8208
 
19384
 
 
19385
8209
CREATE INDEX potmsgset__context__msgid_singular__msgid_plural__idx ON potmsgset USING btree (context, msgid_singular, msgid_plural) WHERE ((context IS NOT NULL) AND (msgid_plural IS NOT NULL));
19386
8210
 
19387
 
 
19388
8211
CREATE INDEX potmsgset__context__msgid_singular__no_msgid_plural__idx ON potmsgset USING btree (context, msgid_singular) WHERE ((context IS NOT NULL) AND (msgid_plural IS NULL));
19389
8212
 
19390
 
 
19391
8213
CREATE INDEX potmsgset__no_context__msgid_singular__msgid_plural__idx ON potmsgset USING btree (msgid_singular, msgid_plural) WHERE ((context IS NULL) AND (msgid_plural IS NOT NULL));
19392
8214
 
19393
 
 
19394
8215
CREATE INDEX potmsgset__no_context__msgid_singular__no_msgid_plural__idx ON potmsgset USING btree (msgid_singular) WHERE ((context IS NULL) AND (msgid_plural IS NULL));
19395
8216
 
19396
 
 
19397
 
CREATE INDEX potmsgset__potemplate__idx ON potmsgset USING btree (potemplate) WHERE (potemplate IS NOT NULL);
19398
 
 
19399
 
 
19400
8217
CREATE INDEX potmsgset_primemsgid_idx ON potmsgset USING btree (msgid_singular);
19401
8218
 
 
8219
CREATE INDEX potmsgset_sequence_idx ON potmsgset USING btree (sequence);
19402
8220
 
19403
8221
CREATE UNIQUE INDEX potranslation_translation_key ON potranslation USING btree (sha1(translation));
19404
8222
 
19405
 
 
19406
8223
CREATE INDEX previewdiff__diff__idx ON previewdiff USING btree (diff);
19407
8224
 
19408
 
 
19409
8225
CREATE INDEX product__bug_supervisor__idx ON product USING btree (bug_supervisor) WHERE (bug_supervisor IS NOT NULL);
19410
8226
 
19411
 
 
19412
8227
CREATE INDEX product__driver__idx ON product USING btree (driver) WHERE (driver IS NOT NULL);
19413
8228
 
19414
 
 
19415
8229
CREATE INDEX product__icon__idx ON product USING btree (icon) WHERE (icon IS NOT NULL);
19416
8230
 
19417
 
 
19418
8231
CREATE INDEX product__logo__idx ON product USING btree (logo) WHERE (logo IS NOT NULL);
19419
8232
 
19420
 
 
19421
8233
CREATE INDEX product__mugshot__idx ON product USING btree (mugshot) WHERE (mugshot IS NOT NULL);
19422
8234
 
19423
 
 
19424
8235
CREATE INDEX product__registrant__idx ON product USING btree (registrant);
19425
8236
 
19426
 
 
19427
8237
CREATE INDEX product__security_contact__idx ON product USING btree (security_contact) WHERE (security_contact IS NOT NULL);
19428
8238
 
19429
 
 
19430
8239
CREATE INDEX product_active_idx ON product USING btree (active);
19431
8240
 
19432
 
 
19433
 
CREATE INDEX product_fti ON product USING gist (fti);
19434
 
 
 
8241
CREATE INDEX product_bugcontact_idx ON product USING btree (bug_supervisor);
 
8242
 
 
8243
CREATE INDEX product_fti ON product USING gist (fti ts2.gist_tsvector_ops);
19435
8244
 
19436
8245
CREATE INDEX product_owner_idx ON product USING btree (owner);
19437
8246
 
19438
 
 
19439
8247
CREATE INDEX product_project_idx ON product USING btree (project);
19440
8248
 
19441
 
 
19442
8249
CREATE INDEX product_translationgroup_idx ON product USING btree (translationgroup);
19443
8250
 
19444
 
 
19445
8251
CREATE INDEX productlicense__license__idx ON productlicense USING btree (license);
19446
8252
 
19447
 
 
19448
8253
CREATE INDEX productrelease_datecreated_idx ON productrelease USING btree (datecreated);
19449
8254
 
19450
 
 
19451
8255
CREATE INDEX productrelease_owner_idx ON productrelease USING btree (owner);
19452
8256
 
19453
 
 
19454
8257
CREATE INDEX productreleasefile__libraryfile__idx ON productreleasefile USING btree (libraryfile);
19455
8258
 
19456
 
 
19457
8259
CREATE INDEX productreleasefile__signature__idx ON productreleasefile USING btree (signature) WHERE (signature IS NOT NULL);
19458
8260
 
19459
 
 
19460
8261
CREATE INDEX productreleasefile__uploader__idx ON productreleasefile USING btree (uploader);
19461
8262
 
19462
 
 
19463
 
CREATE INDEX productreleasefile_fti ON productreleasefile USING gist (fti);
19464
 
 
 
8263
CREATE INDEX productreleasefile_fti ON productreleasefile USING gist (fti ts2.gist_tsvector_ops);
19465
8264
 
19466
8265
CREATE INDEX productseries__branch__idx ON productseries USING btree (branch) WHERE (branch IS NOT NULL);
19467
8266
 
19468
 
 
19469
8267
CREATE INDEX productseries__driver__idx ON productseries USING btree (driver);
19470
8268
 
19471
 
 
19472
8269
CREATE INDEX productseries__owner__idx ON productseries USING btree (owner);
19473
8270
 
19474
 
 
19475
8271
CREATE INDEX productseries__translations_branch__idx ON productseries USING btree (translations_branch);
19476
8272
 
19477
 
 
19478
8273
CREATE INDEX productseries_datecreated_idx ON productseries USING btree (datecreated);
19479
8274
 
19480
 
 
19481
 
CREATE INDEX productseries_name_sort ON productseries USING btree (version_sort_key(name));
19482
 
 
19483
 
 
19484
8275
CREATE INDEX project__driver__idx ON project USING btree (driver);
19485
8276
 
19486
 
 
19487
8277
CREATE INDEX project__icon__idx ON project USING btree (icon) WHERE (icon IS NOT NULL);
19488
8278
 
19489
 
 
19490
8279
CREATE INDEX project__logo__idx ON project USING btree (logo) WHERE (logo IS NOT NULL);
19491
8280
 
19492
 
 
19493
8281
CREATE INDEX project__mugshot__idx ON project USING btree (mugshot) WHERE (mugshot IS NOT NULL);
19494
8282
 
19495
 
 
19496
8283
CREATE INDEX project__registrant__idx ON project USING btree (registrant);
19497
8284
 
19498
 
 
19499
 
CREATE INDEX project_fti ON project USING gist (fti);
19500
 
 
 
8285
CREATE INDEX project_fti ON project USING gist (fti ts2.gist_tsvector_ops);
19501
8286
 
19502
8287
CREATE INDEX project_owner_idx ON project USING btree (owner);
19503
8288
 
19504
 
 
19505
8289
CREATE INDEX project_translationgroup_idx ON project USING btree (translationgroup);
19506
8290
 
19507
 
 
19508
 
CREATE UNIQUE INDEX publisherconfig__distribution__idx ON publisherconfig USING btree (distribution);
19509
 
 
 
8291
CREATE INDEX pushmirroraccess_person_idx ON pushmirroraccess USING btree (person);
19510
8292
 
19511
8293
CREATE INDEX question__answerer__idx ON question USING btree (answerer);
19512
8294
 
19513
 
 
19514
8295
CREATE INDEX question__assignee__idx ON question USING btree (assignee);
19515
8296
 
19516
 
 
19517
8297
CREATE INDEX question__distribution__sourcepackagename__idx ON question USING btree (distribution, sourcepackagename);
19518
8298
 
19519
 
 
19520
8299
CREATE INDEX question__distro__datecreated__idx ON question USING btree (distribution, datecreated);
19521
8300
 
19522
 
 
19523
8301
CREATE INDEX question__faq__idx ON question USING btree (faq) WHERE (faq IS NOT NULL);
19524
8302
 
19525
 
 
19526
8303
CREATE INDEX question__owner__idx ON question USING btree (owner);
19527
8304
 
19528
 
 
19529
8305
CREATE INDEX question__product__datecreated__idx ON question USING btree (product, datecreated);
19530
8306
 
19531
 
 
19532
8307
CREATE INDEX question__product__idx ON question USING btree (product);
19533
8308
 
19534
 
 
19535
8309
CREATE INDEX question__status__datecreated__idx ON question USING btree (status, datecreated);
19536
8310
 
19537
 
 
19538
 
CREATE INDEX question_fti ON question USING gist (fti);
19539
 
 
 
8311
CREATE INDEX question_fti ON question USING gist (fti ts2.gist_tsvector_ops);
19540
8312
 
19541
8313
CREATE INDEX questionbug__question__idx ON questionbug USING btree (question);
19542
8314
 
19543
 
 
19544
 
CREATE INDEX questionjob__question__idx ON questionjob USING btree (question);
19545
 
 
19546
 
 
19547
 
CREATE INDEX questionmessage__owner__idx ON questionmessage USING btree (owner);
19548
 
 
19549
 
 
19550
8315
CREATE INDEX questionmessage__question__idx ON questionmessage USING btree (question);
19551
8316
 
19552
 
 
19553
8317
CREATE INDEX questionreopening__answerer__idx ON questionreopening USING btree (answerer);
19554
8318
 
19555
 
 
19556
8319
CREATE INDEX questionreopening__datecreated__idx ON questionreopening USING btree (datecreated);
19557
8320
 
19558
 
 
19559
8321
CREATE INDEX questionreopening__question__idx ON questionreopening USING btree (question);
19560
8322
 
19561
 
 
19562
8323
CREATE INDEX questionreopening__reopener__idx ON questionreopening USING btree (reopener);
19563
8324
 
19564
 
 
19565
8325
CREATE INDEX questionsubscription__subscriber__idx ON questionsubscription USING btree (person);
19566
8326
 
 
8327
CREATE INDEX requestedcds_request_architecture_idx ON requestedcds USING btree (request, architecture);
19567
8328
 
19568
8329
CREATE INDEX revision__gpgkey__idx ON revision USING btree (gpgkey) WHERE (gpgkey IS NOT NULL);
19569
8330
 
19570
 
 
19571
8331
CREATE INDEX revision__karma_allocated__idx ON revision USING btree (karma_allocated) WHERE (karma_allocated IS FALSE);
19572
8332
 
19573
 
 
19574
8333
CREATE INDEX revision__revision_author__idx ON revision USING btree (revision_author);
19575
8334
 
19576
 
 
19577
8335
CREATE INDEX revision__revision_date__idx ON revision USING btree (revision_date);
19578
8336
 
19579
 
 
19580
8337
CREATE INDEX revisionauthor__email__idx ON revisionauthor USING btree (email);
19581
8338
 
19582
 
 
19583
8339
CREATE INDEX revisionauthor__lower_email__idx ON revisionauthor USING btree (lower(email));
19584
8340
 
19585
 
 
19586
8341
CREATE INDEX revisionauthor__person__idx ON revisionauthor USING btree (person);
19587
8342
 
19588
 
 
19589
8343
CREATE UNIQUE INDEX revisioncache__distroseries__sourcepackagename__revision__priva ON revisioncache USING btree (distroseries, sourcepackagename, revision, private) WHERE (distroseries IS NOT NULL);
19590
8344
 
19591
 
 
19592
8345
CREATE UNIQUE INDEX revisioncache__product__revision__private__key ON revisioncache USING btree (product, revision, private) WHERE (product IS NOT NULL);
19593
8346
 
19594
 
 
19595
8347
CREATE INDEX revisioncache__revision__idx ON revisioncache USING btree (revision);
19596
8348
 
19597
 
 
19598
8349
CREATE INDEX revisioncache__revision_author__idx ON revisioncache USING btree (revision_author);
19599
8350
 
19600
 
 
19601
8351
CREATE INDEX revisioncache__revision_date__idx ON revisioncache USING btree (revision_date);
19602
8352
 
19603
 
 
19604
8353
CREATE INDEX sbpph__dateremoved__idx ON binarypackagepublishinghistory USING btree (dateremoved) WHERE (dateremoved IS NOT NULL);
19605
8354
 
19606
 
 
19607
8355
CREATE INDEX scriptactivity__name__date_started__idx ON scriptactivity USING btree (name, date_started);
19608
8356
 
19609
 
 
19610
8357
CREATE INDEX securebinarypackagepublishinghistory__archive__status__idx ON binarypackagepublishinghistory USING btree (archive, status);
19611
8358
 
19612
 
 
19613
8359
CREATE INDEX securebinarypackagepublishinghistory__distroarchseries__idx ON binarypackagepublishinghistory USING btree (distroarchseries);
19614
8360
 
19615
 
 
19616
8361
CREATE INDEX securebinarypackagepublishinghistory__removed_by__idx ON binarypackagepublishinghistory USING btree (removed_by) WHERE (removed_by IS NOT NULL);
19617
8362
 
19618
 
 
19619
8363
CREATE INDEX securebinarypackagepublishinghistory__supersededby__idx ON binarypackagepublishinghistory USING btree (supersededby);
19620
8364
 
19621
 
 
19622
8365
CREATE INDEX securebinarypackagepublishinghistory_binarypackagerelease_idx ON binarypackagepublishinghistory USING btree (binarypackagerelease);
19623
8366
 
19624
 
 
19625
8367
CREATE INDEX securebinarypackagepublishinghistory_component_idx ON binarypackagepublishinghistory USING btree (component);
19626
8368
 
19627
 
 
19628
8369
CREATE INDEX securebinarypackagepublishinghistory_pocket_idx ON binarypackagepublishinghistory USING btree (pocket);
19629
8370
 
19630
 
 
19631
8371
CREATE INDEX securebinarypackagepublishinghistory_section_idx ON binarypackagepublishinghistory USING btree (section);
19632
8372
 
19633
 
 
19634
8373
CREATE INDEX securebinarypackagepublishinghistory_status_idx ON binarypackagepublishinghistory USING btree (status);
19635
8374
 
19636
 
 
19637
8375
CREATE INDEX securesourcepackagepublishinghistory__archive__status__idx ON sourcepackagepublishinghistory USING btree (archive, status);
19638
8376
 
19639
 
 
19640
8377
CREATE INDEX securesourcepackagepublishinghistory__distroseries__idx ON sourcepackagepublishinghistory USING btree (distroseries);
19641
8378
 
19642
 
 
19643
8379
CREATE INDEX securesourcepackagepublishinghistory__removed_by__idx ON sourcepackagepublishinghistory USING btree (removed_by) WHERE (removed_by IS NOT NULL);
19644
8380
 
19645
 
 
19646
8381
CREATE INDEX securesourcepackagepublishinghistory_component_idx ON sourcepackagepublishinghistory USING btree (component);
19647
8382
 
19648
 
 
19649
8383
CREATE INDEX securesourcepackagepublishinghistory_pocket_idx ON sourcepackagepublishinghistory USING btree (pocket);
19650
8384
 
19651
 
 
19652
8385
CREATE INDEX securesourcepackagepublishinghistory_section_idx ON sourcepackagepublishinghistory USING btree (section);
19653
8386
 
19654
 
 
19655
8387
CREATE INDEX securesourcepackagepublishinghistory_sourcepackagerelease_idx ON sourcepackagepublishinghistory USING btree (sourcepackagerelease);
19656
8388
 
19657
 
 
19658
8389
CREATE INDEX securesourcepackagepublishinghistory_status_idx ON sourcepackagepublishinghistory USING btree (status);
19659
8390
 
19660
 
 
19661
8391
CREATE INDEX seriessourcepackagebranch__branch__idx ON seriessourcepackagebranch USING btree (branch);
19662
8392
 
19663
 
 
19664
8393
CREATE INDEX seriessourcepackagebranch__registrant__key ON seriessourcepackagebranch USING btree (registrant);
19665
8394
 
 
8395
CREATE INDEX shipitreport__csvfile__idx ON shipitreport USING btree (csvfile);
 
8396
 
 
8397
CREATE INDEX shipitsurvey__account__idx ON shipitsurvey USING btree (account);
 
8398
 
 
8399
CREATE UNIQUE INDEX shipitsurvey__unexported__key ON shipitsurvey USING btree (id) WHERE (exported IS FALSE);
 
8400
 
 
8401
CREATE INDEX shipitsurveyresult__survey__question__answer__idx ON shipitsurveyresult USING btree (survey, question, answer);
 
8402
 
 
8403
CREATE INDEX shipment_shippingrun_idx ON shipment USING btree (shippingrun);
 
8404
 
 
8405
CREATE INDEX shippingrequest__daterequested__approved__idx ON shippingrequest USING btree (daterequested) WHERE (status = 1);
 
8406
 
 
8407
CREATE INDEX shippingrequest__daterequested__unapproved__idx ON shippingrequest USING btree (daterequested) WHERE (status = 0);
 
8408
 
 
8409
CREATE INDEX shippingrequest__normalized_address__idx ON shippingrequest USING btree (normalized_address);
 
8410
 
 
8411
CREATE INDEX shippingrequest__whocancelled__idx ON shippingrequest USING btree (whocancelled) WHERE (whocancelled IS NOT NULL);
 
8412
 
 
8413
CREATE INDEX shippingrequest_daterequested_idx ON shippingrequest USING btree (daterequested);
 
8414
 
 
8415
ALTER TABLE shippingrequest CLUSTER ON shippingrequest_daterequested_idx;
 
8416
 
 
8417
CREATE INDEX shippingrequest_fti ON shippingrequest USING gist (fti ts2.gist_tsvector_ops);
 
8418
 
 
8419
CREATE INDEX shippingrequest_highpriority_idx ON shippingrequest USING btree (highpriority);
 
8420
 
 
8421
CREATE UNIQUE INDEX shippingrequest_one_outstanding_request_unique ON shippingrequest USING btree (recipient) WHERE (((shipment IS NULL) AND (is_admin_request IS NOT TRUE)) AND (status <> ALL (ARRAY[2, 3])));
 
8422
 
 
8423
CREATE INDEX shippingrequest_recipient_idx ON shippingrequest USING btree (recipient);
 
8424
 
 
8425
CREATE INDEX shippingrequest_whoapproved_idx ON shippingrequest USING btree (whoapproved);
19666
8426
 
19667
8427
CREATE INDEX signedcodeofconduct_owner_idx ON signedcodeofconduct USING btree (owner);
19668
8428
 
19669
 
 
19670
 
CREATE INDEX sourcepackagepublishinghistory__ancestor__idx ON sourcepackagepublishinghistory USING btree (ancestor);
19671
 
 
19672
 
 
19673
 
CREATE INDEX sourcepackagepublishinghistory__creator__idx ON sourcepackagepublishinghistory USING btree (creator) WHERE (creator IS NOT NULL);
19674
 
 
19675
 
 
19676
 
CREATE INDEX sourcepackagepublishinghistory__sourcepackagename__idx ON sourcepackagepublishinghistory USING btree (sourcepackagename);
19677
 
 
19678
 
 
19679
8429
CREATE INDEX sourcepackagerecipe__daily_build_archive__idx ON sourcepackagerecipe USING btree (daily_build_archive);
19680
8430
 
19681
 
 
19682
8431
CREATE INDEX sourcepackagerecipe__is_stale__build_daily__idx ON sourcepackagerecipe USING btree (is_stale, build_daily);
19683
8432
 
19684
 
 
19685
8433
CREATE INDEX sourcepackagerecipe__registrant__idx ON sourcepackagerecipe USING btree (registrant);
19686
8434
 
19687
 
 
19688
8435
CREATE INDEX sourcepackagerecipebuild__distroseries__idx ON sourcepackagerecipebuild USING btree (distroseries);
19689
8436
 
19690
 
 
19691
8437
CREATE INDEX sourcepackagerecipebuild__manifest__idx ON sourcepackagerecipebuild USING btree (manifest);
19692
8438
 
19693
 
 
19694
8439
CREATE INDEX sourcepackagerecipebuild__recipe__idx ON sourcepackagerecipebuild USING btree (recipe);
19695
8440
 
19696
 
 
19697
8441
CREATE INDEX sourcepackagerecipebuild__requester__idx ON sourcepackagerecipebuild USING btree (requester);
19698
8442
 
19699
 
 
19700
8443
CREATE INDEX sourcepackagerecipedata__base_branch__idx ON sourcepackagerecipedata USING btree (base_branch);
19701
8444
 
19702
 
 
19703
8445
CREATE UNIQUE INDEX sourcepackagerecipedata__sourcepackage_recipe__key ON sourcepackagerecipedata USING btree (sourcepackage_recipe) WHERE (sourcepackage_recipe IS NOT NULL);
19704
8446
 
19705
 
 
19706
8447
CREATE UNIQUE INDEX sourcepackagerecipedata__sourcepackage_recipe_build__key ON sourcepackagerecipedata USING btree (sourcepackage_recipe_build) WHERE (sourcepackage_recipe_build IS NOT NULL);
19707
8448
 
19708
 
 
19709
8449
CREATE INDEX sourcepackagerecipedatainstruction__branch__idx ON sourcepackagerecipedatainstruction USING btree (branch);
19710
8450
 
19711
 
 
19712
8451
CREATE INDEX sourcepackagerelease__changelog__idx ON sourcepackagerelease USING btree (changelog);
19713
8452
 
19714
 
 
19715
8453
CREATE INDEX sourcepackagerelease__sourcepackage_recipe_build__idx ON sourcepackagerelease USING btree (sourcepackage_recipe_build);
19716
8454
 
19717
 
 
19718
8455
CREATE INDEX sourcepackagerelease__upload_archive__idx ON sourcepackagerelease USING btree (upload_archive);
19719
8456
 
19720
 
 
19721
 
CREATE INDEX sourcepackagerelease__version__idx ON sourcepackagerelease USING btree (version);
19722
 
 
19723
 
 
19724
8457
CREATE INDEX sourcepackagerelease_creator_idx ON sourcepackagerelease USING btree (creator);
19725
8458
 
19726
 
 
19727
8459
CREATE INDEX sourcepackagerelease_maintainer_idx ON sourcepackagerelease USING btree (maintainer);
19728
8460
 
19729
 
 
19730
8461
CREATE INDEX sourcepackagerelease_sourcepackagename_idx ON sourcepackagerelease USING btree (sourcepackagename);
19731
8462
 
 
8463
CREATE INDEX sourcepackagerelease_version_sort ON sourcepackagerelease USING btree (debversion_sort_key(version));
19732
8464
 
19733
8465
CREATE INDEX sourcepackagereleasefile_libraryfile_idx ON sourcepackagereleasefile USING btree (libraryfile);
19734
8466
 
19735
 
 
19736
8467
CREATE INDEX sourcepackagereleasefile_sourcepackagerelease_idx ON sourcepackagereleasefile USING btree (sourcepackagerelease);
19737
8468
 
19738
 
 
19739
8469
CREATE INDEX specification__completer__idx ON specification USING btree (completer);
19740
8470
 
19741
 
 
19742
8471
CREATE INDEX specification__goal_decider__idx ON specification USING btree (goal_decider);
19743
8472
 
19744
 
 
19745
8473
CREATE INDEX specification__goal_proposer__idx ON specification USING btree (goal_proposer);
19746
8474
 
19747
 
 
19748
8475
CREATE INDEX specification__starter__idx ON specification USING btree (starter);
19749
8476
 
19750
 
 
19751
8477
CREATE INDEX specification_approver_idx ON specification USING btree (approver);
19752
8478
 
19753
 
 
19754
8479
CREATE INDEX specification_assignee_idx ON specification USING btree (assignee);
19755
8480
 
19756
 
 
19757
8481
CREATE INDEX specification_datecreated_idx ON specification USING btree (datecreated);
19758
8482
 
19759
 
 
19760
8483
CREATE INDEX specification_drafter_idx ON specification USING btree (drafter);
19761
8484
 
19762
 
 
19763
 
CREATE INDEX specification_fti ON specification USING gist (fti);
19764
 
 
 
8485
CREATE INDEX specification_fti ON specification USING gist (fti ts2.gist_tsvector_ops);
19765
8486
 
19766
8487
CREATE INDEX specification_owner_idx ON specification USING btree (owner);
19767
8488
 
19768
 
 
19769
8489
CREATE INDEX specificationbranch__registrant__idx ON specificationbranch USING btree (registrant);
19770
8490
 
19771
 
 
19772
8491
CREATE INDEX specificationbranch__specification__idx ON specificationbranch USING btree (specification);
19773
8492
 
19774
 
 
19775
8493
CREATE INDEX specificationbug_bug_idx ON specificationbug USING btree (bug);
19776
8494
 
19777
 
 
19778
8495
CREATE INDEX specificationbug_specification_idx ON specificationbug USING btree (specification);
19779
8496
 
19780
 
 
19781
8497
CREATE INDEX specificationdependency_dependency_idx ON specificationdependency USING btree (dependency);
19782
8498
 
19783
 
 
19784
8499
CREATE INDEX specificationdependency_specification_idx ON specificationdependency USING btree (specification);
19785
8500
 
19786
 
 
19787
8501
CREATE INDEX specificationfeedback_requester_idx ON specificationfeedback USING btree (requester);
19788
8502
 
19789
 
 
19790
8503
CREATE INDEX specificationfeedback_reviewer_idx ON specificationfeedback USING btree (reviewer);
19791
8504
 
19792
 
 
19793
8505
CREATE INDEX specificationsubscription_specification_idx ON specificationsubscription USING btree (specification);
19794
8506
 
19795
 
 
19796
8507
CREATE INDEX specificationsubscription_subscriber_idx ON specificationsubscription USING btree (person);
19797
8508
 
19798
 
 
19799
8509
CREATE INDEX sprint__driver__idx ON sprint USING btree (driver);
19800
8510
 
19801
 
 
19802
8511
CREATE INDEX sprint__icon__idx ON sprint USING btree (icon) WHERE (icon IS NOT NULL);
19803
8512
 
19804
 
 
19805
8513
CREATE INDEX sprint__logo__idx ON sprint USING btree (logo) WHERE (logo IS NOT NULL);
19806
8514
 
19807
 
 
19808
8515
CREATE INDEX sprint__mugshot__idx ON sprint USING btree (mugshot) WHERE (mugshot IS NOT NULL);
19809
8516
 
19810
 
 
19811
8517
CREATE INDEX sprint__owner__idx ON sprint USING btree (owner);
19812
8518
 
19813
 
 
19814
8519
CREATE INDEX sprint_datecreated_idx ON sprint USING btree (datecreated);
19815
8520
 
19816
 
 
19817
8521
CREATE INDEX sprintattendance_sprint_idx ON sprintattendance USING btree (sprint);
19818
8522
 
19819
 
 
19820
8523
CREATE INDEX sprintspec_sprint_idx ON sprintspecification USING btree (sprint);
19821
8524
 
19822
 
 
19823
8525
CREATE INDEX sprintspecification__decider__idx ON sprintspecification USING btree (decider);
19824
8526
 
19825
 
 
19826
8527
CREATE INDEX sprintspecification__registrant__idx ON sprintspecification USING btree (registrant);
19827
8528
 
19828
 
 
19829
8529
CREATE INDEX sshkey_person_key ON sshkey USING btree (person);
19830
8530
 
19831
 
 
19832
 
CREATE UNIQUE INDEX structuralsubscription__distribution__sourcepackagename__subscr ON structuralsubscription USING btree (distribution, sourcepackagename, subscriber) WHERE ((distribution IS NOT NULL) AND (sourcepackagename IS NOT NULL));
19833
 
 
19834
 
 
19835
 
CREATE UNIQUE INDEX structuralsubscription__distribution__subscriber__key ON structuralsubscription USING btree (distribution, subscriber) WHERE ((distribution IS NOT NULL) AND (sourcepackagename IS NULL));
19836
 
 
19837
 
 
19838
 
CREATE UNIQUE INDEX structuralsubscription__distroseries__subscriber__key ON structuralsubscription USING btree (distroseries, subscriber) WHERE (distroseries IS NOT NULL);
19839
 
 
19840
 
 
19841
 
CREATE UNIQUE INDEX structuralsubscription__milestone__subscriber__key ON structuralsubscription USING btree (milestone, subscriber) WHERE (milestone IS NOT NULL);
19842
 
 
19843
 
 
19844
 
CREATE UNIQUE INDEX structuralsubscription__product__subscriber__key ON structuralsubscription USING btree (product, subscriber) WHERE (product IS NOT NULL);
19845
 
 
19846
 
 
19847
 
CREATE UNIQUE INDEX structuralsubscription__productseries__subscriber__key ON structuralsubscription USING btree (productseries, subscriber) WHERE (productseries IS NOT NULL);
19848
 
 
19849
 
 
19850
 
CREATE UNIQUE INDEX structuralsubscription__project__subscriber__key ON structuralsubscription USING btree (project, subscriber) WHERE (project IS NOT NULL);
19851
 
 
 
8531
CREATE INDEX staticdiff__diff__idx ON staticdiff USING btree (diff);
 
8532
 
 
8533
CREATE INDEX structuralsubscription__blueprint_notification_level__idx ON structuralsubscription USING btree (blueprint_notification_level);
 
8534
 
 
8535
CREATE INDEX structuralsubscription__bug_notification_level__idx ON structuralsubscription USING btree (bug_notification_level);
 
8536
 
 
8537
CREATE INDEX structuralsubscription__distribution__sourcepackagename__idx ON structuralsubscription USING btree (distribution, sourcepackagename) WHERE (distribution IS NOT NULL);
 
8538
 
 
8539
CREATE INDEX structuralsubscription__distroseries__idx ON structuralsubscription USING btree (distroseries) WHERE (distroseries IS NOT NULL);
 
8540
 
 
8541
CREATE INDEX structuralsubscription__milestone__idx ON structuralsubscription USING btree (milestone) WHERE (milestone IS NOT NULL);
 
8542
 
 
8543
CREATE INDEX structuralsubscription__product__idx ON structuralsubscription USING btree (product) WHERE (product IS NOT NULL);
 
8544
 
 
8545
CREATE INDEX structuralsubscription__productseries__idx ON structuralsubscription USING btree (productseries) WHERE (productseries IS NOT NULL);
 
8546
 
 
8547
CREATE INDEX structuralsubscription__project__idx ON structuralsubscription USING btree (project) WHERE (project IS NOT NULL);
19852
8548
 
19853
8549
CREATE INDEX structuralsubscription__subscribed_by__idx ON structuralsubscription USING btree (subscribed_by);
19854
8550
 
19855
 
 
19856
8551
CREATE INDEX structuralsubscription__subscriber__idx ON structuralsubscription USING btree (subscriber);
19857
8552
 
19858
 
 
19859
 
CREATE INDEX subunitstream__branch_created__idx ON subunitstream USING btree (branch, date_created);
19860
 
 
19861
 
 
19862
 
CREATE INDEX subunitstream__stream__idx ON subunitstream USING btree (stream);
19863
 
 
19864
 
 
19865
 
CREATE INDEX subunitstream__uploader_created__idx ON subunitstream USING btree (uploader, date_created);
19866
 
 
19867
 
 
19868
8553
CREATE INDEX teammembership__acknowledged_by__idx ON teammembership USING btree (acknowledged_by) WHERE (acknowledged_by IS NOT NULL);
19869
8554
 
19870
 
 
19871
8555
CREATE INDEX teammembership__last_changed_by__idx ON teammembership USING btree (last_changed_by) WHERE (last_changed_by IS NOT NULL);
19872
8556
 
19873
 
 
19874
8557
CREATE INDEX teammembership__proposed_by__idx ON teammembership USING btree (proposed_by) WHERE (proposed_by IS NOT NULL);
19875
8558
 
19876
 
 
19877
8559
CREATE INDEX teammembership__reviewed_by__idx ON teammembership USING btree (reviewed_by) WHERE (reviewed_by IS NOT NULL);
19878
8560
 
19879
 
 
19880
8561
CREATE INDEX teammembership__team__idx ON teammembership USING btree (team);
19881
8562
 
19882
 
 
19883
8563
CREATE INDEX teamparticipation_person_idx ON teamparticipation USING btree (person);
19884
8564
 
19885
8565
ALTER TABLE teamparticipation CLUSTER ON teamparticipation_person_idx;
19886
8566
 
19887
 
 
19888
 
CREATE INDEX tm__potmsgset__language__not_used__idx ON translationmessage USING btree (potmsgset, language) WHERE (NOT ((is_current_ubuntu IS TRUE) AND (is_current_upstream IS TRUE)));
19889
 
 
19890
 
 
19891
 
CREATE UNIQUE INDEX tm__potmsgset__language__shared__ubuntu__key ON translationmessage USING btree (potmsgset, language) WHERE ((is_current_ubuntu IS TRUE) AND (potemplate IS NULL));
19892
 
 
19893
 
 
19894
 
CREATE UNIQUE INDEX tm__potmsgset__language__shared__upstream__key ON translationmessage USING btree (potmsgset, language) WHERE ((is_current_upstream IS TRUE) AND (potemplate IS NULL));
19895
 
 
19896
 
 
19897
 
CREATE UNIQUE INDEX tm__potmsgset__template__language__diverged__ubuntu__key ON translationmessage USING btree (potmsgset, potemplate, language) WHERE ((is_current_ubuntu IS TRUE) AND (potemplate IS NOT NULL));
19898
 
 
19899
 
 
19900
 
CREATE UNIQUE INDEX tm__potmsgset__template__language__diverged__upstream__key ON translationmessage USING btree (potmsgset, potemplate, language) WHERE ((is_current_upstream IS TRUE) AND (potemplate IS NOT NULL));
19901
 
 
 
8567
CREATE UNIQUE INDEX tm__potmsgset__language__no_variant__shared__current__key ON translationmessage USING btree (potmsgset, language) WHERE (((is_current IS TRUE) AND (potemplate IS NULL)) AND (variant IS NULL));
 
8568
 
 
8569
CREATE UNIQUE INDEX tm__potmsgset__language__no_variant__shared__imported__key ON translationmessage USING btree (potmsgset, language) WHERE (((is_imported IS TRUE) AND (potemplate IS NULL)) AND (variant IS NULL));
 
8570
 
 
8571
CREATE INDEX tm__potmsgset__language__variant__not_used__idx ON translationmessage USING btree (potmsgset, language, variant) WHERE (NOT ((is_current IS TRUE) AND (is_imported IS TRUE)));
 
8572
 
 
8573
CREATE UNIQUE INDEX tm__potmsgset__language__variant__shared__current__key ON translationmessage USING btree (potmsgset, language, variant) WHERE (((is_current IS TRUE) AND (potemplate IS NULL)) AND (variant IS NOT NULL));
 
8574
 
 
8575
CREATE UNIQUE INDEX tm__potmsgset__language__variant__shared__imported__key ON translationmessage USING btree (potmsgset, language, variant) WHERE (((is_imported IS TRUE) AND (potemplate IS NULL)) AND (variant IS NOT NULL));
 
8576
 
 
8577
CREATE UNIQUE INDEX tm__potmsgset__potemplate__language__no_variant__diverged__curr ON translationmessage USING btree (potmsgset, potemplate, language) WHERE (((is_current IS TRUE) AND (potemplate IS NOT NULL)) AND (variant IS NULL));
 
8578
 
 
8579
CREATE UNIQUE INDEX tm__potmsgset__potemplate__language__no_variant__diverged__impo ON translationmessage USING btree (potmsgset, potemplate, language) WHERE (((is_imported IS TRUE) AND (potemplate IS NOT NULL)) AND (variant IS NULL));
 
8580
 
 
8581
CREATE UNIQUE INDEX tm__potmsgset__potemplate__language__variant__diverged__current ON translationmessage USING btree (potmsgset, potemplate, language, variant) WHERE (((is_current IS TRUE) AND (potemplate IS NOT NULL)) AND (variant IS NOT NULL));
 
8582
 
 
8583
CREATE UNIQUE INDEX tm__potmsgset__potemplate__language__variant__diverged__importe ON translationmessage USING btree (potmsgset, potemplate, language, variant) WHERE (((is_imported IS TRUE) AND (potemplate IS NOT NULL)) AND (variant IS NOT NULL));
19902
8584
 
19903
8585
CREATE INDEX translationgroup__owner__idx ON translationgroup USING btree (owner);
19904
8586
 
19905
 
 
19906
8587
CREATE INDEX translationimportqueueentry__content__idx ON translationimportqueueentry USING btree (content) WHERE (content IS NOT NULL);
19907
8588
 
19908
 
 
19909
8589
CREATE INDEX translationimportqueueentry__context__path__idx ON translationimportqueueentry USING btree (distroseries, sourcepackagename, productseries, path);
19910
8590
 
19911
 
 
19912
8591
CREATE UNIQUE INDEX translationimportqueueentry__entry_per_importer__unq ON translationimportqueueentry USING btree (importer, path, (COALESCE(potemplate, (-1))), (COALESCE(distroseries, (-1))), (COALESCE(sourcepackagename, (-1))), (COALESCE(productseries, (-1))));
19913
8592
 
19914
 
 
19915
8593
CREATE INDEX translationimportqueueentry__path__idx ON translationimportqueueentry USING btree (path);
19916
8594
 
19917
 
 
19918
8595
CREATE INDEX translationimportqueueentry__pofile__idx ON translationimportqueueentry USING btree (pofile) WHERE (pofile IS NOT NULL);
19919
8596
 
19920
 
 
19921
8597
CREATE INDEX translationimportqueueentry__potemplate__idx ON translationimportqueueentry USING btree (potemplate) WHERE (potemplate IS NOT NULL);
19922
8598
 
19923
 
 
19924
8599
CREATE INDEX translationimportqueueentry__productseries__idx ON translationimportqueueentry USING btree (productseries) WHERE (productseries IS NOT NULL);
19925
8600
 
19926
 
 
19927
8601
CREATE INDEX translationimportqueueentry__sourcepackagename__idx ON translationimportqueueentry USING btree (sourcepackagename) WHERE (sourcepackagename IS NOT NULL);
19928
8602
 
19929
 
 
19930
8603
CREATE UNIQUE INDEX translationimportqueueentry__status__dateimported__id__idx ON translationimportqueueentry USING btree (status, dateimported, id);
19931
8604
 
 
8605
CREATE INDEX translationmessage__language__no_variant__submitter__idx ON translationmessage USING btree (language, submitter) WHERE (variant IS NULL);
 
8606
 
 
8607
CREATE INDEX translationmessage__language__variant__submitter__idx ON translationmessage USING btree (language, variant, submitter) WHERE (variant IS NOT NULL);
19932
8608
 
19933
8609
CREATE INDEX translationmessage__msgstr0__idx ON translationmessage USING btree (msgstr0);
19934
8610
 
19935
 
 
19936
8611
CREATE INDEX translationmessage__msgstr1__idx ON translationmessage USING btree (msgstr1) WHERE (msgstr1 IS NOT NULL);
19937
8612
 
19938
 
 
19939
8613
CREATE INDEX translationmessage__msgstr2__idx ON translationmessage USING btree (msgstr2) WHERE (msgstr2 IS NOT NULL);
19940
8614
 
19941
 
 
19942
8615
CREATE INDEX translationmessage__msgstr3__idx ON translationmessage USING btree (msgstr3) WHERE (msgstr3 IS NOT NULL);
19943
8616
 
19944
 
 
19945
8617
CREATE INDEX translationmessage__msgstr4__idx ON translationmessage USING btree (msgstr4) WHERE (msgstr4 IS NOT NULL);
19946
8618
 
19947
 
 
19948
8619
CREATE INDEX translationmessage__msgstr5__idx ON translationmessage USING btree (msgstr5) WHERE (msgstr5 IS NOT NULL);
19949
8620
 
19950
 
 
19951
 
CREATE INDEX translationmessage__potemplate__idx ON translationmessage USING btree (potemplate) WHERE (potemplate IS NOT NULL);
19952
 
 
 
8621
CREATE INDEX translationmessage__pofile__idx ON translationmessage USING btree (pofile);
19953
8622
 
19954
8623
CREATE INDEX translationmessage__potmsgset__idx ON translationmessage USING btree (potmsgset);
19955
8624
 
19956
 
 
19957
8625
CREATE INDEX translationmessage__potmsgset__language__idx ON translationmessage USING btree (potmsgset, language);
19958
8626
 
19959
 
 
19960
8627
CREATE INDEX translationmessage__reviewer__idx ON translationmessage USING btree (reviewer);
19961
8628
 
19962
 
 
19963
8629
CREATE INDEX translationmessage__submitter__idx ON translationmessage USING btree (submitter);
19964
8630
 
19965
 
 
19966
8631
CREATE UNIQUE INDEX translationtemplateitem__potemplate__potmsgset__key ON translationtemplateitem USING btree (potemplate, potmsgset);
19967
8632
 
19968
 
 
19969
8633
CREATE INDEX translationtemplateitem__potemplate__sequence__idx ON translationtemplateitem USING btree (potemplate, sequence);
19970
8634
 
19971
 
 
19972
8635
CREATE UNIQUE INDEX translationtemplateitem__potemplate__sequence__key ON translationtemplateitem USING btree (potemplate, sequence) WHERE (sequence > 0);
19973
8636
 
19974
 
 
19975
8637
CREATE INDEX translationtemplateitem__potmsgset__idx ON translationtemplateitem USING btree (potmsgset);
19976
8638
 
19977
 
 
19978
 
CREATE INDEX translationtemplatesbuild__branch__idx ON translationtemplatesbuild USING btree (branch);
19979
 
 
19980
 
 
19981
 
CREATE INDEX translationtemplatesbuild__build_farm_job__idx ON translationtemplatesbuild USING btree (build_farm_job);
19982
 
 
19983
 
 
19984
8639
CREATE INDEX translator__translator__idx ON translator USING btree (translator);
19985
8640
 
19986
 
 
19987
8641
CREATE INDEX usertouseremail__recipient__idx ON usertouseremail USING btree (recipient);
19988
8642
 
19989
 
 
19990
8643
CREATE INDEX usertouseremail__sender__date_sent__idx ON usertouseremail USING btree (sender, date_sent);
19991
8644
 
19992
 
 
19993
8645
CREATE INDEX vote__person__idx ON vote USING btree (person);
19994
8646
 
19995
 
 
19996
8647
CREATE INDEX votecast_poll_idx ON votecast USING btree (poll);
19997
8648
 
 
8649
CREATE UNIQUE INDEX webserviceban__consumer__ip__key ON webserviceban USING btree (consumer, ip) WHERE ((consumer IS NOT NULL) AND (ip IS NOT NULL));
 
8650
 
 
8651
CREATE UNIQUE INDEX webserviceban__consumer__key ON webserviceban USING btree (consumer) WHERE ((consumer IS NOT NULL) AND (ip IS NULL));
 
8652
 
 
8653
CREATE UNIQUE INDEX webserviceban__ip__key ON webserviceban USING btree (ip) WHERE ((((person IS NULL) AND (consumer IS NULL)) AND (token IS NULL)) AND (ip IS NOT NULL));
 
8654
 
 
8655
CREATE UNIQUE INDEX webserviceban__person__ip__key ON webserviceban USING btree (person, ip) WHERE ((person IS NOT NULL) AND (ip IS NOT NULL));
 
8656
 
 
8657
CREATE UNIQUE INDEX webserviceban__person__key ON webserviceban USING btree (person) WHERE ((person IS NOT NULL) AND (ip IS NULL));
 
8658
 
 
8659
CREATE UNIQUE INDEX webserviceban__token__ip__key ON webserviceban USING btree (token, ip) WHERE ((token IS NOT NULL) AND (ip IS NOT NULL));
 
8660
 
 
8661
CREATE UNIQUE INDEX webserviceban__token__key ON webserviceban USING btree (token) WHERE ((token IS NOT NULL) AND (ip IS NULL));
19998
8662
 
19999
8663
CREATE INDEX wikiname_person_idx ON wikiname USING btree (person);
20000
8664
 
 
8665
CREATE RULE delete_rule AS ON DELETE TO revisionnumber DO INSTEAD DELETE FROM branchrevision WHERE (branchrevision.id = old.id);
 
8666
 
 
8667
CREATE RULE insert_rule AS ON INSERT TO revisionnumber DO INSTEAD INSERT INTO branchrevision (id, sequence, branch, revision) VALUES (new.id, new.sequence, new.branch, new.revision);
 
8668
 
 
8669
CREATE RULE update_rule AS ON UPDATE TO revisionnumber DO INSTEAD UPDATE branchrevision SET id = new.id, sequence = new.sequence, branch = new.branch, revision = new.revision WHERE (branchrevision.id = old.id);
20001
8670
 
20002
8671
CREATE TRIGGER bug_latest_patch_uploaded_on_delete_t
20003
8672
    AFTER DELETE ON bugattachment
20004
8673
    FOR EACH ROW
20005
8674
    EXECUTE PROCEDURE bug_update_latest_patch_uploaded_on_delete();
20006
8675
 
20007
 
 
20008
8676
CREATE TRIGGER bug_latest_patch_uploaded_on_insert_update_t
20009
8677
    AFTER INSERT OR UPDATE ON bugattachment
20010
8678
    FOR EACH ROW
20011
8679
    EXECUTE PROCEDURE bug_update_latest_patch_uploaded_on_insert_update();
20012
8680
 
20013
 
 
20014
 
CREATE TRIGGER bug_maintain_bug_summary_trigger
20015
 
    AFTER DELETE OR UPDATE ON bug
20016
 
    FOR EACH ROW
20017
 
    EXECUTE PROCEDURE bug_maintain_bug_summary();
20018
 
 
20019
 
 
20020
 
CREATE TRIGGER bug_to_bugtask_heat
20021
 
    AFTER UPDATE ON bug
20022
 
    FOR EACH ROW
20023
 
    EXECUTE PROCEDURE bug_update_heat_copy_to_bugtask();
20024
 
 
20025
 
 
20026
 
CREATE TRIGGER bugmessage__owner__mirror
20027
 
    AFTER INSERT OR UPDATE ON bugmessage
20028
 
    FOR EACH ROW
20029
 
    EXECUTE PROCEDURE bugmessage_copy_owner_from_message();
20030
 
 
20031
 
 
20032
 
CREATE TRIGGER bugsubscription_maintain_bug_summary_after_trigger
20033
 
    AFTER INSERT OR DELETE OR UPDATE ON bugsubscription
20034
 
    FOR EACH ROW
20035
 
    EXECUTE PROCEDURE bugsubscription_maintain_bug_summary();
20036
 
 
20037
 
 
20038
 
CREATE TRIGGER bugsubscription_maintain_bug_summary_before_trigger
20039
 
    BEFORE INSERT OR DELETE OR UPDATE ON bugsubscription
20040
 
    FOR EACH ROW
20041
 
    EXECUTE PROCEDURE bugsubscription_maintain_bug_summary();
20042
 
 
20043
 
 
20044
 
CREATE TRIGGER bugtag_maintain_bug_summary_after_trigger
20045
 
    AFTER INSERT OR DELETE OR UPDATE ON bugtag
20046
 
    FOR EACH ROW
20047
 
    EXECUTE PROCEDURE bugtag_maintain_bug_summary();
20048
 
 
20049
 
 
20050
 
CREATE TRIGGER bugtag_maintain_bug_summary_before_trigger
20051
 
    BEFORE INSERT OR DELETE OR UPDATE ON bugtag
20052
 
    FOR EACH ROW
20053
 
    EXECUTE PROCEDURE bugtag_maintain_bug_summary();
20054
 
 
20055
 
 
20056
 
CREATE TRIGGER bugtask_maintain_bug_summary_after_trigger
20057
 
    AFTER INSERT OR DELETE OR UPDATE ON bugtask
20058
 
    FOR EACH ROW
20059
 
    EXECUTE PROCEDURE bugtask_maintain_bug_summary();
20060
 
 
20061
 
 
20062
 
CREATE TRIGGER bugtask_maintain_bug_summary_before_trigger
20063
 
    BEFORE INSERT OR DELETE OR UPDATE ON bugtask
20064
 
    FOR EACH ROW
20065
 
    EXECUTE PROCEDURE bugtask_maintain_bug_summary();
20066
 
 
20067
 
 
20068
 
CREATE TRIGGER lp_mirror_openididentifier_del_t
20069
 
    AFTER DELETE ON openididentifier
20070
 
    FOR EACH ROW
20071
 
    EXECUTE PROCEDURE lp_mirror_openididentifier_del();
20072
 
 
20073
 
 
20074
 
CREATE TRIGGER lp_mirror_openididentifier_ins_t
20075
 
    AFTER INSERT ON openididentifier
20076
 
    FOR EACH ROW
20077
 
    EXECUTE PROCEDURE lp_mirror_openididentifier_ins();
20078
 
 
20079
 
 
20080
 
CREATE TRIGGER lp_mirror_openididentifier_upd_t
20081
 
    AFTER UPDATE ON openididentifier
20082
 
    FOR EACH ROW
20083
 
    EXECUTE PROCEDURE lp_mirror_openididentifier_upd();
20084
 
 
 
8681
CREATE TRIGGER lp_mirror_account_del_t
 
8682
    AFTER DELETE ON account
 
8683
    FOR EACH ROW
 
8684
    EXECUTE PROCEDURE lp_mirror_del();
 
8685
 
 
8686
CREATE TRIGGER lp_mirror_account_ins_t
 
8687
    AFTER INSERT ON account
 
8688
    FOR EACH ROW
 
8689
    EXECUTE PROCEDURE lp_mirror_account_ins();
 
8690
 
 
8691
CREATE TRIGGER lp_mirror_account_upd_t
 
8692
    AFTER UPDATE ON account
 
8693
    FOR EACH ROW
 
8694
    EXECUTE PROCEDURE lp_mirror_account_upd();
20085
8695
 
20086
8696
CREATE TRIGGER lp_mirror_person_del_t
20087
8697
    AFTER DELETE ON person
20088
8698
    FOR EACH ROW
20089
8699
    EXECUTE PROCEDURE lp_mirror_del();
20090
8700
 
20091
 
 
20092
8701
CREATE TRIGGER lp_mirror_person_ins_t
20093
8702
    AFTER INSERT ON person
20094
8703
    FOR EACH ROW
20095
8704
    EXECUTE PROCEDURE lp_mirror_person_ins();
20096
8705
 
20097
 
 
20098
8706
CREATE TRIGGER lp_mirror_person_upd_t
20099
8707
    AFTER UPDATE ON person
20100
8708
    FOR EACH ROW
20101
8709
    EXECUTE PROCEDURE lp_mirror_person_upd();
20102
8710
 
20103
 
 
20104
8711
CREATE TRIGGER lp_mirror_personlocation_del_t
20105
8712
    AFTER DELETE ON teamparticipation
20106
8713
    FOR EACH ROW
20107
8714
    EXECUTE PROCEDURE lp_mirror_del();
20108
8715
 
20109
 
 
20110
8716
CREATE TRIGGER lp_mirror_personlocation_ins_t
20111
8717
    AFTER INSERT ON personlocation
20112
8718
    FOR EACH ROW
20113
8719
    EXECUTE PROCEDURE lp_mirror_personlocation_ins();
20114
8720
 
20115
 
 
20116
8721
CREATE TRIGGER lp_mirror_personlocation_upd_t
20117
8722
    AFTER UPDATE ON personlocation
20118
8723
    FOR EACH ROW
20119
8724
    EXECUTE PROCEDURE lp_mirror_personlocation_upd();
20120
8725
 
20121
 
 
20122
8726
CREATE TRIGGER lp_mirror_teamparticipation_del_t
20123
8727
    AFTER DELETE ON teamparticipation
20124
8728
    FOR EACH ROW
20125
8729
    EXECUTE PROCEDURE lp_mirror_del();
20126
8730
 
20127
 
 
20128
8731
CREATE TRIGGER lp_mirror_teamparticipation_ins_t
20129
8732
    AFTER INSERT ON teamparticipation
20130
8733
    FOR EACH ROW
20131
8734
    EXECUTE PROCEDURE lp_mirror_teamparticipation_ins();
20132
8735
 
20133
 
 
20134
8736
CREATE TRIGGER lp_mirror_teamparticipation_upd_t
20135
8737
    AFTER UPDATE ON teamparticipation
20136
8738
    FOR EACH ROW
20137
8739
    EXECUTE PROCEDURE lp_mirror_teamparticipation_upd();
20138
8740
 
20139
 
 
20140
 
CREATE TRIGGER maintain_branch_transitive_privacy_t
20141
 
    AFTER INSERT OR UPDATE ON branch
20142
 
    FOR EACH ROW
20143
 
    EXECUTE PROCEDURE maintain_transitively_private();
20144
 
 
20145
 
 
20146
 
CREATE TRIGGER message__owner__mirror
20147
 
    AFTER UPDATE ON message
20148
 
    FOR EACH ROW
20149
 
    EXECUTE PROCEDURE message_copy_owner_to_bugmessage();
20150
 
 
20151
 
 
20152
 
CREATE TRIGGER message__owner__mirror__questionmessage
20153
 
    AFTER UPDATE ON message
20154
 
    FOR EACH ROW
20155
 
    EXECUTE PROCEDURE message_copy_owner_to_questionmessage();
20156
 
 
20157
 
 
20158
8741
CREATE TRIGGER mv_branch_distribution_update_t
20159
8742
    AFTER UPDATE ON distribution
20160
8743
    FOR EACH ROW
20161
8744
    EXECUTE PROCEDURE mv_branch_distribution_update();
20162
8745
 
20163
 
 
20164
8746
CREATE TRIGGER mv_branch_distroseries_update_t
20165
8747
    AFTER UPDATE ON distroseries
20166
8748
    FOR EACH ROW
20167
8749
    EXECUTE PROCEDURE mv_branch_distroseries_update();
20168
8750
 
20169
 
 
20170
8751
CREATE TRIGGER mv_branch_person_update_t
20171
8752
    AFTER UPDATE ON person
20172
8753
    FOR EACH ROW
20173
8754
    EXECUTE PROCEDURE mv_branch_person_update();
20174
8755
 
20175
 
 
20176
8756
CREATE TRIGGER mv_branch_product_update_t
20177
8757
    AFTER UPDATE ON product
20178
8758
    FOR EACH ROW
20179
8759
    EXECUTE PROCEDURE mv_branch_product_update();
20180
8760
 
20181
 
 
20182
8761
CREATE TRIGGER mv_pillarname_distribution_t
20183
8762
    AFTER INSERT OR UPDATE ON distribution
20184
8763
    FOR EACH ROW
20185
8764
    EXECUTE PROCEDURE mv_pillarname_distribution();
20186
8765
 
20187
 
 
20188
8766
CREATE TRIGGER mv_pillarname_product_t
20189
8767
    AFTER INSERT OR UPDATE ON product
20190
8768
    FOR EACH ROW
20191
8769
    EXECUTE PROCEDURE mv_pillarname_product();
20192
8770
 
20193
 
 
20194
8771
CREATE TRIGGER mv_pillarname_project_t
20195
8772
    AFTER INSERT OR UPDATE ON project
20196
8773
    FOR EACH ROW
20197
8774
    EXECUTE PROCEDURE mv_pillarname_project();
20198
8775
 
20199
 
 
20200
8776
CREATE TRIGGER mv_pofiletranslator_translationmessage
20201
8777
    AFTER INSERT OR DELETE OR UPDATE ON translationmessage
20202
8778
    FOR EACH ROW
20203
8779
    EXECUTE PROCEDURE mv_pofiletranslator_translationmessage();
20204
8780
 
20205
 
 
20206
8781
CREATE TRIGGER packageset_deleted_trig
20207
8782
    BEFORE DELETE ON packageset
20208
8783
    FOR EACH ROW
20209
8784
    EXECUTE PROCEDURE packageset_deleted_trig();
20210
8785
 
20211
 
 
20212
8786
CREATE TRIGGER packageset_inserted_trig
20213
8787
    AFTER INSERT ON packageset
20214
8788
    FOR EACH ROW
20215
8789
    EXECUTE PROCEDURE packageset_inserted_trig();
20216
8790
 
20217
 
 
20218
8791
CREATE TRIGGER packagesetinclusion_deleted_trig
20219
8792
    BEFORE DELETE ON packagesetinclusion
20220
8793
    FOR EACH ROW
20221
8794
    EXECUTE PROCEDURE packagesetinclusion_deleted_trig();
20222
8795
 
20223
 
 
20224
8796
CREATE TRIGGER packagesetinclusion_inserted_trig
20225
8797
    AFTER INSERT ON packagesetinclusion
20226
8798
    FOR EACH ROW
20227
8799
    EXECUTE PROCEDURE packagesetinclusion_inserted_trig();
20228
8800
 
20229
 
 
20230
 
CREATE TRIGGER questionmessage__owner__mirror
20231
 
    AFTER INSERT OR UPDATE ON questionmessage
20232
 
    FOR EACH ROW
20233
 
    EXECUTE PROCEDURE questionmessage_copy_owner_from_message();
20234
 
 
20235
 
 
20236
8801
CREATE TRIGGER set_bug_message_count_t
20237
8802
    AFTER INSERT OR DELETE OR UPDATE ON bugmessage
20238
8803
    FOR EACH ROW
20239
8804
    EXECUTE PROCEDURE set_bug_message_count();
20240
8805
 
20241
 
 
20242
8806
CREATE TRIGGER set_bug_number_of_duplicates_t
20243
8807
    AFTER INSERT OR DELETE OR UPDATE ON bug
20244
8808
    FOR EACH ROW
20245
8809
    EXECUTE PROCEDURE set_bug_number_of_duplicates();
20246
8810
 
20247
 
 
20248
8811
CREATE TRIGGER set_bug_users_affected_count_t
20249
8812
    AFTER INSERT OR DELETE OR UPDATE ON bugaffectsperson
20250
8813
    FOR EACH ROW
20251
8814
    EXECUTE PROCEDURE set_bug_users_affected_count();
20252
8815
 
20253
 
 
20254
8816
CREATE TRIGGER set_bugtask_date_milestone_set_t
20255
8817
    AFTER INSERT OR UPDATE ON bugtask
20256
8818
    FOR EACH ROW
20257
8819
    EXECUTE PROCEDURE set_bugtask_date_milestone_set();
20258
8820
 
20259
 
 
20260
8821
CREATE TRIGGER set_date_last_message_t
20261
8822
    AFTER INSERT OR DELETE OR UPDATE ON bugmessage
20262
8823
    FOR EACH ROW
20263
8824
    EXECUTE PROCEDURE set_bug_date_last_message();
20264
8825
 
20265
 
 
20266
8826
CREATE TRIGGER set_date_status_set_t
20267
8827
    BEFORE UPDATE ON account
20268
8828
    FOR EACH ROW
20269
8829
    EXECUTE PROCEDURE set_date_status_set();
20270
8830
 
 
8831
CREATE TRIGGER set_normalized_address
 
8832
    BEFORE INSERT OR UPDATE ON shippingrequest
 
8833
    FOR EACH ROW
 
8834
    EXECUTE PROCEDURE set_shipit_normalized_address();
 
8835
 
 
8836
CREATE TRIGGER tsvectorupdate
 
8837
    BEFORE INSERT OR UPDATE ON bugtask
 
8838
    FOR EACH ROW
 
8839
    EXECUTE PROCEDURE ts2.ftiupdate('targetnamecache', 'b', 'statusexplanation', 'c');
20271
8840
 
20272
8841
CREATE TRIGGER tsvectorupdate
20273
8842
    BEFORE INSERT OR UPDATE ON binarypackagerelease
20274
8843
    FOR EACH ROW
20275
8844
    EXECUTE PROCEDURE ts2.ftiupdate('summary', 'b', 'description', 'c');
20276
8845
 
20277
 
 
20278
8846
CREATE TRIGGER tsvectorupdate
20279
8847
    BEFORE INSERT OR UPDATE ON cve
20280
8848
    FOR EACH ROW
20281
8849
    EXECUTE PROCEDURE ts2.ftiupdate('sequence', 'a', 'description', 'b');
20282
8850
 
20283
 
 
20284
8851
CREATE TRIGGER tsvectorupdate
20285
8852
    BEFORE INSERT OR UPDATE ON distroseriespackagecache
20286
8853
    FOR EACH ROW
20287
8854
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'summaries', 'b', 'descriptions', 'c');
20288
8855
 
20289
 
 
20290
8856
CREATE TRIGGER tsvectorupdate
20291
8857
    BEFORE INSERT OR UPDATE ON message
20292
8858
    FOR EACH ROW
20293
8859
    EXECUTE PROCEDURE ts2.ftiupdate('subject', 'b');
20294
8860
 
20295
 
 
20296
8861
CREATE TRIGGER tsvectorupdate
20297
8862
    BEFORE INSERT OR UPDATE ON messagechunk
20298
8863
    FOR EACH ROW
20299
8864
    EXECUTE PROCEDURE ts2.ftiupdate('content', 'c');
20300
8865
 
20301
 
 
20302
8866
CREATE TRIGGER tsvectorupdate
20303
8867
    BEFORE INSERT OR UPDATE ON product
20304
8868
    FOR EACH ROW
20305
8869
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a', 'title', 'b', 'summary', 'c', 'description', 'd');
20306
8870
 
20307
 
 
20308
8871
CREATE TRIGGER tsvectorupdate
20309
8872
    BEFORE INSERT OR UPDATE ON project
20310
8873
    FOR EACH ROW
20311
8874
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a', 'title', 'b', 'summary', 'c', 'description', 'd');
20312
8875
 
 
8876
CREATE TRIGGER tsvectorupdate
 
8877
    BEFORE INSERT OR UPDATE ON shippingrequest
 
8878
    FOR EACH ROW
 
8879
    EXECUTE PROCEDURE ts2.ftiupdate('recipientdisplayname', 'a');
20313
8880
 
20314
8881
CREATE TRIGGER tsvectorupdate
20315
8882
    BEFORE INSERT OR UPDATE ON question
20316
8883
    FOR EACH ROW
20317
8884
    EXECUTE PROCEDURE ts2.ftiupdate('title', 'a', 'description', 'b', 'whiteboard', 'b');
20318
8885
 
20319
 
 
20320
8886
CREATE TRIGGER tsvectorupdate
20321
8887
    BEFORE INSERT OR UPDATE ON bug
20322
8888
    FOR EACH ROW
20323
8889
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'title', 'b', 'description', 'd');
20324
8890
 
20325
 
 
20326
8891
CREATE TRIGGER tsvectorupdate
20327
8892
    BEFORE INSERT OR UPDATE ON person
20328
8893
    FOR EACH ROW
20329
8894
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a');
20330
8895
 
20331
 
 
20332
8896
CREATE TRIGGER tsvectorupdate
20333
8897
    BEFORE INSERT OR UPDATE ON specification
20334
8898
    FOR EACH ROW
20335
8899
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'title', 'a', 'summary', 'b', 'whiteboard', 'd');
20336
8900
 
20337
 
 
20338
8901
CREATE TRIGGER tsvectorupdate
20339
8902
    BEFORE INSERT OR UPDATE ON distribution
20340
8903
    FOR EACH ROW
20341
8904
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a', 'title', 'b', 'summary', 'c', 'description', 'd');
20342
8905
 
20343
 
 
20344
8906
CREATE TRIGGER tsvectorupdate
20345
8907
    BEFORE INSERT OR UPDATE ON distributionsourcepackagecache
20346
8908
    FOR EACH ROW
20347
8909
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'binpkgnames', 'b', 'binpkgsummaries', 'c', 'binpkgdescriptions', 'd', 'changelog', 'd');
20348
8910
 
20349
 
 
20350
8911
CREATE TRIGGER tsvectorupdate
20351
8912
    BEFORE INSERT OR UPDATE ON productreleasefile
20352
8913
    FOR EACH ROW
20353
8914
    EXECUTE PROCEDURE ts2.ftiupdate('description', 'd');
20354
8915
 
20355
 
 
20356
8916
CREATE TRIGGER tsvectorupdate
20357
8917
    BEFORE INSERT OR UPDATE ON faq
20358
8918
    FOR EACH ROW
20359
8919
    EXECUTE PROCEDURE ts2.ftiupdate('title', 'a', 'tags', 'b', 'content', 'd');
20360
8920
 
20361
 
 
20362
8921
CREATE TRIGGER tsvectorupdate
20363
8922
    BEFORE INSERT OR UPDATE ON archive
20364
8923
    FOR EACH ROW
20365
8924
    EXECUTE PROCEDURE ts2.ftiupdate('description', 'a', 'package_description_cache', 'b');
20366
8925
 
20367
 
 
20368
 
CREATE TRIGGER tsvectorupdate
20369
 
    BEFORE INSERT OR UPDATE ON bugtask
20370
 
    FOR EACH ROW
20371
 
    EXECUTE PROCEDURE ts2.ftiupdate('targetnamecache', 'b');
20372
 
 
20373
 
 
20374
8926
CREATE TRIGGER update_branch_name_cache_t
20375
8927
    BEFORE INSERT OR UPDATE ON branch
20376
8928
    FOR EACH ROW
20377
8929
    EXECUTE PROCEDURE update_branch_name_cache();
20378
8930
 
20379
 
 
20380
8931
CREATE TRIGGER you_are_your_own_member
20381
8932
    AFTER INSERT ON person
20382
8933
    FOR EACH ROW
20383
8934
    EXECUTE PROCEDURE you_are_your_own_member();
20384
8935
 
20385
 
 
20386
8936
ALTER TABLE ONLY processor
20387
8937
    ADD CONSTRAINT "$1" FOREIGN KEY (family) REFERENCES processorfamily(id);
20388
8938
 
20389
 
 
20390
8939
ALTER TABLE ONLY builder
20391
8940
    ADD CONSTRAINT "$1" FOREIGN KEY (processor) REFERENCES processor(id);
20392
8941
 
20393
 
 
20394
8942
ALTER TABLE ONLY distribution
20395
8943
    ADD CONSTRAINT "$1" FOREIGN KEY (owner) REFERENCES person(id);
20396
8944
 
20397
 
 
20398
8945
ALTER TABLE ONLY libraryfilealias
20399
8946
    ADD CONSTRAINT "$1" FOREIGN KEY (content) REFERENCES libraryfilecontent(id);
20400
8947
 
20401
 
 
20402
8948
ALTER TABLE ONLY productreleasefile
20403
8949
    ADD CONSTRAINT "$1" FOREIGN KEY (productrelease) REFERENCES productrelease(id);
20404
8950
 
20405
 
 
20406
8951
ALTER TABLE ONLY spokenin
20407
8952
    ADD CONSTRAINT "$1" FOREIGN KEY (language) REFERENCES language(id);
20408
8953
 
 
8954
ALTER TABLE ONLY pocomment
 
8955
    ADD CONSTRAINT "$1" FOREIGN KEY (potemplate) REFERENCES potemplate(id);
 
8956
 
 
8957
ALTER TABLE ONLY posubscription
 
8958
    ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
20409
8959
 
20410
8960
ALTER TABLE ONLY bugsubscription
20411
8961
    ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
20412
8962
 
20413
 
 
20414
8963
ALTER TABLE ONLY bugactivity
20415
8964
    ADD CONSTRAINT "$1" FOREIGN KEY (bug) REFERENCES bug(id);
20416
8965
 
20417
 
 
20418
8966
ALTER TABLE ONLY sshkey
20419
8967
    ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
20420
8968
 
 
8969
ALTER TABLE ONLY pushmirroraccess
 
8970
    ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
20421
8971
 
20422
8972
ALTER TABLE ONLY polloption
20423
8973
    ADD CONSTRAINT "$1" FOREIGN KEY (poll) REFERENCES poll(id);
20424
8974
 
20425
 
 
20426
8975
ALTER TABLE ONLY product
20427
8976
    ADD CONSTRAINT "$1" FOREIGN KEY (bug_supervisor) REFERENCES person(id);
20428
8977
 
 
8978
ALTER TABLE ONLY shipitreport
 
8979
    ADD CONSTRAINT "$1" FOREIGN KEY (csvfile) REFERENCES libraryfilealias(id);
20429
8980
 
20430
8981
ALTER TABLE ONLY country
20431
8982
    ADD CONSTRAINT "$1" FOREIGN KEY (continent) REFERENCES continent(id);
20432
8983
 
20433
 
 
20434
8984
ALTER TABLE ONLY sourcepackagereleasefile
20435
8985
    ADD CONSTRAINT "$1" FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id) ON DELETE CASCADE;
20436
8986
 
20437
 
 
20438
8987
ALTER TABLE ONLY builder
20439
8988
    ADD CONSTRAINT "$2" FOREIGN KEY (owner) REFERENCES person(id);
20440
8989
 
20441
 
 
20442
8990
ALTER TABLE ONLY productreleasefile
20443
8991
    ADD CONSTRAINT "$2" FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
20444
8992
 
20445
 
 
20446
8993
ALTER TABLE ONLY sourcepackagereleasefile
20447
8994
    ADD CONSTRAINT "$2" FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
20448
8995
 
20449
 
 
20450
8996
ALTER TABLE ONLY spokenin
20451
8997
    ADD CONSTRAINT "$2" FOREIGN KEY (country) REFERENCES country(id);
20452
8998
 
 
8999
ALTER TABLE ONLY pocomment
 
9000
    ADD CONSTRAINT "$2" FOREIGN KEY (pomsgid) REFERENCES pomsgid(id);
 
9001
 
 
9002
ALTER TABLE ONLY posubscription
 
9003
    ADD CONSTRAINT "$2" FOREIGN KEY (potemplate) REFERENCES potemplate(id);
20453
9004
 
20454
9005
ALTER TABLE ONLY bugsubscription
20455
9006
    ADD CONSTRAINT "$2" FOREIGN KEY (bug) REFERENCES bug(id);
20456
9007
 
20457
 
 
20458
9008
ALTER TABLE ONLY buildqueue
20459
9009
    ADD CONSTRAINT "$2" FOREIGN KEY (builder) REFERENCES builder(id);
20460
9010
 
20461
 
 
20462
9011
ALTER TABLE ONLY distribution
20463
9012
    ADD CONSTRAINT "$2" FOREIGN KEY (members) REFERENCES person(id);
20464
9013
 
 
9014
ALTER TABLE ONLY pocomment
 
9015
    ADD CONSTRAINT "$3" FOREIGN KEY (language) REFERENCES language(id);
 
9016
 
 
9017
ALTER TABLE ONLY posubscription
 
9018
    ADD CONSTRAINT "$3" FOREIGN KEY (language) REFERENCES language(id);
20465
9019
 
20466
9020
ALTER TABLE ONLY distribution
20467
9021
    ADD CONSTRAINT "$3" FOREIGN KEY (bug_supervisor) REFERENCES person(id);
20468
9022
 
20469
 
 
20470
9023
ALTER TABLE ONLY pofile
20471
9024
    ADD CONSTRAINT "$3" FOREIGN KEY (from_sourcepackagename) REFERENCES sourcepackagename(id);
20472
9025
 
20473
 
 
20474
 
ALTER TABLE ONLY accesspolicy
20475
 
    ADD CONSTRAINT accesspolicy_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
20476
 
 
20477
 
 
20478
 
ALTER TABLE ONLY accesspolicy
20479
 
    ADD CONSTRAINT accesspolicy_product_fkey FOREIGN KEY (product) REFERENCES product(id);
20480
 
 
20481
 
 
20482
 
ALTER TABLE ONLY accesspolicyartifact
20483
 
    ADD CONSTRAINT accesspolicyartifact_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
20484
 
 
20485
 
 
20486
 
ALTER TABLE ONLY accesspolicyartifact
20487
 
    ADD CONSTRAINT accesspolicyartifact_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
20488
 
 
20489
 
 
20490
 
ALTER TABLE ONLY accesspolicyartifact
20491
 
    ADD CONSTRAINT accesspolicyartifact_policy_fkey FOREIGN KEY (policy) REFERENCES accesspolicy(id);
20492
 
 
20493
 
 
20494
 
ALTER TABLE ONLY accesspolicygrant
20495
 
    ADD CONSTRAINT accesspolicygrant_artifact_fkey FOREIGN KEY (artifact) REFERENCES accesspolicyartifact(id);
20496
 
 
20497
 
 
20498
 
ALTER TABLE ONLY accesspolicygrant
20499
 
    ADD CONSTRAINT accesspolicygrant_grantee_fkey FOREIGN KEY (grantee) REFERENCES person(id);
20500
 
 
20501
 
 
20502
 
ALTER TABLE ONLY accesspolicygrant
20503
 
    ADD CONSTRAINT accesspolicygrant_grantor_fkey FOREIGN KEY (grantor) REFERENCES person(id);
20504
 
 
20505
 
 
20506
 
ALTER TABLE ONLY accesspolicygrant
20507
 
    ADD CONSTRAINT accesspolicygrant_policy_fkey FOREIGN KEY (policy) REFERENCES accesspolicy(id);
20508
 
 
 
9026
ALTER TABLE ONLY pocomment
 
9027
    ADD CONSTRAINT "$4" FOREIGN KEY (potranslation) REFERENCES potranslation(id);
 
9028
 
 
9029
ALTER TABLE ONLY pocomment
 
9030
    ADD CONSTRAINT "$5" FOREIGN KEY (person) REFERENCES person(id);
20509
9031
 
20510
9032
ALTER TABLE ONLY accountpassword
20511
9033
    ADD CONSTRAINT accountpassword_account_fkey FOREIGN KEY (account) REFERENCES account(id) ON DELETE CASCADE;
20512
9034
 
20513
 
 
20514
9035
ALTER TABLE ONLY karma
20515
9036
    ADD CONSTRAINT action_fkey FOREIGN KEY (action) REFERENCES karmaaction(id);
20516
9037
 
20517
 
 
20518
9038
ALTER TABLE ONLY announcement
20519
9039
    ADD CONSTRAINT announcement_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
20520
9040
 
20521
 
 
20522
9041
ALTER TABLE ONLY announcement
20523
9042
    ADD CONSTRAINT announcement_product_fkey FOREIGN KEY (product) REFERENCES product(id);
20524
9043
 
20525
 
 
20526
9044
ALTER TABLE ONLY announcement
20527
9045
    ADD CONSTRAINT announcement_project_fkey FOREIGN KEY (project) REFERENCES project(id);
20528
9046
 
20529
 
 
20530
9047
ALTER TABLE ONLY announcement
20531
9048
    ADD CONSTRAINT announcement_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20532
9049
 
20533
 
 
20534
9050
ALTER TABLE ONLY answercontact
20535
9051
    ADD CONSTRAINT answercontact__distribution__fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
20536
9052
 
20537
 
 
20538
9053
ALTER TABLE ONLY answercontact
20539
9054
    ADD CONSTRAINT answercontact__person__fkey FOREIGN KEY (person) REFERENCES person(id);
20540
9055
 
20541
 
 
20542
9056
ALTER TABLE ONLY answercontact
20543
9057
    ADD CONSTRAINT answercontact__product__fkey FOREIGN KEY (product) REFERENCES product(id);
20544
9058
 
20545
 
 
20546
9059
ALTER TABLE ONLY answercontact
20547
9060
    ADD CONSTRAINT answercontact__sourcepackagename__fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
20548
9061
 
20549
 
 
20550
9062
ALTER TABLE ONLY apportjob
20551
9063
    ADD CONSTRAINT apportjob_blob_fkey FOREIGN KEY (blob) REFERENCES temporaryblobstorage(id);
20552
9064
 
20553
 
 
20554
9065
ALTER TABLE ONLY apportjob
20555
9066
    ADD CONSTRAINT apportjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
20556
9067
 
20557
 
 
20558
9068
ALTER TABLE ONLY archive
20559
9069
    ADD CONSTRAINT archive__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
20560
9070
 
20561
 
 
20562
9071
ALTER TABLE ONLY archive
20563
9072
    ADD CONSTRAINT archive__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
20564
9073
 
20565
 
 
20566
9074
ALTER TABLE ONLY archive
20567
9075
    ADD CONSTRAINT archive_signing_key_fkey FOREIGN KEY (signing_key) REFERENCES gpgkey(id);
20568
9076
 
20569
 
 
20570
9077
ALTER TABLE ONLY archivearch
20571
9078
    ADD CONSTRAINT archivearch__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20572
9079
 
20573
 
 
20574
9080
ALTER TABLE ONLY archivearch
20575
9081
    ADD CONSTRAINT archivearch__processorfamily__fk FOREIGN KEY (processorfamily) REFERENCES processorfamily(id);
20576
9082
 
20577
 
 
20578
9083
ALTER TABLE ONLY archiveauthtoken
20579
9084
    ADD CONSTRAINT archiveauthtoken__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20580
9085
 
20581
 
 
20582
9086
ALTER TABLE ONLY archiveauthtoken
20583
9087
    ADD CONSTRAINT archiveauthtoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
20584
9088
 
20585
 
 
20586
9089
ALTER TABLE ONLY archivedependency
20587
9090
    ADD CONSTRAINT archivedependency__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20588
9091
 
20589
 
 
20590
9092
ALTER TABLE ONLY archivedependency
20591
9093
    ADD CONSTRAINT archivedependency__dependency__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20592
9094
 
20593
 
 
20594
9095
ALTER TABLE ONLY archivedependency
20595
9096
    ADD CONSTRAINT archivedependency_component_fkey FOREIGN KEY (component) REFERENCES component(id);
20596
9097
 
20597
 
 
20598
9098
ALTER TABLE ONLY archivejob
20599
9099
    ADD CONSTRAINT archivejob__archive__fk FOREIGN KEY (archive) REFERENCES archive(id);
20600
9100
 
20601
 
 
20602
9101
ALTER TABLE ONLY archivejob
20603
9102
    ADD CONSTRAINT archivejob__job__fk FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
20604
9103
 
20605
 
 
20606
9104
ALTER TABLE ONLY archivepermission
20607
9105
    ADD CONSTRAINT archivepermission__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20608
9106
 
20609
 
 
20610
9107
ALTER TABLE ONLY archivepermission
20611
9108
    ADD CONSTRAINT archivepermission__component__fk FOREIGN KEY (component) REFERENCES component(id);
20612
9109
 
20613
 
 
20614
9110
ALTER TABLE ONLY archivepermission
20615
9111
    ADD CONSTRAINT archivepermission__packageset__fk FOREIGN KEY (packageset) REFERENCES packageset(id);
20616
9112
 
20617
 
 
20618
9113
ALTER TABLE ONLY archivepermission
20619
9114
    ADD CONSTRAINT archivepermission__person__fk FOREIGN KEY (person) REFERENCES person(id);
20620
9115
 
20621
 
 
20622
9116
ALTER TABLE ONLY archivepermission
20623
9117
    ADD CONSTRAINT archivepermission__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
20624
9118
 
20625
 
 
20626
9119
ALTER TABLE ONLY archivesubscriber
20627
9120
    ADD CONSTRAINT archivesubscriber__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20628
9121
 
20629
 
 
20630
9122
ALTER TABLE ONLY archivesubscriber
20631
9123
    ADD CONSTRAINT archivesubscriber_cancelled_by_fkey FOREIGN KEY (cancelled_by) REFERENCES person(id);
20632
9124
 
20633
 
 
20634
9125
ALTER TABLE ONLY archivesubscriber
20635
9126
    ADD CONSTRAINT archivesubscriber_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20636
9127
 
20637
 
 
20638
9128
ALTER TABLE ONLY archivesubscriber
20639
9129
    ADD CONSTRAINT archivesubscriber_subscriber_fkey FOREIGN KEY (subscriber) REFERENCES person(id);
20640
9130
 
 
9131
ALTER TABLE ONLY authtoken
 
9132
    ADD CONSTRAINT authtoken__requester__fk FOREIGN KEY (requester) REFERENCES account(id);
20641
9133
 
20642
9134
ALTER TABLE ONLY binarypackagebuild
20643
9135
    ADD CONSTRAINT binarypackagebuild__distro_arch_series__fk FOREIGN KEY (distro_arch_series) REFERENCES distroarchseries(id);
20644
9136
 
20645
 
 
20646
9137
ALTER TABLE ONLY binarypackagebuild
20647
9138
    ADD CONSTRAINT binarypackagebuild__package_build__fk FOREIGN KEY (package_build) REFERENCES packagebuild(id);
20648
9139
 
20649
 
 
20650
9140
ALTER TABLE ONLY binarypackagebuild
20651
9141
    ADD CONSTRAINT binarypackagebuild__source_package_release__fk FOREIGN KEY (source_package_release) REFERENCES sourcepackagerelease(id);
20652
9142
 
20653
 
 
20654
9143
ALTER TABLE ONLY binarypackagefile
20655
9144
    ADD CONSTRAINT binarypackagefile_binarypackagerelease_fk FOREIGN KEY (binarypackagerelease) REFERENCES binarypackagerelease(id) ON DELETE CASCADE;
20656
9145
 
20657
 
 
20658
9146
ALTER TABLE ONLY binarypackagefile
20659
9147
    ADD CONSTRAINT binarypackagefile_libraryfile_fk FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
20660
9148
 
20661
 
 
20662
 
ALTER TABLE ONLY binarypackagepublishinghistory
20663
 
    ADD CONSTRAINT binarypackagepublishinghistory_binarypackagename_fkey FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
20664
 
 
20665
 
 
20666
9149
ALTER TABLE ONLY binarypackagepublishinghistory
20667
9150
    ADD CONSTRAINT binarypackagepublishinghistory_supersededby_fk FOREIGN KEY (supersededby) REFERENCES binarypackagebuild(id);
20668
9151
 
20669
 
 
20670
9152
ALTER TABLE ONLY binarypackagerelease
20671
9153
    ADD CONSTRAINT binarypackagerelease_binarypackagename_fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
20672
9154
 
20673
 
 
20674
9155
ALTER TABLE ONLY binarypackagerelease
20675
9156
    ADD CONSTRAINT binarypackagerelease_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id) ON DELETE CASCADE;
20676
9157
 
20677
 
 
20678
9158
ALTER TABLE ONLY binarypackagerelease
20679
9159
    ADD CONSTRAINT binarypackagerelease_component_fk FOREIGN KEY (component) REFERENCES component(id);
20680
9160
 
20681
 
 
20682
9161
ALTER TABLE ONLY binarypackagerelease
20683
9162
    ADD CONSTRAINT binarypackagerelease_debug_package_fkey FOREIGN KEY (debug_package) REFERENCES binarypackagerelease(id);
20684
9163
 
20685
 
 
20686
9164
ALTER TABLE ONLY binarypackagerelease
20687
9165
    ADD CONSTRAINT binarypackagerelease_section_fk FOREIGN KEY (section) REFERENCES section(id);
20688
9166
 
20689
 
 
20690
 
ALTER TABLE ONLY binarypackagereleasecontents
20691
 
    ADD CONSTRAINT binarypackagereleasecontents_binarypackagepath_fkey FOREIGN KEY (binarypackagepath) REFERENCES binarypackagepath(id);
20692
 
 
20693
 
 
20694
 
ALTER TABLE ONLY binarypackagereleasecontents
20695
 
    ADD CONSTRAINT binarypackagereleasecontents_binarypackagerelease_fkey FOREIGN KEY (binarypackagerelease) REFERENCES binarypackagerelease(id);
20696
 
 
20697
 
 
20698
9167
ALTER TABLE ONLY binarypackagereleasedownloadcount
20699
9168
    ADD CONSTRAINT binarypackagereleasedownloadcount_archive_fkey FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
20700
9169
 
20701
 
 
20702
9170
ALTER TABLE ONLY binarypackagereleasedownloadcount
20703
9171
    ADD CONSTRAINT binarypackagereleasedownloadcount_binary_package_release_fkey FOREIGN KEY (binary_package_release) REFERENCES binarypackagerelease(id);
20704
9172
 
20705
 
 
20706
9173
ALTER TABLE ONLY binarypackagereleasedownloadcount
20707
9174
    ADD CONSTRAINT binarypackagereleasedownloadcount_country_fkey FOREIGN KEY (country) REFERENCES country(id);
20708
9175
 
20709
 
 
20710
 
ALTER TABLE ONLY branch
20711
 
    ADD CONSTRAINT branch_access_policy_fkey FOREIGN KEY (access_policy) REFERENCES accesspolicy(id);
20712
 
 
 
9176
ALTER TABLE ONLY bounty
 
9177
    ADD CONSTRAINT bounty_claimant_fk FOREIGN KEY (claimant) REFERENCES person(id);
 
9178
 
 
9179
ALTER TABLE ONLY bounty
 
9180
    ADD CONSTRAINT bounty_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
 
9181
 
 
9182
ALTER TABLE ONLY bounty
 
9183
    ADD CONSTRAINT bounty_reviewer_fk FOREIGN KEY (reviewer) REFERENCES person(id);
 
9184
 
 
9185
ALTER TABLE ONLY bountymessage
 
9186
    ADD CONSTRAINT bountymessage_bounty_fk FOREIGN KEY (bounty) REFERENCES bounty(id);
 
9187
 
 
9188
ALTER TABLE ONLY bountymessage
 
9189
    ADD CONSTRAINT bountymessage_message_fk FOREIGN KEY (message) REFERENCES message(id);
 
9190
 
 
9191
ALTER TABLE ONLY bountysubscription
 
9192
    ADD CONSTRAINT bountysubscription_bounty_fk FOREIGN KEY (bounty) REFERENCES bounty(id);
 
9193
 
 
9194
ALTER TABLE ONLY bountysubscription
 
9195
    ADD CONSTRAINT bountysubscription_person_fk FOREIGN KEY (person) REFERENCES person(id);
20713
9196
 
20714
9197
ALTER TABLE ONLY branch
20715
9198
    ADD CONSTRAINT branch_author_fk FOREIGN KEY (author) REFERENCES person(id);
20716
9199
 
20717
 
 
20718
9200
ALTER TABLE ONLY branch
20719
9201
    ADD CONSTRAINT branch_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
20720
9202
 
20721
 
 
20722
 
ALTER TABLE ONLY incrementaldiff
20723
 
    ADD CONSTRAINT branch_merge_proposal_fk FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id) ON DELETE CASCADE;
20724
 
 
20725
 
 
20726
9203
ALTER TABLE ONLY branch
20727
 
    ADD CONSTRAINT branch_merge_queue_fkey FOREIGN KEY (merge_queue) REFERENCES branchmergequeue(id);
20728
 
 
 
9204
    ADD CONSTRAINT branch_merge_robot_fkey FOREIGN KEY (merge_robot) REFERENCES branchmergerobot(id);
20729
9205
 
20730
9206
ALTER TABLE ONLY branch
20731
9207
    ADD CONSTRAINT branch_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
20732
9208
 
20733
 
 
20734
9209
ALTER TABLE ONLY branch
20735
9210
    ADD CONSTRAINT branch_product_fk FOREIGN KEY (product) REFERENCES product(id);
20736
9211
 
20737
 
 
20738
9212
ALTER TABLE ONLY branch
20739
9213
    ADD CONSTRAINT branch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20740
9214
 
20741
 
 
20742
9215
ALTER TABLE ONLY branch
20743
9216
    ADD CONSTRAINT branch_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
20744
9217
 
20745
 
 
20746
9218
ALTER TABLE ONLY branch
20747
9219
    ADD CONSTRAINT branch_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
20748
9220
 
20749
 
 
20750
9221
ALTER TABLE ONLY branch
20751
9222
    ADD CONSTRAINT branch_stacked_on_fkey FOREIGN KEY (stacked_on) REFERENCES branch(id);
20752
9223
 
20753
 
 
20754
9224
ALTER TABLE ONLY branchjob
20755
9225
    ADD CONSTRAINT branchjob_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
20756
9226
 
20757
 
 
20758
9227
ALTER TABLE ONLY branchjob
20759
9228
    ADD CONSTRAINT branchjob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
20760
9229
 
20761
 
 
20762
9230
ALTER TABLE ONLY branchmergeproposal
20763
9231
    ADD CONSTRAINT branchmergeproposal_dependent_branch_fkey FOREIGN KEY (dependent_branch) REFERENCES branch(id);
20764
9232
 
20765
 
 
20766
9233
ALTER TABLE ONLY branchmergeproposal
20767
9234
    ADD CONSTRAINT branchmergeproposal_merge_diff_fkey FOREIGN KEY (merge_diff) REFERENCES previewdiff(id);
20768
9235
 
20769
 
 
20770
9236
ALTER TABLE ONLY branchmergeproposal
20771
9237
    ADD CONSTRAINT branchmergeproposal_merge_log_file_fkey FOREIGN KEY (merge_log_file) REFERENCES libraryfilealias(id);
20772
9238
 
20773
 
 
20774
9239
ALTER TABLE ONLY branchmergeproposal
20775
9240
    ADD CONSTRAINT branchmergeproposal_merge_reporter_fkey FOREIGN KEY (merge_reporter) REFERENCES person(id);
20776
9241
 
20777
 
 
20778
9242
ALTER TABLE ONLY branchmergeproposal
20779
9243
    ADD CONSTRAINT branchmergeproposal_merger_fkey FOREIGN KEY (merger) REFERENCES person(id);
20780
9244
 
20781
 
 
20782
9245
ALTER TABLE ONLY branchmergeproposal
20783
9246
    ADD CONSTRAINT branchmergeproposal_queuer_fkey FOREIGN KEY (queuer) REFERENCES person(id);
20784
9247
 
20785
 
 
20786
9248
ALTER TABLE ONLY branchmergeproposal
20787
9249
    ADD CONSTRAINT branchmergeproposal_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20788
9250
 
 
9251
ALTER TABLE ONLY branchmergeproposal
 
9252
    ADD CONSTRAINT branchmergeproposal_review_diff_fkey FOREIGN KEY (review_diff) REFERENCES staticdiff(id);
20789
9253
 
20790
9254
ALTER TABLE ONLY branchmergeproposal
20791
9255
    ADD CONSTRAINT branchmergeproposal_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
20792
9256
 
20793
 
 
20794
9257
ALTER TABLE ONLY branchmergeproposal
20795
9258
    ADD CONSTRAINT branchmergeproposal_source_branch_fkey FOREIGN KEY (source_branch) REFERENCES branch(id);
20796
9259
 
20797
 
 
20798
9260
ALTER TABLE ONLY branchmergeproposal
20799
9261
    ADD CONSTRAINT branchmergeproposal_superseded_by_fkey FOREIGN KEY (superseded_by) REFERENCES branchmergeproposal(id);
20800
9262
 
20801
 
 
20802
9263
ALTER TABLE ONLY branchmergeproposal
20803
9264
    ADD CONSTRAINT branchmergeproposal_target_branch_fkey FOREIGN KEY (target_branch) REFERENCES branch(id);
20804
9265
 
20805
 
 
20806
9266
ALTER TABLE ONLY branchmergeproposaljob
20807
9267
    ADD CONSTRAINT branchmergeproposaljob_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
20808
9268
 
20809
 
 
20810
9269
ALTER TABLE ONLY branchmergeproposaljob
20811
9270
    ADD CONSTRAINT branchmergeproposaljob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
20812
9271
 
20813
 
 
20814
 
ALTER TABLE ONLY branchmergequeue
20815
 
    ADD CONSTRAINT branchmergequeue_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
20816
 
 
20817
 
 
20818
 
ALTER TABLE ONLY branchmergequeue
20819
 
    ADD CONSTRAINT branchmergequeue_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20820
 
 
 
9272
ALTER TABLE ONLY branchmergerobot
 
9273
    ADD CONSTRAINT branchmergerobot_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
 
9274
 
 
9275
ALTER TABLE ONLY branchmergerobot
 
9276
    ADD CONSTRAINT branchmergerobot_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20821
9277
 
20822
9278
ALTER TABLE ONLY branchrevision
20823
9279
    ADD CONSTRAINT branchrevision__branch__fk FOREIGN KEY (branch) REFERENCES branch(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
20824
9280
 
20825
 
 
20826
9281
ALTER TABLE ONLY branchrevision
20827
9282
    ADD CONSTRAINT branchrevision__revision__fk FOREIGN KEY (revision) REFERENCES revision(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
20828
9283
 
20829
 
 
20830
9284
ALTER TABLE ONLY branchsubscription
20831
9285
    ADD CONSTRAINT branchsubscription_branch_fk FOREIGN KEY (branch) REFERENCES branch(id);
20832
9286
 
20833
 
 
20834
9287
ALTER TABLE ONLY branchsubscription
20835
9288
    ADD CONSTRAINT branchsubscription_person_fk FOREIGN KEY (person) REFERENCES person(id);
20836
9289
 
20837
 
 
20838
9290
ALTER TABLE ONLY branchsubscription
20839
9291
    ADD CONSTRAINT branchsubscription_subscribed_by_fkey FOREIGN KEY (subscribed_by) REFERENCES person(id);
20840
9292
 
20841
 
 
20842
9293
ALTER TABLE ONLY branchvisibilitypolicy
20843
9294
    ADD CONSTRAINT branchvisibilitypolicy_product_fkey FOREIGN KEY (product) REFERENCES product(id);
20844
9295
 
20845
 
 
20846
9296
ALTER TABLE ONLY branchvisibilitypolicy
20847
9297
    ADD CONSTRAINT branchvisibilitypolicy_project_fkey FOREIGN KEY (project) REFERENCES project(id);
20848
9298
 
20849
 
 
20850
9299
ALTER TABLE ONLY branchvisibilitypolicy
20851
9300
    ADD CONSTRAINT branchvisibilitypolicy_team_fkey FOREIGN KEY (team) REFERENCES person(id);
20852
9301
 
20853
 
 
20854
9302
ALTER TABLE ONLY bug
20855
9303
    ADD CONSTRAINT bug__who_made_private__fk FOREIGN KEY (who_made_private) REFERENCES person(id);
20856
9304
 
20857
 
 
20858
 
ALTER TABLE ONLY bug
20859
 
    ADD CONSTRAINT bug_access_policy_fkey FOREIGN KEY (access_policy) REFERENCES accesspolicy(id);
20860
 
 
20861
 
 
20862
9305
ALTER TABLE ONLY bug
20863
9306
    ADD CONSTRAINT bug_duplicateof_fk FOREIGN KEY (duplicateof) REFERENCES bug(id);
20864
9307
 
20865
 
 
20866
9308
ALTER TABLE ONLY bug
20867
9309
    ADD CONSTRAINT bug_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
20868
9310
 
20869
 
 
20870
9311
ALTER TABLE ONLY bugactivity
20871
9312
    ADD CONSTRAINT bugactivity__person__fk FOREIGN KEY (person) REFERENCES person(id);
20872
9313
 
20873
 
 
20874
9314
ALTER TABLE ONLY bugaffectsperson
20875
9315
    ADD CONSTRAINT bugaffectsperson_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
20876
9316
 
20877
 
 
20878
9317
ALTER TABLE ONLY bugaffectsperson
20879
9318
    ADD CONSTRAINT bugaffectsperson_person_fkey FOREIGN KEY (person) REFERENCES person(id);
20880
9319
 
20881
 
 
20882
9320
ALTER TABLE ONLY bugattachment
20883
9321
    ADD CONSTRAINT bugattachment_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
20884
9322
 
20885
 
 
20886
9323
ALTER TABLE ONLY bugattachment
20887
9324
    ADD CONSTRAINT bugattachment_libraryfile_fk FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
20888
9325
 
20889
 
 
20890
9326
ALTER TABLE ONLY bugattachment
20891
9327
    ADD CONSTRAINT bugattachment_message_fk FOREIGN KEY (message) REFERENCES message(id);
20892
9328
 
20893
 
 
20894
9329
ALTER TABLE ONLY bugbranch
20895
9330
    ADD CONSTRAINT bugbranch_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
20896
9331
 
20897
 
 
20898
9332
ALTER TABLE ONLY bugbranch
20899
9333
    ADD CONSTRAINT bugbranch_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
20900
9334
 
20901
 
 
20902
9335
ALTER TABLE ONLY bugbranch
20903
9336
    ADD CONSTRAINT bugbranch_fixed_in_revision_fkey FOREIGN KEY (revision_hint) REFERENCES revision(id);
20904
9337
 
20905
 
 
20906
9338
ALTER TABLE ONLY bugbranch
20907
9339
    ADD CONSTRAINT bugbranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
20908
9340
 
20909
 
 
20910
9341
ALTER TABLE ONLY bugcve
20911
9342
    ADD CONSTRAINT bugcve_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
20912
9343
 
20913
 
 
20914
9344
ALTER TABLE ONLY bugcve
20915
9345
    ADD CONSTRAINT bugcve_cve_fk FOREIGN KEY (cve) REFERENCES cve(id);
20916
9346
 
20917
 
 
20918
9347
ALTER TABLE ONLY bugjob
20919
9348
    ADD CONSTRAINT bugjob_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
20920
9349
 
20921
 
 
20922
9350
ALTER TABLE ONLY bugjob
20923
9351
    ADD CONSTRAINT bugjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
20924
9352
 
20925
 
 
20926
9353
ALTER TABLE ONLY bugmessage
20927
9354
    ADD CONSTRAINT bugmessage__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
20928
9355
 
20929
 
 
20930
9356
ALTER TABLE ONLY bugmessage
20931
9357
    ADD CONSTRAINT bugmessage_bugwatch_fkey FOREIGN KEY (bugwatch) REFERENCES bugwatch(id);
20932
9358
 
20933
 
 
20934
9359
ALTER TABLE ONLY bugmessage
20935
9360
    ADD CONSTRAINT bugmessage_message_fk FOREIGN KEY (message) REFERENCES message(id);
20936
9361
 
20937
 
 
20938
 
ALTER TABLE ONLY bugmute
20939
 
    ADD CONSTRAINT bugmute_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id) ON DELETE CASCADE;
20940
 
 
20941
 
 
20942
 
ALTER TABLE ONLY bugmute
20943
 
    ADD CONSTRAINT bugmute_person_fkey FOREIGN KEY (person) REFERENCES person(id) ON DELETE CASCADE;
20944
 
 
20945
 
 
20946
9362
ALTER TABLE ONLY bugnomination
20947
9363
    ADD CONSTRAINT bugnomination__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
20948
9364
 
20949
 
 
20950
9365
ALTER TABLE ONLY bugnomination
20951
9366
    ADD CONSTRAINT bugnomination__decider__fk FOREIGN KEY (decider) REFERENCES person(id);
20952
9367
 
20953
 
 
20954
9368
ALTER TABLE ONLY bugnomination
20955
9369
    ADD CONSTRAINT bugnomination__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
20956
9370
 
20957
 
 
20958
9371
ALTER TABLE ONLY bugnomination
20959
9372
    ADD CONSTRAINT bugnomination__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
20960
9373
 
20961
 
 
20962
9374
ALTER TABLE ONLY bugnomination
20963
9375
    ADD CONSTRAINT bugnomination__productseries__fk FOREIGN KEY (productseries) REFERENCES productseries(id);
20964
9376
 
20965
 
 
20966
 
ALTER TABLE ONLY bugnotification
20967
 
    ADD CONSTRAINT bugnotification_activity_fkey FOREIGN KEY (activity) REFERENCES bugactivity(id);
20968
 
 
20969
 
 
20970
9377
ALTER TABLE ONLY bugnotification
20971
9378
    ADD CONSTRAINT bugnotification_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
20972
9379
 
20973
 
 
20974
9380
ALTER TABLE ONLY bugnotification
20975
9381
    ADD CONSTRAINT bugnotification_message_fkey FOREIGN KEY (message) REFERENCES message(id);
20976
9382
 
20977
 
 
20978
9383
ALTER TABLE ONLY bugnotificationarchive
20979
9384
    ADD CONSTRAINT bugnotificationarchive__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
20980
9385
 
20981
 
 
20982
9386
ALTER TABLE ONLY bugnotificationarchive
20983
9387
    ADD CONSTRAINT bugnotificationarchive__message__fk FOREIGN KEY (message) REFERENCES message(id);
20984
9388
 
20985
 
 
20986
9389
ALTER TABLE ONLY bugnotificationattachment
20987
9390
    ADD CONSTRAINT bugnotificationattachment__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotification(id) ON DELETE CASCADE;
20988
9391
 
20989
 
 
20990
9392
ALTER TABLE ONLY bugnotificationattachment
20991
9393
    ADD CONSTRAINT bugnotificationattachment_message_fkey FOREIGN KEY (message) REFERENCES message(id);
20992
9394
 
20993
 
 
20994
 
ALTER TABLE ONLY bugnotificationfilter
20995
 
    ADD CONSTRAINT bugnotificationfilter_bug_notification_fkey FOREIGN KEY (bug_notification) REFERENCES bugnotification(id) ON DELETE CASCADE;
20996
 
 
20997
 
 
20998
 
ALTER TABLE ONLY bugnotificationfilter
20999
 
    ADD CONSTRAINT bugnotificationfilter_bug_subscription_filter_fkey FOREIGN KEY (bug_subscription_filter) REFERENCES bugsubscriptionfilter(id) ON DELETE CASCADE;
21000
 
 
21001
 
 
21002
9395
ALTER TABLE ONLY bugnotificationrecipient
21003
9396
    ADD CONSTRAINT bugnotificationrecipient__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotification(id) ON DELETE CASCADE;
21004
9397
 
21005
 
 
21006
9398
ALTER TABLE ONLY bugnotificationrecipient
21007
9399
    ADD CONSTRAINT bugnotificationrecipient_person_fkey FOREIGN KEY (person) REFERENCES person(id);
21008
9400
 
21009
 
 
21010
9401
ALTER TABLE ONLY bugnotificationrecipientarchive
21011
9402
    ADD CONSTRAINT bugnotificationrecipientarchive__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotificationarchive(id);
21012
9403
 
21013
 
 
21014
9404
ALTER TABLE ONLY bugnotificationrecipientarchive
21015
9405
    ADD CONSTRAINT bugnotificationrecipientarchive__person__fk FOREIGN KEY (person) REFERENCES person(id);
21016
9406
 
 
9407
ALTER TABLE ONLY bugpackageinfestation
 
9408
    ADD CONSTRAINT bugpackageinfestation_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
 
9409
 
 
9410
ALTER TABLE ONLY bugpackageinfestation
 
9411
    ADD CONSTRAINT bugpackageinfestation_creator_fk FOREIGN KEY (creator) REFERENCES person(id);
 
9412
 
 
9413
ALTER TABLE ONLY bugpackageinfestation
 
9414
    ADD CONSTRAINT bugpackageinfestation_lastmodifiedby_fk FOREIGN KEY (lastmodifiedby) REFERENCES person(id);
 
9415
 
 
9416
ALTER TABLE ONLY bugpackageinfestation
 
9417
    ADD CONSTRAINT bugpackageinfestation_sourcepackagerelease_fk FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id);
 
9418
 
 
9419
ALTER TABLE ONLY bugpackageinfestation
 
9420
    ADD CONSTRAINT bugpackageinfestation_verifiedby_fk FOREIGN KEY (verifiedby) REFERENCES person(id);
 
9421
 
 
9422
ALTER TABLE ONLY bugproductinfestation
 
9423
    ADD CONSTRAINT bugproductinfestation_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
 
9424
 
 
9425
ALTER TABLE ONLY bugproductinfestation
 
9426
    ADD CONSTRAINT bugproductinfestation_creator_fk FOREIGN KEY (creator) REFERENCES person(id);
 
9427
 
 
9428
ALTER TABLE ONLY bugproductinfestation
 
9429
    ADD CONSTRAINT bugproductinfestation_lastmodifiedby_fk FOREIGN KEY (lastmodifiedby) REFERENCES person(id);
 
9430
 
 
9431
ALTER TABLE ONLY bugproductinfestation
 
9432
    ADD CONSTRAINT bugproductinfestation_productrelease_fk FOREIGN KEY (productrelease) REFERENCES productrelease(id);
 
9433
 
 
9434
ALTER TABLE ONLY bugproductinfestation
 
9435
    ADD CONSTRAINT bugproductinfestation_verifiedby_fk FOREIGN KEY (verifiedby) REFERENCES person(id);
21017
9436
 
21018
9437
ALTER TABLE ONLY bugsubscription
21019
9438
    ADD CONSTRAINT bugsubscription_subscribed_by_fkey FOREIGN KEY (subscribed_by) REFERENCES person(id);
21020
9439
 
21021
 
 
21022
 
ALTER TABLE ONLY bugsubscriptionfilter
21023
 
    ADD CONSTRAINT bugsubscriptionfilter__structuralsubscription__fk FOREIGN KEY (structuralsubscription) REFERENCES structuralsubscription(id) ON DELETE CASCADE;
21024
 
 
21025
 
 
21026
 
ALTER TABLE ONLY bugsubscriptionfilterimportance
21027
 
    ADD CONSTRAINT bugsubscriptionfilterimportance_filter_fkey FOREIGN KEY (filter) REFERENCES bugsubscriptionfilter(id);
21028
 
 
21029
 
 
21030
 
ALTER TABLE ONLY bugsubscriptionfiltermute
21031
 
    ADD CONSTRAINT bugsubscriptionfiltermute_filter_fkey FOREIGN KEY (filter) REFERENCES bugsubscriptionfilter(id) ON DELETE CASCADE;
21032
 
 
21033
 
 
21034
 
ALTER TABLE ONLY bugsubscriptionfiltermute
21035
 
    ADD CONSTRAINT bugsubscriptionfiltermute_person_fkey FOREIGN KEY (person) REFERENCES person(id) ON DELETE CASCADE;
21036
 
 
21037
 
 
21038
 
ALTER TABLE ONLY bugsubscriptionfilterstatus
21039
 
    ADD CONSTRAINT bugsubscriptionfilterstatus_filter_fkey FOREIGN KEY (filter) REFERENCES bugsubscriptionfilter(id);
21040
 
 
21041
 
 
21042
 
ALTER TABLE ONLY bugsubscriptionfiltertag
21043
 
    ADD CONSTRAINT bugsubscriptionfiltertag_filter_fkey FOREIGN KEY (filter) REFERENCES bugsubscriptionfilter(id);
21044
 
 
21045
 
 
21046
 
ALTER TABLE ONLY bugsummary
21047
 
    ADD CONSTRAINT bugsummary_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id) ON DELETE CASCADE;
21048
 
 
21049
 
 
21050
 
ALTER TABLE ONLY bugsummary
21051
 
    ADD CONSTRAINT bugsummary_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id) ON DELETE CASCADE;
21052
 
 
21053
 
 
21054
 
ALTER TABLE ONLY bugsummary
21055
 
    ADD CONSTRAINT bugsummary_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id) ON DELETE CASCADE;
21056
 
 
21057
 
 
21058
 
ALTER TABLE ONLY bugsummary
21059
 
    ADD CONSTRAINT bugsummary_product_fkey FOREIGN KEY (product) REFERENCES product(id) ON DELETE CASCADE;
21060
 
 
21061
 
 
21062
 
ALTER TABLE ONLY bugsummary
21063
 
    ADD CONSTRAINT bugsummary_productseries_fkey FOREIGN KEY (productseries) REFERENCES productseries(id) ON DELETE CASCADE;
21064
 
 
21065
 
 
21066
 
ALTER TABLE ONLY bugsummary
21067
 
    ADD CONSTRAINT bugsummary_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id) ON DELETE CASCADE;
21068
 
 
21069
 
 
21070
 
ALTER TABLE ONLY bugsummaryjournal
21071
 
    ADD CONSTRAINT bugsummaryjournal_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id) ON DELETE CASCADE;
21072
 
 
21073
 
 
21074
 
ALTER TABLE ONLY bugsummaryjournal
21075
 
    ADD CONSTRAINT bugsummaryjournal_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id) ON DELETE CASCADE;
21076
 
 
21077
 
 
21078
 
ALTER TABLE ONLY bugsummaryjournal
21079
 
    ADD CONSTRAINT bugsummaryjournal_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id) ON DELETE CASCADE;
21080
 
 
21081
 
 
21082
 
ALTER TABLE ONLY bugsummaryjournal
21083
 
    ADD CONSTRAINT bugsummaryjournal_product_fkey FOREIGN KEY (product) REFERENCES product(id) ON DELETE CASCADE;
21084
 
 
21085
 
 
21086
 
ALTER TABLE ONLY bugsummaryjournal
21087
 
    ADD CONSTRAINT bugsummaryjournal_productseries_fkey FOREIGN KEY (productseries) REFERENCES productseries(id) ON DELETE CASCADE;
21088
 
 
21089
 
 
21090
 
ALTER TABLE ONLY bugsummaryjournal
21091
 
    ADD CONSTRAINT bugsummaryjournal_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id) ON DELETE CASCADE;
21092
 
 
21093
 
 
21094
 
ALTER TABLE ONLY bugsummary
21095
 
    ADD CONSTRAINT bugsummaryjournal_viewed_by_fkey FOREIGN KEY (viewed_by) REFERENCES person(id) ON DELETE CASCADE;
21096
 
 
21097
 
 
21098
9440
ALTER TABLE ONLY bugtask
21099
9441
    ADD CONSTRAINT bugtask__assignee__fk FOREIGN KEY (assignee) REFERENCES person(id);
21100
9442
 
21101
 
 
21102
9443
ALTER TABLE ONLY bugtask
21103
9444
    ADD CONSTRAINT bugtask__binarypackagename__fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
21104
9445
 
21105
 
 
21106
9446
ALTER TABLE ONLY bugtask
21107
9447
    ADD CONSTRAINT bugtask__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
21108
9448
 
21109
 
 
21110
9449
ALTER TABLE ONLY bugtask
21111
9450
    ADD CONSTRAINT bugtask__bugwatch__fk FOREIGN KEY (bugwatch) REFERENCES bugwatch(id);
21112
9451
 
21113
 
 
21114
9452
ALTER TABLE ONLY bugtask
21115
9453
    ADD CONSTRAINT bugtask__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21116
9454
 
21117
 
 
21118
9455
ALTER TABLE ONLY bugtask
21119
9456
    ADD CONSTRAINT bugtask__distribution__milestone__fk FOREIGN KEY (distribution, milestone) REFERENCES milestone(distribution, id);
21120
9457
 
21121
 
 
21122
9458
ALTER TABLE ONLY bugtask
21123
9459
    ADD CONSTRAINT bugtask__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21124
9460
 
21125
 
 
21126
9461
ALTER TABLE ONLY bugtask
21127
9462
    ADD CONSTRAINT bugtask__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
21128
9463
 
21129
 
 
21130
9464
ALTER TABLE ONLY bugtask
21131
9465
    ADD CONSTRAINT bugtask__product__fk FOREIGN KEY (product) REFERENCES product(id);
21132
9466
 
21133
 
 
21134
9467
ALTER TABLE ONLY bugtask
21135
9468
    ADD CONSTRAINT bugtask__product__milestone__fk FOREIGN KEY (product, milestone) REFERENCES milestone(product, id);
21136
9469
 
21137
 
 
21138
9470
ALTER TABLE ONLY bugtask
21139
9471
    ADD CONSTRAINT bugtask__productseries__fk FOREIGN KEY (productseries) REFERENCES productseries(id);
21140
9472
 
21141
 
 
21142
9473
ALTER TABLE ONLY bugtask
21143
9474
    ADD CONSTRAINT bugtask__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21144
9475
 
21145
 
 
21146
9476
ALTER TABLE ONLY bugtracker
21147
9477
    ADD CONSTRAINT bugtracker_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
21148
9478
 
21149
 
 
21150
9479
ALTER TABLE ONLY bugtrackeralias
21151
9480
    ADD CONSTRAINT bugtrackeralias__bugtracker__fk FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
21152
9481
 
21153
 
 
21154
 
ALTER TABLE ONLY bugtrackercomponent
21155
 
    ADD CONSTRAINT bugtrackercomponent_component_group_fkey FOREIGN KEY (component_group) REFERENCES bugtrackercomponentgroup(id);
21156
 
 
21157
 
 
21158
 
ALTER TABLE ONLY bugtrackercomponent
21159
 
    ADD CONSTRAINT bugtrackercomponent_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21160
 
 
21161
 
 
21162
 
ALTER TABLE ONLY bugtrackercomponent
21163
 
    ADD CONSTRAINT bugtrackercomponent_source_package_name_fkey FOREIGN KEY (source_package_name) REFERENCES sourcepackagename(id);
21164
 
 
21165
 
 
21166
 
ALTER TABLE ONLY bugtrackercomponentgroup
21167
 
    ADD CONSTRAINT bugtrackercomponentgroup_bug_tracker_fkey FOREIGN KEY (bug_tracker) REFERENCES bugtracker(id);
21168
 
 
21169
 
 
21170
9482
ALTER TABLE ONLY bugtrackerperson
21171
9483
    ADD CONSTRAINT bugtrackerperson_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
21172
9484
 
21173
 
 
21174
9485
ALTER TABLE ONLY bugtrackerperson
21175
9486
    ADD CONSTRAINT bugtrackerperson_person_fkey FOREIGN KEY (person) REFERENCES person(id);
21176
9487
 
21177
 
 
21178
9488
ALTER TABLE ONLY bugwatch
21179
9489
    ADD CONSTRAINT bugwatch_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
21180
9490
 
21181
 
 
21182
9491
ALTER TABLE ONLY bugwatch
21183
9492
    ADD CONSTRAINT bugwatch_bugtracker_fk FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
21184
9493
 
21185
 
 
21186
9494
ALTER TABLE ONLY bugwatch
21187
9495
    ADD CONSTRAINT bugwatch_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
21188
9496
 
21189
 
 
21190
9497
ALTER TABLE ONLY bugwatchactivity
21191
9498
    ADD CONSTRAINT bugwatchactivity_bug_watch_fkey FOREIGN KEY (bug_watch) REFERENCES bugwatch(id);
21192
9499
 
21193
 
 
21194
9500
ALTER TABLE ONLY buildfarmjob
21195
9501
    ADD CONSTRAINT buildfarmjob__builder__fk FOREIGN KEY (builder) REFERENCES builder(id);
21196
9502
 
21197
 
 
21198
9503
ALTER TABLE ONLY buildfarmjob
21199
9504
    ADD CONSTRAINT buildfarmjob__log__fk FOREIGN KEY (log) REFERENCES libraryfilealias(id);
21200
9505
 
21201
 
 
21202
9506
ALTER TABLE ONLY buildfarmjob
21203
9507
    ADD CONSTRAINT buildfarmjob__processor__fk FOREIGN KEY (processor) REFERENCES processor(id);
21204
9508
 
21205
 
 
21206
9509
ALTER TABLE ONLY buildpackagejob
21207
9510
    ADD CONSTRAINT buildpackagejob__job__fk FOREIGN KEY (job) REFERENCES job(id);
21208
9511
 
21209
 
 
21210
9512
ALTER TABLE ONLY buildpackagejob
21211
9513
    ADD CONSTRAINT buildpackagejob_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id);
21212
9514
 
21213
 
 
21214
9515
ALTER TABLE ONLY buildqueue
21215
9516
    ADD CONSTRAINT buildqueue__job__fk FOREIGN KEY (job) REFERENCES job(id);
21216
9517
 
21217
 
 
21218
9518
ALTER TABLE ONLY buildqueue
21219
9519
    ADD CONSTRAINT buildqueue__processor__fk FOREIGN KEY (processor) REFERENCES processor(id);
21220
9520
 
21221
 
 
21222
9521
ALTER TABLE ONLY codeimport
21223
9522
    ADD CONSTRAINT codeimport_assignee_fkey FOREIGN KEY (assignee) REFERENCES person(id);
21224
9523
 
21225
 
 
21226
9524
ALTER TABLE ONLY codeimport
21227
9525
    ADD CONSTRAINT codeimport_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
21228
9526
 
21229
 
 
21230
9527
ALTER TABLE ONLY codeimport
21231
9528
    ADD CONSTRAINT codeimport_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
21232
9529
 
21233
 
 
21234
9530
ALTER TABLE ONLY codeimport
21235
9531
    ADD CONSTRAINT codeimport_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
21236
9532
 
21237
 
 
21238
9533
ALTER TABLE ONLY codeimportevent
21239
9534
    ADD CONSTRAINT codeimportevent__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id) ON DELETE CASCADE;
21240
9535
 
21241
 
 
21242
9536
ALTER TABLE ONLY codeimportevent
21243
9537
    ADD CONSTRAINT codeimportevent__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
21244
9538
 
21245
 
 
21246
9539
ALTER TABLE ONLY codeimportevent
21247
9540
    ADD CONSTRAINT codeimportevent__person__fk FOREIGN KEY (person) REFERENCES person(id);
21248
9541
 
21249
 
 
21250
9542
ALTER TABLE ONLY codeimporteventdata
21251
9543
    ADD CONSTRAINT codeimporteventdata__event__fk FOREIGN KEY (event) REFERENCES codeimportevent(id) ON DELETE CASCADE;
21252
9544
 
21253
 
 
21254
9545
ALTER TABLE ONLY codeimportjob
21255
9546
    ADD CONSTRAINT codeimportjob__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id);
21256
9547
 
21257
 
 
21258
9548
ALTER TABLE ONLY codeimportjob
21259
9549
    ADD CONSTRAINT codeimportjob__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
21260
9550
 
21261
 
 
21262
9551
ALTER TABLE ONLY codeimportjob
21263
9552
    ADD CONSTRAINT codeimportjob__requesting_user__fk FOREIGN KEY (requesting_user) REFERENCES person(id);
21264
9553
 
21265
 
 
21266
9554
ALTER TABLE ONLY codeimportresult
21267
9555
    ADD CONSTRAINT codeimportresult__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id) ON DELETE CASCADE;
21268
9556
 
21269
 
 
21270
9557
ALTER TABLE ONLY codeimportresult
21271
9558
    ADD CONSTRAINT codeimportresult__log_file__fk FOREIGN KEY (log_file) REFERENCES libraryfilealias(id);
21272
9559
 
21273
 
 
21274
9560
ALTER TABLE ONLY codeimportresult
21275
9561
    ADD CONSTRAINT codeimportresult__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
21276
9562
 
21277
 
 
21278
9563
ALTER TABLE ONLY codeimportresult
21279
9564
    ADD CONSTRAINT codeimportresult__requesting_user__fk FOREIGN KEY (requesting_user) REFERENCES person(id);
21280
9565
 
21281
 
 
21282
9566
ALTER TABLE ONLY codereviewmessage
21283
9567
    ADD CONSTRAINT codereviewmessage_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
21284
9568
 
21285
 
 
21286
9569
ALTER TABLE ONLY codereviewmessage
21287
9570
    ADD CONSTRAINT codereviewmessage_message_fkey FOREIGN KEY (message) REFERENCES message(id);
21288
9571
 
21289
 
 
21290
9572
ALTER TABLE ONLY codereviewvote
21291
9573
    ADD CONSTRAINT codereviewvote_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
21292
9574
 
21293
 
 
21294
9575
ALTER TABLE ONLY codereviewvote
21295
9576
    ADD CONSTRAINT codereviewvote_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
21296
9577
 
21297
 
 
21298
9578
ALTER TABLE ONLY codereviewvote
21299
9579
    ADD CONSTRAINT codereviewvote_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
21300
9580
 
21301
 
 
21302
9581
ALTER TABLE ONLY codereviewvote
21303
9582
    ADD CONSTRAINT codereviewvote_vote_message_fkey FOREIGN KEY (vote_message) REFERENCES codereviewmessage(id);
21304
9583
 
21305
 
 
21306
9584
ALTER TABLE ONLY commercialsubscription
21307
9585
    ADD CONSTRAINT commercialsubscription__product__fk FOREIGN KEY (product) REFERENCES product(id);
21308
9586
 
21309
 
 
21310
9587
ALTER TABLE ONLY commercialsubscription
21311
9588
    ADD CONSTRAINT commercialsubscription__purchaser__fk FOREIGN KEY (purchaser) REFERENCES person(id);
21312
9589
 
21313
 
 
21314
9590
ALTER TABLE ONLY commercialsubscription
21315
9591
    ADD CONSTRAINT commercialsubscription__registrant__fk FOREIGN KEY (registrant) REFERENCES person(id);
21316
9592
 
21317
 
 
21318
9593
ALTER TABLE ONLY componentselection
21319
9594
    ADD CONSTRAINT componentselection__component__fk FOREIGN KEY (component) REFERENCES component(id);
21320
9595
 
21321
 
 
21322
9596
ALTER TABLE ONLY componentselection
21323
9597
    ADD CONSTRAINT componentselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21324
9598
 
21325
 
 
21326
9599
ALTER TABLE ONLY customlanguagecode
21327
9600
    ADD CONSTRAINT customlanguagecode_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21328
9601
 
21329
 
 
21330
9602
ALTER TABLE ONLY customlanguagecode
21331
9603
    ADD CONSTRAINT customlanguagecode_language_fkey FOREIGN KEY (language) REFERENCES language(id);
21332
9604
 
21333
 
 
21334
9605
ALTER TABLE ONLY customlanguagecode
21335
9606
    ADD CONSTRAINT customlanguagecode_product_fkey FOREIGN KEY (product) REFERENCES product(id);
21336
9607
 
21337
 
 
21338
9608
ALTER TABLE ONLY customlanguagecode
21339
9609
    ADD CONSTRAINT customlanguagecode_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21340
9610
 
21341
 
 
21342
9611
ALTER TABLE ONLY cvereference
21343
9612
    ADD CONSTRAINT cvereference_cve_fk FOREIGN KEY (cve) REFERENCES cve(id);
21344
9613
 
21345
 
 
21346
9614
ALTER TABLE ONLY diff
21347
9615
    ADD CONSTRAINT diff_diff_text_fkey FOREIGN KEY (diff_text) REFERENCES libraryfilealias(id);
21348
9616
 
21349
 
 
21350
 
ALTER TABLE ONLY incrementaldiff
21351
 
    ADD CONSTRAINT diff_fk FOREIGN KEY (diff) REFERENCES diff(id) ON DELETE CASCADE;
21352
 
 
21353
 
 
21354
9617
ALTER TABLE ONLY distribution
21355
9618
    ADD CONSTRAINT distribution__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
21356
9619
 
21357
 
 
21358
9620
ALTER TABLE ONLY distribution
21359
9621
    ADD CONSTRAINT distribution__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
21360
9622
 
21361
 
 
21362
9623
ALTER TABLE ONLY distribution
21363
9624
    ADD CONSTRAINT distribution__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
21364
9625
 
21365
 
 
21366
9626
ALTER TABLE ONLY distribution
21367
9627
    ADD CONSTRAINT distribution_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
21368
9628
 
21369
 
 
21370
9629
ALTER TABLE ONLY distribution
21371
9630
    ADD CONSTRAINT distribution_language_pack_admin_fkey FOREIGN KEY (language_pack_admin) REFERENCES person(id);
21372
9631
 
21373
 
 
21374
9632
ALTER TABLE ONLY distribution
21375
9633
    ADD CONSTRAINT distribution_mirror_admin_fkey FOREIGN KEY (mirror_admin) REFERENCES person(id);
21376
9634
 
21377
 
 
21378
 
ALTER TABLE ONLY distribution
21379
 
    ADD CONSTRAINT distribution_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
21380
 
 
21381
 
 
21382
9635
ALTER TABLE ONLY distribution
21383
9636
    ADD CONSTRAINT distribution_security_contact_fkey FOREIGN KEY (security_contact) REFERENCES person(id);
21384
9637
 
21385
 
 
21386
9638
ALTER TABLE ONLY distribution
21387
9639
    ADD CONSTRAINT distribution_translation_focus_fkey FOREIGN KEY (translation_focus) REFERENCES distroseries(id);
21388
9640
 
21389
 
 
21390
9641
ALTER TABLE ONLY distribution
21391
9642
    ADD CONSTRAINT distribution_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
21392
9643
 
21393
 
 
21394
9644
ALTER TABLE ONLY distribution
21395
9645
    ADD CONSTRAINT distribution_upload_admin_fk FOREIGN KEY (upload_admin) REFERENCES person(id);
21396
9646
 
21397
 
 
21398
 
ALTER TABLE ONLY distributionjob
21399
 
    ADD CONSTRAINT distributionjob__job__fk FOREIGN KEY (job) REFERENCES job(id);
21400
 
 
21401
 
 
21402
 
ALTER TABLE ONLY distributionjob
21403
 
    ADD CONSTRAINT distributionjob_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21404
 
 
21405
 
 
21406
 
ALTER TABLE ONLY distributionjob
21407
 
    ADD CONSTRAINT distributionjob_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21408
 
 
 
9647
ALTER TABLE ONLY distributionbounty
 
9648
    ADD CONSTRAINT distributionbounty_bounty_fk FOREIGN KEY (bounty) REFERENCES bounty(id);
 
9649
 
 
9650
ALTER TABLE ONLY distributionbounty
 
9651
    ADD CONSTRAINT distributionbounty_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21409
9652
 
21410
9653
ALTER TABLE ONLY distributionmirror
21411
9654
    ADD CONSTRAINT distributionmirror_country_fkey FOREIGN KEY (country) REFERENCES country(id);
21412
9655
 
21413
 
 
21414
9656
ALTER TABLE ONLY distributionmirror
21415
9657
    ADD CONSTRAINT distributionmirror_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21416
9658
 
21417
 
 
21418
9659
ALTER TABLE ONLY distributionmirror
21419
9660
    ADD CONSTRAINT distributionmirror_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
21420
9661
 
21421
 
 
21422
9662
ALTER TABLE ONLY distributionmirror
21423
9663
    ADD CONSTRAINT distributionmirror_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
21424
9664
 
21425
 
 
21426
9665
ALTER TABLE ONLY distributionsourcepackage
21427
9666
    ADD CONSTRAINT distributionpackage__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21428
9667
 
21429
 
 
21430
9668
ALTER TABLE ONLY distributionsourcepackage
21431
9669
    ADD CONSTRAINT distributionpackage__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21432
9670
 
21433
 
 
21434
9671
ALTER TABLE ONLY distributionsourcepackagecache
21435
9672
    ADD CONSTRAINT distributionsourcepackagecache__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
21436
9673
 
21437
 
 
21438
9674
ALTER TABLE ONLY distributionsourcepackagecache
21439
9675
    ADD CONSTRAINT distributionsourcepackagecache_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21440
9676
 
21441
 
 
21442
9677
ALTER TABLE ONLY distributionsourcepackagecache
21443
9678
    ADD CONSTRAINT distributionsourcepackagecache_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21444
9679
 
21445
 
 
21446
9680
ALTER TABLE ONLY distroarchseries
21447
9681
    ADD CONSTRAINT distroarchseries__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21448
9682
 
21449
 
 
21450
9683
ALTER TABLE ONLY distroarchseries
21451
9684
    ADD CONSTRAINT distroarchseries__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
21452
9685
 
21453
 
 
21454
9686
ALTER TABLE ONLY distroarchseries
21455
9687
    ADD CONSTRAINT distroarchseries__processorfamily__fk FOREIGN KEY (processorfamily) REFERENCES processorfamily(id);
21456
9688
 
 
9689
ALTER TABLE ONLY distrocomponentuploader
 
9690
    ADD CONSTRAINT distrocomponentuploader_component_fk FOREIGN KEY (component) REFERENCES component(id);
 
9691
 
 
9692
ALTER TABLE ONLY distrocomponentuploader
 
9693
    ADD CONSTRAINT distrocomponentuploader_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
 
9694
 
 
9695
ALTER TABLE ONLY distrocomponentuploader
 
9696
    ADD CONSTRAINT distrocomponentuploader_uploader_fk FOREIGN KEY (uploader) REFERENCES person(id);
21457
9697
 
21458
9698
ALTER TABLE ONLY distroseries
21459
9699
    ADD CONSTRAINT distrorelease_parentrelease_fk FOREIGN KEY (parent_series) REFERENCES distroseries(id);
21460
9700
 
21461
 
 
21462
9701
ALTER TABLE ONLY distroserieslanguage
21463
9702
    ADD CONSTRAINT distroreleaselanguage_language_fk FOREIGN KEY (language) REFERENCES language(id);
21464
9703
 
21465
 
 
21466
9704
ALTER TABLE ONLY distroseries
21467
9705
    ADD CONSTRAINT distroseries__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21468
9706
 
21469
 
 
21470
9707
ALTER TABLE ONLY distroseries
21471
9708
    ADD CONSTRAINT distroseries__driver__fk FOREIGN KEY (driver) REFERENCES person(id);
21472
9709
 
21473
 
 
21474
9710
ALTER TABLE ONLY distroseries
21475
9711
    ADD CONSTRAINT distroseries__language_pack_base__fk FOREIGN KEY (language_pack_base) REFERENCES languagepack(id);
21476
9712
 
21477
 
 
21478
9713
ALTER TABLE ONLY distroseries
21479
9714
    ADD CONSTRAINT distroseries__language_pack_delta__fk FOREIGN KEY (language_pack_delta) REFERENCES languagepack(id);
21480
9715
 
21481
 
 
21482
9716
ALTER TABLE ONLY distroseries
21483
9717
    ADD CONSTRAINT distroseries__language_pack_proposed__fk FOREIGN KEY (language_pack_proposed) REFERENCES languagepack(id);
21484
9718
 
21485
 
 
21486
9719
ALTER TABLE ONLY distroseries
21487
9720
    ADD CONSTRAINT distroseries__nominatedarchindep__fk FOREIGN KEY (nominatedarchindep) REFERENCES distroarchseries(id);
21488
9721
 
 
9722
ALTER TABLE ONLY distroseries
 
9723
    ADD CONSTRAINT distroseries__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
21489
9724
 
21490
9725
ALTER TABLE ONLY distroseries
21491
9726
    ADD CONSTRAINT distroseries__parent_series__fk FOREIGN KEY (parent_series) REFERENCES distroseries(id);
21492
9727
 
21493
 
 
21494
 
ALTER TABLE ONLY distroseries
21495
 
    ADD CONSTRAINT distroseries__registrant__fk FOREIGN KEY (registrant) REFERENCES person(id);
21496
 
 
21497
 
 
21498
 
ALTER TABLE ONLY packagingjob
21499
 
    ADD CONSTRAINT distroseries_fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21500
 
 
21501
 
 
21502
 
ALTER TABLE ONLY distroseriesdifference
21503
 
    ADD CONSTRAINT distroseriesdifference__derived_series__fk FOREIGN KEY (derived_series) REFERENCES distroseries(id);
21504
 
 
21505
 
 
21506
 
ALTER TABLE ONLY distroseriesdifference
21507
 
    ADD CONSTRAINT distroseriesdifference__package_diff__fk FOREIGN KEY (package_diff) REFERENCES packagediff(id);
21508
 
 
21509
 
 
21510
 
ALTER TABLE ONLY distroseriesdifference
21511
 
    ADD CONSTRAINT distroseriesdifference__parent_package_diff__fk FOREIGN KEY (parent_package_diff) REFERENCES packagediff(id);
21512
 
 
21513
 
 
21514
 
ALTER TABLE ONLY distroseriesdifference
21515
 
    ADD CONSTRAINT distroseriesdifference__parentseries__fk FOREIGN KEY (parent_series) REFERENCES distroseries(id);
21516
 
 
21517
 
 
21518
 
ALTER TABLE ONLY distroseriesdifference
21519
 
    ADD CONSTRAINT distroseriesdifference__source_package_name__fk FOREIGN KEY (source_package_name) REFERENCES sourcepackagename(id);
21520
 
 
21521
 
 
21522
 
ALTER TABLE ONLY distroseriesdifferencemessage
21523
 
    ADD CONSTRAINT distroseriesdifferencemessage__distro_series_difference__fk FOREIGN KEY (distro_series_difference) REFERENCES distroseriesdifference(id);
21524
 
 
21525
 
 
21526
 
ALTER TABLE ONLY distroseriesdifferencemessage
21527
 
    ADD CONSTRAINT distroseriesdifferencemessage__message__fk FOREIGN KEY (message) REFERENCES message(id);
21528
 
 
21529
 
 
21530
9728
ALTER TABLE ONLY distroserieslanguage
21531
9729
    ADD CONSTRAINT distroserieslanguage__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21532
9730
 
21533
 
 
21534
9731
ALTER TABLE ONLY distroserieslanguage
21535
9732
    ADD CONSTRAINT distroserieslanguage__language__fk FOREIGN KEY (language) REFERENCES language(id);
21536
9733
 
21537
 
 
21538
9734
ALTER TABLE ONLY distroseriespackagecache
21539
9735
    ADD CONSTRAINT distroseriespackagecache__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
21540
9736
 
21541
 
 
21542
9737
ALTER TABLE ONLY distroseriespackagecache
21543
9738
    ADD CONSTRAINT distroseriespackagecache__binarypackagename__fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
21544
9739
 
21545
 
 
21546
9740
ALTER TABLE ONLY distroseriespackagecache
21547
9741
    ADD CONSTRAINT distroseriespackagecache__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21548
9742
 
21549
 
 
21550
 
ALTER TABLE ONLY distroseriesparent
21551
 
    ADD CONSTRAINT distroseriesparent__derivedseries__fk FOREIGN KEY (derived_series) REFERENCES distroseries(id);
21552
 
 
21553
 
 
21554
 
ALTER TABLE ONLY distroseriesparent
21555
 
    ADD CONSTRAINT distroseriesparent__parentseries__fk FOREIGN KEY (parent_series) REFERENCES distroseries(id);
21556
 
 
21557
 
 
21558
 
ALTER TABLE ONLY distroseriesparent
21559
 
    ADD CONSTRAINT distroseriesparent_component_fkey FOREIGN KEY (component) REFERENCES component(id);
21560
 
 
21561
 
 
21562
9743
ALTER TABLE ONLY emailaddress
21563
9744
    ADD CONSTRAINT emailaddress__account__fk FOREIGN KEY (account) REFERENCES account(id) ON DELETE SET NULL;
21564
9745
 
21565
 
 
21566
9746
ALTER TABLE ONLY emailaddress
21567
9747
    ADD CONSTRAINT emailaddress__person__fk FOREIGN KEY (person) REFERENCES person(id);
21568
9748
 
21569
 
 
21570
9749
ALTER TABLE ONLY entitlement
21571
9750
    ADD CONSTRAINT entitlement_approved_by_fkey FOREIGN KEY (approved_by) REFERENCES person(id);
21572
9751
 
21573
 
 
21574
9752
ALTER TABLE ONLY entitlement
21575
9753
    ADD CONSTRAINT entitlement_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21576
9754
 
21577
 
 
21578
9755
ALTER TABLE ONLY entitlement
21579
9756
    ADD CONSTRAINT entitlement_person_fkey FOREIGN KEY (person) REFERENCES person(id);
21580
9757
 
21581
 
 
21582
9758
ALTER TABLE ONLY entitlement
21583
9759
    ADD CONSTRAINT entitlement_product_fkey FOREIGN KEY (product) REFERENCES product(id);
21584
9760
 
21585
 
 
21586
9761
ALTER TABLE ONLY entitlement
21587
9762
    ADD CONSTRAINT entitlement_project_fkey FOREIGN KEY (project) REFERENCES project(id);
21588
9763
 
21589
 
 
21590
9764
ALTER TABLE ONLY entitlement
21591
9765
    ADD CONSTRAINT entitlement_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
21592
9766
 
21593
 
 
21594
9767
ALTER TABLE ONLY faq
21595
9768
    ADD CONSTRAINT faq_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21596
9769
 
21597
 
 
21598
9770
ALTER TABLE ONLY faq
21599
9771
    ADD CONSTRAINT faq_last_updated_by_fkey FOREIGN KEY (last_updated_by) REFERENCES person(id);
21600
9772
 
21601
 
 
21602
9773
ALTER TABLE ONLY faq
21603
9774
    ADD CONSTRAINT faq_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
21604
9775
 
21605
 
 
21606
9776
ALTER TABLE ONLY faq
21607
9777
    ADD CONSTRAINT faq_product_fkey FOREIGN KEY (product) REFERENCES product(id);
21608
9778
 
21609
 
 
21610
9779
ALTER TABLE ONLY featuredproject
21611
9780
    ADD CONSTRAINT featuredproject_pillar_name_fkey FOREIGN KEY (pillar_name) REFERENCES pillarname(id);
21612
9781
 
21613
 
 
21614
 
ALTER TABLE ONLY featureflagchangelogentry
21615
 
    ADD CONSTRAINT featureflagchangelogentry_person_fkey FOREIGN KEY (person) REFERENCES person(id);
21616
 
 
21617
 
 
21618
9782
ALTER TABLE ONLY flatpackagesetinclusion
21619
9783
    ADD CONSTRAINT flatpackagesetinclusion__child__fk FOREIGN KEY (child) REFERENCES packageset(id);
21620
9784
 
21621
 
 
21622
9785
ALTER TABLE ONLY flatpackagesetinclusion
21623
9786
    ADD CONSTRAINT flatpackagesetinclusion__parent__fk FOREIGN KEY (parent) REFERENCES packageset(id);
21624
9787
 
21625
 
 
21626
9788
ALTER TABLE ONLY gpgkey
21627
9789
    ADD CONSTRAINT gpgkey_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
21628
9790
 
21629
 
 
21630
9791
ALTER TABLE ONLY hwdevice
21631
9792
    ADD CONSTRAINT hwdevice_bus_vendor_id_fkey FOREIGN KEY (bus_vendor_id) REFERENCES hwvendorid(id);
21632
9793
 
21633
 
 
21634
9794
ALTER TABLE ONLY hwdeviceclass
21635
9795
    ADD CONSTRAINT hwdeviceclass_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
21636
9796
 
21637
 
 
21638
9797
ALTER TABLE ONLY hwdevicedriverlink
21639
9798
    ADD CONSTRAINT hwdevicedriverlink_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
21640
9799
 
21641
 
 
21642
9800
ALTER TABLE ONLY hwdevicedriverlink
21643
9801
    ADD CONSTRAINT hwdevicedriverlink_driver_fkey FOREIGN KEY (driver) REFERENCES hwdriver(id);
21644
9802
 
21645
 
 
21646
9803
ALTER TABLE ONLY hwdevicenamevariant
21647
9804
    ADD CONSTRAINT hwdevicenamevariant_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
21648
9805
 
21649
 
 
21650
9806
ALTER TABLE ONLY hwdevicenamevariant
21651
9807
    ADD CONSTRAINT hwdevicenamevariant_vendor_name_fkey FOREIGN KEY (vendor_name) REFERENCES hwvendorname(id);
21652
9808
 
21653
 
 
21654
9809
ALTER TABLE ONLY hwdmihandle
21655
9810
    ADD CONSTRAINT hwdmihandle_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
21656
9811
 
21657
 
 
21658
9812
ALTER TABLE ONLY hwdmivalue
21659
9813
    ADD CONSTRAINT hwdmivalue_handle_fkey FOREIGN KEY (handle) REFERENCES hwdmihandle(id);
21660
9814
 
21661
 
 
21662
9815
ALTER TABLE ONLY hwsubmission
21663
9816
    ADD CONSTRAINT hwsubmission__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
21664
9817
 
21665
 
 
21666
9818
ALTER TABLE ONLY hwsubmission
21667
9819
    ADD CONSTRAINT hwsubmission__owned__fk FOREIGN KEY (owner) REFERENCES person(id);
21668
9820
 
21669
 
 
21670
9821
ALTER TABLE ONLY hwsubmission
21671
9822
    ADD CONSTRAINT hwsubmission__raw_submission__fk FOREIGN KEY (raw_submission) REFERENCES libraryfilealias(id);
21672
9823
 
21673
 
 
21674
9824
ALTER TABLE ONLY hwsubmission
21675
9825
    ADD CONSTRAINT hwsubmission__system_fingerprint__fk FOREIGN KEY (system_fingerprint) REFERENCES hwsystemfingerprint(id);
21676
9826
 
21677
 
 
21678
9827
ALTER TABLE ONLY hwsubmissionbug
21679
9828
    ADD CONSTRAINT hwsubmissionbug_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
21680
9829
 
21681
 
 
21682
9830
ALTER TABLE ONLY hwsubmissionbug
21683
9831
    ADD CONSTRAINT hwsubmissionbug_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
21684
9832
 
21685
 
 
21686
9833
ALTER TABLE ONLY hwsubmissiondevice
21687
9834
    ADD CONSTRAINT hwsubmissiondevice_device_driver_link_fkey FOREIGN KEY (device_driver_link) REFERENCES hwdevicedriverlink(id);
21688
9835
 
21689
 
 
21690
9836
ALTER TABLE ONLY hwsubmissiondevice
21691
9837
    ADD CONSTRAINT hwsubmissiondevice_parent_fkey FOREIGN KEY (parent) REFERENCES hwsubmissiondevice(id);
21692
9838
 
21693
 
 
21694
9839
ALTER TABLE ONLY hwsubmissiondevice
21695
9840
    ADD CONSTRAINT hwsubmissiondevice_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
21696
9841
 
21697
 
 
21698
9842
ALTER TABLE ONLY hwtestanswer
21699
9843
    ADD CONSTRAINT hwtestanswer__choice__test__fk FOREIGN KEY (test, choice) REFERENCES hwtestanswerchoice(test, id);
21700
9844
 
21701
 
 
21702
9845
ALTER TABLE ONLY hwtestanswer
21703
9846
    ADD CONSTRAINT hwtestanswer_choice_fkey FOREIGN KEY (choice) REFERENCES hwtestanswerchoice(id);
21704
9847
 
21705
 
 
21706
9848
ALTER TABLE ONLY hwtestanswer
21707
9849
    ADD CONSTRAINT hwtestanswer_language_fkey FOREIGN KEY (language) REFERENCES language(id);
21708
9850
 
21709
 
 
21710
9851
ALTER TABLE ONLY hwtestanswer
21711
9852
    ADD CONSTRAINT hwtestanswer_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
21712
9853
 
21713
 
 
21714
9854
ALTER TABLE ONLY hwtestanswer
21715
9855
    ADD CONSTRAINT hwtestanswer_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
21716
9856
 
21717
 
 
21718
9857
ALTER TABLE ONLY hwtestanswerchoice
21719
9858
    ADD CONSTRAINT hwtestanswerchoice_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
21720
9859
 
21721
 
 
21722
9860
ALTER TABLE ONLY hwtestanswercount
21723
9861
    ADD CONSTRAINT hwtestanswercount_choice_fkey FOREIGN KEY (choice) REFERENCES hwtestanswerchoice(id);
21724
9862
 
21725
 
 
21726
9863
ALTER TABLE ONLY hwtestanswercount
21727
9864
    ADD CONSTRAINT hwtestanswercount_distroarchseries_fkey FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
21728
9865
 
21729
 
 
21730
9866
ALTER TABLE ONLY hwtestanswercount
21731
9867
    ADD CONSTRAINT hwtestanswercount_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
21732
9868
 
21733
 
 
21734
9869
ALTER TABLE ONLY hwtestanswercountdevice
21735
9870
    ADD CONSTRAINT hwtestanswercountdevice_answer_fkey FOREIGN KEY (answer) REFERENCES hwtestanswercount(id);
21736
9871
 
21737
 
 
21738
9872
ALTER TABLE ONLY hwtestanswercountdevice
21739
9873
    ADD CONSTRAINT hwtestanswercountdevice_device_driver_fkey FOREIGN KEY (device_driver) REFERENCES hwdevicedriverlink(id);
21740
9874
 
21741
 
 
21742
9875
ALTER TABLE ONLY hwtestanswerdevice
21743
9876
    ADD CONSTRAINT hwtestanswerdevice_answer_fkey FOREIGN KEY (answer) REFERENCES hwtestanswer(id);
21744
9877
 
21745
 
 
21746
9878
ALTER TABLE ONLY hwtestanswerdevice
21747
9879
    ADD CONSTRAINT hwtestanswerdevice_device_driver_fkey FOREIGN KEY (device_driver) REFERENCES hwdevicedriverlink(id);
21748
9880
 
21749
 
 
21750
9881
ALTER TABLE ONLY hwvendorid
21751
9882
    ADD CONSTRAINT hwvendorid_vendor_name_fkey FOREIGN KEY (vendor_name) REFERENCES hwvendorname(id);
21752
9883
 
21753
 
 
21754
9884
ALTER TABLE ONLY ircid
21755
9885
    ADD CONSTRAINT ircid_person_fk FOREIGN KEY (person) REFERENCES person(id);
21756
9886
 
21757
 
 
21758
9887
ALTER TABLE ONLY jabberid
21759
9888
    ADD CONSTRAINT jabberid_person_fk FOREIGN KEY (person) REFERENCES person(id);
21760
9889
 
21761
 
 
21762
 
ALTER TABLE ONLY packagingjob
21763
 
    ADD CONSTRAINT job_fk FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
21764
 
 
21765
 
 
21766
9890
ALTER TABLE ONLY job
21767
9891
    ADD CONSTRAINT job_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
21768
9892
 
21769
 
 
21770
9893
ALTER TABLE ONLY karma
21771
9894
    ADD CONSTRAINT karma_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21772
9895
 
21773
 
 
21774
9896
ALTER TABLE ONLY karma
21775
9897
    ADD CONSTRAINT karma_person_fk FOREIGN KEY (person) REFERENCES person(id);
21776
9898
 
21777
 
 
21778
9899
ALTER TABLE ONLY karma
21779
9900
    ADD CONSTRAINT karma_product_fkey FOREIGN KEY (product) REFERENCES product(id);
21780
9901
 
21781
 
 
21782
9902
ALTER TABLE ONLY karma
21783
9903
    ADD CONSTRAINT karma_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21784
9904
 
21785
 
 
21786
9905
ALTER TABLE ONLY karmaaction
21787
9906
    ADD CONSTRAINT karmaaction_category_fk FOREIGN KEY (category) REFERENCES karmacategory(id);
21788
9907
 
21789
 
 
21790
9908
ALTER TABLE ONLY karmacache
21791
9909
    ADD CONSTRAINT karmacache_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
21792
9910
 
21793
 
 
21794
9911
ALTER TABLE ONLY karmacache
21795
9912
    ADD CONSTRAINT karmacache_product_fkey FOREIGN KEY (product) REFERENCES product(id);
21796
9913
 
21797
 
 
21798
9914
ALTER TABLE ONLY karmacache
21799
9915
    ADD CONSTRAINT karmacache_project_fkey FOREIGN KEY (project) REFERENCES project(id);
21800
9916
 
21801
 
 
21802
9917
ALTER TABLE ONLY karmacache
21803
9918
    ADD CONSTRAINT karmacache_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
21804
9919
 
21805
 
 
21806
9920
ALTER TABLE ONLY karmatotalcache
21807
9921
    ADD CONSTRAINT karmatotalcache_person_fk FOREIGN KEY (person) REFERENCES person(id) ON DELETE CASCADE;
21808
9922
 
21809
 
 
21810
9923
ALTER TABLE ONLY languagepack
21811
9924
    ADD CONSTRAINT languagepack__file__fk FOREIGN KEY (file) REFERENCES libraryfilealias(id);
21812
9925
 
21813
 
 
21814
9926
ALTER TABLE ONLY languagepack
21815
9927
    ADD CONSTRAINT languagepack__updates__fk FOREIGN KEY (updates) REFERENCES languagepack(id);
21816
9928
 
21817
 
 
21818
9929
ALTER TABLE ONLY languagepack
21819
9930
    ADD CONSTRAINT languagepackage__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21820
9931
 
21821
 
 
21822
9932
ALTER TABLE ONLY libraryfiledownloadcount
21823
9933
    ADD CONSTRAINT libraryfiledownloadcount__libraryfilealias__fk FOREIGN KEY (libraryfilealias) REFERENCES libraryfilealias(id) ON DELETE CASCADE;
21824
9934
 
21825
 
 
21826
9935
ALTER TABLE ONLY libraryfiledownloadcount
21827
9936
    ADD CONSTRAINT libraryfiledownloadcount_country_fkey FOREIGN KEY (country) REFERENCES country(id);
21828
9937
 
21829
 
 
21830
9938
ALTER TABLE ONLY logintoken
21831
9939
    ADD CONSTRAINT logintoken_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
21832
9940
 
21833
 
 
21834
9941
ALTER TABLE ONLY mailinglist
21835
9942
    ADD CONSTRAINT mailinglist_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
21836
9943
 
21837
 
 
21838
9944
ALTER TABLE ONLY mailinglist
21839
9945
    ADD CONSTRAINT mailinglist_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
21840
9946
 
21841
 
 
21842
9947
ALTER TABLE ONLY mailinglist
21843
9948
    ADD CONSTRAINT mailinglist_team_fkey FOREIGN KEY (team) REFERENCES person(id);
21844
9949
 
 
9950
ALTER TABLE ONLY mailinglistban
 
9951
    ADD CONSTRAINT mailinglistban_banned_by_fkey FOREIGN KEY (banned_by) REFERENCES person(id);
 
9952
 
 
9953
ALTER TABLE ONLY mailinglistban
 
9954
    ADD CONSTRAINT mailinglistban_person_fkey FOREIGN KEY (person) REFERENCES person(id);
21845
9955
 
21846
9956
ALTER TABLE ONLY mailinglistsubscription
21847
9957
    ADD CONSTRAINT mailinglistsubscription__email_address_fk FOREIGN KEY (email_address) REFERENCES emailaddress(id) ON DELETE CASCADE;
21848
9958
 
21849
 
 
21850
9959
ALTER TABLE ONLY mailinglistsubscription
21851
9960
    ADD CONSTRAINT mailinglistsubscription_mailing_list_fkey FOREIGN KEY (mailing_list) REFERENCES mailinglist(id);
21852
9961
 
21853
 
 
21854
9962
ALTER TABLE ONLY mailinglistsubscription
21855
9963
    ADD CONSTRAINT mailinglistsubscription_person_fkey FOREIGN KEY (person) REFERENCES person(id);
21856
9964
 
 
9965
ALTER TABLE ONLY mentoringoffer
 
9966
    ADD CONSTRAINT mentoringoffer_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
 
9967
 
 
9968
ALTER TABLE ONLY mentoringoffer
 
9969
    ADD CONSTRAINT mentoringoffer_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
 
9970
 
 
9971
ALTER TABLE ONLY mentoringoffer
 
9972
    ADD CONSTRAINT mentoringoffer_specification_fkey FOREIGN KEY (specification) REFERENCES specification(id);
 
9973
 
 
9974
ALTER TABLE ONLY mentoringoffer
 
9975
    ADD CONSTRAINT mentoringoffer_team_fkey FOREIGN KEY (team) REFERENCES person(id);
21857
9976
 
21858
9977
ALTER TABLE ONLY mergedirectivejob
21859
9978
    ADD CONSTRAINT mergedirectivejob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
21860
9979
 
21861
 
 
21862
9980
ALTER TABLE ONLY mergedirectivejob
21863
9981
    ADD CONSTRAINT mergedirectivejob_merge_directive_fkey FOREIGN KEY (merge_directive) REFERENCES libraryfilealias(id);
21864
9982
 
21865
 
 
21866
9983
ALTER TABLE ONLY message
21867
9984
    ADD CONSTRAINT message_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21868
9985
 
21869
 
 
21870
9986
ALTER TABLE ONLY message
21871
9987
    ADD CONSTRAINT message_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
21872
9988
 
21873
 
 
21874
9989
ALTER TABLE ONLY message
21875
9990
    ADD CONSTRAINT message_parent_fk FOREIGN KEY (parent) REFERENCES message(id);
21876
9991
 
21877
 
 
21878
9992
ALTER TABLE ONLY message
21879
9993
    ADD CONSTRAINT message_raw_fk FOREIGN KEY (raw) REFERENCES libraryfilealias(id);
21880
9994
 
21881
 
 
21882
9995
ALTER TABLE ONLY messageapproval
21883
9996
    ADD CONSTRAINT messageapproval_disposed_by_fkey FOREIGN KEY (disposed_by) REFERENCES person(id);
21884
9997
 
21885
 
 
21886
9998
ALTER TABLE ONLY messageapproval
21887
9999
    ADD CONSTRAINT messageapproval_mailing_list_fkey FOREIGN KEY (mailing_list) REFERENCES mailinglist(id);
21888
10000
 
21889
 
 
21890
10001
ALTER TABLE ONLY messageapproval
21891
10002
    ADD CONSTRAINT messageapproval_message_fkey FOREIGN KEY (message) REFERENCES message(id);
21892
10003
 
21893
 
 
21894
10004
ALTER TABLE ONLY messageapproval
21895
10005
    ADD CONSTRAINT messageapproval_posted_by_fkey FOREIGN KEY (posted_by) REFERENCES person(id);
21896
10006
 
21897
 
 
21898
10007
ALTER TABLE ONLY messageapproval
21899
10008
    ADD CONSTRAINT messageapproval_posted_message_fkey FOREIGN KEY (posted_message) REFERENCES libraryfilealias(id);
21900
10009
 
21901
 
 
21902
10010
ALTER TABLE ONLY messagechunk
21903
10011
    ADD CONSTRAINT messagechunk_blob_fk FOREIGN KEY (blob) REFERENCES libraryfilealias(id);
21904
10012
 
21905
 
 
21906
10013
ALTER TABLE ONLY messagechunk
21907
10014
    ADD CONSTRAINT messagechunk_message_fk FOREIGN KEY (message) REFERENCES message(id);
21908
10015
 
21909
 
 
21910
10016
ALTER TABLE ONLY milestone
21911
10017
    ADD CONSTRAINT milestone__distroseries__distribution__fk FOREIGN KEY (distroseries, distribution) REFERENCES distroseries(id, distribution);
21912
10018
 
21913
 
 
21914
10019
ALTER TABLE ONLY milestone
21915
10020
    ADD CONSTRAINT milestone__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21916
10021
 
21917
 
 
21918
10022
ALTER TABLE ONLY milestone
21919
10023
    ADD CONSTRAINT milestone_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
21920
10024
 
21921
 
 
21922
10025
ALTER TABLE ONLY milestone
21923
10026
    ADD CONSTRAINT milestone_product_fk FOREIGN KEY (product) REFERENCES product(id);
21924
10027
 
21925
 
 
21926
10028
ALTER TABLE ONLY milestone
21927
10029
    ADD CONSTRAINT milestone_product_series_fk FOREIGN KEY (product, productseries) REFERENCES productseries(product, id);
21928
10030
 
21929
 
 
21930
10031
ALTER TABLE ONLY milestone
21931
10032
    ADD CONSTRAINT milestone_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
21932
10033
 
21933
 
 
21934
10034
ALTER TABLE ONLY mirror
21935
10035
    ADD CONSTRAINT mirror_country_fk FOREIGN KEY (country) REFERENCES country(id);
21936
10036
 
21937
 
 
21938
10037
ALTER TABLE ONLY mirror
21939
10038
    ADD CONSTRAINT mirror_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
21940
10039
 
21941
 
 
21942
10040
ALTER TABLE ONLY mirrorcdimagedistroseries
21943
10041
    ADD CONSTRAINT mirrorcdimagedistroseries__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
21944
10042
 
21945
 
 
21946
10043
ALTER TABLE ONLY mirrorcdimagedistroseries
21947
10044
    ADD CONSTRAINT mirrorcdimagedistroseries__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21948
10045
 
21949
 
 
21950
10046
ALTER TABLE ONLY mirrorcontent
21951
10047
    ADD CONSTRAINT mirrorcontent__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
21952
10048
 
21953
 
 
21954
10049
ALTER TABLE ONLY mirrorcontent
21955
10050
    ADD CONSTRAINT mirrorcontent_component_fk FOREIGN KEY (component) REFERENCES component(id);
21956
10051
 
21957
 
 
21958
10052
ALTER TABLE ONLY mirrorcontent
21959
10053
    ADD CONSTRAINT mirrorcontent_mirror_fk FOREIGN KEY (mirror) REFERENCES mirror(id);
21960
10054
 
21961
 
 
21962
10055
ALTER TABLE ONLY mirrordistroarchseries
21963
10056
    ADD CONSTRAINT mirrordistroarchseries__component__fk FOREIGN KEY (component) REFERENCES component(id);
21964
10057
 
21965
 
 
21966
10058
ALTER TABLE ONLY mirrordistroarchseries
21967
10059
    ADD CONSTRAINT mirrordistroarchseries__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
21968
10060
 
21969
 
 
21970
10061
ALTER TABLE ONLY mirrordistroarchseries
21971
10062
    ADD CONSTRAINT mirrordistroarchseries__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
21972
10063
 
21973
 
 
21974
10064
ALTER TABLE ONLY mirrordistroseriessource
21975
10065
    ADD CONSTRAINT mirrordistroseriessource__component__fk FOREIGN KEY (component) REFERENCES component(id);
21976
10066
 
21977
 
 
21978
10067
ALTER TABLE ONLY mirrordistroseriessource
21979
10068
    ADD CONSTRAINT mirrordistroseriessource__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
21980
10069
 
21981
 
 
21982
10070
ALTER TABLE ONLY mirrordistroseriessource
21983
10071
    ADD CONSTRAINT mirrordistroseriessource__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21984
10072
 
21985
 
 
21986
10073
ALTER TABLE ONLY mirrorproberecord
21987
10074
    ADD CONSTRAINT mirrorproberecord_distribution_mirror_fkey FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
21988
10075
 
21989
 
 
21990
10076
ALTER TABLE ONLY mirrorproberecord
21991
10077
    ADD CONSTRAINT mirrorproberecord_log_file_fkey FOREIGN KEY (log_file) REFERENCES libraryfilealias(id);
21992
10078
 
21993
 
 
21994
10079
ALTER TABLE ONLY mirrorsourcecontent
21995
10080
    ADD CONSTRAINT mirrorsourcecontent__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
21996
10081
 
21997
 
 
21998
10082
ALTER TABLE ONLY mirrorsourcecontent
21999
10083
    ADD CONSTRAINT mirrorsourcecontent_component_fk FOREIGN KEY (component) REFERENCES component(id);
22000
10084
 
22001
 
 
22002
10085
ALTER TABLE ONLY mirrorsourcecontent
22003
10086
    ADD CONSTRAINT mirrorsourcecontent_mirror_fk FOREIGN KEY (mirror) REFERENCES mirror(id);
22004
10087
 
22005
 
 
22006
 
ALTER TABLE ONLY nameblacklist
22007
 
    ADD CONSTRAINT nameblacklist_admin_fk FOREIGN KEY (admin) REFERENCES person(id);
22008
 
 
22009
 
 
22010
 
ALTER TABLE ONLY incrementaldiff
22011
 
    ADD CONSTRAINT new_revision_fk FOREIGN KEY (new_revision) REFERENCES revision(id) ON DELETE CASCADE;
22012
 
 
22013
 
 
22014
10088
ALTER TABLE ONLY oauthaccesstoken
22015
10089
    ADD CONSTRAINT oauthaccesstoken_consumer_fkey FOREIGN KEY (consumer) REFERENCES oauthconsumer(id);
22016
10090
 
22017
 
 
22018
10091
ALTER TABLE ONLY oauthaccesstoken
22019
10092
    ADD CONSTRAINT oauthaccesstoken_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
22020
10093
 
22021
 
 
22022
10094
ALTER TABLE ONLY oauthaccesstoken
22023
10095
    ADD CONSTRAINT oauthaccesstoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
22024
10096
 
22025
 
 
22026
10097
ALTER TABLE ONLY oauthaccesstoken
22027
10098
    ADD CONSTRAINT oauthaccesstoken_product_fkey FOREIGN KEY (product) REFERENCES product(id);
22028
10099
 
22029
 
 
22030
10100
ALTER TABLE ONLY oauthaccesstoken
22031
10101
    ADD CONSTRAINT oauthaccesstoken_project_fkey FOREIGN KEY (project) REFERENCES project(id);
22032
10102
 
22033
 
 
22034
10103
ALTER TABLE ONLY oauthaccesstoken
22035
10104
    ADD CONSTRAINT oauthaccesstoken_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22036
10105
 
22037
 
 
22038
10106
ALTER TABLE ONLY oauthnonce
22039
10107
    ADD CONSTRAINT oauthnonce__access_token__fk FOREIGN KEY (access_token) REFERENCES oauthaccesstoken(id) ON DELETE CASCADE;
22040
10108
 
22041
 
 
22042
10109
ALTER TABLE ONLY oauthrequesttoken
22043
10110
    ADD CONSTRAINT oauthrequesttoken_consumer_fkey FOREIGN KEY (consumer) REFERENCES oauthconsumer(id);
22044
10111
 
22045
 
 
22046
10112
ALTER TABLE ONLY oauthrequesttoken
22047
10113
    ADD CONSTRAINT oauthrequesttoken_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
22048
10114
 
22049
 
 
22050
10115
ALTER TABLE ONLY oauthrequesttoken
22051
10116
    ADD CONSTRAINT oauthrequesttoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
22052
10117
 
22053
 
 
22054
10118
ALTER TABLE ONLY oauthrequesttoken
22055
10119
    ADD CONSTRAINT oauthrequesttoken_product_fkey FOREIGN KEY (product) REFERENCES product(id);
22056
10120
 
22057
 
 
22058
10121
ALTER TABLE ONLY oauthrequesttoken
22059
10122
    ADD CONSTRAINT oauthrequesttoken_project_fkey FOREIGN KEY (project) REFERENCES project(id);
22060
10123
 
22061
 
 
22062
10124
ALTER TABLE ONLY oauthrequesttoken
22063
10125
    ADD CONSTRAINT oauthrequesttoken_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22064
10126
 
22065
 
 
22066
10127
ALTER TABLE ONLY officialbugtag
22067
10128
    ADD CONSTRAINT officialbugtag_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
22068
10129
 
22069
 
 
22070
10130
ALTER TABLE ONLY officialbugtag
22071
10131
    ADD CONSTRAINT officialbugtag_product_fkey FOREIGN KEY (product) REFERENCES product(id);
22072
10132
 
22073
 
 
22074
10133
ALTER TABLE ONLY officialbugtag
22075
10134
    ADD CONSTRAINT officialbugtag_project_fkey FOREIGN KEY (project) REFERENCES project(id);
22076
10135
 
22077
 
 
22078
 
ALTER TABLE ONLY incrementaldiff
22079
 
    ADD CONSTRAINT old_revision_fk FOREIGN KEY (old_revision) REFERENCES revision(id) ON DELETE CASCADE;
22080
 
 
22081
 
 
22082
 
ALTER TABLE ONLY openididentifier
22083
 
    ADD CONSTRAINT openididentifier_account_fkey FOREIGN KEY (account) REFERENCES account(id) ON DELETE CASCADE;
22084
 
 
 
10136
ALTER TABLE ONLY openidrpconfig
 
10137
    ADD CONSTRAINT openidrpconfig__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
 
10138
 
 
10139
ALTER TABLE ONLY openidrpsummary
 
10140
    ADD CONSTRAINT openidrpsummary_account_fkey FOREIGN KEY (account) REFERENCES account(id);
 
10141
 
 
10142
ALTER TABLE ONLY packagebugsupervisor
 
10143
    ADD CONSTRAINT packagebugsupervisor__bug_supervisor__fk FOREIGN KEY (bug_supervisor) REFERENCES person(id);
22085
10144
 
22086
10145
ALTER TABLE ONLY packagebuild
22087
10146
    ADD CONSTRAINT packagebuild__archive__fk FOREIGN KEY (archive) REFERENCES archive(id);
22088
10147
 
22089
 
 
22090
10148
ALTER TABLE ONLY packagebuild
22091
10149
    ADD CONSTRAINT packagebuild__build_farm_job__fk FOREIGN KEY (build_farm_job) REFERENCES buildfarmjob(id);
22092
10150
 
22093
 
 
22094
10151
ALTER TABLE ONLY packagebuild
22095
10152
    ADD CONSTRAINT packagebuild__log__fk FOREIGN KEY (upload_log) REFERENCES libraryfilealias(id);
22096
10153
 
22097
 
 
22098
 
ALTER TABLE ONLY packagecopyjob
22099
 
    ADD CONSTRAINT packagecopyjob__job__fk FOREIGN KEY (job) REFERENCES job(id);
22100
 
 
22101
 
 
22102
 
ALTER TABLE ONLY packagecopyjob
22103
 
    ADD CONSTRAINT packagecopyjob_source_archive_fkey FOREIGN KEY (source_archive) REFERENCES archive(id);
22104
 
 
22105
 
 
22106
 
ALTER TABLE ONLY packagecopyjob
22107
 
    ADD CONSTRAINT packagecopyjob_target_archive_fkey FOREIGN KEY (target_archive) REFERENCES archive(id);
22108
 
 
22109
 
 
22110
 
ALTER TABLE ONLY packagecopyjob
22111
 
    ADD CONSTRAINT packagecopyjob_target_distroseries_fkey FOREIGN KEY (target_distroseries) REFERENCES distroseries(id);
22112
 
 
22113
 
 
22114
10154
ALTER TABLE ONLY packagecopyrequest
22115
10155
    ADD CONSTRAINT packagecopyrequest__sourcearchive__fk FOREIGN KEY (source_archive) REFERENCES archive(id) ON DELETE CASCADE;
22116
10156
 
22117
 
 
22118
10157
ALTER TABLE ONLY packagecopyrequest
22119
10158
    ADD CONSTRAINT packagecopyrequest__targetarchive__fk FOREIGN KEY (target_archive) REFERENCES archive(id) ON DELETE CASCADE;
22120
10159
 
22121
 
 
22122
10160
ALTER TABLE ONLY packagecopyrequest
22123
10161
    ADD CONSTRAINT packagecopyrequest_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
22124
10162
 
22125
 
 
22126
10163
ALTER TABLE ONLY packagecopyrequest
22127
10164
    ADD CONSTRAINT packagecopyrequest_sourcecomponent_fk FOREIGN KEY (source_component) REFERENCES component(id);
22128
10165
 
22129
 
 
22130
10166
ALTER TABLE ONLY packagecopyrequest
22131
10167
    ADD CONSTRAINT packagecopyrequest_sourcedistroseries_fk FOREIGN KEY (source_distroseries) REFERENCES distroseries(id);
22132
10168
 
22133
 
 
22134
10169
ALTER TABLE ONLY packagecopyrequest
22135
10170
    ADD CONSTRAINT packagecopyrequest_targetcomponent_fk FOREIGN KEY (target_component) REFERENCES component(id);
22136
10171
 
22137
 
 
22138
10172
ALTER TABLE ONLY packagecopyrequest
22139
10173
    ADD CONSTRAINT packagecopyrequest_targetdistroseries_fk FOREIGN KEY (target_distroseries) REFERENCES distroseries(id);
22140
10174
 
22141
 
 
22142
10175
ALTER TABLE ONLY packagediff
22143
10176
    ADD CONSTRAINT packagediff_diff_content_fkey FOREIGN KEY (diff_content) REFERENCES libraryfilealias(id);
22144
10177
 
22145
 
 
22146
10178
ALTER TABLE ONLY packagediff
22147
10179
    ADD CONSTRAINT packagediff_from_source_fkey FOREIGN KEY (from_source) REFERENCES sourcepackagerelease(id);
22148
10180
 
22149
 
 
22150
10181
ALTER TABLE ONLY packagediff
22151
10182
    ADD CONSTRAINT packagediff_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
22152
10183
 
22153
 
 
22154
10184
ALTER TABLE ONLY packagediff
22155
10185
    ADD CONSTRAINT packagediff_to_source_fkey FOREIGN KEY (to_source) REFERENCES sourcepackagerelease(id);
22156
10186
 
 
10187
ALTER TABLE ONLY packageselection
 
10188
    ADD CONSTRAINT packageselection__binarypackagename__fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
 
10189
 
 
10190
ALTER TABLE ONLY packageselection
 
10191
    ADD CONSTRAINT packageselection__component__fk FOREIGN KEY (component) REFERENCES component(id);
 
10192
 
 
10193
ALTER TABLE ONLY packageselection
 
10194
    ADD CONSTRAINT packageselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
 
10195
 
 
10196
ALTER TABLE ONLY packageselection
 
10197
    ADD CONSTRAINT packageselection__section__fk FOREIGN KEY (section) REFERENCES section(id);
 
10198
 
 
10199
ALTER TABLE ONLY packageselection
 
10200
    ADD CONSTRAINT packageselection__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22157
10201
 
22158
10202
ALTER TABLE ONLY packageset
22159
10203
    ADD CONSTRAINT packageset__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22160
10204
 
22161
 
 
22162
10205
ALTER TABLE ONLY packageset
22163
10206
    ADD CONSTRAINT packageset__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
22164
10207
 
22165
 
 
22166
10208
ALTER TABLE ONLY packageset
22167
10209
    ADD CONSTRAINT packageset__packagesetgroup__fk FOREIGN KEY (packagesetgroup) REFERENCES packagesetgroup(id);
22168
10210
 
22169
 
 
22170
10211
ALTER TABLE ONLY packagesetgroup
22171
10212
    ADD CONSTRAINT packagesetgroup__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
22172
10213
 
22173
 
 
22174
10214
ALTER TABLE ONLY packagesetinclusion
22175
10215
    ADD CONSTRAINT packagesetinclusion__child__fk FOREIGN KEY (child) REFERENCES packageset(id);
22176
10216
 
22177
 
 
22178
10217
ALTER TABLE ONLY packagesetinclusion
22179
10218
    ADD CONSTRAINT packagesetinclusion__parent__fk FOREIGN KEY (parent) REFERENCES packageset(id);
22180
10219
 
22181
 
 
22182
10220
ALTER TABLE ONLY packagesetsources
22183
10221
    ADD CONSTRAINT packagesetsources__packageset__fk FOREIGN KEY (packageset) REFERENCES packageset(id);
22184
10222
 
22185
 
 
22186
10223
ALTER TABLE ONLY packageupload
22187
10224
    ADD CONSTRAINT packageupload__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
22188
10225
 
22189
 
 
22190
10226
ALTER TABLE ONLY packageupload
22191
10227
    ADD CONSTRAINT packageupload__changesfile__fk FOREIGN KEY (changesfile) REFERENCES libraryfilealias(id);
22192
10228
 
22193
 
 
22194
10229
ALTER TABLE ONLY packageupload
22195
10230
    ADD CONSTRAINT packageupload__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22196
10231
 
22197
 
 
22198
 
ALTER TABLE ONLY packageupload
22199
 
    ADD CONSTRAINT packageupload__package_copy_job__fk FOREIGN KEY (package_copy_job) REFERENCES packagecopyjob(id);
22200
 
 
22201
 
 
22202
10232
ALTER TABLE ONLY packageupload
22203
10233
    ADD CONSTRAINT packageupload__signing_key__fk FOREIGN KEY (signing_key) REFERENCES gpgkey(id);
22204
10234
 
22205
 
 
22206
10235
ALTER TABLE ONLY packageuploadbuild
22207
10236
    ADD CONSTRAINT packageuploadbuild__packageupload__fk FOREIGN KEY (packageupload) REFERENCES packageupload(id) ON DELETE CASCADE;
22208
10237
 
22209
 
 
22210
10238
ALTER TABLE ONLY packageuploadbuild
22211
10239
    ADD CONSTRAINT packageuploadbuild_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id);
22212
10240
 
22213
 
 
22214
10241
ALTER TABLE ONLY packageuploadcustom
22215
10242
    ADD CONSTRAINT packageuploadcustom_libraryfilealias_fk FOREIGN KEY (libraryfilealias) REFERENCES libraryfilealias(id);
22216
10243
 
22217
 
 
22218
10244
ALTER TABLE ONLY packageuploadcustom
22219
10245
    ADD CONSTRAINT packageuploadcustom_packageupload_fk FOREIGN KEY (packageupload) REFERENCES packageupload(id);
22220
10246
 
22221
 
 
22222
10247
ALTER TABLE ONLY packageuploadsource
22223
10248
    ADD CONSTRAINT packageuploadsource__packageupload__fk FOREIGN KEY (packageupload) REFERENCES packageupload(id) ON DELETE CASCADE;
22224
10249
 
22225
 
 
22226
10250
ALTER TABLE ONLY packageuploadsource
22227
10251
    ADD CONSTRAINT packageuploadsource__sourcepackagerelease__fk FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id);
22228
10252
 
22229
 
 
22230
10253
ALTER TABLE ONLY packaging
22231
10254
    ADD CONSTRAINT packaging__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22232
10255
 
22233
 
 
22234
10256
ALTER TABLE ONLY packaging
22235
10257
    ADD CONSTRAINT packaging_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22236
10258
 
22237
 
 
22238
10259
ALTER TABLE ONLY packaging
22239
10260
    ADD CONSTRAINT packaging_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
22240
10261
 
22241
 
 
22242
10262
ALTER TABLE ONLY packaging
22243
10263
    ADD CONSTRAINT packaging_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22244
10264
 
22245
 
 
22246
10265
ALTER TABLE ONLY person
22247
10266
    ADD CONSTRAINT person__account__fk FOREIGN KEY (account) REFERENCES account(id);
22248
10267
 
22249
 
 
22250
10268
ALTER TABLE ONLY person
22251
10269
    ADD CONSTRAINT person__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
22252
10270
 
22253
 
 
22254
10271
ALTER TABLE ONLY person
22255
10272
    ADD CONSTRAINT person__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
22256
10273
 
22257
 
 
22258
10274
ALTER TABLE ONLY person
22259
10275
    ADD CONSTRAINT person__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
22260
10276
 
22261
 
 
22262
10277
ALTER TABLE ONLY karmacache
22263
10278
    ADD CONSTRAINT person_fk FOREIGN KEY (person) REFERENCES person(id);
22264
10279
 
22265
 
 
22266
10280
ALTER TABLE ONLY person
22267
10281
    ADD CONSTRAINT person_language_fk FOREIGN KEY (language) REFERENCES language(id);
22268
10282
 
22269
 
 
22270
10283
ALTER TABLE ONLY person
22271
10284
    ADD CONSTRAINT person_merged_fk FOREIGN KEY (merged) REFERENCES person(id);
22272
10285
 
22273
 
 
22274
10286
ALTER TABLE ONLY person
22275
10287
    ADD CONSTRAINT person_registrant_fk FOREIGN KEY (registrant) REFERENCES person(id);
22276
10288
 
22277
 
 
22278
10289
ALTER TABLE ONLY person
22279
10290
    ADD CONSTRAINT person_teamowner_fk FOREIGN KEY (teamowner) REFERENCES person(id);
22280
10291
 
22281
 
 
22282
10292
ALTER TABLE ONLY personlanguage
22283
10293
    ADD CONSTRAINT personlanguage_language_fk FOREIGN KEY (language) REFERENCES language(id);
22284
10294
 
22285
 
 
22286
10295
ALTER TABLE ONLY personlanguage
22287
10296
    ADD CONSTRAINT personlanguage_person_fk FOREIGN KEY (person) REFERENCES person(id);
22288
10297
 
22289
 
 
22290
10298
ALTER TABLE ONLY personlocation
22291
10299
    ADD CONSTRAINT personlocation_last_modified_by_fkey FOREIGN KEY (last_modified_by) REFERENCES person(id);
22292
10300
 
22293
 
 
22294
10301
ALTER TABLE ONLY personlocation
22295
10302
    ADD CONSTRAINT personlocation_person_fkey FOREIGN KEY (person) REFERENCES person(id);
22296
10303
 
22297
 
 
22298
10304
ALTER TABLE ONLY personnotification
22299
10305
    ADD CONSTRAINT personnotification_person_fkey FOREIGN KEY (person) REFERENCES person(id);
22300
10306
 
22301
 
 
22302
 
ALTER TABLE ONLY personsettings
22303
 
    ADD CONSTRAINT personsettings_person_fkey FOREIGN KEY (person) REFERENCES person(id) ON DELETE CASCADE;
22304
 
 
22305
 
 
22306
 
ALTER TABLE ONLY persontransferjob
22307
 
    ADD CONSTRAINT persontransferjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
22308
 
 
22309
 
 
22310
 
ALTER TABLE ONLY persontransferjob
22311
 
    ADD CONSTRAINT persontransferjob_major_person_fkey FOREIGN KEY (major_person) REFERENCES person(id);
22312
 
 
22313
 
 
22314
 
ALTER TABLE ONLY persontransferjob
22315
 
    ADD CONSTRAINT persontransferjob_minor_person_fkey FOREIGN KEY (minor_person) REFERENCES person(id);
22316
 
 
22317
 
 
22318
10307
ALTER TABLE ONLY pillarname
22319
10308
    ADD CONSTRAINT pillarname__alias_for__fk FOREIGN KEY (alias_for) REFERENCES pillarname(id);
22320
10309
 
22321
 
 
22322
10310
ALTER TABLE ONLY pillarname
22323
10311
    ADD CONSTRAINT pillarname_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id) ON DELETE CASCADE;
22324
10312
 
22325
 
 
22326
10313
ALTER TABLE ONLY pillarname
22327
10314
    ADD CONSTRAINT pillarname_product_fkey FOREIGN KEY (product) REFERENCES product(id) ON DELETE CASCADE;
22328
10315
 
22329
 
 
22330
10316
ALTER TABLE ONLY pillarname
22331
10317
    ADD CONSTRAINT pillarname_project_fkey FOREIGN KEY (project) REFERENCES project(id) ON DELETE CASCADE;
22332
10318
 
22333
 
 
22334
10319
ALTER TABLE ONLY pocketchroot
22335
10320
    ADD CONSTRAINT pocketchroot__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
22336
10321
 
22337
 
 
22338
10322
ALTER TABLE ONLY pocketchroot
22339
10323
    ADD CONSTRAINT pocketchroot__libraryfilealias__fk FOREIGN KEY (chroot) REFERENCES libraryfilealias(id);
22340
10324
 
22341
 
 
22342
10325
ALTER TABLE ONLY poexportrequest
22343
10326
    ADD CONSTRAINT poeportrequest_potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
22344
10327
 
22345
 
 
22346
10328
ALTER TABLE ONLY poexportrequest
22347
10329
    ADD CONSTRAINT poexportrequest_person_fk FOREIGN KEY (person) REFERENCES person(id);
22348
10330
 
22349
 
 
22350
10331
ALTER TABLE ONLY poexportrequest
22351
10332
    ADD CONSTRAINT poexportrequest_pofile_fk FOREIGN KEY (pofile) REFERENCES pofile(id);
22352
10333
 
22353
 
 
22354
10334
ALTER TABLE ONLY pofile
22355
10335
    ADD CONSTRAINT pofile_language_fk FOREIGN KEY (language) REFERENCES language(id);
22356
10336
 
22357
 
 
22358
10337
ALTER TABLE ONLY pofile
22359
10338
    ADD CONSTRAINT pofile_lasttranslator_fk FOREIGN KEY (lasttranslator) REFERENCES person(id);
22360
10339
 
22361
 
 
22362
10340
ALTER TABLE ONLY pofile
22363
10341
    ADD CONSTRAINT pofile_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22364
10342
 
22365
 
 
22366
10343
ALTER TABLE ONLY pofile
22367
10344
    ADD CONSTRAINT pofile_potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
22368
10345
 
22369
 
 
22370
 
ALTER TABLE ONLY pofilestatsjob
22371
 
    ADD CONSTRAINT pofilestatsjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
22372
 
 
22373
 
 
22374
 
ALTER TABLE ONLY pofilestatsjob
22375
 
    ADD CONSTRAINT pofilestatsjob_pofile_fkey FOREIGN KEY (pofile) REFERENCES pofile(id);
22376
 
 
22377
 
 
22378
10346
ALTER TABLE ONLY pofiletranslator
22379
10347
    ADD CONSTRAINT pofiletranslator__latest_message__fk FOREIGN KEY (latest_message) REFERENCES translationmessage(id) DEFERRABLE INITIALLY DEFERRED;
22380
10348
 
22381
 
 
22382
10349
ALTER TABLE ONLY pofiletranslator
22383
10350
    ADD CONSTRAINT pofiletranslator__person__fk FOREIGN KEY (person) REFERENCES person(id);
22384
10351
 
22385
 
 
22386
10352
ALTER TABLE ONLY pofiletranslator
22387
10353
    ADD CONSTRAINT pofiletranslator__pofile__fk FOREIGN KEY (pofile) REFERENCES pofile(id);
22388
10354
 
22389
 
 
22390
10355
ALTER TABLE ONLY poll
22391
10356
    ADD CONSTRAINT poll_team_fk FOREIGN KEY (team) REFERENCES person(id);
22392
10357
 
22393
 
 
22394
10358
ALTER TABLE ONLY potemplate
22395
10359
    ADD CONSTRAINT potemplate__distrorelease__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22396
10360
 
22397
 
 
22398
10361
ALTER TABLE ONLY potemplate
22399
10362
    ADD CONSTRAINT potemplate__from_sourcepackagename__fk FOREIGN KEY (from_sourcepackagename) REFERENCES sourcepackagename(id);
22400
10363
 
22401
 
 
22402
10364
ALTER TABLE ONLY potemplate
22403
10365
    ADD CONSTRAINT potemplate__source_file__fk FOREIGN KEY (source_file) REFERENCES libraryfilealias(id);
22404
10366
 
22405
 
 
22406
10367
ALTER TABLE ONLY potemplate
22407
10368
    ADD CONSTRAINT potemplate_binarypackagename_fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
22408
10369
 
22409
 
 
22410
 
ALTER TABLE ONLY packagingjob
22411
 
    ADD CONSTRAINT potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
22412
 
 
22413
 
 
22414
10370
ALTER TABLE ONLY potemplate
22415
10371
    ADD CONSTRAINT potemplate_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22416
10372
 
22417
 
 
22418
10373
ALTER TABLE ONLY potemplate
22419
10374
    ADD CONSTRAINT potemplate_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
22420
10375
 
22421
 
 
22422
10376
ALTER TABLE ONLY potemplate
22423
10377
    ADD CONSTRAINT potemplate_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22424
10378
 
22425
 
 
22426
10379
ALTER TABLE ONLY potmsgset
22427
10380
    ADD CONSTRAINT potmsgset__msgid_plural__fk FOREIGN KEY (msgid_plural) REFERENCES pomsgid(id);
22428
10381
 
22429
 
 
22430
10382
ALTER TABLE ONLY potmsgset
22431
10383
    ADD CONSTRAINT potmsgset_potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
22432
10384
 
22433
 
 
22434
10385
ALTER TABLE ONLY potmsgset
22435
10386
    ADD CONSTRAINT potmsgset_primemsgid_fk FOREIGN KEY (msgid_singular) REFERENCES pomsgid(id);
22436
10387
 
22437
 
 
22438
10388
ALTER TABLE ONLY previewdiff
22439
10389
    ADD CONSTRAINT previewdiff_diff_fkey FOREIGN KEY (diff) REFERENCES diff(id) ON DELETE CASCADE;
22440
10390
 
22441
 
 
22442
10391
ALTER TABLE ONLY product
22443
10392
    ADD CONSTRAINT product__development_focus__fk FOREIGN KEY (development_focus) REFERENCES productseries(id);
22444
10393
 
22445
 
 
22446
10394
ALTER TABLE ONLY product
22447
10395
    ADD CONSTRAINT product__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
22448
10396
 
22449
 
 
22450
10397
ALTER TABLE ONLY product
22451
10398
    ADD CONSTRAINT product__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
22452
10399
 
22453
 
 
22454
10400
ALTER TABLE ONLY product
22455
10401
    ADD CONSTRAINT product__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
22456
10402
 
22457
 
 
22458
10403
ALTER TABLE ONLY product
22459
10404
    ADD CONSTRAINT product__translation_focus__fk FOREIGN KEY (translation_focus) REFERENCES productseries(id);
22460
10405
 
22461
 
 
22462
10406
ALTER TABLE ONLY product
22463
10407
    ADD CONSTRAINT product_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
22464
10408
 
22465
 
 
22466
10409
ALTER TABLE ONLY product
22467
10410
    ADD CONSTRAINT product_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
22468
10411
 
22469
 
 
22470
10412
ALTER TABLE ONLY product
22471
10413
    ADD CONSTRAINT product_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22472
10414
 
22473
 
 
22474
10415
ALTER TABLE ONLY product
22475
10416
    ADD CONSTRAINT product_project_fk FOREIGN KEY (project) REFERENCES project(id);
22476
10417
 
22477
 
 
22478
10418
ALTER TABLE ONLY product
22479
10419
    ADD CONSTRAINT product_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
22480
10420
 
22481
 
 
22482
10421
ALTER TABLE ONLY product
22483
10422
    ADD CONSTRAINT product_security_contact_fkey FOREIGN KEY (security_contact) REFERENCES person(id);
22484
10423
 
22485
 
 
22486
10424
ALTER TABLE ONLY product
22487
10425
    ADD CONSTRAINT product_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
22488
10426
 
 
10427
ALTER TABLE ONLY productbounty
 
10428
    ADD CONSTRAINT productbounty_bounty_fk FOREIGN KEY (bounty) REFERENCES bounty(id);
 
10429
 
 
10430
ALTER TABLE ONLY productbounty
 
10431
    ADD CONSTRAINT productbounty_product_fk FOREIGN KEY (product) REFERENCES product(id);
 
10432
 
 
10433
ALTER TABLE ONLY productcvsmodule
 
10434
    ADD CONSTRAINT productcvsmodule_product_fk FOREIGN KEY (product) REFERENCES product(id);
22489
10435
 
22490
10436
ALTER TABLE ONLY productlicense
22491
10437
    ADD CONSTRAINT productlicense_product_fkey FOREIGN KEY (product) REFERENCES product(id);
22492
10438
 
22493
 
 
22494
10439
ALTER TABLE ONLY productrelease
22495
10440
    ADD CONSTRAINT productrelease_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id);
22496
10441
 
22497
 
 
22498
10442
ALTER TABLE ONLY productrelease
22499
10443
    ADD CONSTRAINT productrelease_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22500
10444
 
22501
 
 
22502
10445
ALTER TABLE ONLY productreleasefile
22503
10446
    ADD CONSTRAINT productreleasefile__signature__fk FOREIGN KEY (signature) REFERENCES libraryfilealias(id);
22504
10447
 
22505
 
 
22506
10448
ALTER TABLE ONLY productreleasefile
22507
10449
    ADD CONSTRAINT productreleasefile__uploader__fk FOREIGN KEY (uploader) REFERENCES person(id);
22508
10450
 
22509
 
 
22510
10451
ALTER TABLE ONLY productseries
22511
10452
    ADD CONSTRAINT productseries_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
22512
10453
 
22513
 
 
22514
10454
ALTER TABLE ONLY productseries
22515
10455
    ADD CONSTRAINT productseries_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
22516
10456
 
22517
 
 
22518
 
ALTER TABLE ONLY packagingjob
22519
 
    ADD CONSTRAINT productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
22520
 
 
22521
 
 
22522
10457
ALTER TABLE ONLY productseries
22523
10458
    ADD CONSTRAINT productseries_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22524
10459
 
22525
 
 
22526
10460
ALTER TABLE ONLY productseries
22527
10461
    ADD CONSTRAINT productseries_product_fk FOREIGN KEY (product) REFERENCES product(id);
22528
10462
 
22529
 
 
22530
10463
ALTER TABLE ONLY productseries
22531
10464
    ADD CONSTRAINT productseries_translations_branch_fkey FOREIGN KEY (translations_branch) REFERENCES branch(id);
22532
10465
 
 
10466
ALTER TABLE ONLY productseriescodeimport
 
10467
    ADD CONSTRAINT productseriescodeimport_codeimport_fkey FOREIGN KEY (codeimport) REFERENCES codeimport(id);
 
10468
 
 
10469
ALTER TABLE ONLY productseriescodeimport
 
10470
    ADD CONSTRAINT productseriescodeimport_productseries_fkey FOREIGN KEY (productseries) REFERENCES productseries(id);
 
10471
 
 
10472
ALTER TABLE ONLY productsvnmodule
 
10473
    ADD CONSTRAINT productsvnmodule_product_fk FOREIGN KEY (product) REFERENCES product(id);
22533
10474
 
22534
10475
ALTER TABLE ONLY project
22535
10476
    ADD CONSTRAINT project__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
22536
10477
 
22537
 
 
22538
10478
ALTER TABLE ONLY project
22539
10479
    ADD CONSTRAINT project__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
22540
10480
 
22541
 
 
22542
10481
ALTER TABLE ONLY project
22543
10482
    ADD CONSTRAINT project__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
22544
10483
 
22545
 
 
22546
10484
ALTER TABLE ONLY project
22547
10485
    ADD CONSTRAINT project_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
22548
10486
 
22549
 
 
22550
10487
ALTER TABLE ONLY project
22551
10488
    ADD CONSTRAINT project_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
22552
10489
 
22553
 
 
22554
10490
ALTER TABLE ONLY project
22555
10491
    ADD CONSTRAINT project_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22556
10492
 
22557
 
 
22558
10493
ALTER TABLE ONLY project
22559
10494
    ADD CONSTRAINT project_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
22560
10495
 
22561
 
 
22562
10496
ALTER TABLE ONLY project
22563
10497
    ADD CONSTRAINT project_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
22564
10498
 
22565
 
 
22566
 
ALTER TABLE ONLY publisherconfig
22567
 
    ADD CONSTRAINT publisherconfig__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
22568
 
 
 
10499
ALTER TABLE ONLY projectbounty
 
10500
    ADD CONSTRAINT projectbounty_bounty_fk FOREIGN KEY (bounty) REFERENCES bounty(id);
 
10501
 
 
10502
ALTER TABLE ONLY projectbounty
 
10503
    ADD CONSTRAINT projectbounty_project_fk FOREIGN KEY (project) REFERENCES project(id);
 
10504
 
 
10505
ALTER TABLE ONLY projectrelationship
 
10506
    ADD CONSTRAINT projectrelationship_object_fk FOREIGN KEY (object) REFERENCES project(id);
 
10507
 
 
10508
ALTER TABLE ONLY projectrelationship
 
10509
    ADD CONSTRAINT projectrelationship_subject_fk FOREIGN KEY (subject) REFERENCES project(id);
22569
10510
 
22570
10511
ALTER TABLE ONLY question
22571
10512
    ADD CONSTRAINT question__answer__fk FOREIGN KEY (answer) REFERENCES questionmessage(id);
22572
10513
 
22573
 
 
22574
10514
ALTER TABLE ONLY question
22575
10515
    ADD CONSTRAINT question__answerer__fk FOREIGN KEY (answerer) REFERENCES person(id);
22576
10516
 
22577
 
 
22578
10517
ALTER TABLE ONLY question
22579
10518
    ADD CONSTRAINT question__assignee__fk FOREIGN KEY (assignee) REFERENCES person(id);
22580
10519
 
22581
 
 
22582
10520
ALTER TABLE ONLY question
22583
10521
    ADD CONSTRAINT question__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
22584
10522
 
22585
 
 
22586
10523
ALTER TABLE ONLY question
22587
10524
    ADD CONSTRAINT question__faq__fk FOREIGN KEY (faq) REFERENCES faq(id);
22588
10525
 
22589
 
 
22590
10526
ALTER TABLE ONLY question
22591
10527
    ADD CONSTRAINT question__language__fkey FOREIGN KEY (language) REFERENCES language(id);
22592
10528
 
22593
 
 
22594
10529
ALTER TABLE ONLY question
22595
10530
    ADD CONSTRAINT question__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
22596
10531
 
22597
 
 
22598
10532
ALTER TABLE ONLY question
22599
10533
    ADD CONSTRAINT question__product__fk FOREIGN KEY (product) REFERENCES product(id);
22600
10534
 
22601
 
 
22602
10535
ALTER TABLE ONLY question
22603
10536
    ADD CONSTRAINT question__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22604
10537
 
22605
 
 
22606
10538
ALTER TABLE ONLY questionbug
22607
10539
    ADD CONSTRAINT questionbug__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
22608
10540
 
22609
 
 
22610
10541
ALTER TABLE ONLY questionbug
22611
10542
    ADD CONSTRAINT questionbug__question__fk FOREIGN KEY (question) REFERENCES question(id);
22612
10543
 
22613
 
 
22614
 
ALTER TABLE ONLY questionjob
22615
 
    ADD CONSTRAINT questionjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
22616
 
 
22617
 
 
22618
 
ALTER TABLE ONLY questionjob
22619
 
    ADD CONSTRAINT questionjob_question_fkey FOREIGN KEY (question) REFERENCES question(id);
22620
 
 
22621
 
 
22622
10544
ALTER TABLE ONLY questionmessage
22623
10545
    ADD CONSTRAINT questionmessage__message__fk FOREIGN KEY (message) REFERENCES message(id);
22624
10546
 
22625
 
 
22626
10547
ALTER TABLE ONLY questionmessage
22627
10548
    ADD CONSTRAINT questionmessage__question__fk FOREIGN KEY (question) REFERENCES question(id);
22628
10549
 
22629
 
 
22630
10550
ALTER TABLE ONLY questionreopening
22631
10551
    ADD CONSTRAINT questionreopening__answerer__fk FOREIGN KEY (answerer) REFERENCES person(id);
22632
10552
 
22633
 
 
22634
10553
ALTER TABLE ONLY questionreopening
22635
10554
    ADD CONSTRAINT questionreopening__question__fk FOREIGN KEY (question) REFERENCES question(id);
22636
10555
 
22637
 
 
22638
10556
ALTER TABLE ONLY questionreopening
22639
10557
    ADD CONSTRAINT questionreopening__reopener__fk FOREIGN KEY (reopener) REFERENCES person(id);
22640
10558
 
22641
 
 
22642
10559
ALTER TABLE ONLY questionsubscription
22643
10560
    ADD CONSTRAINT questionsubscription__person__fk FOREIGN KEY (person) REFERENCES person(id);
22644
10561
 
22645
 
 
22646
10562
ALTER TABLE ONLY questionsubscription
22647
10563
    ADD CONSTRAINT questionsubscription__question__fk FOREIGN KEY (question) REFERENCES question(id);
22648
10564
 
 
10565
ALTER TABLE ONLY requestedcds
 
10566
    ADD CONSTRAINT requestedcds_request_fk FOREIGN KEY (request) REFERENCES shippingrequest(id);
22649
10567
 
22650
10568
ALTER TABLE ONLY teammembership
22651
10569
    ADD CONSTRAINT reviewer_fk FOREIGN KEY (last_changed_by) REFERENCES person(id);
22652
10570
 
22653
 
 
22654
10571
ALTER TABLE ONLY revision
22655
10572
    ADD CONSTRAINT revision_gpgkey_fk FOREIGN KEY (gpgkey) REFERENCES gpgkey(id);
22656
10573
 
22657
 
 
22658
10574
ALTER TABLE ONLY revision
22659
10575
    ADD CONSTRAINT revision_revision_author_fk FOREIGN KEY (revision_author) REFERENCES revisionauthor(id);
22660
10576
 
22661
 
 
22662
10577
ALTER TABLE ONLY revisionauthor
22663
10578
    ADD CONSTRAINT revisionauthor_person_fkey FOREIGN KEY (person) REFERENCES person(id);
22664
10579
 
22665
 
 
22666
10580
ALTER TABLE ONLY revisioncache
22667
10581
    ADD CONSTRAINT revisioncache__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22668
10582
 
22669
 
 
22670
10583
ALTER TABLE ONLY revisioncache
22671
10584
    ADD CONSTRAINT revisioncache__product__fk FOREIGN KEY (product) REFERENCES product(id);
22672
10585
 
22673
 
 
22674
10586
ALTER TABLE ONLY revisioncache
22675
10587
    ADD CONSTRAINT revisioncache__revision__fk FOREIGN KEY (revision) REFERENCES revision(id);
22676
10588
 
22677
 
 
22678
10589
ALTER TABLE ONLY revisioncache
22679
10590
    ADD CONSTRAINT revisioncache__revision_author__fk FOREIGN KEY (revision_author) REFERENCES revisionauthor(id);
22680
10591
 
22681
 
 
22682
10592
ALTER TABLE ONLY revisioncache
22683
10593
    ADD CONSTRAINT revisioncache__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22684
10594
 
22685
 
 
22686
10595
ALTER TABLE ONLY revisionparent
22687
10596
    ADD CONSTRAINT revisionparent_revision_fk FOREIGN KEY (revision) REFERENCES revision(id);
22688
10597
 
22689
 
 
22690
10598
ALTER TABLE ONLY revisionproperty
22691
10599
    ADD CONSTRAINT revisionproperty__revision__fk FOREIGN KEY (revision) REFERENCES revision(id);
22692
10600
 
22693
 
 
22694
10601
ALTER TABLE ONLY sectionselection
22695
10602
    ADD CONSTRAINT sectionselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22696
10603
 
22697
 
 
22698
10604
ALTER TABLE ONLY sectionselection
22699
10605
    ADD CONSTRAINT sectionselection__section__fk FOREIGN KEY (section) REFERENCES section(id);
22700
10606
 
22701
 
 
22702
10607
ALTER TABLE ONLY binarypackagepublishinghistory
22703
10608
    ADD CONSTRAINT securebinarypackagepublishinghistory__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
22704
10609
 
22705
 
 
22706
10610
ALTER TABLE ONLY binarypackagepublishinghistory
22707
10611
    ADD CONSTRAINT securebinarypackagepublishinghistory__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
22708
10612
 
22709
 
 
22710
10613
ALTER TABLE ONLY binarypackagepublishinghistory
22711
10614
    ADD CONSTRAINT securebinarypackagepublishinghistory_binarypackagerelease_fk FOREIGN KEY (binarypackagerelease) REFERENCES binarypackagerelease(id);
22712
10615
 
22713
 
 
22714
10616
ALTER TABLE ONLY binarypackagepublishinghistory
22715
10617
    ADD CONSTRAINT securebinarypackagepublishinghistory_component_fk FOREIGN KEY (component) REFERENCES component(id);
22716
10618
 
22717
 
 
22718
10619
ALTER TABLE ONLY binarypackagepublishinghistory
22719
10620
    ADD CONSTRAINT securebinarypackagepublishinghistory_removedby_fk FOREIGN KEY (removed_by) REFERENCES person(id);
22720
10621
 
22721
 
 
22722
10622
ALTER TABLE ONLY binarypackagepublishinghistory
22723
10623
    ADD CONSTRAINT securebinarypackagepublishinghistory_section_fk FOREIGN KEY (section) REFERENCES section(id);
22724
10624
 
22725
 
 
22726
10625
ALTER TABLE ONLY sourcepackagepublishinghistory
22727
10626
    ADD CONSTRAINT securesourcepackagepublishinghistory__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22728
10627
 
22729
 
 
22730
10628
ALTER TABLE ONLY sourcepackagepublishinghistory
22731
10629
    ADD CONSTRAINT securesourcepackagepublishinghistory_component_fk FOREIGN KEY (component) REFERENCES component(id);
22732
10630
 
22733
 
 
22734
10631
ALTER TABLE ONLY sourcepackagepublishinghistory
22735
10632
    ADD CONSTRAINT securesourcepackagepublishinghistory_removedby_fk FOREIGN KEY (removed_by) REFERENCES person(id);
22736
10633
 
22737
 
 
22738
10634
ALTER TABLE ONLY sourcepackagepublishinghistory
22739
10635
    ADD CONSTRAINT securesourcepackagepublishinghistory_section_fk FOREIGN KEY (section) REFERENCES section(id);
22740
10636
 
22741
 
 
22742
10637
ALTER TABLE ONLY sourcepackagepublishinghistory
22743
10638
    ADD CONSTRAINT securesourcepackagepublishinghistory_sourcepackagerelease_fk FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id);
22744
10639
 
22745
 
 
22746
10640
ALTER TABLE ONLY sourcepackagepublishinghistory
22747
10641
    ADD CONSTRAINT securesourcepackagepublishinghistory_supersededby_fk FOREIGN KEY (supersededby) REFERENCES sourcepackagerelease(id);
22748
10642
 
22749
 
 
22750
10643
ALTER TABLE ONLY seriessourcepackagebranch
22751
10644
    ADD CONSTRAINT seriessourcepackagebranch_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
22752
10645
 
22753
 
 
22754
10646
ALTER TABLE ONLY seriessourcepackagebranch
22755
10647
    ADD CONSTRAINT seriessourcepackagebranch_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22756
10648
 
22757
 
 
22758
10649
ALTER TABLE ONLY seriessourcepackagebranch
22759
10650
    ADD CONSTRAINT seriessourcepackagebranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
22760
10651
 
22761
 
 
22762
10652
ALTER TABLE ONLY seriessourcepackagebranch
22763
10653
    ADD CONSTRAINT seriessourcepackagebranch_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22764
10654
 
 
10655
ALTER TABLE ONLY shipitsurveyresult
 
10656
    ADD CONSTRAINT shipitsurveyresult_answer_fkey FOREIGN KEY (answer) REFERENCES shipitsurveyanswer(id);
 
10657
 
 
10658
ALTER TABLE ONLY shipitsurveyresult
 
10659
    ADD CONSTRAINT shipitsurveyresult_question_fkey FOREIGN KEY (question) REFERENCES shipitsurveyquestion(id);
 
10660
 
 
10661
ALTER TABLE ONLY shipitsurveyresult
 
10662
    ADD CONSTRAINT shipitsurveyresult_survey_fkey FOREIGN KEY (survey) REFERENCES shipitsurvey(id);
 
10663
 
 
10664
ALTER TABLE ONLY shipment
 
10665
    ADD CONSTRAINT shipment_shippingrun_fk FOREIGN KEY (shippingrun) REFERENCES shippingrun(id);
 
10666
 
 
10667
ALTER TABLE ONLY shippingrequest
 
10668
    ADD CONSTRAINT shippingrequest__country__fk FOREIGN KEY (country) REFERENCES country(id);
 
10669
 
 
10670
ALTER TABLE ONLY shippingrequest
 
10671
    ADD CONSTRAINT shippingrequest_shipment_fk FOREIGN KEY (shipment) REFERENCES shipment(id);
 
10672
 
 
10673
ALTER TABLE ONLY shippingrun
 
10674
    ADD CONSTRAINT shippingrun_csvfile_fk FOREIGN KEY (csvfile) REFERENCES libraryfilealias(id);
22765
10675
 
22766
10676
ALTER TABLE ONLY signedcodeofconduct
22767
10677
    ADD CONSTRAINT signedcodeofconduct_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22768
10678
 
22769
 
 
22770
10679
ALTER TABLE ONLY signedcodeofconduct
22771
10680
    ADD CONSTRAINT signedcodeofconduct_signingkey_fk FOREIGN KEY (owner, signingkey) REFERENCES gpgkey(owner, id) ON UPDATE CASCADE;
22772
10681
 
22773
 
 
22774
10682
ALTER TABLE ONLY sourcepackageformatselection
22775
10683
    ADD CONSTRAINT sourceformatselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22776
10684
 
22777
 
 
22778
 
ALTER TABLE ONLY packagingjob
22779
 
    ADD CONSTRAINT sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22780
 
 
22781
 
 
22782
10685
ALTER TABLE ONLY packagesetsources
22783
10686
    ADD CONSTRAINT sourcepackagenamesources__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22784
10687
 
22785
 
 
22786
10688
ALTER TABLE ONLY sourcepackagepublishinghistory
22787
10689
    ADD CONSTRAINT sourcepackagepublishinghistory__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
22788
10690
 
22789
 
 
22790
 
ALTER TABLE ONLY sourcepackagepublishinghistory
22791
 
    ADD CONSTRAINT sourcepackagepublishinghistory__creator__fk FOREIGN KEY (creator) REFERENCES person(id);
22792
 
 
22793
 
 
22794
 
ALTER TABLE ONLY sourcepackagepublishinghistory
22795
 
    ADD CONSTRAINT sourcepackagepublishinghistory_ancestor_fkey FOREIGN KEY (ancestor) REFERENCES sourcepackagepublishinghistory(id);
22796
 
 
22797
 
 
22798
 
ALTER TABLE ONLY sourcepackagepublishinghistory
22799
 
    ADD CONSTRAINT sourcepackagepublishinghistory_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22800
 
 
22801
 
 
22802
10691
ALTER TABLE ONLY sourcepackagerecipe
22803
10692
    ADD CONSTRAINT sourcepackagerecipe_daily_build_archive_fkey FOREIGN KEY (daily_build_archive) REFERENCES archive(id);
22804
10693
 
22805
 
 
22806
10694
ALTER TABLE ONLY sourcepackagerecipe
22807
10695
    ADD CONSTRAINT sourcepackagerecipe_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
22808
10696
 
22809
 
 
22810
10697
ALTER TABLE ONLY sourcepackagerecipe
22811
10698
    ADD CONSTRAINT sourcepackagerecipe_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
22812
10699
 
22813
 
 
22814
10700
ALTER TABLE ONLY sourcepackagerecipebuild
22815
10701
    ADD CONSTRAINT sourcepackagerecipebuild_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22816
10702
 
22817
 
 
22818
10703
ALTER TABLE ONLY sourcepackagerecipebuild
22819
10704
    ADD CONSTRAINT sourcepackagerecipebuild_manifest_fkey FOREIGN KEY (manifest) REFERENCES sourcepackagerecipedata(id);
22820
10705
 
22821
 
 
22822
10706
ALTER TABLE ONLY sourcepackagerecipebuild
22823
10707
    ADD CONSTRAINT sourcepackagerecipebuild_package_build_fkey FOREIGN KEY (package_build) REFERENCES packagebuild(id);
22824
10708
 
22825
 
 
22826
10709
ALTER TABLE ONLY sourcepackagerecipebuild
22827
10710
    ADD CONSTRAINT sourcepackagerecipebuild_recipe_fkey FOREIGN KEY (recipe) REFERENCES sourcepackagerecipe(id);
22828
10711
 
22829
 
 
22830
10712
ALTER TABLE ONLY sourcepackagerecipebuild
22831
10713
    ADD CONSTRAINT sourcepackagerecipebuild_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
22832
10714
 
22833
 
 
22834
10715
ALTER TABLE ONLY sourcepackagerecipebuildjob
22835
10716
    ADD CONSTRAINT sourcepackagerecipebuildjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
22836
10717
 
22837
 
 
22838
10718
ALTER TABLE ONLY sourcepackagerecipebuildjob
22839
10719
    ADD CONSTRAINT sourcepackagerecipebuildjob_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
22840
10720
 
22841
 
 
22842
10721
ALTER TABLE ONLY sourcepackagerecipedata
22843
10722
    ADD CONSTRAINT sourcepackagerecipedata_base_branch_fkey FOREIGN KEY (base_branch) REFERENCES branch(id);
22844
10723
 
22845
 
 
22846
10724
ALTER TABLE ONLY sourcepackagerecipedata
22847
10725
    ADD CONSTRAINT sourcepackagerecipedata_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
22848
10726
 
22849
 
 
22850
10727
ALTER TABLE ONLY sourcepackagerecipedata
22851
10728
    ADD CONSTRAINT sourcepackagerecipedata_sourcepackage_recipe_fkey FOREIGN KEY (sourcepackage_recipe) REFERENCES sourcepackagerecipe(id);
22852
10729
 
22853
 
 
22854
10730
ALTER TABLE ONLY sourcepackagerecipedatainstruction
22855
10731
    ADD CONSTRAINT sourcepackagerecipedatainstruction_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
22856
10732
 
22857
 
 
22858
10733
ALTER TABLE ONLY sourcepackagerecipedatainstruction
22859
10734
    ADD CONSTRAINT sourcepackagerecipedatainstruction_parent_instruction_fkey FOREIGN KEY (parent_instruction) REFERENCES sourcepackagerecipedatainstruction(id);
22860
10735
 
22861
 
 
22862
10736
ALTER TABLE ONLY sourcepackagerecipedatainstruction
22863
10737
    ADD CONSTRAINT sourcepackagerecipedatainstruction_recipe_data_fkey FOREIGN KEY (recipe_data) REFERENCES sourcepackagerecipedata(id);
22864
10738
 
22865
 
 
22866
10739
ALTER TABLE ONLY sourcepackagerecipedistroseries
22867
10740
    ADD CONSTRAINT sourcepackagerecipedistroseries_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
22868
10741
 
22869
 
 
22870
10742
ALTER TABLE ONLY sourcepackagerecipedistroseries
22871
10743
    ADD CONSTRAINT sourcepackagerecipedistroseries_sourcepackagerecipe_fkey FOREIGN KEY (sourcepackagerecipe) REFERENCES sourcepackagerecipe(id);
22872
10744
 
22873
 
 
22874
10745
ALTER TABLE ONLY sourcepackagerelease
22875
10746
    ADD CONSTRAINT sourcepackagerelease__creator__fk FOREIGN KEY (creator) REFERENCES person(id);
22876
10747
 
22877
 
 
22878
10748
ALTER TABLE ONLY sourcepackagerelease
22879
10749
    ADD CONSTRAINT sourcepackagerelease__dscsigningkey FOREIGN KEY (dscsigningkey) REFERENCES gpgkey(id);
22880
10750
 
22881
 
 
22882
10751
ALTER TABLE ONLY sourcepackagerelease
22883
10752
    ADD CONSTRAINT sourcepackagerelease__upload_archive__fk FOREIGN KEY (upload_archive) REFERENCES archive(id);
22884
10753
 
22885
 
 
22886
10754
ALTER TABLE ONLY sourcepackagerelease
22887
10755
    ADD CONSTRAINT sourcepackagerelease__upload_distroseries__fk FOREIGN KEY (upload_distroseries) REFERENCES distroseries(id);
22888
10756
 
22889
 
 
22890
10757
ALTER TABLE ONLY sourcepackagerelease
22891
10758
    ADD CONSTRAINT sourcepackagerelease_changelog_fkey FOREIGN KEY (changelog) REFERENCES libraryfilealias(id);
22892
10759
 
22893
 
 
22894
10760
ALTER TABLE ONLY sourcepackagerelease
22895
10761
    ADD CONSTRAINT sourcepackagerelease_component_fk FOREIGN KEY (component) REFERENCES component(id);
22896
10762
 
22897
 
 
22898
10763
ALTER TABLE ONLY sourcepackagerelease
22899
10764
    ADD CONSTRAINT sourcepackagerelease_maintainer_fk FOREIGN KEY (maintainer) REFERENCES person(id);
22900
10765
 
22901
 
 
22902
10766
ALTER TABLE ONLY sourcepackagerelease
22903
10767
    ADD CONSTRAINT sourcepackagerelease_section FOREIGN KEY (section) REFERENCES section(id);
22904
10768
 
22905
 
 
22906
10769
ALTER TABLE ONLY sourcepackagerelease
22907
10770
    ADD CONSTRAINT sourcepackagerelease_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
22908
10771
 
22909
 
 
22910
10772
ALTER TABLE ONLY sourcepackagerelease
22911
10773
    ADD CONSTRAINT sourcepackagerelease_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
22912
10774
 
22913
 
 
22914
10775
ALTER TABLE ONLY specification
22915
10776
    ADD CONSTRAINT specification__distroseries__distribution__fk FOREIGN KEY (distroseries, distribution) REFERENCES distroseries(id, distribution);
22916
10777
 
22917
 
 
22918
10778
ALTER TABLE ONLY specification
22919
10779
    ADD CONSTRAINT specification_approver_fk FOREIGN KEY (approver) REFERENCES person(id);
22920
10780
 
22921
 
 
22922
10781
ALTER TABLE ONLY specification
22923
10782
    ADD CONSTRAINT specification_assignee_fk FOREIGN KEY (assignee) REFERENCES person(id);
22924
10783
 
22925
 
 
22926
10784
ALTER TABLE ONLY specification
22927
10785
    ADD CONSTRAINT specification_completer_fkey FOREIGN KEY (completer) REFERENCES person(id);
22928
10786
 
22929
 
 
22930
10787
ALTER TABLE ONLY specification
22931
10788
    ADD CONSTRAINT specification_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
22932
10789
 
22933
 
 
22934
10790
ALTER TABLE ONLY specification
22935
10791
    ADD CONSTRAINT specification_distribution_milestone_fk FOREIGN KEY (distribution, milestone) REFERENCES milestone(distribution, id);
22936
10792
 
22937
 
 
22938
10793
ALTER TABLE ONLY specification
22939
10794
    ADD CONSTRAINT specification_drafter_fk FOREIGN KEY (drafter) REFERENCES person(id);
22940
10795
 
22941
 
 
22942
10796
ALTER TABLE ONLY specification
22943
10797
    ADD CONSTRAINT specification_goal_decider_fkey FOREIGN KEY (goal_decider) REFERENCES person(id);
22944
10798
 
22945
 
 
22946
10799
ALTER TABLE ONLY specification
22947
10800
    ADD CONSTRAINT specification_goal_proposer_fkey FOREIGN KEY (goal_proposer) REFERENCES person(id);
22948
10801
 
22949
 
 
22950
10802
ALTER TABLE ONLY specification
22951
10803
    ADD CONSTRAINT specification_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
22952
10804
 
22953
 
 
22954
10805
ALTER TABLE ONLY specification
22955
10806
    ADD CONSTRAINT specification_product_fk FOREIGN KEY (product) REFERENCES product(id);
22956
10807
 
22957
 
 
22958
10808
ALTER TABLE ONLY specification
22959
10809
    ADD CONSTRAINT specification_product_milestone_fk FOREIGN KEY (product, milestone) REFERENCES milestone(product, id);
22960
10810
 
22961
 
 
22962
10811
ALTER TABLE ONLY specification
22963
10812
    ADD CONSTRAINT specification_productseries_valid FOREIGN KEY (product, productseries) REFERENCES productseries(product, id);
22964
10813
 
22965
 
 
22966
10814
ALTER TABLE ONLY specification
22967
10815
    ADD CONSTRAINT specification_starter_fkey FOREIGN KEY (starter) REFERENCES person(id);
22968
10816
 
22969
 
 
22970
10817
ALTER TABLE ONLY specification
22971
10818
    ADD CONSTRAINT specification_superseded_by_fk FOREIGN KEY (superseded_by) REFERENCES specification(id);
22972
10819
 
22973
 
 
22974
10820
ALTER TABLE ONLY specificationbranch
22975
10821
    ADD CONSTRAINT specificationbranch__branch__fk FOREIGN KEY (branch) REFERENCES branch(id);
22976
10822
 
22977
 
 
22978
10823
ALTER TABLE ONLY specificationbranch
22979
10824
    ADD CONSTRAINT specificationbranch__specification__fk FOREIGN KEY (specification) REFERENCES specification(id);
22980
10825
 
22981
 
 
22982
10826
ALTER TABLE ONLY specificationbranch
22983
10827
    ADD CONSTRAINT specificationbranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
22984
10828
 
22985
 
 
22986
10829
ALTER TABLE ONLY specificationbug
22987
10830
    ADD CONSTRAINT specificationbug_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
22988
10831
 
22989
 
 
22990
10832
ALTER TABLE ONLY specificationbug
22991
10833
    ADD CONSTRAINT specificationbug_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
22992
10834
 
22993
 
 
22994
10835
ALTER TABLE ONLY specificationdependency
22995
10836
    ADD CONSTRAINT specificationdependency_dependency_fk FOREIGN KEY (dependency) REFERENCES specification(id);
22996
10837
 
22997
 
 
22998
10838
ALTER TABLE ONLY specificationdependency
22999
10839
    ADD CONSTRAINT specificationdependency_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
23000
10840
 
23001
 
 
23002
10841
ALTER TABLE ONLY specificationfeedback
23003
10842
    ADD CONSTRAINT specificationfeedback_provider_fk FOREIGN KEY (reviewer) REFERENCES person(id);
23004
10843
 
23005
 
 
23006
10844
ALTER TABLE ONLY specificationfeedback
23007
10845
    ADD CONSTRAINT specificationfeedback_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
23008
10846
 
23009
 
 
23010
10847
ALTER TABLE ONLY specificationfeedback
23011
10848
    ADD CONSTRAINT specificationfeedback_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
23012
10849
 
23013
 
 
23014
10850
ALTER TABLE ONLY specificationmessage
23015
10851
    ADD CONSTRAINT specificationmessage__message__fk FOREIGN KEY (message) REFERENCES message(id);
23016
10852
 
23017
 
 
23018
10853
ALTER TABLE ONLY specificationmessage
23019
10854
    ADD CONSTRAINT specificationmessage__specification__fk FOREIGN KEY (specification) REFERENCES specification(id);
23020
10855
 
23021
 
 
23022
10856
ALTER TABLE ONLY specificationsubscription
23023
10857
    ADD CONSTRAINT specificationsubscription_person_fk FOREIGN KEY (person) REFERENCES person(id);
23024
10858
 
23025
 
 
23026
10859
ALTER TABLE ONLY specificationsubscription
23027
10860
    ADD CONSTRAINT specificationsubscription_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
23028
10861
 
23029
 
 
23030
10862
ALTER TABLE ONLY sprint
23031
10863
    ADD CONSTRAINT sprint__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
23032
10864
 
23033
 
 
23034
10865
ALTER TABLE ONLY sprint
23035
10866
    ADD CONSTRAINT sprint__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
23036
10867
 
23037
 
 
23038
10868
ALTER TABLE ONLY sprint
23039
10869
    ADD CONSTRAINT sprint__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
23040
10870
 
23041
 
 
23042
10871
ALTER TABLE ONLY sprint
23043
10872
    ADD CONSTRAINT sprint_driver_fkey FOREIGN KEY (driver) REFERENCES person(id);
23044
10873
 
23045
 
 
23046
10874
ALTER TABLE ONLY sprint
23047
10875
    ADD CONSTRAINT sprint_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
23048
10876
 
23049
 
 
23050
10877
ALTER TABLE ONLY sprintattendance
23051
10878
    ADD CONSTRAINT sprintattendance_attendee_fk FOREIGN KEY (attendee) REFERENCES person(id);
23052
10879
 
23053
 
 
23054
10880
ALTER TABLE ONLY sprintattendance
23055
10881
    ADD CONSTRAINT sprintattendance_sprint_fk FOREIGN KEY (sprint) REFERENCES sprint(id);
23056
10882
 
23057
 
 
23058
10883
ALTER TABLE ONLY sprintspecification
23059
10884
    ADD CONSTRAINT sprintspec_spec_fk FOREIGN KEY (specification) REFERENCES specification(id);
23060
10885
 
23061
 
 
23062
10886
ALTER TABLE ONLY sprintspecification
23063
10887
    ADD CONSTRAINT sprintspec_sprint_fk FOREIGN KEY (sprint) REFERENCES sprint(id);
23064
10888
 
23065
 
 
23066
10889
ALTER TABLE ONLY sprintspecification
23067
10890
    ADD CONSTRAINT sprintspecification__nominator__fk FOREIGN KEY (registrant) REFERENCES person(id);
23068
10891
 
23069
 
 
23070
10892
ALTER TABLE ONLY sprintspecification
23071
10893
    ADD CONSTRAINT sprintspecification_decider_fkey FOREIGN KEY (decider) REFERENCES person(id);
23072
10894
 
 
10895
ALTER TABLE ONLY staticdiff
 
10896
    ADD CONSTRAINT staticdiff_diff_fkey FOREIGN KEY (diff) REFERENCES diff(id) ON DELETE CASCADE;
23073
10897
 
23074
10898
ALTER TABLE ONLY structuralsubscription
23075
10899
    ADD CONSTRAINT structuralsubscription_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
23076
10900
 
23077
 
 
23078
10901
ALTER TABLE ONLY structuralsubscription
23079
10902
    ADD CONSTRAINT structuralsubscription_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
23080
10903
 
23081
 
 
23082
10904
ALTER TABLE ONLY structuralsubscription
23083
10905
    ADD CONSTRAINT structuralsubscription_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id);
23084
10906
 
23085
 
 
23086
10907
ALTER TABLE ONLY structuralsubscription
23087
10908
    ADD CONSTRAINT structuralsubscription_product_fkey FOREIGN KEY (product) REFERENCES product(id);
23088
10909
 
23089
 
 
23090
10910
ALTER TABLE ONLY structuralsubscription
23091
10911
    ADD CONSTRAINT structuralsubscription_productseries_fkey FOREIGN KEY (productseries) REFERENCES productseries(id);
23092
10912
 
23093
 
 
23094
10913
ALTER TABLE ONLY structuralsubscription
23095
10914
    ADD CONSTRAINT structuralsubscription_project_fkey FOREIGN KEY (project) REFERENCES project(id);
23096
10915
 
23097
 
 
23098
10916
ALTER TABLE ONLY structuralsubscription
23099
10917
    ADD CONSTRAINT structuralsubscription_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
23100
10918
 
23101
 
 
23102
10919
ALTER TABLE ONLY structuralsubscription
23103
10920
    ADD CONSTRAINT structuralsubscription_subscribed_by_fkey FOREIGN KEY (subscribed_by) REFERENCES person(id);
23104
10921
 
23105
 
 
23106
10922
ALTER TABLE ONLY structuralsubscription
23107
10923
    ADD CONSTRAINT structuralsubscription_subscriber_fkey FOREIGN KEY (subscriber) REFERENCES person(id);
23108
10924
 
23109
 
 
23110
 
ALTER TABLE ONLY subunitstream
23111
 
    ADD CONSTRAINT subunitstream_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
23112
 
 
23113
 
 
23114
 
ALTER TABLE ONLY subunitstream
23115
 
    ADD CONSTRAINT subunitstream_stream_fkey FOREIGN KEY (stream) REFERENCES libraryfilealias(id);
23116
 
 
23117
 
 
23118
 
ALTER TABLE ONLY subunitstream
23119
 
    ADD CONSTRAINT subunitstream_uploader_fkey FOREIGN KEY (uploader) REFERENCES person(id);
23120
 
 
23121
 
 
23122
 
ALTER TABLE ONLY suggestivepotemplate
23123
 
    ADD CONSTRAINT suggestivepotemplate__potemplate__fk FOREIGN KEY (potemplate) REFERENCES potemplate(id) ON DELETE CASCADE;
23124
 
 
23125
 
 
23126
10925
ALTER TABLE ONLY teammembership
23127
10926
    ADD CONSTRAINT teammembership_acknowledged_by_fkey FOREIGN KEY (acknowledged_by) REFERENCES person(id);
23128
10927
 
23129
 
 
23130
10928
ALTER TABLE ONLY teammembership
23131
10929
    ADD CONSTRAINT teammembership_person_fk FOREIGN KEY (person) REFERENCES person(id);
23132
10930
 
23133
 
 
23134
10931
ALTER TABLE ONLY teammembership
23135
10932
    ADD CONSTRAINT teammembership_proposed_by_fkey FOREIGN KEY (proposed_by) REFERENCES person(id);
23136
10933
 
23137
 
 
23138
10934
ALTER TABLE ONLY teammembership
23139
10935
    ADD CONSTRAINT teammembership_reviewed_by_fkey FOREIGN KEY (reviewed_by) REFERENCES person(id);
23140
10936
 
23141
 
 
23142
10937
ALTER TABLE ONLY teammembership
23143
10938
    ADD CONSTRAINT teammembership_team_fk FOREIGN KEY (team) REFERENCES person(id);
23144
10939
 
23145
 
 
23146
10940
ALTER TABLE ONLY teamparticipation
23147
10941
    ADD CONSTRAINT teamparticipation_person_fk FOREIGN KEY (person) REFERENCES person(id);
23148
10942
 
23149
 
 
23150
10943
ALTER TABLE ONLY teamparticipation
23151
10944
    ADD CONSTRAINT teamparticipation_team_fk FOREIGN KEY (team) REFERENCES person(id);
23152
10945
 
23153
 
 
23154
10946
ALTER TABLE ONLY temporaryblobstorage
23155
10947
    ADD CONSTRAINT temporaryblobstorage_file_alias_fkey FOREIGN KEY (file_alias) REFERENCES libraryfilealias(id);
23156
10948
 
23157
 
 
23158
10949
ALTER TABLE ONLY translationgroup
23159
10950
    ADD CONSTRAINT translationgroup_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
23160
10951
 
23161
 
 
23162
10952
ALTER TABLE ONLY translationimportqueueentry
23163
10953
    ADD CONSTRAINT translationimportqueueentry__content__fk FOREIGN KEY (content) REFERENCES libraryfilealias(id);
23164
10954
 
23165
 
 
23166
10955
ALTER TABLE ONLY translationimportqueueentry
23167
10956
    ADD CONSTRAINT translationimportqueueentry__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
23168
10957
 
23169
 
 
23170
10958
ALTER TABLE ONLY translationimportqueueentry
23171
10959
    ADD CONSTRAINT translationimportqueueentry__importer__fk FOREIGN KEY (importer) REFERENCES person(id);
23172
10960
 
23173
 
 
23174
10961
ALTER TABLE ONLY translationimportqueueentry
23175
10962
    ADD CONSTRAINT translationimportqueueentry__pofile__fk FOREIGN KEY (pofile) REFERENCES pofile(id);
23176
10963
 
23177
 
 
23178
10964
ALTER TABLE ONLY translationimportqueueentry
23179
10965
    ADD CONSTRAINT translationimportqueueentry__potemplate__fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
23180
10966
 
23181
 
 
23182
10967
ALTER TABLE ONLY translationimportqueueentry
23183
10968
    ADD CONSTRAINT translationimportqueueentry__productseries__fk FOREIGN KEY (productseries) REFERENCES productseries(id);
23184
10969
 
23185
 
 
23186
10970
ALTER TABLE ONLY translationimportqueueentry
23187
10971
    ADD CONSTRAINT translationimportqueueentry__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
23188
10972
 
23189
 
 
23190
10973
ALTER TABLE ONLY translationmessage
23191
10974
    ADD CONSTRAINT translationmessage__msgstr0__fk FOREIGN KEY (msgstr0) REFERENCES potranslation(id);
23192
10975
 
23193
 
 
23194
10976
ALTER TABLE ONLY translationmessage
23195
10977
    ADD CONSTRAINT translationmessage__msgstr1__fk FOREIGN KEY (msgstr1) REFERENCES potranslation(id);
23196
10978
 
23197
 
 
23198
10979
ALTER TABLE ONLY translationmessage
23199
10980
    ADD CONSTRAINT translationmessage__msgstr2__fk FOREIGN KEY (msgstr2) REFERENCES potranslation(id);
23200
10981
 
23201
 
 
23202
10982
ALTER TABLE ONLY translationmessage
23203
10983
    ADD CONSTRAINT translationmessage__msgstr3__fk FOREIGN KEY (msgstr3) REFERENCES potranslation(id);
23204
10984
 
23205
 
 
23206
10985
ALTER TABLE ONLY translationmessage
23207
10986
    ADD CONSTRAINT translationmessage__msgstr4__fk FOREIGN KEY (msgstr4) REFERENCES potranslation(id);
23208
10987
 
23209
 
 
23210
10988
ALTER TABLE ONLY translationmessage
23211
10989
    ADD CONSTRAINT translationmessage__msgstr5__fk FOREIGN KEY (msgstr5) REFERENCES potranslation(id);
23212
10990
 
 
10991
ALTER TABLE ONLY translationmessage
 
10992
    ADD CONSTRAINT translationmessage__pofile__fk FOREIGN KEY (pofile) REFERENCES pofile(id);
23213
10993
 
23214
10994
ALTER TABLE ONLY translationmessage
23215
10995
    ADD CONSTRAINT translationmessage__potmsgset__fk FOREIGN KEY (potmsgset) REFERENCES potmsgset(id);
23216
10996
 
23217
 
 
23218
10997
ALTER TABLE ONLY translationmessage
23219
10998
    ADD CONSTRAINT translationmessage__reviewer__fk FOREIGN KEY (reviewer) REFERENCES person(id);
23220
10999
 
23221
 
 
23222
11000
ALTER TABLE ONLY translationmessage
23223
11001
    ADD CONSTRAINT translationmessage__submitter__fk FOREIGN KEY (submitter) REFERENCES person(id);
23224
11002
 
23225
 
 
23226
11003
ALTER TABLE ONLY translationmessage
23227
11004
    ADD CONSTRAINT translationmessage_language_fkey FOREIGN KEY (language) REFERENCES language(id);
23228
11005
 
23229
 
 
23230
11006
ALTER TABLE ONLY translationmessage
23231
11007
    ADD CONSTRAINT translationmessage_potemplate_fkey FOREIGN KEY (potemplate) REFERENCES potemplate(id);
23232
11008
 
23233
 
 
23234
11009
ALTER TABLE ONLY translationrelicensingagreement
23235
11010
    ADD CONSTRAINT translationrelicensingagreement__person__fk FOREIGN KEY (person) REFERENCES person(id);
23236
11011
 
23237
 
 
23238
11012
ALTER TABLE ONLY translationtemplateitem
23239
11013
    ADD CONSTRAINT translationtemplateitem_potemplate_fkey FOREIGN KEY (potemplate) REFERENCES potemplate(id);
23240
11014
 
23241
 
 
23242
11015
ALTER TABLE ONLY translationtemplateitem
23243
11016
    ADD CONSTRAINT translationtemplateitem_potmsgset_fkey FOREIGN KEY (potmsgset) REFERENCES potmsgset(id);
23244
11017
 
23245
 
 
23246
 
ALTER TABLE ONLY translationtemplatesbuild
23247
 
    ADD CONSTRAINT translationtemplatesbuild_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
23248
 
 
23249
 
 
23250
 
ALTER TABLE ONLY translationtemplatesbuild
23251
 
    ADD CONSTRAINT translationtemplatesbuild_build_farm_job_fkey FOREIGN KEY (build_farm_job) REFERENCES buildfarmjob(id);
23252
 
 
23253
 
 
23254
11018
ALTER TABLE ONLY translator
23255
11019
    ADD CONSTRAINT translator_language_fk FOREIGN KEY (language) REFERENCES language(id);
23256
11020
 
23257
 
 
23258
11021
ALTER TABLE ONLY translator
23259
11022
    ADD CONSTRAINT translator_person_fk FOREIGN KEY (translator) REFERENCES person(id);
23260
11023
 
23261
 
 
23262
11024
ALTER TABLE ONLY translator
23263
11025
    ADD CONSTRAINT translator_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
23264
11026
 
23265
 
 
23266
11027
ALTER TABLE ONLY usertouseremail
23267
11028
    ADD CONSTRAINT usertouseremail__recipient__fk FOREIGN KEY (recipient) REFERENCES person(id);
23268
11029
 
23269
 
 
23270
11030
ALTER TABLE ONLY usertouseremail
23271
11031
    ADD CONSTRAINT usertouseremail__sender__fk FOREIGN KEY (sender) REFERENCES person(id);
23272
11032
 
23273
 
 
23274
11033
ALTER TABLE ONLY vote
23275
11034
    ADD CONSTRAINT vote_person_fk FOREIGN KEY (person) REFERENCES person(id);
23276
11035
 
23277
 
 
23278
11036
ALTER TABLE ONLY vote
23279
11037
    ADD CONSTRAINT vote_poll_fk FOREIGN KEY (poll) REFERENCES poll(id);
23280
11038
 
23281
 
 
23282
11039
ALTER TABLE ONLY vote
23283
11040
    ADD CONSTRAINT vote_poll_option_fk FOREIGN KEY (poll, option) REFERENCES polloption(poll, id);
23284
11041
 
23285
 
 
23286
11042
ALTER TABLE ONLY votecast
23287
11043
    ADD CONSTRAINT votecast_person_fk FOREIGN KEY (person) REFERENCES person(id);
23288
11044
 
23289
 
 
23290
11045
ALTER TABLE ONLY votecast
23291
11046
    ADD CONSTRAINT votecast_poll_fk FOREIGN KEY (poll) REFERENCES poll(id);
23292
11047
 
 
11048
ALTER TABLE ONLY webserviceban
 
11049
    ADD CONSTRAINT webserviceban_consumer_fkey FOREIGN KEY (consumer) REFERENCES oauthconsumer(id);
 
11050
 
 
11051
ALTER TABLE ONLY webserviceban
 
11052
    ADD CONSTRAINT webserviceban_person_fkey FOREIGN KEY (person) REFERENCES person(id);
 
11053
 
 
11054
ALTER TABLE ONLY webserviceban
 
11055
    ADD CONSTRAINT webserviceban_token_fkey FOREIGN KEY (token) REFERENCES oauthaccesstoken(id);
23293
11056
 
23294
11057
ALTER TABLE ONLY wikiname
23295
11058
    ADD CONSTRAINT wikiname_person_fk FOREIGN KEY (person) REFERENCES person(id);
23296
11059
 
23297
 
 
 
11060
-- debversion datatype, which will be added to production manually
 
11061
\i /usr/share/postgresql/8.4/contrib/debversion.sql
23298
11062