~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

merge optional-deb-version branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- Generated Tue Dec  6 20:57:32 2011 UTC
1
2
 
2
3
SET client_min_messages TO ERROR;
3
 
 
4
 
 
 
4
SET statement_timeout = 0;
5
5
SET client_encoding = 'UTF8';
6
6
SET standard_conforming_strings = off;
7
7
SET check_function_bodies = false;
8
8
SET client_min_messages = warning;
9
9
SET escape_string_warning = off;
10
10
 
 
11
CREATE SCHEMA todrop;
 
12
 
 
13
 
 
14
CREATE SCHEMA ts2;
 
15
 
 
16
 
 
17
CREATE PROCEDURAL LANGUAGE plpgsql;
 
18
 
 
19
 
 
20
CREATE PROCEDURAL LANGUAGE plpythonu;
 
21
 
 
22
 
11
23
SET search_path = public, pg_catalog;
12
24
 
 
25
CREATE TYPE debversion;
 
26
 
 
27
 
 
28
CREATE FUNCTION debversionin(cstring) RETURNS debversion
 
29
    LANGUAGE internal IMMUTABLE STRICT
 
30
    AS $$textin$$;
 
31
 
 
32
 
 
33
CREATE FUNCTION debversionout(debversion) RETURNS cstring
 
34
    LANGUAGE internal IMMUTABLE STRICT
 
35
    AS $$textout$$;
 
36
 
 
37
 
 
38
CREATE FUNCTION debversionrecv(internal) RETURNS debversion
 
39
    LANGUAGE internal STABLE STRICT
 
40
    AS $$textrecv$$;
 
41
 
 
42
 
 
43
CREATE FUNCTION debversionsend(debversion) RETURNS bytea
 
44
    LANGUAGE internal STABLE STRICT
 
45
    AS $$textsend$$;
 
46
 
 
47
 
 
48
CREATE TYPE debversion (
 
49
    INTERNALLENGTH = variable,
 
50
    INPUT = debversionin,
 
51
    OUTPUT = debversionout,
 
52
    RECEIVE = debversionrecv,
 
53
    SEND = debversionsend,
 
54
    CATEGORY = 'S',
 
55
    ALIGNMENT = int4,
 
56
    STORAGE = extended
 
57
);
 
58
 
 
59
 
 
60
COMMENT ON TYPE debversion IS 'Debian package version number';
 
61
 
 
62
 
13
63
CREATE TYPE pgstattuple_type AS (
14
64
        table_len bigint,
15
65
        tuple_count bigint,
23
72
        free_percent double precision
24
73
);
25
74
 
 
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
 
26
232
SET default_tablespace = '';
27
233
 
28
234
SET default_with_oids = false;
29
235
 
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;
 
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
 
42
2628
 
43
2629
CREATE FUNCTION pgstattuple(text) RETURNS pgstattuple_type
44
 
    AS '$libdir/pgstattuple', 'pgstattuple'
45
 
    LANGUAGE c STRICT;
 
2630
    LANGUAGE c STRICT
 
2631
    AS '$libdir/pgstattuple', 'pgstattuple';
 
2632
 
46
2633
 
47
2634
CREATE FUNCTION pgstattuple(oid) RETURNS pgstattuple_type
48
 
    AS '$libdir/pgstattuple', 'pgstattuplebyid'
49
 
    LANGUAGE c STRICT;
 
2635
    LANGUAGE c STRICT
 
2636
    AS '$libdir/pgstattuple', 'pgstattuplebyid';
 
2637
 
50
2638
 
51
2639
CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
52
 
    AS '$libdir/plpgsql', 'plpgsql_call_handler'
53
 
    LANGUAGE c;
 
2640
    LANGUAGE c
 
2641
    AS '$libdir/plpgsql', 'plpgsql_call_handler';
 
2642
 
54
2643
 
55
2644
CREATE FUNCTION plpython_call_handler() RETURNS language_handler
56
 
    AS '$libdir/plpython', 'plpython_call_handler'
57
 
    LANGUAGE c;
 
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
 
58
4558
 
59
4559
CREATE TABLE account (
60
4560
    id integer NOT NULL,
63
4563
    status integer NOT NULL,
64
4564
    date_status_set timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
65
4565
    displayname text NOT NULL,
66
 
    openid_identifier text DEFAULT generate_openid_identifier() NOT NULL,
67
 
    status_comment text,
68
 
    old_openid_identifier text
 
4566
    status_comment text
69
4567
);
70
4568
 
 
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
 
71
4585
CREATE SEQUENCE account_id_seq
 
4586
    START WITH 1
72
4587
    INCREMENT BY 1
73
4588
    NO MAXVALUE
74
4589
    NO MINVALUE
75
4590
    CACHE 1;
76
4591
 
 
4592
 
77
4593
ALTER SEQUENCE account_id_seq OWNED BY account.id;
78
4594
 
 
4595
 
79
4596
CREATE TABLE accountpassword (
80
4597
    id integer NOT NULL,
81
4598
    account integer NOT NULL,
82
4599
    password text NOT NULL
83
4600
);
84
4601
 
 
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
 
85
4609
CREATE SEQUENCE accountpassword_id_seq
 
4610
    START WITH 1
86
4611
    INCREMENT BY 1
87
4612
    NO MAXVALUE
88
4613
    NO MINVALUE
89
4614
    CACHE 1;
90
4615
 
 
4616
 
91
4617
ALTER SEQUENCE accountpassword_id_seq OWNED BY accountpassword.id;
92
4618
 
 
4619
 
93
4620
CREATE VIEW alllocks AS
94
4621
    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)));
95
4622
 
 
4623
 
96
4624
CREATE TABLE announcement (
97
4625
    id integer NOT NULL,
98
4626
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
110
4638
    CONSTRAINT valid_url CHECK (valid_absolute_url(url))
111
4639
);
112
4640
 
 
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
 
113
4654
CREATE SEQUENCE announcement_id_seq
 
4655
    START WITH 1
114
4656
    INCREMENT BY 1
115
4657
    NO MAXVALUE
116
4658
    NO MINVALUE
117
4659
    CACHE 1;
118
4660
 
 
4661
 
119
4662
ALTER SEQUENCE announcement_id_seq OWNED BY announcement.id;
120
4663
 
 
4664
 
121
4665
CREATE TABLE answercontact (
122
4666
    id integer NOT NULL,
123
4667
    product integer,
128
4672
    CONSTRAINT valid_target CHECK ((((product IS NULL) <> (distribution IS NULL)) AND ((product IS NULL) OR (sourcepackagename IS NULL))))
129
4673
);
130
4674
 
 
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
 
131
4694
CREATE SEQUENCE answercontact_id_seq
 
4695
    START WITH 1
132
4696
    INCREMENT BY 1
133
4697
    NO MAXVALUE
134
4698
    NO MINVALUE
135
4699
    CACHE 1;
136
4700
 
 
4701
 
137
4702
ALTER SEQUENCE answercontact_id_seq OWNED BY answercontact.id;
138
4703
 
 
4704
 
139
4705
CREATE TABLE apportjob (
140
4706
    id integer NOT NULL,
141
4707
    job integer NOT NULL,
144
4710
    json_data text
145
4711
);
146
4712
 
 
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
 
147
4726
CREATE SEQUENCE apportjob_id_seq
 
4727
    START WITH 1
148
4728
    INCREMENT BY 1
149
4729
    NO MAXVALUE
150
4730
    NO MINVALUE
151
4731
    CACHE 1;
152
4732
 
 
4733
 
153
4734
ALTER SEQUENCE apportjob_id_seq OWNED BY apportjob.id;
154
4735
 
 
4736
 
155
4737
CREATE TABLE archive (
156
4738
    id integer NOT NULL,
157
4739
    owner integer NOT NULL,
189
4771
    CONSTRAINT valid_name CHECK (valid_name(name))
190
4772
);
191
4773
 
 
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
 
192
4862
CREATE SEQUENCE archive_id_seq
 
4863
    START WITH 1
193
4864
    INCREMENT BY 1
194
4865
    NO MAXVALUE
195
4866
    NO MINVALUE
196
4867
    CACHE 1;
197
4868
 
 
4869
 
198
4870
ALTER SEQUENCE archive_id_seq OWNED BY archive.id;
199
4871
 
 
4872
 
200
4873
CREATE TABLE archivearch (
201
4874
    id integer NOT NULL,
202
4875
    archive integer NOT NULL,
203
4876
    processorfamily integer NOT NULL
204
4877
);
205
4878
 
 
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
 
206
4889
CREATE SEQUENCE archivearch_id_seq
 
4890
    START WITH 1
207
4891
    INCREMENT BY 1
208
4892
    NO MAXVALUE
209
4893
    NO MINVALUE
210
4894
    CACHE 1;
211
4895
 
 
4896
 
212
4897
ALTER SEQUENCE archivearch_id_seq OWNED BY archivearch.id;
213
4898
 
 
4899
 
214
4900
CREATE TABLE archiveauthtoken (
215
4901
    id integer NOT NULL,
216
4902
    archive integer NOT NULL,
220
4906
    token text NOT NULL
221
4907
);
222
4908
 
 
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
 
223
4928
CREATE SEQUENCE archiveauthtoken_id_seq
 
4929
    START WITH 1
224
4930
    INCREMENT BY 1
225
4931
    NO MAXVALUE
226
4932
    NO MINVALUE
227
4933
    CACHE 1;
228
4934
 
 
4935
 
229
4936
ALTER SEQUENCE archiveauthtoken_id_seq OWNED BY archiveauthtoken.id;
230
4937
 
 
4938
 
231
4939
CREATE TABLE archivedependency (
232
4940
    id integer NOT NULL,
233
4941
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
238
4946
    CONSTRAINT distinct_archives CHECK ((archive <> dependency))
239
4947
);
240
4948
 
 
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
 
241
4962
CREATE SEQUENCE archivedependency_id_seq
 
4963
    START WITH 1
242
4964
    INCREMENT BY 1
243
4965
    NO MAXVALUE
244
4966
    NO MINVALUE
245
4967
    CACHE 1;
246
4968
 
 
4969
 
247
4970
ALTER SEQUENCE archivedependency_id_seq OWNED BY archivedependency.id;
248
4971
 
 
4972
 
249
4973
CREATE TABLE archivejob (
250
4974
    id integer NOT NULL,
251
4975
    job integer NOT NULL,
254
4978
    json_data text
255
4979
);
256
4980
 
 
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
 
257
4994
CREATE SEQUENCE archivejob_id_seq
258
4995
    START WITH 1
259
4996
    INCREMENT BY 1
261
4998
    NO MINVALUE
262
4999
    CACHE 1;
263
5000
 
 
5001
 
264
5002
ALTER SEQUENCE archivejob_id_seq OWNED BY archivejob.id;
265
5003
 
 
5004
 
266
5005
CREATE TABLE archivepermission (
267
5006
    id integer NOT NULL,
268
5007
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
276
5015
    CONSTRAINT one_target CHECK ((null_count(ARRAY[packageset, component, sourcepackagename]) = 2))
277
5016
);
278
5017
 
 
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
 
279
5046
CREATE SEQUENCE archivepermission_id_seq
 
5047
    START WITH 1
280
5048
    INCREMENT BY 1
281
5049
    NO MAXVALUE
282
5050
    NO MINVALUE
283
5051
    CACHE 1;
284
5052
 
 
5053
 
285
5054
ALTER SEQUENCE archivepermission_id_seq OWNED BY archivepermission.id;
286
5055
 
 
5056
 
287
5057
CREATE TABLE archivesubscriber (
288
5058
    id integer NOT NULL,
289
5059
    archive integer NOT NULL,
297
5067
    cancelled_by integer
298
5068
);
299
5069
 
 
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
 
300
5101
CREATE SEQUENCE archivesubscriber_id_seq
 
5102
    START WITH 1
301
5103
    INCREMENT BY 1
302
5104
    NO MAXVALUE
303
5105
    NO MINVALUE
304
5106
    CACHE 1;
305
5107
 
 
5108
 
306
5109
ALTER SEQUENCE archivesubscriber_id_seq OWNED BY archivesubscriber.id;
307
5110
 
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;
327
5111
 
328
5112
CREATE TABLE binarypackagename (
329
5113
    id integer NOT NULL,
331
5115
    CONSTRAINT valid_name CHECK (valid_name(name))
332
5116
);
333
5117
 
 
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
 
334
5125
CREATE TABLE sourcepackagename (
335
5126
    id integer NOT NULL,
336
5127
    name text NOT NULL,
337
5128
    CONSTRAINT valid_name CHECK (valid_name(name))
338
5129
);
339
5130
 
 
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
 
340
5138
CREATE VIEW binaryandsourcepackagenameview AS
341
5139
    SELECT binarypackagename.name FROM binarypackagename UNION SELECT sourcepackagename.name FROM sourcepackagename;
342
5140
 
 
5141
 
343
5142
CREATE TABLE binarypackagebuild (
344
5143
    id integer NOT NULL,
345
5144
    package_build integer NOT NULL,
347
5146
    source_package_release integer NOT NULL
348
5147
);
349
5148
 
 
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
 
350
5162
CREATE SEQUENCE binarypackagebuild_id_seq
 
5163
    START WITH 1
351
5164
    INCREMENT BY 1
352
5165
    NO MAXVALUE
353
5166
    NO MINVALUE
354
5167
    CACHE 1;
355
5168
 
 
5169
 
356
5170
ALTER SEQUENCE binarypackagebuild_id_seq OWNED BY binarypackagebuild.id;
357
5171
 
 
5172
 
358
5173
CREATE TABLE binarypackagefile (
359
5174
    binarypackagerelease integer NOT NULL,
360
5175
    libraryfile integer NOT NULL,
362
5177
    id integer DEFAULT nextval(('binarypackagefile_id_seq'::text)::regclass) NOT NULL
363
5178
);
364
5179
 
 
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
 
365
5193
CREATE SEQUENCE binarypackagefile_id_seq
 
5194
    START WITH 1
366
5195
    INCREMENT BY 1
367
5196
    NO MAXVALUE
368
5197
    NO MINVALUE
369
5198
    CACHE 1;
370
5199
 
 
5200
 
371
5201
ALTER SEQUENCE binarypackagefile_id_seq OWNED BY binarypackagefile.id;
372
5202
 
 
5203
 
373
5204
CREATE TABLE binarypackagepublishinghistory (
374
5205
    id integer NOT NULL,
375
5206
    binarypackagerelease integer NOT NULL,
388
5219
    pocket integer DEFAULT 0 NOT NULL,
389
5220
    archive integer NOT NULL,
390
5221
    removed_by integer,
391
 
    removal_comment text
 
5222
    removal_comment text,
 
5223
    binarypackagename integer
392
5224
);
393
5225
 
 
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
 
394
5281
CREATE TABLE binarypackagerelease (
395
5282
    id integer NOT NULL,
396
5283
    binarypackagename integer NOT NULL,
397
 
    version text NOT NULL,
 
5284
    version debversion NOT NULL,
398
5285
    summary text NOT NULL,
399
5286
    description text NOT NULL,
400
5287
    build integer NOT NULL,
418
5305
    enhances text,
419
5306
    breaks text,
420
5307
    debug_package integer,
421
 
    CONSTRAINT valid_version CHECK (valid_debian_version(version))
 
5308
    user_defined_fields text,
 
5309
    homepage text,
 
5310
    CONSTRAINT valid_version CHECK (valid_debian_version((version)::text))
422
5311
);
423
5312
 
 
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
 
424
5392
CREATE TABLE component (
425
5393
    id integer NOT NULL,
426
5394
    name text NOT NULL,
428
5396
    CONSTRAINT valid_name CHECK (valid_name(name))
429
5397
);
430
5398
 
 
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
 
431
5409
CREATE TABLE distroarchseries (
432
5410
    id integer NOT NULL,
433
5411
    distroseries integer NOT NULL,
437
5415
    official boolean NOT NULL,
438
5416
    package_count integer DEFAULT 0 NOT NULL,
439
5417
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
440
 
    supports_virtualized boolean DEFAULT false 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))
441
5421
);
442
5422
 
 
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
 
443
5449
CREATE TABLE distroseries (
444
5450
    id integer NOT NULL,
445
5451
    distribution integer NOT NULL,
450
5456
    releasestatus integer NOT NULL,
451
5457
    datereleased timestamp without time zone,
452
5458
    parent_series integer,
453
 
    owner integer NOT NULL,
454
 
    lucilleconfig text,
 
5459
    registrant integer NOT NULL,
455
5460
    summary text NOT NULL,
456
5461
    displayname text NOT NULL,
457
5462
    datelastlangpack timestamp without time zone,
468
5473
    language_pack_delta integer,
469
5474
    language_pack_proposed integer,
470
5475
    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,
471
5478
    CONSTRAINT valid_language_pack_delta CHECK (((language_pack_base IS NOT NULL) OR (language_pack_delta IS NULL))),
472
5479
    CONSTRAINT valid_name CHECK (valid_name(name)),
473
5480
    CONSTRAINT valid_version CHECK (sane_version(version))
474
5481
);
475
5482
 
 
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
 
476
5557
CREATE TABLE libraryfilealias (
477
5558
    id integer NOT NULL,
478
5559
    content integer,
486
5567
    CONSTRAINT valid_filename CHECK ((filename !~~ '%/%'::text))
487
5568
);
488
5569
 
 
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
 
489
5598
CREATE TABLE sourcepackagerelease (
490
5599
    id integer NOT NULL,
491
5600
    creator integer NOT NULL,
492
 
    version text NOT NULL,
 
5601
    version debversion NOT NULL,
493
5602
    dateuploaded timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
494
5603
    urgency integer NOT NULL,
495
5604
    dscsigningkey integer,
514
5623
    build_conflicts_indep text,
515
5624
    sourcepackage_recipe_build integer,
516
5625
    changelog integer,
517
 
    CONSTRAINT valid_version CHECK (valid_debian_version(version))
 
5626
    user_defined_fields text,
 
5627
    homepage text,
 
5628
    CONSTRAINT valid_version CHECK (valid_debian_version((version)::text))
518
5629
);
519
5630
 
 
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
 
520
5754
CREATE VIEW binarypackagefilepublishing AS
521
5755
    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);
522
5756
 
 
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
 
523
5761
CREATE SEQUENCE binarypackagename_id_seq
 
5762
    START WITH 1
524
5763
    INCREMENT BY 1
525
5764
    NO MAXVALUE
526
5765
    NO MINVALUE
527
5766
    CACHE 1;
528
5767
 
 
5768
 
529
5769
ALTER SEQUENCE binarypackagename_id_seq OWNED BY binarypackagename.id;
530
5770
 
 
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
 
531
5789
CREATE SEQUENCE binarypackagepublishinghistory_id_seq
 
5790
    START WITH 1
532
5791
    INCREMENT BY 1
533
5792
    NO MAXVALUE
534
5793
    NO MINVALUE
535
5794
    CACHE 1;
536
5795
 
 
5796
 
537
5797
ALTER SEQUENCE binarypackagepublishinghistory_id_seq OWNED BY binarypackagepublishinghistory.id;
538
5798
 
 
5799
 
539
5800
CREATE SEQUENCE binarypackagerelease_id_seq
 
5801
    START WITH 1
540
5802
    INCREMENT BY 1
541
5803
    NO MAXVALUE
542
5804
    NO MINVALUE
543
5805
    CACHE 1;
544
5806
 
 
5807
 
545
5808
ALTER SEQUENCE binarypackagerelease_id_seq OWNED BY binarypackagerelease.id;
546
5809
 
 
5810
 
 
5811
CREATE TABLE binarypackagereleasecontents (
 
5812
    binarypackagerelease integer NOT NULL,
 
5813
    binarypackagepath integer NOT NULL
 
5814
);
 
5815
 
 
5816
 
547
5817
CREATE TABLE binarypackagereleasedownloadcount (
548
5818
    id integer NOT NULL,
549
5819
    archive integer NOT NULL,
553
5823
    count integer NOT NULL
554
5824
);
555
5825
 
 
5826
 
556
5827
CREATE SEQUENCE binarypackagereleasedownloadcount_id_seq
557
5828
    START WITH 1
558
5829
    INCREMENT BY 1
560
5831
    NO MINVALUE
561
5832
    CACHE 1;
562
5833
 
 
5834
 
563
5835
ALTER SEQUENCE binarypackagereleasedownloadcount_id_seq OWNED BY binarypackagereleasedownloadcount.id;
564
5836
 
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;
617
5837
 
618
5838
CREATE TABLE branch (
619
5839
    id integer NOT NULL,
640
5860
    private boolean DEFAULT false NOT NULL,
641
5861
    branch_type integer NOT NULL,
642
5862
    reviewer integer,
643
 
    merge_robot integer,
644
 
    merge_control_status integer DEFAULT 1 NOT NULL,
645
5863
    date_last_modified timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
646
5864
    registrant integer NOT NULL,
647
5865
    branch_format integer,
654
5872
    target_suffix text,
655
5873
    unique_name text,
656
5874
    size_on_disk bigint,
657
 
    CONSTRAINT branch_merge_control CHECK (((merge_robot IS NULL) OR (merge_control_status = ANY (ARRAY[3, 4])))),
 
5875
    merge_queue integer,
 
5876
    merge_queue_config text,
 
5877
    transitively_private boolean DEFAULT true NOT NULL,
 
5878
    access_policy integer,
658
5879
    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))),
659
5880
    CONSTRAINT branch_url_no_trailing_slash CHECK ((url !~~ '%/'::text)),
660
5881
    CONSTRAINT branch_url_not_supermirror CHECK ((url !~~ 'http://bazaar.launchpad.net/%'::text)),
664
5885
    CONSTRAINT valid_url CHECK (valid_absolute_url(url))
665
5886
);
666
5887
 
 
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
 
667
5967
CREATE SEQUENCE branch_id_seq
 
5968
    START WITH 1
668
5969
    INCREMENT BY 1
669
5970
    NO MAXVALUE
670
5971
    NO MINVALUE
671
5972
    CACHE 1;
672
5973
 
 
5974
 
673
5975
ALTER SEQUENCE branch_id_seq OWNED BY branch.id;
674
5976
 
 
5977
 
675
5978
CREATE TABLE branchjob (
676
5979
    id integer NOT NULL,
677
5980
    job integer NOT NULL,
680
5983
    json_data text
681
5984
);
682
5985
 
 
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
 
683
6002
CREATE SEQUENCE branchjob_id_seq
 
6003
    START WITH 1
684
6004
    INCREMENT BY 1
685
6005
    NO MAXVALUE
686
6006
    NO MINVALUE
687
6007
    CACHE 1;
688
6008
 
 
6009
 
689
6010
ALTER SEQUENCE branchjob_id_seq OWNED BY branchjob.id;
690
6011
 
 
6012
 
691
6013
CREATE TABLE branchmergeproposal (
692
6014
    id integer NOT NULL,
693
6015
    registrant integer NOT NULL,
716
6038
    merge_log_file integer,
717
6039
    superseded_by integer,
718
6040
    root_message_id text,
719
 
    review_diff integer,
720
6041
    merge_diff integer,
721
6042
    description text,
722
6043
    CONSTRAINT different_branches CHECK ((((source_branch <> target_branch) AND (dependent_branch <> source_branch)) AND (dependent_branch <> target_branch))),
723
6044
    CONSTRAINT positive_revno CHECK (((merged_revno IS NULL) OR (merged_revno > 0)))
724
6045
);
725
6046
 
 
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
 
726
6132
CREATE SEQUENCE branchmergeproposal_id_seq
 
6133
    START WITH 1
727
6134
    INCREMENT BY 1
728
6135
    NO MAXVALUE
729
6136
    NO MINVALUE
730
6137
    CACHE 1;
731
6138
 
 
6139
 
732
6140
ALTER SEQUENCE branchmergeproposal_id_seq OWNED BY branchmergeproposal.id;
733
6141
 
 
6142
 
734
6143
CREATE TABLE branchmergeproposaljob (
735
6144
    id integer NOT NULL,
736
6145
    job integer NOT NULL,
739
6148
    json_data text
740
6149
);
741
6150
 
 
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
 
742
6167
CREATE SEQUENCE branchmergeproposaljob_id_seq
 
6168
    START WITH 1
743
6169
    INCREMENT BY 1
744
6170
    NO MAXVALUE
745
6171
    NO MINVALUE
746
6172
    CACHE 1;
747
6173
 
 
6174
 
748
6175
ALTER SEQUENCE branchmergeproposaljob_id_seq OWNED BY branchmergeproposaljob.id;
749
6176
 
750
 
CREATE TABLE branchmergerobot (
 
6177
 
 
6178
CREATE TABLE branchmergequeue (
751
6179
    id integer NOT NULL,
752
6180
    registrant integer NOT NULL,
753
6181
    owner integer NOT NULL,
754
6182
    name text NOT NULL,
755
 
    whiteboard text,
756
 
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) 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))
757
6187
);
758
6188
 
759
 
CREATE SEQUENCE branchmergerobot_id_seq
 
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
760
6216
    INCREMENT BY 1
761
6217
    NO MAXVALUE
762
6218
    NO MINVALUE
763
6219
    CACHE 1;
764
6220
 
765
 
ALTER SEQUENCE branchmergerobot_id_seq OWNED BY branchmergerobot.id;
 
6221
 
 
6222
ALTER SEQUENCE branchmergequeue_id_seq OWNED BY branchmergequeue.id;
 
6223
 
766
6224
 
767
6225
CREATE TABLE branchrevision (
768
 
    id integer NOT NULL,
769
6226
    sequence integer,
770
6227
    branch integer NOT NULL,
771
6228
    revision integer NOT NULL
772
 
);
 
6229
)
 
6230
WITH (fillfactor=100);
773
6231
ALTER TABLE ONLY branchrevision ALTER COLUMN branch SET STATISTICS 500;
774
6232
ALTER TABLE ONLY branchrevision ALTER COLUMN revision SET STATISTICS 500;
775
6233
 
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;
783
6234
 
784
6235
CREATE TABLE branchsubscription (
785
6236
    id integer NOT NULL,
792
6243
    subscribed_by integer NOT NULL
793
6244
);
794
6245
 
 
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
 
795
6265
CREATE SEQUENCE branchsubscription_id_seq
 
6266
    START WITH 1
796
6267
    INCREMENT BY 1
797
6268
    NO MAXVALUE
798
6269
    NO MINVALUE
799
6270
    CACHE 1;
800
6271
 
 
6272
 
801
6273
ALTER SEQUENCE branchsubscription_id_seq OWNED BY branchsubscription.id;
802
6274
 
 
6275
 
803
6276
CREATE TABLE branchvisibilitypolicy (
804
6277
    id integer NOT NULL,
805
6278
    project integer,
809
6282
    CONSTRAINT only_one_target CHECK (((project IS NULL) <> (product IS NULL)))
810
6283
);
811
6284
 
 
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
 
812
6301
CREATE SEQUENCE branchvisibilitypolicy_id_seq
 
6302
    START WITH 1
813
6303
    INCREMENT BY 1
814
6304
    NO MAXVALUE
815
6305
    NO MINVALUE
816
6306
    CACHE 1;
817
6307
 
 
6308
 
818
6309
ALTER SEQUENCE branchvisibilitypolicy_id_seq OWNED BY branchvisibilitypolicy.id;
819
6310
 
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
 
);
947
6311
 
948
6312
CREATE SEQUENCE bug_id_seq
 
6313
    START WITH 1
949
6314
    INCREMENT BY 1
950
6315
    NO MAXVALUE
951
6316
    NO MINVALUE
952
6317
    CACHE 1;
953
6318
 
 
6319
 
954
6320
ALTER SEQUENCE bug_id_seq OWNED BY bug.id;
955
6321
 
 
6322
 
956
6323
CREATE TABLE bugactivity (
957
6324
    id integer NOT NULL,
958
6325
    bug integer NOT NULL,
962
6329
    oldvalue text,
963
6330
    newvalue text,
964
6331
    message text
965
 
);
 
6332
)
 
6333
WITH (fillfactor=100);
 
6334
 
966
6335
 
967
6336
CREATE SEQUENCE bugactivity_id_seq
 
6337
    START WITH 1
968
6338
    INCREMENT BY 1
969
6339
    NO MAXVALUE
970
6340
    NO MINVALUE
971
6341
    CACHE 1;
972
6342
 
 
6343
 
973
6344
ALTER SEQUENCE bugactivity_id_seq OWNED BY bugactivity.id;
974
6345
 
 
6346
 
975
6347
CREATE TABLE bugaffectsperson (
976
6348
    id integer NOT NULL,
977
6349
    bug integer NOT NULL,
979
6351
    affected boolean DEFAULT true NOT NULL
980
6352
);
981
6353
 
 
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
 
982
6364
CREATE SEQUENCE bugaffectsperson_id_seq
 
6365
    START WITH 1
983
6366
    INCREMENT BY 1
984
6367
    NO MAXVALUE
985
6368
    NO MINVALUE
986
6369
    CACHE 1;
987
6370
 
 
6371
 
988
6372
ALTER SEQUENCE bugaffectsperson_id_seq OWNED BY bugaffectsperson.id;
989
6373
 
 
6374
 
990
6375
CREATE TABLE bugattachment (
991
6376
    id integer NOT NULL,
992
6377
    message integer NOT NULL,
998
6383
    CONSTRAINT valid_name CHECK (valid_name(name))
999
6384
);
1000
6385
 
 
6386
 
1001
6387
CREATE SEQUENCE bugattachment_id_seq
 
6388
    START WITH 1
1002
6389
    INCREMENT BY 1
1003
6390
    NO MAXVALUE
1004
6391
    NO MINVALUE
1005
6392
    CACHE 1;
1006
6393
 
 
6394
 
1007
6395
ALTER SEQUENCE bugattachment_id_seq OWNED BY bugattachment.id;
1008
6396
 
 
6397
 
1009
6398
CREATE TABLE bugbranch (
1010
6399
    id integer NOT NULL,
1011
6400
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
1016
6405
    registrant integer NOT NULL
1017
6406
);
1018
6407
 
 
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
 
1019
6427
CREATE SEQUENCE bugbranch_id_seq
 
6428
    START WITH 1
1020
6429
    INCREMENT BY 1
1021
6430
    NO MAXVALUE
1022
6431
    NO MINVALUE
1023
6432
    CACHE 1;
1024
6433
 
 
6434
 
1025
6435
ALTER SEQUENCE bugbranch_id_seq OWNED BY bugbranch.id;
1026
6436
 
 
6437
 
1027
6438
CREATE TABLE bugcve (
1028
6439
    id integer NOT NULL,
1029
6440
    bug integer NOT NULL,
1031
6442
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
1032
6443
);
1033
6444
 
 
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
 
1034
6449
CREATE SEQUENCE bugcve_id_seq
 
6450
    START WITH 1
1035
6451
    INCREMENT BY 1
1036
6452
    NO MAXVALUE
1037
6453
    NO MINVALUE
1038
6454
    CACHE 1;
1039
6455
 
 
6456
 
1040
6457
ALTER SEQUENCE bugcve_id_seq OWNED BY bugcve.id;
1041
6458
 
 
6459
 
1042
6460
CREATE TABLE bugjob (
1043
6461
    id integer NOT NULL,
1044
6462
    job integer NOT NULL,
1047
6465
    json_data text
1048
6466
);
1049
6467
 
 
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
 
1050
6481
CREATE SEQUENCE bugjob_id_seq
 
6482
    START WITH 1
1051
6483
    INCREMENT BY 1
1052
6484
    NO MAXVALUE
1053
6485
    NO MINVALUE
1054
6486
    CACHE 1;
1055
6487
 
 
6488
 
1056
6489
ALTER SEQUENCE bugjob_id_seq OWNED BY bugjob.id;
1057
6490
 
 
6491
 
1058
6492
CREATE TABLE bugmessage (
1059
6493
    id integer NOT NULL,
1060
6494
    bug integer NOT NULL,
1061
6495
    message integer NOT NULL,
1062
6496
    bugwatch integer,
1063
6497
    remote_comment_id text,
1064
 
    visible boolean DEFAULT true NOT NULL,
 
6498
    index integer NOT NULL,
 
6499
    owner integer NOT NULL,
1065
6500
    CONSTRAINT imported_comment CHECK (((remote_comment_id IS NULL) OR (bugwatch IS NOT NULL)))
1066
6501
);
1067
6502
 
 
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
 
1068
6516
CREATE SEQUENCE bugmessage_id_seq
 
6517
    START WITH 1
1069
6518
    INCREMENT BY 1
1070
6519
    NO MAXVALUE
1071
6520
    NO MINVALUE
1072
6521
    CACHE 1;
1073
6522
 
 
6523
 
1074
6524
ALTER SEQUENCE bugmessage_id_seq OWNED BY bugmessage.id;
1075
6525
 
 
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
 
1076
6534
CREATE TABLE bugnomination (
1077
6535
    id integer NOT NULL,
1078
6536
    bug integer NOT NULL,
1086
6544
    CONSTRAINT distroseries_or_productseries CHECK (((distroseries IS NULL) <> (productseries IS NULL)))
1087
6545
);
1088
6546
 
 
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
 
1089
6575
CREATE SEQUENCE bugnomination_id_seq
 
6576
    START WITH 1
1090
6577
    INCREMENT BY 1
1091
6578
    NO MAXVALUE
1092
6579
    NO MINVALUE
1093
6580
    CACHE 1;
1094
6581
 
 
6582
 
1095
6583
ALTER SEQUENCE bugnomination_id_seq OWNED BY bugnomination.id;
1096
6584
 
 
6585
 
1097
6586
CREATE TABLE bugnotification (
1098
6587
    id integer NOT NULL,
1099
6588
    bug integer NOT NULL,
1100
6589
    message integer NOT NULL,
1101
6590
    is_comment boolean NOT NULL,
1102
 
    date_emailed timestamp without time zone
 
6591
    date_emailed timestamp without time zone,
 
6592
    status integer DEFAULT 10 NOT NULL,
 
6593
    activity integer
1103
6594
);
1104
6595
 
 
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
 
1105
6612
CREATE SEQUENCE bugnotification_id_seq
 
6613
    START WITH 1
1106
6614
    INCREMENT BY 1
1107
6615
    NO MAXVALUE
1108
6616
    NO MINVALUE
1109
6617
    CACHE 1;
1110
6618
 
 
6619
 
1111
6620
ALTER SEQUENCE bugnotification_id_seq OWNED BY bugnotification.id;
1112
6621
 
 
6622
 
1113
6623
CREATE TABLE bugnotificationarchive (
1114
6624
    id integer NOT NULL,
1115
6625
    bug integer,
1118
6628
    date_emailed timestamp without time zone
1119
6629
);
1120
6630
 
 
6631
 
1121
6632
CREATE TABLE bugnotificationattachment (
1122
6633
    id integer NOT NULL,
1123
6634
    message integer NOT NULL,
1124
6635
    bug_notification integer NOT NULL
1125
6636
);
1126
6637
 
 
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
 
1127
6648
CREATE SEQUENCE bugnotificationattachment_id_seq
 
6649
    START WITH 1
1128
6650
    INCREMENT BY 1
1129
6651
    NO MAXVALUE
1130
6652
    NO MINVALUE
1131
6653
    CACHE 1;
1132
6654
 
 
6655
 
1133
6656
ALTER SEQUENCE bugnotificationattachment_id_seq OWNED BY bugnotificationattachment.id;
1134
6657
 
 
6658
 
 
6659
CREATE TABLE bugnotificationfilter (
 
6660
    bug_notification integer NOT NULL,
 
6661
    bug_subscription_filter integer NOT NULL
 
6662
);
 
6663
 
 
6664
 
1135
6665
CREATE TABLE bugnotificationrecipient (
1136
6666
    id integer NOT NULL,
1137
6667
    bug_notification integer NOT NULL,
1140
6670
    reason_body text NOT NULL
1141
6671
);
1142
6672
 
 
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
 
1143
6689
CREATE SEQUENCE bugnotificationrecipient_id_seq
 
6690
    START WITH 1
1144
6691
    INCREMENT BY 1
1145
6692
    NO MAXVALUE
1146
6693
    NO MINVALUE
1147
6694
    CACHE 1;
1148
6695
 
 
6696
 
1149
6697
ALTER SEQUENCE bugnotificationrecipient_id_seq OWNED BY bugnotificationrecipient.id;
1150
6698
 
 
6699
 
1151
6700
CREATE TABLE bugnotificationrecipientarchive (
1152
6701
    id integer NOT NULL,
1153
6702
    bug_notification integer,
1156
6705
    reason_body text
1157
6706
);
1158
6707
 
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
 
);
1211
6708
 
1212
6709
CREATE SEQUENCE bugsubscription_id_seq
 
6710
    START WITH 1
1213
6711
    INCREMENT BY 1
1214
6712
    NO MAXVALUE
1215
6713
    NO MINVALUE
1216
6714
    CACHE 1;
1217
6715
 
 
6716
 
1218
6717
ALTER SEQUENCE bugsubscription_id_seq OWNED BY bugsubscription.id;
1219
6718
 
1220
 
CREATE TABLE bugtag (
1221
 
    id integer NOT NULL,
1222
 
    bug integer NOT NULL,
 
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,
1223
6828
    tag text NOT NULL,
1224
 
    CONSTRAINT valid_tag CHECK (valid_name(tag))
1225
 
);
 
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
 
1226
6895
 
1227
6896
CREATE SEQUENCE bugtag_id_seq
 
6897
    START WITH 1
1228
6898
    INCREMENT BY 1
1229
6899
    NO MAXVALUE
1230
6900
    NO MINVALUE
1231
6901
    CACHE 1;
1232
6902
 
 
6903
 
1233
6904
ALTER SEQUENCE bugtag_id_seq OWNED BY bugtag.id;
1234
6905
 
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
 
);
1269
6906
 
1270
6907
CREATE SEQUENCE bugtask_id_seq
 
6908
    START WITH 1
1271
6909
    INCREMENT BY 1
1272
6910
    NO MAXVALUE
1273
6911
    NO MINVALUE
1274
6912
    CACHE 1;
1275
6913
 
 
6914
 
1276
6915
ALTER SEQUENCE bugtask_id_seq OWNED BY bugtask.id;
1277
6916
 
 
6917
 
1278
6918
CREATE TABLE bugtracker (
1279
6919
    id integer NOT NULL,
1280
6920
    bugtrackertype integer NOT NULL,
1292
6932
    CONSTRAINT valid_name CHECK (valid_name(name))
1293
6933
);
1294
6934
 
 
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
 
1295
6969
CREATE SEQUENCE bugtracker_id_seq
 
6970
    START WITH 1
1296
6971
    INCREMENT BY 1
1297
6972
    NO MAXVALUE
1298
6973
    NO MINVALUE
1299
6974
    CACHE 1;
1300
6975
 
 
6976
 
1301
6977
ALTER SEQUENCE bugtracker_id_seq OWNED BY bugtracker.id;
1302
6978
 
 
6979
 
1303
6980
CREATE TABLE bugtrackeralias (
1304
6981
    id integer NOT NULL,
1305
6982
    bugtracker integer NOT NULL,
1306
6983
    base_url text NOT NULL
1307
6984
);
1308
6985
 
 
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
 
1309
6996
CREATE SEQUENCE bugtrackeralias_id_seq
 
6997
    START WITH 1
1310
6998
    INCREMENT BY 1
1311
6999
    NO MAXVALUE
1312
7000
    NO MINVALUE
1313
7001
    CACHE 1;
1314
7002
 
 
7003
 
1315
7004
ALTER SEQUENCE bugtrackeralias_id_seq OWNED BY bugtrackeralias.id;
1316
7005
 
 
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
 
1317
7078
CREATE TABLE bugtrackerperson (
1318
7079
    id integer NOT NULL,
1319
7080
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
1322
7083
    name text NOT NULL
1323
7084
);
1324
7085
 
 
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
 
1325
7102
CREATE SEQUENCE bugtrackerperson_id_seq
 
7103
    START WITH 1
1326
7104
    INCREMENT BY 1
1327
7105
    NO MAXVALUE
1328
7106
    NO MINVALUE
1329
7107
    CACHE 1;
1330
7108
 
 
7109
 
1331
7110
ALTER SEQUENCE bugtrackerperson_id_seq OWNED BY bugtrackerperson.id;
1332
7111
 
 
7112
 
1333
7113
CREATE TABLE bugwatch (
1334
7114
    id integer NOT NULL,
1335
7115
    bug integer NOT NULL,
1346
7126
    next_check timestamp without time zone
1347
7127
);
1348
7128
 
 
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
 
1349
7142
CREATE SEQUENCE bugwatch_id_seq
 
7143
    START WITH 1
1350
7144
    INCREMENT BY 1
1351
7145
    NO MAXVALUE
1352
7146
    NO MINVALUE
1353
7147
    CACHE 1;
1354
7148
 
 
7149
 
1355
7150
ALTER SEQUENCE bugwatch_id_seq OWNED BY bugwatch.id;
1356
7151
 
 
7152
 
1357
7153
CREATE TABLE bugwatchactivity (
1358
7154
    id integer NOT NULL,
1359
7155
    bug_watch integer NOT NULL,
1361
7157
    result integer NOT NULL,
1362
7158
    message text,
1363
7159
    oops_id text
1364
 
);
 
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
 
1365
7181
 
1366
7182
CREATE SEQUENCE bugwatchactivity_id_seq
 
7183
    START WITH 1
1367
7184
    INCREMENT BY 1
1368
7185
    NO MAXVALUE
1369
7186
    NO MINVALUE
1370
7187
    CACHE 1;
1371
7188
 
 
7189
 
1372
7190
ALTER SEQUENCE bugwatchactivity_id_seq OWNED BY bugwatchactivity.id;
1373
7191
 
 
7192
 
1374
7193
CREATE TABLE builder (
1375
7194
    id integer NOT NULL,
1376
7195
    processor integer NOT NULL,
1387
7206
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
1388
7207
    vm_host text,
1389
7208
    active boolean DEFAULT true NOT NULL,
 
7209
    failure_count integer DEFAULT 0 NOT NULL,
1390
7210
    CONSTRAINT valid_absolute_url CHECK (valid_absolute_url(url))
1391
7211
);
1392
7212
 
 
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
 
1393
7244
CREATE SEQUENCE builder_id_seq
 
7245
    START WITH 1
1394
7246
    INCREMENT BY 1
1395
7247
    NO MAXVALUE
1396
7248
    NO MINVALUE
1397
7249
    CACHE 1;
1398
7250
 
 
7251
 
1399
7252
ALTER SEQUENCE builder_id_seq OWNED BY builder.id;
1400
7253
 
 
7254
 
1401
7255
CREATE TABLE buildfarmjob (
1402
7256
    id integer NOT NULL,
1403
7257
    processor integer,
1410
7264
    status integer NOT NULL,
1411
7265
    log integer,
1412
7266
    job_type integer NOT NULL,
 
7267
    failure_count integer DEFAULT 0 NOT NULL,
1413
7268
    CONSTRAINT started_if_finished CHECK (((date_finished IS NULL) OR (date_started IS NOT NULL)))
1414
7269
);
1415
7270
 
 
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
 
1416
7308
CREATE SEQUENCE buildfarmjob_id_seq
 
7309
    START WITH 1
1417
7310
    INCREMENT BY 1
1418
7311
    NO MAXVALUE
1419
7312
    NO MINVALUE
1420
7313
    CACHE 1;
1421
7314
 
 
7315
 
1422
7316
ALTER SEQUENCE buildfarmjob_id_seq OWNED BY buildfarmjob.id;
1423
7317
 
 
7318
 
1424
7319
CREATE TABLE buildpackagejob (
1425
7320
    id integer NOT NULL,
1426
7321
    job integer NOT NULL,
1427
7322
    build integer NOT NULL
1428
7323
);
1429
7324
 
 
7325
 
1430
7326
CREATE SEQUENCE buildpackagejob_id_seq
 
7327
    START WITH 1
1431
7328
    INCREMENT BY 1
1432
7329
    NO MAXVALUE
1433
7330
    NO MINVALUE
1434
7331
    CACHE 1;
1435
7332
 
 
7333
 
1436
7334
ALTER SEQUENCE buildpackagejob_id_seq OWNED BY buildpackagejob.id;
1437
7335
 
 
7336
 
1438
7337
CREATE TABLE buildqueue (
1439
7338
    id integer NOT NULL,
1440
7339
    builder integer,
1448
7347
    virtualized boolean
1449
7348
);
1450
7349
 
 
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
 
1451
7381
CREATE SEQUENCE buildqueue_id_seq
 
7382
    START WITH 1
1452
7383
    INCREMENT BY 1
1453
7384
    NO MAXVALUE
1454
7385
    NO MINVALUE
1455
7386
    CACHE 1;
1456
7387
 
 
7388
 
1457
7389
ALTER SEQUENCE buildqueue_id_seq OWNED BY buildqueue.id;
1458
7390
 
 
7391
 
1459
7392
CREATE TABLE codeimport (
1460
7393
    id integer NOT NULL,
1461
7394
    branch integer NOT NULL,
1470
7403
    assignee integer,
1471
7404
    update_interval interval,
1472
7405
    url text,
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)
 
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)
1474
7407
);
1475
7408
 
 
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
 
1476
7446
CREATE SEQUENCE codeimport_id_seq
 
7447
    START WITH 1
1477
7448
    INCREMENT BY 1
1478
7449
    NO MAXVALUE
1479
7450
    NO MINVALUE
1480
7451
    CACHE 1;
1481
7452
 
 
7453
 
1482
7454
ALTER SEQUENCE codeimport_id_seq OWNED BY codeimport.id;
1483
7455
 
 
7456
 
1484
7457
CREATE TABLE codeimportevent (
1485
7458
    id integer NOT NULL,
1486
7459
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
1490
7463
    machine integer
1491
7464
);
1492
7465
 
 
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
 
1493
7482
CREATE SEQUENCE codeimportevent_id_seq
 
7483
    START WITH 1
1494
7484
    INCREMENT BY 1
1495
7485
    NO MAXVALUE
1496
7486
    NO MINVALUE
1497
7487
    CACHE 1;
1498
7488
 
 
7489
 
1499
7490
ALTER SEQUENCE codeimportevent_id_seq OWNED BY codeimportevent.id;
1500
7491
 
 
7492
 
1501
7493
CREATE TABLE codeimporteventdata (
1502
7494
    id integer NOT NULL,
1503
7495
    event integer,
1505
7497
    data_value text
1506
7498
);
1507
7499
 
 
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
 
1508
7513
CREATE SEQUENCE codeimporteventdata_id_seq
 
7514
    START WITH 1
1509
7515
    INCREMENT BY 1
1510
7516
    NO MAXVALUE
1511
7517
    NO MINVALUE
1512
7518
    CACHE 1;
1513
7519
 
 
7520
 
1514
7521
ALTER SEQUENCE codeimporteventdata_id_seq OWNED BY codeimporteventdata.id;
1515
7522
 
 
7523
 
1516
7524
CREATE TABLE codeimportjob (
1517
7525
    id integer NOT NULL,
1518
7526
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
1528
7536
    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)
1529
7537
);
1530
7538
 
 
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
 
1531
7570
CREATE SEQUENCE codeimportjob_id_seq
 
7571
    START WITH 1
1532
7572
    INCREMENT BY 1
1533
7573
    NO MAXVALUE
1534
7574
    NO MINVALUE
1535
7575
    CACHE 1;
1536
7576
 
 
7577
 
1537
7578
ALTER SEQUENCE codeimportjob_id_seq OWNED BY codeimportjob.id;
1538
7579
 
 
7580
 
1539
7581
CREATE TABLE codeimportmachine (
1540
7582
    id integer NOT NULL,
1541
7583
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
1544
7586
    heartbeat timestamp without time zone
1545
7587
);
1546
7588
 
 
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
 
1547
7602
CREATE SEQUENCE codeimportmachine_id_seq
 
7603
    START WITH 1
1548
7604
    INCREMENT BY 1
1549
7605
    NO MAXVALUE
1550
7606
    NO MINVALUE
1551
7607
    CACHE 1;
1552
7608
 
 
7609
 
1553
7610
ALTER SEQUENCE codeimportmachine_id_seq OWNED BY codeimportmachine.id;
1554
7611
 
 
7612
 
1555
7613
CREATE TABLE codeimportresult (
1556
7614
    id integer NOT NULL,
1557
7615
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
1564
7622
    date_job_started timestamp without time zone
1565
7623
);
1566
7624
 
 
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
 
1567
7647
CREATE SEQUENCE codeimportresult_id_seq
 
7648
    START WITH 1
1568
7649
    INCREMENT BY 1
1569
7650
    NO MAXVALUE
1570
7651
    NO MINVALUE
1571
7652
    CACHE 1;
1572
7653
 
 
7654
 
1573
7655
ALTER SEQUENCE codeimportresult_id_seq OWNED BY codeimportresult.id;
1574
7656
 
 
7657
 
1575
7658
CREATE TABLE codereviewmessage (
1576
7659
    id integer NOT NULL,
1577
7660
    branch_merge_proposal integer NOT NULL,
1580
7663
    vote_tag text
1581
7664
);
1582
7665
 
 
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
 
1583
7682
CREATE SEQUENCE codereviewmessage_id_seq
 
7683
    START WITH 1
1584
7684
    INCREMENT BY 1
1585
7685
    NO MAXVALUE
1586
7686
    NO MINVALUE
1587
7687
    CACHE 1;
1588
7688
 
 
7689
 
1589
7690
ALTER SEQUENCE codereviewmessage_id_seq OWNED BY codereviewmessage.id;
1590
7691
 
 
7692
 
1591
7693
CREATE TABLE codereviewvote (
1592
7694
    id integer NOT NULL,
1593
7695
    branch_merge_proposal integer NOT NULL,
1598
7700
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
1599
7701
);
1600
7702
 
 
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
 
1601
7725
CREATE SEQUENCE codereviewvote_id_seq
 
7726
    START WITH 1
1602
7727
    INCREMENT BY 1
1603
7728
    NO MAXVALUE
1604
7729
    NO MINVALUE
1605
7730
    CACHE 1;
1606
7731
 
 
7732
 
1607
7733
ALTER SEQUENCE codereviewvote_id_seq OWNED BY codereviewvote.id;
1608
7734
 
 
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
 
1609
7740
CREATE TABLE commercialsubscription (
1610
7741
    id integer NOT NULL,
1611
7742
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
1620
7751
    sales_system_id text
1621
7752
);
1622
7753
 
 
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
 
1623
7788
CREATE SEQUENCE commercialsubscription_id_seq
 
7789
    START WITH 1
1624
7790
    INCREMENT BY 1
1625
7791
    NO MAXVALUE
1626
7792
    NO MINVALUE
1627
7793
    CACHE 1;
1628
7794
 
 
7795
 
1629
7796
ALTER SEQUENCE commercialsubscription_id_seq OWNED BY commercialsubscription.id;
1630
7797
 
 
7798
 
1631
7799
CREATE SEQUENCE component_id_seq
 
7800
    START WITH 1
1632
7801
    INCREMENT BY 1
1633
7802
    NO MAXVALUE
1634
7803
    NO MINVALUE
1635
7804
    CACHE 1;
1636
7805
 
 
7806
 
1637
7807
ALTER SEQUENCE component_id_seq OWNED BY component.id;
1638
7808
 
 
7809
 
1639
7810
CREATE TABLE componentselection (
1640
7811
    id integer NOT NULL,
1641
7812
    distroseries integer NOT NULL,
1643
7814
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
1644
7815
);
1645
7816
 
 
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
 
1646
7827
CREATE SEQUENCE componentselection_id_seq
 
7828
    START WITH 1
1647
7829
    INCREMENT BY 1
1648
7830
    NO MAXVALUE
1649
7831
    NO MINVALUE
1650
7832
    CACHE 1;
1651
7833
 
 
7834
 
1652
7835
ALTER SEQUENCE componentselection_id_seq OWNED BY componentselection.id;
1653
7836
 
 
7837
 
1654
7838
CREATE TABLE continent (
1655
7839
    id integer NOT NULL,
1656
7840
    code text NOT NULL,
1657
7841
    name text NOT NULL
1658
 
);
 
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
 
1659
7854
 
1660
7855
CREATE SEQUENCE continent_id_seq
 
7856
    START WITH 1
1661
7857
    INCREMENT BY 1
1662
7858
    NO MAXVALUE
1663
7859
    NO MINVALUE
1664
7860
    CACHE 1;
1665
7861
 
 
7862
 
1666
7863
ALTER SEQUENCE continent_id_seq OWNED BY continent.id;
1667
7864
 
 
7865
 
1668
7866
CREATE TABLE country (
1669
7867
    id integer NOT NULL,
1670
7868
    iso3166code2 character(2) NOT NULL,
1673
7871
    title text,
1674
7872
    description text,
1675
7873
    continent integer NOT NULL
1676
 
);
 
7874
)
 
7875
WITH (fillfactor=100);
 
7876
 
1677
7877
 
1678
7878
CREATE SEQUENCE country_id_seq
 
7879
    START WITH 1
1679
7880
    INCREMENT BY 1
1680
7881
    NO MAXVALUE
1681
7882
    NO MINVALUE
1682
7883
    CACHE 1;
1683
7884
 
 
7885
 
1684
7886
ALTER SEQUENCE country_id_seq OWNED BY country.id;
1685
7887
 
 
7888
 
1686
7889
CREATE TABLE customlanguagecode (
1687
7890
    id integer NOT NULL,
1688
7891
    product integer,
1694
7897
    CONSTRAINT product_or_distro CHECK (((product IS NULL) <> (distribution IS NULL)))
1695
7898
);
1696
7899
 
 
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
 
1697
7919
CREATE SEQUENCE customlanguagecode_id_seq
 
7920
    START WITH 1
1698
7921
    INCREMENT BY 1
1699
7922
    NO MAXVALUE
1700
7923
    NO MINVALUE
1701
7924
    CACHE 1;
1702
7925
 
 
7926
 
1703
7927
ALTER SEQUENCE customlanguagecode_id_seq OWNED BY customlanguagecode.id;
1704
7928
 
 
7929
 
1705
7930
CREATE TABLE cve (
1706
7931
    id integer NOT NULL,
1707
7932
    sequence text NOT NULL,
1713
7938
    CONSTRAINT valid_cve_ref CHECK (valid_cve(sequence))
1714
7939
);
1715
7940
 
 
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
 
1716
7954
CREATE SEQUENCE cve_id_seq
 
7955
    START WITH 1
1717
7956
    INCREMENT BY 1
1718
7957
    NO MAXVALUE
1719
7958
    NO MINVALUE
1720
7959
    CACHE 1;
1721
7960
 
 
7961
 
1722
7962
ALTER SEQUENCE cve_id_seq OWNED BY cve.id;
1723
7963
 
 
7964
 
1724
7965
CREATE TABLE cvereference (
1725
7966
    id integer NOT NULL,
1726
7967
    cve integer NOT NULL,
1730
7971
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
1731
7972
);
1732
7973
 
 
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
 
1733
7987
CREATE SEQUENCE cvereference_id_seq
 
7988
    START WITH 1
1734
7989
    INCREMENT BY 1
1735
7990
    NO MAXVALUE
1736
7991
    NO MINVALUE
1737
7992
    CACHE 1;
1738
7993
 
 
7994
 
1739
7995
ALTER SEQUENCE cvereference_id_seq OWNED BY cvereference.id;
1740
7996
 
 
7997
 
1741
7998
CREATE TABLE databasecpustats (
1742
7999
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
1743
8000
    username text NOT NULL,
1744
8001
    cpu integer NOT NULL
1745
 
);
 
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
 
1746
8032
 
1747
8033
CREATE TABLE databasereplicationlag (
1748
8034
    node integer NOT NULL,
1750
8036
    updated timestamp without time zone DEFAULT timezone('UTC'::text, now())
1751
8037
);
1752
8038
 
 
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
 
1753
8052
CREATE TABLE databasetablestats (
1754
8053
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
1755
8054
    schemaname name NOT NULL,
1768
8067
    last_autovacuum timestamp with time zone,
1769
8068
    last_analyze timestamp with time zone,
1770
8069
    last_autoanalyze timestamp with time zone
1771
 
);
 
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
 
1772
8076
 
1773
8077
CREATE TABLE diff (
1774
8078
    id integer NOT NULL,
1779
8083
    removed_lines_count integer
1780
8084
);
1781
8085
 
 
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
 
1782
8105
CREATE SEQUENCE diff_id_seq
 
8106
    START WITH 1
1783
8107
    INCREMENT BY 1
1784
8108
    NO MAXVALUE
1785
8109
    NO MINVALUE
1786
8110
    CACHE 1;
1787
8111
 
 
8112
 
1788
8113
ALTER SEQUENCE diff_id_seq OWNED BY diff.id;
1789
8114
 
 
8115
 
1790
8116
CREATE TABLE distribution (
1791
8117
    id integer NOT NULL,
1792
8118
    name text NOT NULL,
1794
8120
    description text NOT NULL,
1795
8121
    domainname text NOT NULL,
1796
8122
    owner integer NOT NULL,
1797
 
    lucilleconfig text,
1798
8123
    displayname text NOT NULL,
1799
8124
    summary text NOT NULL,
1800
8125
    members integer NOT NULL,
1826
8151
    answers_usage integer DEFAULT 10 NOT NULL,
1827
8152
    blueprints_usage integer DEFAULT 10 NOT NULL,
1828
8153
    translations_usage integer DEFAULT 10 NOT NULL,
 
8154
    registrant integer NOT NULL,
 
8155
    package_derivatives_email text,
1829
8156
    CONSTRAINT only_launchpad_has_expiration CHECK (((enable_bug_expiration IS FALSE) OR (official_malone IS TRUE))),
1830
8157
    CONSTRAINT valid_name CHECK (valid_name(name))
1831
8158
);
1832
8159
 
 
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
 
1833
8258
CREATE SEQUENCE distribution_id_seq
 
8259
    START WITH 1
1834
8260
    INCREMENT BY 1
1835
8261
    NO MAXVALUE
1836
8262
    NO MINVALUE
1837
8263
    CACHE 1;
1838
8264
 
 
8265
 
1839
8266
ALTER SEQUENCE distribution_id_seq OWNED BY distribution.id;
1840
8267
 
1841
 
CREATE TABLE distributionbounty (
 
8268
 
 
8269
CREATE TABLE distributionjob (
1842
8270
    id integer NOT NULL,
1843
 
    bounty integer NOT NULL,
 
8271
    job integer NOT NULL,
1844
8272
    distribution integer NOT NULL,
1845
 
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
 
8273
    distroseries integer,
 
8274
    job_type integer NOT NULL,
 
8275
    json_data text
1846
8276
);
1847
8277
 
1848
 
CREATE SEQUENCE distributionbounty_id_seq
 
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
1849
8296
    INCREMENT BY 1
1850
8297
    NO MAXVALUE
1851
8298
    NO MINVALUE
1852
8299
    CACHE 1;
1853
8300
 
1854
 
ALTER SEQUENCE distributionbounty_id_seq OWNED BY distributionbounty.id;
 
8301
 
 
8302
ALTER SEQUENCE distributionjob_id_seq OWNED BY distributionjob.id;
 
8303
 
1855
8304
 
1856
8305
CREATE TABLE distributionmirror (
1857
8306
    id integer NOT NULL,
1881
8330
    CONSTRAINT valid_rsync_base_url CHECK (valid_absolute_url(rsync_base_url))
1882
8331
);
1883
8332
 
 
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
 
1884
8394
CREATE SEQUENCE distributionmirror_id_seq
 
8395
    START WITH 1
1885
8396
    INCREMENT BY 1
1886
8397
    NO MAXVALUE
1887
8398
    NO MINVALUE
1888
8399
    CACHE 1;
1889
8400
 
 
8401
 
1890
8402
ALTER SEQUENCE distributionmirror_id_seq OWNED BY distributionmirror.id;
1891
8403
 
 
8404
 
1892
8405
CREATE TABLE distributionsourcepackage (
1893
8406
    id integer NOT NULL,
1894
8407
    distribution integer NOT NULL,
1899
8412
    total_bug_heat integer,
1900
8413
    bug_count integer,
1901
8414
    po_message_count integer,
1902
 
    is_upstream_link_allowed boolean DEFAULT true NOT NULL
 
8415
    is_upstream_link_allowed boolean DEFAULT true NOT NULL,
 
8416
    enable_bugfiling_duplicate_search boolean DEFAULT true NOT NULL
1903
8417
);
1904
8418
 
 
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
 
1905
8447
CREATE SEQUENCE distributionsourcepackage_id_seq
 
8448
    START WITH 1
1906
8449
    INCREMENT BY 1
1907
8450
    NO MAXVALUE
1908
8451
    NO MINVALUE
1909
8452
    CACHE 1;
1910
8453
 
 
8454
 
1911
8455
ALTER SEQUENCE distributionsourcepackage_id_seq OWNED BY distributionsourcepackage.id;
1912
8456
 
 
8457
 
1913
8458
CREATE TABLE distributionsourcepackagecache (
1914
8459
    id integer NOT NULL,
1915
8460
    distribution integer NOT NULL,
1923
8468
    archive integer NOT NULL
1924
8469
);
1925
8470
 
 
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
 
1926
8499
CREATE SEQUENCE distributionsourcepackagecache_id_seq
 
8500
    START WITH 1
1927
8501
    INCREMENT BY 1
1928
8502
    NO MAXVALUE
1929
8503
    NO MINVALUE
1930
8504
    CACHE 1;
1931
8505
 
 
8506
 
1932
8507
ALTER SEQUENCE distributionsourcepackagecache_id_seq OWNED BY distributionsourcepackagecache.id;
1933
8508
 
 
8509
 
1934
8510
CREATE SEQUENCE distroarchseries_id_seq
 
8511
    START WITH 1
1935
8512
    INCREMENT BY 1
1936
8513
    NO MAXVALUE
1937
8514
    NO MINVALUE
1938
8515
    CACHE 1;
1939
8516
 
 
8517
 
1940
8518
ALTER SEQUENCE distroarchseries_id_seq OWNED BY distroarchseries.id;
1941
8519
 
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;
1957
8520
 
1958
8521
CREATE SEQUENCE distroseries_id_seq
 
8522
    START WITH 1
1959
8523
    INCREMENT BY 1
1960
8524
    NO MAXVALUE
1961
8525
    NO MINVALUE
1962
8526
    CACHE 1;
1963
8527
 
 
8528
 
1964
8529
ALTER SEQUENCE distroseries_id_seq OWNED BY distroseries.id;
1965
8530
 
 
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
 
1966
8618
CREATE TABLE distroserieslanguage (
1967
8619
    id integer NOT NULL,
1968
8620
    distroseries integer,
1975
8627
    unreviewed_count integer DEFAULT 0 NOT NULL
1976
8628
);
1977
8629
 
 
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
 
1978
8652
CREATE SEQUENCE distroserieslanguage_id_seq
 
8653
    START WITH 1
1979
8654
    INCREMENT BY 1
1980
8655
    NO MAXVALUE
1981
8656
    NO MINVALUE
1982
8657
    CACHE 1;
1983
8658
 
 
8659
 
1984
8660
ALTER SEQUENCE distroserieslanguage_id_seq OWNED BY distroserieslanguage.id;
1985
8661
 
 
8662
 
1986
8663
CREATE TABLE distroseriespackagecache (
1987
8664
    id integer NOT NULL,
1988
8665
    distroseries integer NOT NULL,
1996
8673
    archive integer NOT NULL
1997
8674
);
1998
8675
 
 
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
 
1999
8701
CREATE SEQUENCE distroseriespackagecache_id_seq
 
8702
    START WITH 1
2000
8703
    INCREMENT BY 1
2001
8704
    NO MAXVALUE
2002
8705
    NO MINVALUE
2003
8706
    CACHE 1;
2004
8707
 
 
8708
 
2005
8709
ALTER SEQUENCE distroseriespackagecache_id_seq OWNED BY distroseriespackagecache.id;
2006
8710
 
 
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
 
2007
8735
CREATE TABLE emailaddress (
2008
8736
    id integer NOT NULL,
2009
8737
    email text NOT NULL,
2014
8742
    CONSTRAINT emailaddress__is_linked__chk CHECK (((person IS NOT NULL) OR (account IS NOT NULL)))
2015
8743
);
2016
8744
 
 
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
 
2017
8749
CREATE SEQUENCE emailaddress_id_seq
 
8750
    START WITH 1
2018
8751
    INCREMENT BY 1
2019
8752
    NO MAXVALUE
2020
8753
    NO MINVALUE
2021
8754
    CACHE 1;
2022
8755
 
 
8756
 
2023
8757
ALTER SEQUENCE emailaddress_id_seq OWNED BY emailaddress.id;
2024
8758
 
 
8759
 
2025
8760
CREATE TABLE entitlement (
2026
8761
    id integer NOT NULL,
2027
8762
    person integer,
2043
8778
    CONSTRAINT only_one_target CHECK ((null_count(ARRAY[person, product, project, distribution]) = 3))
2044
8779
);
2045
8780
 
 
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
 
2046
8833
CREATE SEQUENCE entitlement_id_seq
 
8834
    START WITH 1
2047
8835
    INCREMENT BY 1
2048
8836
    NO MAXVALUE
2049
8837
    NO MINVALUE
2050
8838
    CACHE 1;
2051
8839
 
 
8840
 
2052
8841
ALTER SEQUENCE entitlement_id_seq OWNED BY entitlement.id;
2053
8842
 
 
8843
 
2054
8844
CREATE VIEW exclusivelocks AS
2055
8845
    SELECT alllocks.procpid, alllocks.usename, alllocks.age, alllocks.relname, alllocks.mode, alllocks.granted, alllocks.current_query FROM alllocks WHERE (alllocks.mode !~~ '%Share%'::text);
2056
8846
 
 
8847
 
2057
8848
CREATE TABLE faq (
2058
8849
    id integer NOT NULL,
2059
8850
    title text NOT NULL,
2069
8860
    CONSTRAINT product_or_distro CHECK (((product IS NULL) <> (distribution IS NULL)))
2070
8861
);
2071
8862
 
 
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
 
2072
8899
CREATE SEQUENCE faq_id_seq
 
8900
    START WITH 1
2073
8901
    INCREMENT BY 1
2074
8902
    NO MAXVALUE
2075
8903
    NO MINVALUE
2076
8904
    CACHE 1;
2077
8905
 
 
8906
 
2078
8907
ALTER SEQUENCE faq_id_seq OWNED BY faq.id;
2079
8908
 
 
8909
 
2080
8910
CREATE TABLE featuredproject (
2081
8911
    id integer NOT NULL,
2082
8912
    pillar_name integer NOT NULL
2083
8913
);
2084
8914
 
 
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
 
2085
8922
CREATE SEQUENCE featuredproject_id_seq
 
8923
    START WITH 1
2086
8924
    INCREMENT BY 1
2087
8925
    NO MAXVALUE
2088
8926
    NO MINVALUE
2089
8927
    CACHE 1;
2090
8928
 
 
8929
 
2091
8930
ALTER SEQUENCE featuredproject_id_seq OWNED BY featuredproject.id;
2092
8931
 
 
8932
 
2093
8933
CREATE TABLE featureflag (
2094
8934
    scope text NOT NULL,
2095
8935
    priority integer NOT NULL,
2096
8936
    flag text NOT NULL,
2097
 
    value text,
 
8937
    value text NOT NULL,
2098
8938
    date_modified timestamp without time zone DEFAULT timezone('utc'::text, now()) NOT NULL
2099
8939
);
2100
8940
 
 
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
 
2101
8976
CREATE TABLE flatpackagesetinclusion (
2102
8977
    id integer NOT NULL,
2103
8978
    parent integer NOT NULL,
2104
8979
    child integer NOT NULL
2105
8980
);
2106
8981
 
 
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
 
2107
8992
CREATE SEQUENCE flatpackagesetinclusion_id_seq
 
8993
    START WITH 1
2108
8994
    INCREMENT BY 1
2109
8995
    NO MAXVALUE
2110
8996
    NO MINVALUE
2111
8997
    CACHE 1;
2112
8998
 
 
8999
 
2113
9000
ALTER SEQUENCE flatpackagesetinclusion_id_seq OWNED BY flatpackagesetinclusion.id;
2114
9001
 
 
9002
 
2115
9003
CREATE TABLE fticache (
2116
9004
    id integer NOT NULL,
2117
9005
    tablename text NOT NULL,
2118
9006
    columns text NOT NULL
2119
9007
);
2120
9008
 
 
9009
 
2121
9010
CREATE SEQUENCE fticache_id_seq
 
9011
    START WITH 1
2122
9012
    INCREMENT BY 1
2123
9013
    NO MAXVALUE
2124
9014
    NO MINVALUE
2125
9015
    CACHE 1;
2126
9016
 
 
9017
 
2127
9018
ALTER SEQUENCE fticache_id_seq OWNED BY fticache.id;
2128
9019
 
 
9020
 
2129
9021
CREATE TABLE gpgkey (
2130
9022
    id integer NOT NULL,
2131
9023
    owner integer NOT NULL,
2140
9032
    CONSTRAINT valid_keyid CHECK (valid_keyid(keyid))
2141
9033
);
2142
9034
 
 
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
 
2143
9057
CREATE SEQUENCE gpgkey_id_seq
 
9058
    START WITH 1
2144
9059
    INCREMENT BY 1
2145
9060
    NO MAXVALUE
2146
9061
    NO MINVALUE
2147
9062
    CACHE 1;
2148
9063
 
 
9064
 
2149
9065
ALTER SEQUENCE gpgkey_id_seq OWNED BY gpgkey.id;
2150
9066
 
 
9067
 
2151
9068
CREATE TABLE hwdevice (
2152
9069
    id integer NOT NULL,
2153
9070
    bus_vendor_id integer NOT NULL,
2157
9074
    submissions integer NOT NULL
2158
9075
);
2159
9076
 
 
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
 
2160
9096
CREATE SEQUENCE hwdevice_id_seq
 
9097
    START WITH 1
2161
9098
    INCREMENT BY 1
2162
9099
    NO MAXVALUE
2163
9100
    NO MINVALUE
2164
9101
    CACHE 1;
2165
9102
 
 
9103
 
2166
9104
ALTER SEQUENCE hwdevice_id_seq OWNED BY hwdevice.id;
2167
9105
 
 
9106
 
2168
9107
CREATE TABLE hwdeviceclass (
2169
9108
    id integer NOT NULL,
2170
9109
    device integer NOT NULL,
2172
9111
    sub_class integer
2173
9112
);
2174
9113
 
 
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
 
2175
9127
CREATE SEQUENCE hwdeviceclass_id_seq
 
9128
    START WITH 1
2176
9129
    INCREMENT BY 1
2177
9130
    NO MAXVALUE
2178
9131
    NO MINVALUE
2179
9132
    CACHE 1;
2180
9133
 
 
9134
 
2181
9135
ALTER SEQUENCE hwdeviceclass_id_seq OWNED BY hwdeviceclass.id;
2182
9136
 
 
9137
 
2183
9138
CREATE TABLE hwdevicedriverlink (
2184
9139
    id integer NOT NULL,
2185
9140
    device integer NOT NULL,
2186
9141
    driver integer
2187
9142
);
2188
9143
 
 
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
 
2189
9154
CREATE SEQUENCE hwdevicedriverlink_id_seq
 
9155
    START WITH 1
2190
9156
    INCREMENT BY 1
2191
9157
    NO MAXVALUE
2192
9158
    NO MINVALUE
2193
9159
    CACHE 1;
2194
9160
 
 
9161
 
2195
9162
ALTER SEQUENCE hwdevicedriverlink_id_seq OWNED BY hwdevicedriverlink.id;
2196
9163
 
 
9164
 
2197
9165
CREATE TABLE hwdevicenamevariant (
2198
9166
    id integer NOT NULL,
2199
9167
    vendor_name integer NOT NULL,
2202
9170
    submissions integer NOT NULL
2203
9171
);
2204
9172
 
 
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
 
2205
9189
CREATE SEQUENCE hwdevicenamevariant_id_seq
 
9190
    START WITH 1
2206
9191
    INCREMENT BY 1
2207
9192
    NO MAXVALUE
2208
9193
    NO MINVALUE
2209
9194
    CACHE 1;
2210
9195
 
 
9196
 
2211
9197
ALTER SEQUENCE hwdevicenamevariant_id_seq OWNED BY hwdevicenamevariant.id;
2212
9198
 
 
9199
 
2213
9200
CREATE TABLE hwdmihandle (
2214
9201
    id integer NOT NULL,
2215
9202
    handle integer NOT NULL,
2217
9204
    submission integer
2218
9205
);
2219
9206
 
 
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
 
2220
9217
CREATE SEQUENCE hwdmihandle_id_seq
 
9218
    START WITH 1
2221
9219
    INCREMENT BY 1
2222
9220
    NO MAXVALUE
2223
9221
    NO MINVALUE
2224
9222
    CACHE 1;
2225
9223
 
 
9224
 
2226
9225
ALTER SEQUENCE hwdmihandle_id_seq OWNED BY hwdmihandle.id;
2227
9226
 
 
9227
 
2228
9228
CREATE TABLE hwdmivalue (
2229
9229
    id integer NOT NULL,
2230
9230
    key text,
2232
9232
    handle integer NOT NULL
2233
9233
);
2234
9234
 
 
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
 
2235
9248
CREATE SEQUENCE hwdmivalue_id_seq
 
9249
    START WITH 1
2236
9250
    INCREMENT BY 1
2237
9251
    NO MAXVALUE
2238
9252
    NO MINVALUE
2239
9253
    CACHE 1;
2240
9254
 
 
9255
 
2241
9256
ALTER SEQUENCE hwdmivalue_id_seq OWNED BY hwdmivalue.id;
2242
9257
 
 
9258
 
2243
9259
CREATE TABLE hwdriver (
2244
9260
    id integer NOT NULL,
2245
9261
    package_name text,
2247
9263
    license integer
2248
9264
);
2249
9265
 
 
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
 
2250
9276
CREATE SEQUENCE hwdriver_id_seq
 
9277
    START WITH 1
2251
9278
    INCREMENT BY 1
2252
9279
    NO MAXVALUE
2253
9280
    NO MINVALUE
2254
9281
    CACHE 1;
2255
9282
 
 
9283
 
2256
9284
ALTER SEQUENCE hwdriver_id_seq OWNED BY hwdriver.id;
2257
9285
 
 
9286
 
2258
9287
CREATE VIEW hwdrivernames AS
2259
9288
    SELECT DISTINCT ON (hwdriver.name) hwdriver.id, hwdriver.name FROM hwdriver ORDER BY hwdriver.name, hwdriver.id;
2260
9289
 
 
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
 
2261
9297
CREATE VIEW hwdriverpackagenames AS
2262
9298
    SELECT DISTINCT ON (hwdriver.package_name) hwdriver.id, hwdriver.package_name FROM hwdriver ORDER BY hwdriver.package_name, hwdriver.id;
2263
9299
 
 
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
 
2264
9307
CREATE TABLE hwsubmission (
2265
9308
    id integer NOT NULL,
2266
9309
    date_created timestamp without time zone NOT NULL,
2277
9320
    raw_emailaddress text
2278
9321
);
2279
9322
 
 
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
 
2280
9363
CREATE SEQUENCE hwsubmission_id_seq
 
9364
    START WITH 1
2281
9365
    INCREMENT BY 1
2282
9366
    NO MAXVALUE
2283
9367
    NO MINVALUE
2284
9368
    CACHE 1;
2285
9369
 
 
9370
 
2286
9371
ALTER SEQUENCE hwsubmission_id_seq OWNED BY hwsubmission.id;
2287
9372
 
 
9373
 
2288
9374
CREATE TABLE hwsubmissionbug (
2289
9375
    id integer NOT NULL,
2290
9376
    submission integer NOT NULL,
2291
9377
    bug integer NOT NULL
2292
9378
);
2293
9379
 
 
9380
 
 
9381
COMMENT ON TABLE hwsubmissionbug IS 'Link bugs to HWDB submissions';
 
9382
 
 
9383
 
2294
9384
CREATE SEQUENCE hwsubmissionbug_id_seq
 
9385
    START WITH 1
2295
9386
    INCREMENT BY 1
2296
9387
    NO MAXVALUE
2297
9388
    NO MINVALUE
2298
9389
    CACHE 1;
2299
9390
 
 
9391
 
2300
9392
ALTER SEQUENCE hwsubmissionbug_id_seq OWNED BY hwsubmissionbug.id;
2301
9393
 
 
9394
 
2302
9395
CREATE TABLE hwsubmissiondevice (
2303
9396
    id integer NOT NULL,
2304
9397
    device_driver_link integer NOT NULL,
2307
9400
    hal_device_id integer NOT NULL
2308
9401
);
2309
9402
 
 
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
 
2310
9419
CREATE SEQUENCE hwsubmissiondevice_id_seq
 
9420
    START WITH 1
2311
9421
    INCREMENT BY 1
2312
9422
    NO MAXVALUE
2313
9423
    NO MINVALUE
2314
9424
    CACHE 1;
2315
9425
 
 
9426
 
2316
9427
ALTER SEQUENCE hwsubmissiondevice_id_seq OWNED BY hwsubmissiondevice.id;
2317
9428
 
 
9429
 
2318
9430
CREATE TABLE hwsystemfingerprint (
2319
9431
    id integer NOT NULL,
2320
9432
    fingerprint text NOT NULL
2321
9433
);
2322
9434
 
 
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
 
2323
9442
CREATE SEQUENCE hwsystemfingerprint_id_seq
 
9443
    START WITH 1
2324
9444
    INCREMENT BY 1
2325
9445
    NO MAXVALUE
2326
9446
    NO MINVALUE
2327
9447
    CACHE 1;
2328
9448
 
 
9449
 
2329
9450
ALTER SEQUENCE hwsystemfingerprint_id_seq OWNED BY hwsystemfingerprint.id;
2330
9451
 
 
9452
 
2331
9453
CREATE TABLE hwtest (
2332
9454
    id integer NOT NULL,
2333
9455
    namespace text,
2335
9457
    version text NOT NULL
2336
9458
);
2337
9459
 
 
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
 
2338
9470
CREATE SEQUENCE hwtest_id_seq
 
9471
    START WITH 1
2339
9472
    INCREMENT BY 1
2340
9473
    NO MAXVALUE
2341
9474
    NO MINVALUE
2342
9475
    CACHE 1;
2343
9476
 
 
9477
 
2344
9478
ALTER SEQUENCE hwtest_id_seq OWNED BY hwtest.id;
2345
9479
 
 
9480
 
2346
9481
CREATE TABLE hwtestanswer (
2347
9482
    id integer NOT NULL,
2348
9483
    test integer NOT NULL,
2356
9491
    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))))
2357
9492
);
2358
9493
 
 
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
 
2359
9513
CREATE SEQUENCE hwtestanswer_id_seq
 
9514
    START WITH 1
2360
9515
    INCREMENT BY 1
2361
9516
    NO MAXVALUE
2362
9517
    NO MINVALUE
2363
9518
    CACHE 1;
2364
9519
 
 
9520
 
2365
9521
ALTER SEQUENCE hwtestanswer_id_seq OWNED BY hwtestanswer.id;
2366
9522
 
 
9523
 
2367
9524
CREATE TABLE hwtestanswerchoice (
2368
9525
    id integer NOT NULL,
2369
9526
    choice text NOT NULL,
2370
9527
    test integer NOT NULL
2371
9528
);
2372
9529
 
 
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
 
2373
9540
CREATE SEQUENCE hwtestanswerchoice_id_seq
 
9541
    START WITH 1
2374
9542
    INCREMENT BY 1
2375
9543
    NO MAXVALUE
2376
9544
    NO MINVALUE
2377
9545
    CACHE 1;
2378
9546
 
 
9547
 
2379
9548
ALTER SEQUENCE hwtestanswerchoice_id_seq OWNED BY hwtestanswerchoice.id;
2380
9549
 
 
9550
 
2381
9551
CREATE TABLE hwtestanswercount (
2382
9552
    id integer NOT NULL,
2383
9553
    test integer NOT NULL,
2390
9560
    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))))
2391
9561
);
2392
9562
 
 
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
 
2393
9588
CREATE SEQUENCE hwtestanswercount_id_seq
 
9589
    START WITH 1
2394
9590
    INCREMENT BY 1
2395
9591
    NO MAXVALUE
2396
9592
    NO MINVALUE
2397
9593
    CACHE 1;
2398
9594
 
 
9595
 
2399
9596
ALTER SEQUENCE hwtestanswercount_id_seq OWNED BY hwtestanswercount.id;
2400
9597
 
 
9598
 
2401
9599
CREATE TABLE hwtestanswercountdevice (
2402
9600
    id integer NOT NULL,
2403
9601
    answer integer NOT NULL,
2404
9602
    device_driver integer NOT NULL
2405
9603
);
2406
9604
 
 
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
 
2407
9615
CREATE SEQUENCE hwtestanswercountdevice_id_seq
 
9616
    START WITH 1
2408
9617
    INCREMENT BY 1
2409
9618
    NO MAXVALUE
2410
9619
    NO MINVALUE
2411
9620
    CACHE 1;
2412
9621
 
 
9622
 
2413
9623
ALTER SEQUENCE hwtestanswercountdevice_id_seq OWNED BY hwtestanswercountdevice.id;
2414
9624
 
 
9625
 
2415
9626
CREATE TABLE hwtestanswerdevice (
2416
9627
    id integer NOT NULL,
2417
9628
    answer integer NOT NULL,
2418
9629
    device_driver integer NOT NULL
2419
9630
);
2420
9631
 
 
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
 
2421
9642
CREATE SEQUENCE hwtestanswerdevice_id_seq
 
9643
    START WITH 1
2422
9644
    INCREMENT BY 1
2423
9645
    NO MAXVALUE
2424
9646
    NO MINVALUE
2425
9647
    CACHE 1;
2426
9648
 
 
9649
 
2427
9650
ALTER SEQUENCE hwtestanswerdevice_id_seq OWNED BY hwtestanswerdevice.id;
2428
9651
 
 
9652
 
2429
9653
CREATE TABLE hwvendorid (
2430
9654
    id integer NOT NULL,
2431
9655
    bus integer NOT NULL,
2433
9657
    vendor_name integer NOT NULL
2434
9658
);
2435
9659
 
 
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
 
2436
9670
CREATE SEQUENCE hwvendorid_id_seq
 
9671
    START WITH 1
2437
9672
    INCREMENT BY 1
2438
9673
    NO MAXVALUE
2439
9674
    NO MINVALUE
2440
9675
    CACHE 1;
2441
9676
 
 
9677
 
2442
9678
ALTER SEQUENCE hwvendorid_id_seq OWNED BY hwvendorid.id;
2443
9679
 
 
9680
 
2444
9681
CREATE TABLE hwvendorname (
2445
9682
    id integer NOT NULL,
2446
9683
    name text NOT NULL
2447
9684
);
2448
9685
 
 
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
 
2449
9693
CREATE SEQUENCE hwvendorname_id_seq
 
9694
    START WITH 1
2450
9695
    INCREMENT BY 1
2451
9696
    NO MAXVALUE
2452
9697
    NO MINVALUE
2453
9698
    CACHE 1;
2454
9699
 
 
9700
 
2455
9701
ALTER SEQUENCE hwvendorname_id_seq OWNED BY hwvendorname.id;
2456
9702
 
 
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
 
2457
9739
CREATE TABLE ircid (
2458
9740
    id integer NOT NULL,
2459
9741
    person integer NOT NULL,
2461
9743
    nickname text NOT NULL
2462
9744
);
2463
9745
 
 
9746
 
2464
9747
CREATE SEQUENCE ircid_id_seq
 
9748
    START WITH 1
2465
9749
    INCREMENT BY 1
2466
9750
    NO MAXVALUE
2467
9751
    NO MINVALUE
2468
9752
    CACHE 1;
2469
9753
 
 
9754
 
2470
9755
ALTER SEQUENCE ircid_id_seq OWNED BY ircid.id;
2471
9756
 
 
9757
 
2472
9758
CREATE TABLE jabberid (
2473
9759
    id integer NOT NULL,
2474
9760
    person integer NOT NULL,
2475
9761
    jabberid text NOT NULL
2476
9762
);
2477
9763
 
 
9764
 
2478
9765
CREATE SEQUENCE jabberid_id_seq
 
9766
    START WITH 1
2479
9767
    INCREMENT BY 1
2480
9768
    NO MAXVALUE
2481
9769
    NO MINVALUE
2482
9770
    CACHE 1;
2483
9771
 
 
9772
 
2484
9773
ALTER SEQUENCE jabberid_id_seq OWNED BY jabberid.id;
2485
9774
 
 
9775
 
2486
9776
CREATE TABLE job (
2487
9777
    id integer NOT NULL,
2488
9778
    requester integer,
2501
9791
    date_finished timestamp without time zone
2502
9792
);
2503
9793
 
 
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
 
2504
9840
CREATE SEQUENCE job_id_seq
 
9841
    START WITH 1
2505
9842
    INCREMENT BY 1
2506
9843
    NO MAXVALUE
2507
9844
    NO MINVALUE
2508
9845
    CACHE 1;
2509
9846
 
 
9847
 
2510
9848
ALTER SEQUENCE job_id_seq OWNED BY job.id;
2511
9849
 
 
9850
 
2512
9851
CREATE TABLE karma (
2513
9852
    id integer NOT NULL,
2514
9853
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
2517
9856
    product integer,
2518
9857
    distribution integer,
2519
9858
    sourcepackagename integer
2520
 
);
 
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
 
2521
9883
 
2522
9884
CREATE SEQUENCE karma_id_seq
 
9885
    START WITH 1
2523
9886
    INCREMENT BY 1
2524
9887
    NO MAXVALUE
2525
9888
    NO MINVALUE
2526
9889
    CACHE 1;
2527
9890
 
 
9891
 
2528
9892
ALTER SEQUENCE karma_id_seq OWNED BY karma.id;
2529
9893
 
 
9894
 
2530
9895
CREATE TABLE karmaaction (
2531
9896
    id integer NOT NULL,
2532
9897
    category integer,
2536
9901
    summary text NOT NULL
2537
9902
);
2538
9903
 
 
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
 
2539
9917
CREATE SEQUENCE karmaaction_id_seq
 
9918
    START WITH 1
2540
9919
    INCREMENT BY 1
2541
9920
    NO MAXVALUE
2542
9921
    NO MINVALUE
2543
9922
    CACHE 1;
2544
9923
 
 
9924
 
2545
9925
ALTER SEQUENCE karmaaction_id_seq OWNED BY karmaaction.id;
2546
9926
 
 
9927
 
2547
9928
CREATE TABLE karmacache (
2548
9929
    id integer NOT NULL,
2549
9930
    person integer NOT NULL,
2559
9940
    CONSTRAINT sourcepackagename_requires_distribution CHECK (((sourcepackagename IS NULL) OR (distribution IS NOT NULL)))
2560
9941
);
2561
9942
 
 
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
 
2562
9956
CREATE SEQUENCE karmacache_id_seq
 
9957
    START WITH 1
2563
9958
    INCREMENT BY 1
2564
9959
    NO MAXVALUE
2565
9960
    NO MINVALUE
2566
9961
    CACHE 1;
2567
9962
 
 
9963
 
2568
9964
ALTER SEQUENCE karmacache_id_seq OWNED BY karmacache.id;
2569
9965
 
 
9966
 
2570
9967
CREATE TABLE karmacategory (
2571
9968
    id integer NOT NULL,
2572
9969
    name text NOT NULL,
2574
9971
    summary text NOT NULL
2575
9972
);
2576
9973
 
 
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
 
2577
9980
CREATE SEQUENCE karmacategory_id_seq
 
9981
    START WITH 1
2578
9982
    INCREMENT BY 1
2579
9983
    NO MAXVALUE
2580
9984
    NO MINVALUE
2581
9985
    CACHE 1;
2582
9986
 
 
9987
 
2583
9988
ALTER SEQUENCE karmacategory_id_seq OWNED BY karmacategory.id;
2584
9989
 
 
9990
 
2585
9991
CREATE TABLE karmatotalcache (
2586
9992
    id integer NOT NULL,
2587
9993
    person integer NOT NULL,
2588
9994
    karma_total integer NOT NULL
2589
9995
);
2590
9996
 
 
9997
 
2591
9998
CREATE SEQUENCE karmatotalcache_id_seq
 
9999
    START WITH 1
2592
10000
    INCREMENT BY 1
2593
10001
    NO MAXVALUE
2594
10002
    NO MINVALUE
2595
10003
    CACHE 1;
2596
10004
 
 
10005
 
2597
10006
ALTER SEQUENCE karmatotalcache_id_seq OWNED BY karmatotalcache.id;
2598
10007
 
 
10008
 
2599
10009
CREATE TABLE language (
2600
10010
    id integer NOT NULL,
2601
10011
    code text NOT NULL,
2609
10019
    CONSTRAINT valid_language CHECK (((pluralforms IS NULL) = (pluralexpression IS NULL)))
2610
10020
);
2611
10021
 
 
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
 
2612
10050
CREATE SEQUENCE language_id_seq
 
10051
    START WITH 1
2613
10052
    INCREMENT BY 1
2614
10053
    NO MAXVALUE
2615
10054
    NO MINVALUE
2616
10055
    CACHE 1;
2617
10056
 
 
10057
 
2618
10058
ALTER SEQUENCE language_id_seq OWNED BY language.id;
2619
10059
 
 
10060
 
2620
10061
CREATE TABLE languagepack (
2621
10062
    id integer NOT NULL,
2622
10063
    file integer NOT NULL,
2628
10069
    CONSTRAINT valid_updates CHECK ((((type = 2) AND (updates IS NOT NULL)) OR ((type = 1) AND (updates IS NULL))))
2629
10070
);
2630
10071
 
 
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
 
2631
10094
CREATE SEQUENCE languagepack_id_seq
 
10095
    START WITH 1
2632
10096
    INCREMENT BY 1
2633
10097
    NO MAXVALUE
2634
10098
    NO MINVALUE
2635
10099
    CACHE 1;
2636
10100
 
 
10101
 
2637
10102
ALTER SEQUENCE languagepack_id_seq OWNED BY languagepack.id;
2638
10103
 
 
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
 
2639
10109
CREATE TABLE launchpaddatabaserevision (
2640
10110
    major integer NOT NULL,
2641
10111
    minor integer NOT NULL,
2642
 
    patch integer NOT NULL
2643
 
);
 
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
 
2644
10153
 
2645
10154
CREATE TABLE launchpadstatistic (
2646
10155
    id integer NOT NULL,
2649
10158
    dateupdated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL
2650
10159
);
2651
10160
 
 
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
 
2652
10165
CREATE SEQUENCE launchpadstatistic_id_seq
 
10166
    START WITH 1
2653
10167
    INCREMENT BY 1
2654
10168
    NO MAXVALUE
2655
10169
    NO MINVALUE
2656
10170
    CACHE 1;
2657
10171
 
 
10172
 
2658
10173
ALTER SEQUENCE launchpadstatistic_id_seq OWNED BY launchpadstatistic.id;
2659
10174
 
 
10175
 
2660
10176
CREATE SEQUENCE libraryfilealias_id_seq
 
10177
    START WITH 1
2661
10178
    INCREMENT BY 1
2662
10179
    NO MAXVALUE
2663
10180
    NO MINVALUE
2664
10181
    CACHE 1;
2665
10182
 
 
10183
 
2666
10184
ALTER SEQUENCE libraryfilealias_id_seq OWNED BY libraryfilealias.id;
2667
10185
 
 
10186
 
2668
10187
CREATE TABLE libraryfilecontent (
2669
10188
    id integer NOT NULL,
2670
10189
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
2672
10191
    sha1 character(40) NOT NULL,
2673
10192
    md5 character(32) NOT NULL,
2674
10193
    sha256 character(64)
2675
 
);
 
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
 
2676
10215
 
2677
10216
CREATE SEQUENCE libraryfilecontent_id_seq
 
10217
    START WITH 1
2678
10218
    INCREMENT BY 1
2679
10219
    NO MAXVALUE
2680
10220
    NO MINVALUE
2681
10221
    CACHE 1;
2682
10222
 
 
10223
 
2683
10224
ALTER SEQUENCE libraryfilecontent_id_seq OWNED BY libraryfilecontent.id;
2684
10225
 
 
10226
 
2685
10227
CREATE TABLE libraryfiledownloadcount (
2686
10228
    id integer NOT NULL,
2687
10229
    libraryfilealias integer NOT NULL,
2690
10232
    country integer
2691
10233
);
2692
10234
 
 
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
 
2693
10251
CREATE SEQUENCE libraryfiledownloadcount_id_seq
 
10252
    START WITH 1
2694
10253
    INCREMENT BY 1
2695
10254
    NO MAXVALUE
2696
10255
    NO MINVALUE
2697
10256
    CACHE 1;
2698
10257
 
 
10258
 
2699
10259
ALTER SEQUENCE libraryfiledownloadcount_id_seq OWNED BY libraryfiledownloadcount.id;
2700
10260
 
 
10261
 
2701
10262
CREATE TABLE logintoken (
2702
10263
    id integer NOT NULL,
2703
10264
    requester integer,
2712
10273
    CONSTRAINT valid_fingerprint CHECK (((fingerprint IS NULL) OR valid_fingerprint(fingerprint)))
2713
10274
);
2714
10275
 
 
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
 
2715
10304
CREATE SEQUENCE logintoken_id_seq
 
10305
    START WITH 1
2716
10306
    INCREMENT BY 1
2717
10307
    NO MAXVALUE
2718
10308
    NO MINVALUE
2719
10309
    CACHE 1;
2720
10310
 
 
10311
 
2721
10312
ALTER SEQUENCE logintoken_id_seq OWNED BY logintoken.id;
2722
10313
 
 
10314
 
2723
10315
CREATE TABLE lp_account (
2724
10316
    id integer NOT NULL,
2725
10317
    openid_identifier text NOT NULL
2726
10318
);
2727
10319
 
 
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
 
2728
10328
CREATE TABLE lp_person (
2729
10329
    id integer NOT NULL,
2730
10330
    displayname text,
2765
10365
    account integer
2766
10366
);
2767
10367
 
 
10368
 
2768
10369
CREATE TABLE lp_personlocation (
2769
10370
    id integer NOT NULL,
2770
10371
    date_created timestamp without time zone,
2778
10379
    locked boolean
2779
10380
);
2780
10381
 
 
10382
 
2781
10383
CREATE TABLE lp_teamparticipation (
2782
10384
    id integer NOT NULL,
2783
10385
    team integer,
2784
10386
    person integer
2785
10387
);
2786
10388
 
 
10389
 
2787
10390
CREATE TABLE mailinglist (
2788
10391
    id integer NOT NULL,
2789
10392
    team integer NOT NULL,
2796
10399
    welcome_message text
2797
10400
);
2798
10401
 
 
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
 
2799
10430
CREATE SEQUENCE mailinglist_id_seq
 
10431
    START WITH 1
2800
10432
    INCREMENT BY 1
2801
10433
    NO MAXVALUE
2802
10434
    NO MINVALUE
2803
10435
    CACHE 1;
2804
10436
 
 
10437
 
2805
10438
ALTER SEQUENCE mailinglist_id_seq OWNED BY mailinglist.id;
2806
10439
 
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;
2822
10440
 
2823
10441
CREATE TABLE mailinglistsubscription (
2824
10442
    id integer NOT NULL,
2828
10446
    email_address integer
2829
10447
);
2830
10448
 
 
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
 
2831
10465
CREATE SEQUENCE mailinglistsubscription_id_seq
 
10466
    START WITH 1
2832
10467
    INCREMENT BY 1
2833
10468
    NO MAXVALUE
2834
10469
    NO MINVALUE
2835
10470
    CACHE 1;
2836
10471
 
 
10472
 
2837
10473
ALTER SEQUENCE mailinglistsubscription_id_seq OWNED BY mailinglistsubscription.id;
2838
10474
 
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;
2856
10475
 
2857
10476
CREATE TABLE mergedirectivejob (
2858
10477
    id integer NOT NULL,
2861
10480
    action integer NOT NULL
2862
10481
);
2863
10482
 
 
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
 
2864
10496
CREATE SEQUENCE mergedirectivejob_id_seq
 
10497
    START WITH 1
2865
10498
    INCREMENT BY 1
2866
10499
    NO MAXVALUE
2867
10500
    NO MINVALUE
2868
10501
    CACHE 1;
2869
10502
 
 
10503
 
2870
10504
ALTER SEQUENCE mergedirectivejob_id_seq OWNED BY mergedirectivejob.id;
2871
10505
 
 
10506
 
2872
10507
CREATE TABLE message (
2873
10508
    id integer NOT NULL,
2874
10509
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
2878
10513
    distribution integer,
2879
10514
    rfc822msgid text NOT NULL,
2880
10515
    fti ts2.tsvector,
2881
 
    raw integer
2882
 
);
 
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
 
2883
10536
 
2884
10537
CREATE SEQUENCE message_id_seq
 
10538
    START WITH 1
2885
10539
    INCREMENT BY 1
2886
10540
    NO MAXVALUE
2887
10541
    NO MINVALUE
2888
10542
    CACHE 1;
2889
10543
 
 
10544
 
2890
10545
ALTER SEQUENCE message_id_seq OWNED BY message.id;
2891
10546
 
 
10547
 
2892
10548
CREATE TABLE messageapproval (
2893
10549
    id integer NOT NULL,
2894
10550
    posted_by integer NOT NULL,
2902
10558
    message integer NOT NULL
2903
10559
);
2904
10560
 
 
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
 
2905
10592
CREATE SEQUENCE messageapproval_id_seq
 
10593
    START WITH 1
2906
10594
    INCREMENT BY 1
2907
10595
    NO MAXVALUE
2908
10596
    NO MINVALUE
2909
10597
    CACHE 1;
2910
10598
 
 
10599
 
2911
10600
ALTER SEQUENCE messageapproval_id_seq OWNED BY messageapproval.id;
2912
10601
 
 
10602
 
2913
10603
CREATE TABLE messagechunk (
2914
10604
    id integer NOT NULL,
2915
10605
    message integer NOT NULL,
2918
10608
    blob integer,
2919
10609
    fti ts2.tsvector,
2920
10610
    CONSTRAINT text_or_content CHECK ((((blob IS NULL) AND (content IS NULL)) OR ((blob IS NULL) <> (content IS NULL))))
2921
 
);
 
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
 
2922
10626
 
2923
10627
CREATE SEQUENCE messagechunk_id_seq
 
10628
    START WITH 1
2924
10629
    INCREMENT BY 1
2925
10630
    NO MAXVALUE
2926
10631
    NO MINVALUE
2927
10632
    CACHE 1;
2928
10633
 
 
10634
 
2929
10635
ALTER SEQUENCE messagechunk_id_seq OWNED BY messagechunk.id;
2930
10636
 
 
10637
 
2931
10638
CREATE TABLE milestone (
2932
10639
    id integer NOT NULL,
2933
10640
    product integer,
2944
10651
    CONSTRAINT valid_target CHECK ((NOT ((product IS NULL) AND (distribution IS NULL))))
2945
10652
);
2946
10653
 
 
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
 
2947
10685
CREATE SEQUENCE milestone_id_seq
 
10686
    START WITH 1
2948
10687
    INCREMENT BY 1
2949
10688
    NO MAXVALUE
2950
10689
    NO MINVALUE
2951
10690
    CACHE 1;
2952
10691
 
 
10692
 
2953
10693
ALTER SEQUENCE milestone_id_seq OWNED BY milestone.id;
2954
10694
 
 
10695
 
2955
10696
CREATE TABLE mirror (
2956
10697
    id integer NOT NULL,
2957
10698
    owner integer NOT NULL,
2965
10706
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
2966
10707
);
2967
10708
 
 
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
 
2968
10734
CREATE SEQUENCE mirror_id_seq
 
10735
    START WITH 1
2969
10736
    INCREMENT BY 1
2970
10737
    NO MAXVALUE
2971
10738
    NO MINVALUE
2972
10739
    CACHE 1;
2973
10740
 
 
10741
 
2974
10742
ALTER SEQUENCE mirror_id_seq OWNED BY mirror.id;
2975
10743
 
 
10744
 
2976
10745
CREATE TABLE mirrorcdimagedistroseries (
2977
10746
    id integer NOT NULL,
2978
10747
    distribution_mirror integer NOT NULL,
2981
10750
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
2982
10751
);
2983
10752
 
 
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
 
2984
10766
CREATE SEQUENCE mirrorcdimagedistroseries_id_seq
 
10767
    START WITH 1
2985
10768
    INCREMENT BY 1
2986
10769
    NO MAXVALUE
2987
10770
    NO MINVALUE
2988
10771
    CACHE 1;
2989
10772
 
 
10773
 
2990
10774
ALTER SEQUENCE mirrorcdimagedistroseries_id_seq OWNED BY mirrorcdimagedistroseries.id;
2991
10775
 
 
10776
 
2992
10777
CREATE TABLE mirrorcontent (
2993
10778
    id integer NOT NULL,
2994
10779
    mirror integer NOT NULL,
2997
10782
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
2998
10783
);
2999
10784
 
 
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
 
3000
10795
CREATE SEQUENCE mirrorcontent_id_seq
 
10796
    START WITH 1
3001
10797
    INCREMENT BY 1
3002
10798
    NO MAXVALUE
3003
10799
    NO MINVALUE
3004
10800
    CACHE 1;
3005
10801
 
 
10802
 
3006
10803
ALTER SEQUENCE mirrorcontent_id_seq OWNED BY mirrorcontent.id;
3007
10804
 
 
10805
 
3008
10806
CREATE TABLE mirrordistroarchseries (
3009
10807
    id integer NOT NULL,
3010
10808
    distribution_mirror integer NOT NULL,
3015
10813
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3016
10814
);
3017
10815
 
 
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
 
3018
10832
CREATE SEQUENCE mirrordistroarchseries_id_seq
 
10833
    START WITH 1
3019
10834
    INCREMENT BY 1
3020
10835
    NO MAXVALUE
3021
10836
    NO MINVALUE
3022
10837
    CACHE 1;
3023
10838
 
 
10839
 
3024
10840
ALTER SEQUENCE mirrordistroarchseries_id_seq OWNED BY mirrordistroarchseries.id;
3025
10841
 
 
10842
 
3026
10843
CREATE TABLE mirrordistroseriessource (
3027
10844
    id integer NOT NULL,
3028
10845
    distribution_mirror integer NOT NULL,
3033
10850
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3034
10851
);
3035
10852
 
 
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
 
3036
10866
CREATE SEQUENCE mirrordistroseriessource_id_seq
 
10867
    START WITH 1
3037
10868
    INCREMENT BY 1
3038
10869
    NO MAXVALUE
3039
10870
    NO MINVALUE
3040
10871
    CACHE 1;
3041
10872
 
 
10873
 
3042
10874
ALTER SEQUENCE mirrordistroseriessource_id_seq OWNED BY mirrordistroseriessource.id;
3043
10875
 
 
10876
 
3044
10877
CREATE TABLE mirrorproberecord (
3045
10878
    id integer NOT NULL,
3046
10879
    distribution_mirror integer NOT NULL,
3048
10881
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL
3049
10882
);
3050
10883
 
 
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
 
3051
10897
CREATE SEQUENCE mirrorproberecord_id_seq
 
10898
    START WITH 1
3052
10899
    INCREMENT BY 1
3053
10900
    NO MAXVALUE
3054
10901
    NO MINVALUE
3055
10902
    CACHE 1;
3056
10903
 
 
10904
 
3057
10905
ALTER SEQUENCE mirrorproberecord_id_seq OWNED BY mirrorproberecord.id;
3058
10906
 
 
10907
 
3059
10908
CREATE TABLE mirrorsourcecontent (
3060
10909
    id integer NOT NULL,
3061
10910
    mirror integer NOT NULL,
3064
10913
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3065
10914
);
3066
10915
 
 
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
 
3067
10926
CREATE SEQUENCE mirrorsourcecontent_id_seq
 
10927
    START WITH 1
3068
10928
    INCREMENT BY 1
3069
10929
    NO MAXVALUE
3070
10930
    NO MINVALUE
3071
10931
    CACHE 1;
3072
10932
 
 
10933
 
3073
10934
ALTER SEQUENCE mirrorsourcecontent_id_seq OWNED BY mirrorsourcecontent.id;
3074
10935
 
 
10936
 
3075
10937
CREATE TABLE nameblacklist (
3076
10938
    id integer NOT NULL,
3077
10939
    regexp text NOT NULL,
3078
10940
    comment text,
 
10941
    admin integer,
3079
10942
    CONSTRAINT valid_regexp CHECK (valid_regexp(regexp))
3080
10943
);
3081
10944
 
 
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
 
3082
10955
CREATE SEQUENCE nameblacklist_id_seq
 
10956
    START WITH 1
3083
10957
    INCREMENT BY 1
3084
10958
    NO MAXVALUE
3085
10959
    NO MINVALUE
3086
10960
    CACHE 1;
3087
10961
 
 
10962
 
3088
10963
ALTER SEQUENCE nameblacklist_id_seq OWNED BY nameblacklist.id;
3089
10964
 
 
10965
 
3090
10966
CREATE TABLE oauthaccesstoken (
3091
10967
    id integer NOT NULL,
3092
10968
    consumer integer NOT NULL,
3104
10980
    CONSTRAINT sourcepackagename_needs_distro CHECK (((sourcepackagename IS NULL) OR (distribution IS NOT NULL)))
3105
10981
);
3106
10982
 
 
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
 
3107
11021
CREATE SEQUENCE oauthaccesstoken_id_seq
 
11022
    START WITH 1
3108
11023
    INCREMENT BY 1
3109
11024
    NO MAXVALUE
3110
11025
    NO MINVALUE
3111
11026
    CACHE 1;
3112
11027
 
 
11028
 
3113
11029
ALTER SEQUENCE oauthaccesstoken_id_seq OWNED BY oauthaccesstoken.id;
3114
11030
 
 
11031
 
3115
11032
CREATE TABLE oauthconsumer (
3116
11033
    id integer NOT NULL,
3117
11034
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
3120
11037
    secret text
3121
11038
);
3122
11039
 
 
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
 
3123
11056
CREATE SEQUENCE oauthconsumer_id_seq
 
11057
    START WITH 1
3124
11058
    INCREMENT BY 1
3125
11059
    NO MAXVALUE
3126
11060
    NO MINVALUE
3127
11061
    CACHE 1;
3128
11062
 
 
11063
 
3129
11064
ALTER SEQUENCE oauthconsumer_id_seq OWNED BY oauthconsumer.id;
3130
11065
 
 
11066
 
3131
11067
CREATE TABLE oauthnonce (
3132
 
    id integer NOT NULL,
3133
11068
    request_timestamp timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
3134
11069
    nonce text NOT NULL,
3135
11070
    access_token integer NOT NULL
3136
11071
);
3137
11072
 
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;
 
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
 
3145
11085
 
3146
11086
CREATE TABLE oauthrequesttoken (
3147
11087
    id integer NOT NULL,
3162
11102
    CONSTRAINT sourcepackagename_needs_distro CHECK (((sourcepackagename IS NULL) OR (distribution IS NOT NULL)))
3163
11103
);
3164
11104
 
 
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
 
3165
11146
CREATE SEQUENCE oauthrequesttoken_id_seq
 
11147
    START WITH 1
3166
11148
    INCREMENT BY 1
3167
11149
    NO MAXVALUE
3168
11150
    NO MINVALUE
3169
11151
    CACHE 1;
3170
11152
 
 
11153
 
3171
11154
ALTER SEQUENCE oauthrequesttoken_id_seq OWNED BY oauthrequesttoken.id;
3172
11155
 
 
11156
 
3173
11157
CREATE TABLE officialbugtag (
3174
11158
    id integer NOT NULL,
3175
11159
    tag text NOT NULL,
3179
11163
    CONSTRAINT context_required CHECK (((product IS NOT NULL) OR (distribution IS NOT NULL)))
3180
11164
);
3181
11165
 
 
11166
 
 
11167
COMMENT ON TABLE officialbugtag IS 'Bug tags that have been officially endorced by this product''s or distribution''s lead';
 
11168
 
 
11169
 
3182
11170
CREATE SEQUENCE officialbugtag_id_seq
 
11171
    START WITH 1
3183
11172
    INCREMENT BY 1
3184
11173
    NO MAXVALUE
3185
11174
    NO MINVALUE
3186
11175
    CACHE 1;
3187
11176
 
 
11177
 
3188
11178
ALTER SEQUENCE officialbugtag_id_seq OWNED BY officialbugtag.id;
3189
11179
 
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
 
);
3199
11180
 
3200
11181
CREATE TABLE openidconsumerassociation (
3201
11182
    server_url character varying(2047) NOT NULL,
3207
11188
    CONSTRAINT secret_length_constraint CHECK ((length(secret) <= 128))
3208
11189
);
3209
11190
 
 
11191
 
3210
11192
CREATE TABLE openidconsumernonce (
3211
11193
    server_url character varying(2047) NOT NULL,
3212
11194
    "timestamp" integer NOT NULL,
3213
11195
    salt character(40) NOT NULL
3214
11196
);
3215
11197
 
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,
 
11198
 
 
11199
CREATE TABLE openididentifier (
 
11200
    identifier text NOT NULL,
3238
11201
    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,
3259
11202
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3260
11203
);
3261
11204
 
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;
 
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
 
3269
11211
 
3270
11212
CREATE TABLE packagebuild (
3271
11213
    id integer NOT NULL,
3276
11218
    dependencies text
3277
11219
);
3278
11220
 
 
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
 
3279
11240
CREATE SEQUENCE packagebuild_id_seq
 
11241
    START WITH 1
3280
11242
    INCREMENT BY 1
3281
11243
    NO MAXVALUE
3282
11244
    NO MINVALUE
3283
11245
    CACHE 1;
3284
11246
 
 
11247
 
3285
11248
ALTER SEQUENCE packagebuild_id_seq OWNED BY packagebuild.id;
3286
11249
 
 
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
 
3287
11275
CREATE TABLE packagecopyrequest (
3288
11276
    id integer NOT NULL,
3289
11277
    target_archive integer NOT NULL,
3303
11291
    date_completed timestamp without time zone
3304
11292
);
3305
11293
 
 
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
 
3306
11340
CREATE SEQUENCE packagecopyrequest_id_seq
 
11341
    START WITH 1
3307
11342
    INCREMENT BY 1
3308
11343
    NO MAXVALUE
3309
11344
    NO MINVALUE
3310
11345
    CACHE 1;
3311
11346
 
 
11347
 
3312
11348
ALTER SEQUENCE packagecopyrequest_id_seq OWNED BY packagecopyrequest.id;
3313
11349
 
 
11350
 
3314
11351
CREATE TABLE packagediff (
3315
11352
    id integer NOT NULL,
3316
11353
    date_requested timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
3323
11360
    CONSTRAINT distinct_sources CHECK ((from_source <> to_source))
3324
11361
);
3325
11362
 
 
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
 
3326
11388
CREATE SEQUENCE packagediff_id_seq
 
11389
    START WITH 1
3327
11390
    INCREMENT BY 1
3328
11391
    NO MAXVALUE
3329
11392
    NO MINVALUE
3330
11393
    CACHE 1;
3331
11394
 
 
11395
 
3332
11396
ALTER SEQUENCE packagediff_id_seq OWNED BY packagediff.id;
3333
11397
 
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;
3353
11398
 
3354
11399
CREATE TABLE packageset (
3355
11400
    id integer NOT NULL,
3362
11407
    CONSTRAINT packageset_name_check CHECK (valid_name(name))
3363
11408
);
3364
11409
 
 
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
 
3365
11433
CREATE SEQUENCE packageset_id_seq
 
11434
    START WITH 1
3366
11435
    INCREMENT BY 1
3367
11436
    NO MAXVALUE
3368
11437
    NO MINVALUE
3369
11438
    CACHE 1;
3370
11439
 
 
11440
 
3371
11441
ALTER SEQUENCE packageset_id_seq OWNED BY packageset.id;
3372
11442
 
 
11443
 
3373
11444
CREATE TABLE packagesetgroup (
3374
11445
    id integer NOT NULL,
3375
11446
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
3376
11447
    owner integer NOT NULL
3377
11448
);
3378
11449
 
 
11450
 
 
11451
COMMENT ON TABLE packagesetgroup IS 'Package set groups keep track of equivalent package sets across distro series boundaries.';
 
11452
 
 
11453
 
3379
11454
CREATE SEQUENCE packagesetgroup_id_seq
 
11455
    START WITH 1
3380
11456
    INCREMENT BY 1
3381
11457
    NO MAXVALUE
3382
11458
    NO MINVALUE
3383
11459
    CACHE 1;
3384
11460
 
 
11461
 
3385
11462
ALTER SEQUENCE packagesetgroup_id_seq OWNED BY packagesetgroup.id;
3386
11463
 
 
11464
 
3387
11465
CREATE TABLE packagesetinclusion (
3388
11466
    id integer NOT NULL,
3389
11467
    parent integer NOT NULL,
3390
11468
    child integer NOT NULL
3391
11469
);
3392
11470
 
 
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
 
3393
11481
CREATE SEQUENCE packagesetinclusion_id_seq
3394
11482
    START WITH 1
3395
11483
    INCREMENT BY 1
3397
11485
    NO MINVALUE
3398
11486
    CACHE 1;
3399
11487
 
 
11488
 
3400
11489
ALTER SEQUENCE packagesetinclusion_id_seq OWNED BY packagesetinclusion.id;
3401
11490
 
 
11491
 
3402
11492
CREATE TABLE packagesetsources (
3403
11493
    id integer NOT NULL,
3404
11494
    packageset integer NOT NULL,
3405
11495
    sourcepackagename integer NOT NULL
3406
11496
);
3407
11497
 
 
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
 
3408
11508
CREATE SEQUENCE packagesetsources_id_seq
 
11509
    START WITH 1
3409
11510
    INCREMENT BY 1
3410
11511
    NO MAXVALUE
3411
11512
    NO MINVALUE
3412
11513
    CACHE 1;
3413
11514
 
 
11515
 
3414
11516
ALTER SEQUENCE packagesetsources_id_seq OWNED BY packagesetsources.id;
3415
11517
 
 
11518
 
3416
11519
CREATE TABLE packageupload (
3417
11520
    id integer NOT NULL,
3418
11521
    status integer DEFAULT 0 NOT NULL,
3421
11524
    changesfile integer,
3422
11525
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
3423
11526
    signing_key integer,
3424
 
    archive integer NOT NULL
 
11527
    archive integer NOT NULL,
 
11528
    package_copy_job integer
3425
11529
);
3426
11530
 
 
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
 
3427
11550
CREATE SEQUENCE packageupload_id_seq
 
11551
    START WITH 1
3428
11552
    INCREMENT BY 1
3429
11553
    NO MAXVALUE
3430
11554
    NO MINVALUE
3431
11555
    CACHE 1;
3432
11556
 
 
11557
 
3433
11558
ALTER SEQUENCE packageupload_id_seq OWNED BY packageupload.id;
3434
11559
 
 
11560
 
3435
11561
CREATE TABLE packageuploadbuild (
3436
11562
    id integer NOT NULL,
3437
11563
    packageupload integer NOT NULL,
3439
11565
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3440
11566
);
3441
11567
 
 
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
 
3442
11578
CREATE SEQUENCE packageuploadbuild_id_seq
 
11579
    START WITH 1
3443
11580
    INCREMENT BY 1
3444
11581
    NO MAXVALUE
3445
11582
    NO MINVALUE
3446
11583
    CACHE 1;
3447
11584
 
 
11585
 
3448
11586
ALTER SEQUENCE packageuploadbuild_id_seq OWNED BY packageuploadbuild.id;
3449
11587
 
 
11588
 
3450
11589
CREATE TABLE packageuploadcustom (
3451
11590
    id integer NOT NULL,
3452
11591
    packageupload integer NOT NULL,
3455
11594
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3456
11595
);
3457
11596
 
 
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
 
3458
11610
CREATE SEQUENCE packageuploadcustom_id_seq
 
11611
    START WITH 1
3459
11612
    INCREMENT BY 1
3460
11613
    NO MAXVALUE
3461
11614
    NO MINVALUE
3462
11615
    CACHE 1;
3463
11616
 
 
11617
 
3464
11618
ALTER SEQUENCE packageuploadcustom_id_seq OWNED BY packageuploadcustom.id;
3465
11619
 
 
11620
 
3466
11621
CREATE TABLE packageuploadsource (
3467
11622
    id integer NOT NULL,
3468
11623
    packageupload integer NOT NULL,
3470
11625
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3471
11626
);
3472
11627
 
 
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
 
3473
11638
CREATE SEQUENCE packageuploadsource_id_seq
 
11639
    START WITH 1
3474
11640
    INCREMENT BY 1
3475
11641
    NO MAXVALUE
3476
11642
    NO MINVALUE
3477
11643
    CACHE 1;
3478
11644
 
 
11645
 
3479
11646
ALTER SEQUENCE packageuploadsource_id_seq OWNED BY packageuploadsource.id;
3480
11647
 
 
11648
 
3481
11649
CREATE TABLE packaging (
3482
11650
    packaging integer NOT NULL,
3483
11651
    id integer DEFAULT nextval(('packaging_id_seq'::text)::regclass) NOT NULL,
3484
11652
    sourcepackagename integer,
3485
 
    distroseries integer,
 
11653
    distroseries integer NOT NULL,
3486
11654
    productseries integer NOT NULL,
3487
11655
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
3488
11656
    owner integer,
3489
11657
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3490
11658
);
3491
11659
 
 
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
 
3492
11707
CREATE SEQUENCE packaging_id_seq
 
11708
    START WITH 1
3493
11709
    INCREMENT BY 1
3494
11710
    NO MAXVALUE
3495
11711
    NO MINVALUE
3496
11712
    CACHE 1;
3497
11713
 
 
11714
 
3498
11715
ALTER SEQUENCE packaging_id_seq OWNED BY packaging.id;
3499
11716
 
 
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
 
3500
11741
CREATE TABLE parsedapachelog (
3501
11742
    id integer NOT NULL,
3502
11743
    first_line text NOT NULL,
3503
 
    bytes_read integer NOT NULL,
 
11744
    bytes_read bigint NOT NULL,
3504
11745
    date_last_parsed timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3505
11746
);
3506
11747
 
 
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
 
3507
11758
CREATE SEQUENCE parsedapachelog_id_seq
 
11759
    START WITH 1
3508
11760
    INCREMENT BY 1
3509
11761
    NO MAXVALUE
3510
11762
    NO MINVALUE
3511
11763
    CACHE 1;
3512
11764
 
 
11765
 
3513
11766
ALTER SEQUENCE parsedapachelog_id_seq OWNED BY parsedapachelog.id;
3514
11767
 
 
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
 
3515
11879
CREATE SEQUENCE person_id_seq
 
11880
    START WITH 1
3516
11881
    INCREMENT BY 1
3517
11882
    NO MAXVALUE
3518
11883
    NO MINVALUE
3519
11884
    CACHE 1;
3520
11885
 
 
11886
 
3521
11887
ALTER SEQUENCE person_id_seq OWNED BY person.id;
3522
11888
 
 
11889
 
3523
11890
CREATE TABLE personlanguage (
3524
11891
    id integer NOT NULL,
3525
11892
    person integer NOT NULL,
3527
11894
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3528
11895
);
3529
11896
 
 
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
 
3530
11907
CREATE SEQUENCE personlanguage_id_seq
 
11908
    START WITH 1
3531
11909
    INCREMENT BY 1
3532
11910
    NO MAXVALUE
3533
11911
    NO MINVALUE
3534
11912
    CACHE 1;
3535
11913
 
 
11914
 
3536
11915
ALTER SEQUENCE personlanguage_id_seq OWNED BY personlanguage.id;
3537
11916
 
 
11917
 
3538
11918
CREATE TABLE personlocation (
3539
11919
    id integer NOT NULL,
3540
11920
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
3549
11929
    CONSTRAINT latitude_and_longitude_together CHECK (((latitude IS NULL) = (longitude IS NULL)))
3550
11930
);
3551
11931
 
 
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
 
3552
11957
CREATE SEQUENCE personlocation_id_seq
 
11958
    START WITH 1
3553
11959
    INCREMENT BY 1
3554
11960
    NO MAXVALUE
3555
11961
    NO MINVALUE
3556
11962
    CACHE 1;
3557
11963
 
 
11964
 
3558
11965
ALTER SEQUENCE personlocation_id_seq OWNED BY personlocation.id;
3559
11966
 
 
11967
 
3560
11968
CREATE TABLE personnotification (
3561
11969
    id integer NOT NULL,
3562
11970
    person integer NOT NULL,
3566
11974
    subject text NOT NULL
3567
11975
);
3568
11976
 
 
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
 
3569
11993
CREATE SEQUENCE personnotification_id_seq
 
11994
    START WITH 1
3570
11995
    INCREMENT BY 1
3571
11996
    NO MAXVALUE
3572
11997
    NO MINVALUE
3573
11998
    CACHE 1;
3574
11999
 
 
12000
 
3575
12001
ALTER SEQUENCE personnotification_id_seq OWNED BY personnotification.id;
3576
12002
 
 
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
 
3577
12049
CREATE TABLE pillarname (
3578
12050
    id integer NOT NULL,
3579
12051
    name text NOT NULL,
3586
12058
    CONSTRAINT valid_name CHECK (valid_name(name))
3587
12059
);
3588
12060
 
 
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
 
3589
12068
CREATE SEQUENCE pillarname_id_seq
 
12069
    START WITH 1
3590
12070
    INCREMENT BY 1
3591
12071
    NO MAXVALUE
3592
12072
    NO MINVALUE
3593
12073
    CACHE 1;
3594
12074
 
 
12075
 
3595
12076
ALTER SEQUENCE pillarname_id_seq OWNED BY pillarname.id;
3596
12077
 
 
12078
 
3597
12079
CREATE TABLE pocketchroot (
3598
12080
    id integer NOT NULL,
3599
12081
    distroarchseries integer,
3602
12084
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3603
12085
);
3604
12086
 
 
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
 
3605
12100
CREATE SEQUENCE pocketchroot_id_seq
 
12101
    START WITH 1
3606
12102
    INCREMENT BY 1
3607
12103
    NO MAXVALUE
3608
12104
    NO MINVALUE
3609
12105
    CACHE 1;
3610
12106
 
 
12107
 
3611
12108
ALTER SEQUENCE pocketchroot_id_seq OWNED BY pocketchroot.id;
3612
12109
 
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;
3631
12110
 
3632
12111
CREATE TABLE poexportrequest (
3633
12112
    id integer NOT NULL,
3638
12117
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3639
12118
);
3640
12119
 
 
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
 
3641
12137
CREATE SEQUENCE poexportrequest_id_seq
 
12138
    START WITH 1
3642
12139
    INCREMENT BY 1
3643
12140
    NO MAXVALUE
3644
12141
    NO MINVALUE
3645
12142
    CACHE 1;
3646
12143
 
 
12144
 
3647
12145
ALTER SEQUENCE poexportrequest_id_seq OWNED BY poexportrequest.id;
3648
12146
 
 
12147
 
3649
12148
CREATE TABLE pofile (
3650
12149
    id integer NOT NULL,
3651
12150
    potemplate integer NOT NULL,
3660
12159
    rosettacount integer NOT NULL,
3661
12160
    lastparsed timestamp without time zone,
3662
12161
    owner integer NOT NULL,
3663
 
    variant text,
3664
12162
    path text NOT NULL,
3665
12163
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, ('now'::text)::timestamp(6) with time zone) NOT NULL,
3666
12164
    from_sourcepackagename integer,
3667
12165
    unreviewed_count integer DEFAULT 0 NOT NULL,
3668
 
    date_changed timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
3669
 
    CONSTRAINT valid_variant CHECK ((variant <> ''::text))
 
12166
    date_changed timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3670
12167
);
3671
12168
 
 
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
 
3672
12183
CREATE SEQUENCE pofile_id_seq
 
12184
    START WITH 1
3673
12185
    INCREMENT BY 1
3674
12186
    NO MAXVALUE
3675
12187
    NO MINVALUE
3676
12188
    CACHE 1;
3677
12189
 
 
12190
 
3678
12191
ALTER SEQUENCE pofile_id_seq OWNED BY pofile.id;
3679
12192
 
 
12193
 
 
12194
CREATE TABLE pofilestatsjob (
 
12195
    job integer NOT NULL,
 
12196
    pofile integer NOT NULL
 
12197
);
 
12198
 
 
12199
 
3680
12200
CREATE TABLE pofiletranslator (
3681
12201
    id integer NOT NULL,
3682
12202
    person integer NOT NULL,
3685
12205
    date_last_touched timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3686
12206
);
3687
12207
 
 
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
 
3688
12226
CREATE SEQUENCE pofiletranslator_id_seq
 
12227
    START WITH 1
3689
12228
    INCREMENT BY 1
3690
12229
    NO MAXVALUE
3691
12230
    NO MINVALUE
3692
12231
    CACHE 1;
3693
12232
 
 
12233
 
3694
12234
ALTER SEQUENCE pofiletranslator_id_seq OWNED BY pofiletranslator.id;
3695
12235
 
 
12236
 
3696
12237
CREATE TABLE poll (
3697
12238
    id integer NOT NULL,
3698
12239
    team integer NOT NULL,
3708
12249
    CONSTRAINT sane_dates CHECK ((dateopens < datecloses))
3709
12250
);
3710
12251
 
 
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
 
3711
12283
CREATE SEQUENCE poll_id_seq
 
12284
    START WITH 1
3712
12285
    INCREMENT BY 1
3713
12286
    NO MAXVALUE
3714
12287
    NO MINVALUE
3715
12288
    CACHE 1;
3716
12289
 
 
12290
 
3717
12291
ALTER SEQUENCE poll_id_seq OWNED BY poll.id;
3718
12292
 
 
12293
 
3719
12294
CREATE TABLE polloption (
3720
12295
    id integer NOT NULL,
3721
12296
    poll integer NOT NULL,
3725
12300
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
3726
12301
);
3727
12302
 
 
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
 
3728
12319
CREATE SEQUENCE polloption_id_seq
 
12320
    START WITH 1
3729
12321
    INCREMENT BY 1
3730
12322
    NO MAXVALUE
3731
12323
    NO MINVALUE
3732
12324
    CACHE 1;
3733
12325
 
 
12326
 
3734
12327
ALTER SEQUENCE polloption_id_seq OWNED BY polloption.id;
3735
12328
 
 
12329
 
3736
12330
CREATE TABLE pomsgid (
3737
12331
    id integer NOT NULL,
3738
12332
    msgid text NOT NULL
3739
12333
);
3740
12334
 
 
12335
 
3741
12336
CREATE SEQUENCE pomsgid_id_seq
 
12337
    START WITH 1
3742
12338
    INCREMENT BY 1
3743
12339
    NO MAXVALUE
3744
12340
    NO MINVALUE
3745
12341
    CACHE 1;
3746
12342
 
 
12343
 
3747
12344
ALTER SEQUENCE pomsgid_id_seq OWNED BY pomsgid.id;
3748
12345
 
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;
3766
12346
 
3767
12347
CREATE TABLE potemplate (
3768
12348
    id integer NOT NULL,
3792
12372
    CONSTRAINT valid_link CHECK ((((productseries IS NULL) <> (distroseries IS NULL)) AND ((distroseries IS NULL) = (sourcepackagename IS NULL))))
3793
12373
);
3794
12374
 
 
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
 
3795
12412
CREATE SEQUENCE potemplate_id_seq
 
12413
    START WITH 1
3796
12414
    INCREMENT BY 1
3797
12415
    NO MAXVALUE
3798
12416
    NO MINVALUE
3799
12417
    CACHE 1;
3800
12418
 
 
12419
 
3801
12420
ALTER SEQUENCE potemplate_id_seq OWNED BY potemplate.id;
3802
12421
 
 
12422
 
3803
12423
CREATE TABLE potmsgset (
3804
12424
    id integer NOT NULL,
3805
12425
    msgid_singular integer NOT NULL,
3806
 
    sequence integer,
3807
12426
    potemplate integer,
3808
12427
    commenttext text,
3809
12428
    filereferences text,
3813
12432
    msgid_plural integer
3814
12433
);
3815
12434
 
 
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
 
3816
12465
CREATE TABLE translationtemplateitem (
3817
12466
    id integer NOT NULL,
3818
12467
    potemplate integer NOT NULL,
3821
12470
    CONSTRAINT translationtemplateitem_sequence_check CHECK ((sequence >= 0))
3822
12471
);
3823
12472
 
 
12473
 
3824
12474
CREATE VIEW potexport AS
3825
12475
    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)));
3826
12476
 
 
12477
 
3827
12478
CREATE SEQUENCE potmsgset_id_seq
 
12479
    START WITH 1
3828
12480
    INCREMENT BY 1
3829
12481
    NO MAXVALUE
3830
12482
    NO MINVALUE
3831
12483
    CACHE 1;
3832
12484
 
 
12485
 
3833
12486
ALTER SEQUENCE potmsgset_id_seq OWNED BY potmsgset.id;
3834
12487
 
 
12488
 
3835
12489
CREATE TABLE potranslation (
3836
12490
    id integer NOT NULL,
3837
12491
    translation text NOT NULL
3838
 
);
 
12492
)
 
12493
WITH (fillfactor=100);
 
12494
 
3839
12495
 
3840
12496
CREATE SEQUENCE potranslation_id_seq
 
12497
    START WITH 1
3841
12498
    INCREMENT BY 1
3842
12499
    NO MAXVALUE
3843
12500
    NO MINVALUE
3844
12501
    CACHE 1;
3845
12502
 
 
12503
 
3846
12504
ALTER SEQUENCE potranslation_id_seq OWNED BY potranslation.id;
3847
12505
 
 
12506
 
3848
12507
CREATE TABLE previewdiff (
3849
12508
    id integer NOT NULL,
3850
12509
    source_revision_id text NOT NULL,
3854
12513
    conflicts text
3855
12514
);
3856
12515
 
 
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
 
3857
12535
CREATE SEQUENCE previewdiff_id_seq
 
12536
    START WITH 1
3858
12537
    INCREMENT BY 1
3859
12538
    NO MAXVALUE
3860
12539
    NO MINVALUE
3861
12540
    CACHE 1;
3862
12541
 
 
12542
 
3863
12543
ALTER SEQUENCE previewdiff_id_seq OWNED BY previewdiff.id;
3864
12544
 
 
12545
 
3865
12546
CREATE TABLE processor (
3866
12547
    id integer NOT NULL,
3867
12548
    family integer NOT NULL,
3870
12551
    description text NOT NULL
3871
12552
);
3872
12553
 
 
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
 
3873
12564
CREATE SEQUENCE processor_id_seq
 
12565
    START WITH 1
3874
12566
    INCREMENT BY 1
3875
12567
    NO MAXVALUE
3876
12568
    NO MINVALUE
3877
12569
    CACHE 1;
3878
12570
 
 
12571
 
3879
12572
ALTER SEQUENCE processor_id_seq OWNED BY processor.id;
3880
12573
 
 
12574
 
3881
12575
CREATE TABLE processorfamily (
3882
12576
    id integer NOT NULL,
3883
12577
    name text NOT NULL,
3886
12580
    restricted boolean DEFAULT false NOT NULL
3887
12581
);
3888
12582
 
 
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
 
3889
12596
CREATE SEQUENCE processorfamily_id_seq
 
12597
    START WITH 1
3890
12598
    INCREMENT BY 1
3891
12599
    NO MAXVALUE
3892
12600
    NO MINVALUE
3893
12601
    CACHE 1;
3894
12602
 
 
12603
 
3895
12604
ALTER SEQUENCE processorfamily_id_seq OWNED BY processorfamily.id;
3896
12605
 
 
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
 
3897
12791
CREATE SEQUENCE product_id_seq
 
12792
    START WITH 1
3898
12793
    INCREMENT BY 1
3899
12794
    NO MAXVALUE
3900
12795
    NO MINVALUE
3901
12796
    CACHE 1;
3902
12797
 
 
12798
 
3903
12799
ALTER SEQUENCE product_id_seq OWNED BY product.id;
3904
12800
 
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;
3936
12801
 
3937
12802
CREATE TABLE productlicense (
3938
12803
    id integer NOT NULL,
3940
12805
    license integer NOT NULL
3941
12806
);
3942
12807
 
 
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
 
3943
12818
CREATE SEQUENCE productlicense_id_seq
 
12819
    START WITH 1
3944
12820
    INCREMENT BY 1
3945
12821
    NO MAXVALUE
3946
12822
    NO MINVALUE
3947
12823
    CACHE 1;
3948
12824
 
 
12825
 
3949
12826
ALTER SEQUENCE productlicense_id_seq OWNED BY productlicense.id;
3950
12827
 
 
12828
 
3951
12829
CREATE TABLE productrelease (
3952
12830
    id integer NOT NULL,
3953
12831
    datereleased timestamp without time zone NOT NULL,
3958
12836
    milestone integer NOT NULL
3959
12837
);
3960
12838
 
 
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
 
3961
12861
CREATE SEQUENCE productrelease_id_seq
 
12862
    START WITH 1
3962
12863
    INCREMENT BY 1
3963
12864
    NO MAXVALUE
3964
12865
    NO MINVALUE
3965
12866
    CACHE 1;
3966
12867
 
 
12868
 
3967
12869
ALTER SEQUENCE productrelease_id_seq OWNED BY productrelease.id;
3968
12870
 
 
12871
 
3969
12872
CREATE TABLE productreleasefile (
3970
12873
    productrelease integer NOT NULL,
3971
12874
    libraryfile integer NOT NULL,
3978
12881
    signature integer
3979
12882
);
3980
12883
 
 
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
 
3981
12909
CREATE SEQUENCE productreleasefile_id_seq
 
12910
    START WITH 1
3982
12911
    INCREMENT BY 1
3983
12912
    NO MAXVALUE
3984
12913
    NO MINVALUE
3985
12914
    CACHE 1;
3986
12915
 
 
12916
 
3987
12917
ALTER SEQUENCE productreleasefile_id_seq OWNED BY productreleasefile.id;
3988
12918
 
 
12919
 
3989
12920
CREATE TABLE productseries (
3990
12921
    id integer NOT NULL,
3991
12922
    product integer NOT NULL,
4004
12935
    CONSTRAINT valid_releasefileglob CHECK (valid_absolute_url(releasefileglob))
4005
12936
);
4006
12937
 
 
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
 
4007
12977
CREATE SEQUENCE productseries_id_seq
 
12978
    START WITH 1
4008
12979
    INCREMENT BY 1
4009
12980
    NO MAXVALUE
4010
12981
    NO MINVALUE
4011
12982
    CACHE 1;
4012
12983
 
 
12984
 
4013
12985
ALTER SEQUENCE productseries_id_seq OWNED BY productseries.id;
4014
12986
 
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;
4044
12987
 
4045
12988
CREATE TABLE project (
4046
12989
    id integer NOT NULL,
4075
13018
    CONSTRAINT valid_name CHECK (valid_name(name))
4076
13019
);
4077
13020
 
 
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
 
4078
13107
CREATE SEQUENCE project_id_seq
 
13108
    START WITH 1
4079
13109
    INCREMENT BY 1
4080
13110
    NO MAXVALUE
4081
13111
    NO MINVALUE
4082
13112
    CACHE 1;
4083
13113
 
 
13114
 
4084
13115
ALTER SEQUENCE project_id_seq OWNED BY project.id;
4085
13116
 
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;
 
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
 
4130
13137
 
4131
13138
CREATE TABLE question (
4132
13139
    id integer NOT NULL,
4156
13163
    CONSTRAINT sourcepackagename_needs_distro CHECK (((sourcepackagename IS NULL) OR (distribution IS NOT NULL)))
4157
13164
);
4158
13165
 
 
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
 
4159
13215
CREATE SEQUENCE question_id_seq
 
13216
    START WITH 1
4160
13217
    INCREMENT BY 1
4161
13218
    NO MAXVALUE
4162
13219
    NO MINVALUE
4163
13220
    CACHE 1;
4164
13221
 
 
13222
 
4165
13223
ALTER SEQUENCE question_id_seq OWNED BY question.id;
4166
13224
 
 
13225
 
4167
13226
CREATE TABLE questionbug (
4168
13227
    id integer NOT NULL,
4169
13228
    question integer NOT NULL,
4171
13230
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
4172
13231
);
4173
13232
 
 
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
 
4174
13237
CREATE SEQUENCE questionbug_id_seq
 
13238
    START WITH 1
4175
13239
    INCREMENT BY 1
4176
13240
    NO MAXVALUE
4177
13241
    NO MINVALUE
4178
13242
    CACHE 1;
4179
13243
 
 
13244
 
4180
13245
ALTER SEQUENCE questionbug_id_seq OWNED BY questionbug.id;
4181
13246
 
 
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
 
4182
13283
CREATE TABLE questionmessage (
4183
13284
    id integer NOT NULL,
4184
13285
    question integer NOT NULL,
4185
13286
    message integer NOT NULL,
4186
13287
    action integer NOT NULL,
4187
 
    new_status integer NOT NULL
 
13288
    new_status integer NOT NULL,
 
13289
    owner integer NOT NULL
4188
13290
);
4189
13291
 
 
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
 
4190
13302
CREATE SEQUENCE questionmessage_id_seq
 
13303
    START WITH 1
4191
13304
    INCREMENT BY 1
4192
13305
    NO MAXVALUE
4193
13306
    NO MINVALUE
4194
13307
    CACHE 1;
4195
13308
 
 
13309
 
4196
13310
ALTER SEQUENCE questionmessage_id_seq OWNED BY questionmessage.id;
4197
13311
 
 
13312
 
4198
13313
CREATE TABLE questionreopening (
4199
13314
    id integer NOT NULL,
4200
13315
    question integer NOT NULL,
4205
13320
    priorstate integer NOT NULL
4206
13321
);
4207
13322
 
 
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
 
4208
13336
CREATE SEQUENCE questionreopening_id_seq
 
13337
    START WITH 1
4209
13338
    INCREMENT BY 1
4210
13339
    NO MAXVALUE
4211
13340
    NO MINVALUE
4212
13341
    CACHE 1;
4213
13342
 
 
13343
 
4214
13344
ALTER SEQUENCE questionreopening_id_seq OWNED BY questionreopening.id;
4215
13345
 
 
13346
 
4216
13347
CREATE TABLE questionsubscription (
4217
13348
    id integer NOT NULL,
4218
13349
    question integer NOT NULL,
4220
13351
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
4221
13352
);
4222
13353
 
 
13354
 
 
13355
COMMENT ON TABLE questionsubscription IS 'A subscription of a person to a particular question.';
 
13356
 
 
13357
 
4223
13358
CREATE SEQUENCE questionsubscription_id_seq
 
13359
    START WITH 1
4224
13360
    INCREMENT BY 1
4225
13361
    NO MAXVALUE
4226
13362
    NO MINVALUE
4227
13363
    CACHE 1;
4228
13364
 
 
13365
 
4229
13366
ALTER SEQUENCE questionsubscription_id_seq OWNED BY questionsubscription.id;
4230
13367
 
4231
 
CREATE TABLE requestedcds (
 
13368
 
 
13369
CREATE TABLE revision (
4232
13370
    id integer NOT NULL,
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))
 
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
4241
13378
);
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;
 
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
 
4250
13382
 
4251
13383
CREATE SEQUENCE revision_id_seq
 
13384
    START WITH 1
4252
13385
    INCREMENT BY 1
4253
13386
    NO MAXVALUE
4254
13387
    NO MINVALUE
4255
13388
    CACHE 1;
4256
13389
 
 
13390
 
4257
13391
ALTER SEQUENCE revision_id_seq OWNED BY revision.id;
4258
13392
 
 
13393
 
4259
13394
CREATE TABLE revisionauthor (
4260
13395
    id integer NOT NULL,
4261
13396
    name text NOT NULL,
4263
13398
    person integer
4264
13399
);
4265
13400
 
 
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
 
4266
13414
CREATE SEQUENCE revisionauthor_id_seq
 
13415
    START WITH 1
4267
13416
    INCREMENT BY 1
4268
13417
    NO MAXVALUE
4269
13418
    NO MINVALUE
4270
13419
    CACHE 1;
4271
13420
 
 
13421
 
4272
13422
ALTER SEQUENCE revisionauthor_id_seq OWNED BY revisionauthor.id;
4273
13423
 
 
13424
 
4274
13425
CREATE TABLE revisioncache (
4275
13426
    id integer NOT NULL,
4276
13427
    revision integer NOT NULL,
4283
13434
    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)))))
4284
13435
);
4285
13436
 
 
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
 
4286
13462
CREATE SEQUENCE revisioncache_id_seq
 
13463
    START WITH 1
4287
13464
    INCREMENT BY 1
4288
13465
    NO MAXVALUE
4289
13466
    NO MINVALUE
4290
13467
    CACHE 1;
4291
13468
 
 
13469
 
4292
13470
ALTER SEQUENCE revisioncache_id_seq OWNED BY revisioncache.id;
4293
13471
 
4294
 
CREATE VIEW revisionnumber AS
4295
 
    SELECT branchrevision.id, branchrevision.sequence, branchrevision.branch, branchrevision.revision FROM branchrevision;
4296
13472
 
4297
13473
CREATE TABLE revisionparent (
4298
13474
    id integer NOT NULL,
4301
13477
    parent_id text NOT NULL
4302
13478
);
4303
13479
 
 
13480
 
4304
13481
CREATE SEQUENCE revisionparent_id_seq
 
13482
    START WITH 1
4305
13483
    INCREMENT BY 1
4306
13484
    NO MAXVALUE
4307
13485
    NO MINVALUE
4308
13486
    CACHE 1;
4309
13487
 
 
13488
 
4310
13489
ALTER SEQUENCE revisionparent_id_seq OWNED BY revisionparent.id;
4311
13490
 
 
13491
 
4312
13492
CREATE TABLE revisionproperty (
4313
13493
    id integer NOT NULL,
4314
13494
    revision integer NOT NULL,
4316
13496
    value text NOT NULL
4317
13497
);
4318
13498
 
 
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
 
4319
13512
CREATE SEQUENCE revisionproperty_id_seq
 
13513
    START WITH 1
4320
13514
    INCREMENT BY 1
4321
13515
    NO MAXVALUE
4322
13516
    NO MINVALUE
4323
13517
    CACHE 1;
4324
13518
 
 
13519
 
4325
13520
ALTER SEQUENCE revisionproperty_id_seq OWNED BY revisionproperty.id;
4326
13521
 
 
13522
 
4327
13523
CREATE TABLE scriptactivity (
4328
13524
    id integer NOT NULL,
4329
13525
    name text NOT NULL,
4332
13528
    date_completed timestamp without time zone NOT NULL
4333
13529
);
4334
13530
 
 
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
 
4335
13547
CREATE SEQUENCE scriptactivity_id_seq
 
13548
    START WITH 1
4336
13549
    INCREMENT BY 1
4337
13550
    NO MAXVALUE
4338
13551
    NO MINVALUE
4339
13552
    CACHE 1;
4340
13553
 
 
13554
 
4341
13555
ALTER SEQUENCE scriptactivity_id_seq OWNED BY scriptactivity.id;
4342
13556
 
 
13557
 
4343
13558
CREATE TABLE section (
4344
13559
    id integer NOT NULL,
4345
13560
    name text NOT NULL
4346
13561
);
4347
13562
 
 
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
 
4348
13570
CREATE SEQUENCE section_id_seq
 
13571
    START WITH 1
4349
13572
    INCREMENT BY 1
4350
13573
    NO MAXVALUE
4351
13574
    NO MINVALUE
4352
13575
    CACHE 1;
4353
13576
 
 
13577
 
4354
13578
ALTER SEQUENCE section_id_seq OWNED BY section.id;
4355
13579
 
 
13580
 
4356
13581
CREATE TABLE sectionselection (
4357
13582
    id integer NOT NULL,
4358
13583
    distroseries integer NOT NULL,
4360
13585
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
4361
13586
);
4362
13587
 
 
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
 
4363
13598
CREATE SEQUENCE sectionselection_id_seq
 
13599
    START WITH 1
4364
13600
    INCREMENT BY 1
4365
13601
    NO MAXVALUE
4366
13602
    NO MINVALUE
4367
13603
    CACHE 1;
4368
13604
 
 
13605
 
4369
13606
ALTER SEQUENCE sectionselection_id_seq OWNED BY sectionselection.id;
4370
13607
 
 
13608
 
4371
13609
CREATE TABLE seriessourcepackagebranch (
4372
13610
    id integer NOT NULL,
4373
13611
    distroseries integer NOT NULL,
4378
13616
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
4379
13617
);
4380
13618
 
 
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
 
4381
13641
CREATE SEQUENCE seriessourcepackagebranch_id_seq
 
13642
    START WITH 1
4382
13643
    INCREMENT BY 1
4383
13644
    NO MAXVALUE
4384
13645
    NO MINVALUE
4385
13646
    CACHE 1;
4386
13647
 
 
13648
 
4387
13649
ALTER SEQUENCE seriessourcepackagebranch_id_seq OWNED BY seriessourcepackagebranch.id;
4388
13650
 
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;
4526
13651
 
4527
13652
CREATE TABLE signedcodeofconduct (
4528
13653
    id integer NOT NULL,
4535
13660
    admincomment text
4536
13661
);
4537
13662
 
 
13663
 
4538
13664
CREATE SEQUENCE signedcodeofconduct_id_seq
 
13665
    START WITH 1
4539
13666
    INCREMENT BY 1
4540
13667
    NO MAXVALUE
4541
13668
    NO MINVALUE
4542
13669
    CACHE 1;
4543
13670
 
 
13671
 
4544
13672
ALTER SEQUENCE signedcodeofconduct_id_seq OWNED BY signedcodeofconduct.id;
4545
13673
 
 
13674
 
4546
13675
CREATE TABLE sourcepackagepublishinghistory (
4547
13676
    id integer NOT NULL,
4548
13677
    sourcepackagerelease integer NOT NULL,
4560
13689
    pocket integer DEFAULT 0 NOT NULL,
4561
13690
    archive integer NOT NULL,
4562
13691
    removed_by integer,
4563
 
    removal_comment text
 
13692
    removal_comment text,
 
13693
    ancestor integer,
 
13694
    sourcepackagename integer,
 
13695
    creator integer
4564
13696
);
4565
13697
 
 
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
 
4566
13750
CREATE TABLE sourcepackagereleasefile (
4567
13751
    sourcepackagerelease integer NOT NULL,
4568
13752
    libraryfile integer NOT NULL,
4570
13754
    id integer DEFAULT nextval(('sourcepackagereleasefile_id_seq'::text)::regclass) NOT NULL
4571
13755
);
4572
13756
 
 
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
 
4573
13770
CREATE VIEW sourcepackagefilepublishing AS
4574
13771
    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);
4575
13772
 
 
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
 
4576
13777
CREATE TABLE sourcepackageformatselection (
4577
13778
    id integer NOT NULL,
4578
13779
    distroseries integer NOT NULL,
4579
13780
    format integer NOT NULL
4580
13781
);
4581
13782
 
 
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
 
4582
13793
CREATE SEQUENCE sourcepackageformatselection_id_seq
 
13794
    START WITH 1
4583
13795
    INCREMENT BY 1
4584
13796
    NO MAXVALUE
4585
13797
    NO MINVALUE
4586
13798
    CACHE 1;
4587
13799
 
 
13800
 
4588
13801
ALTER SEQUENCE sourcepackageformatselection_id_seq OWNED BY sourcepackageformatselection.id;
4589
13802
 
 
13803
 
4590
13804
CREATE SEQUENCE sourcepackagename_id_seq
 
13805
    START WITH 1
4591
13806
    INCREMENT BY 1
4592
13807
    NO MAXVALUE
4593
13808
    NO MINVALUE
4594
13809
    CACHE 1;
4595
13810
 
 
13811
 
4596
13812
ALTER SEQUENCE sourcepackagename_id_seq OWNED BY sourcepackagename.id;
4597
13813
 
 
13814
 
4598
13815
CREATE SEQUENCE sourcepackagepublishinghistory_id_seq
 
13816
    START WITH 1
4599
13817
    INCREMENT BY 1
4600
13818
    NO MAXVALUE
4601
13819
    NO MINVALUE
4602
13820
    CACHE 1;
4603
13821
 
 
13822
 
4604
13823
ALTER SEQUENCE sourcepackagepublishinghistory_id_seq OWNED BY sourcepackagepublishinghistory.id;
4605
13824
 
 
13825
 
4606
13826
CREATE TABLE sourcepackagerecipe (
4607
13827
    id integer NOT NULL,
4608
13828
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
4610
13830
    registrant integer NOT NULL,
4611
13831
    owner integer NOT NULL,
4612
13832
    name text NOT NULL,
4613
 
    description text NOT NULL,
 
13833
    description text,
4614
13834
    build_daily boolean DEFAULT false NOT NULL,
4615
13835
    daily_build_archive integer,
4616
13836
    is_stale boolean DEFAULT true NOT NULL
4617
13837
);
4618
13838
 
 
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
 
4619
13861
CREATE SEQUENCE sourcepackagerecipe_id_seq
 
13862
    START WITH 1
4620
13863
    INCREMENT BY 1
4621
13864
    NO MAXVALUE
4622
13865
    NO MINVALUE
4623
13866
    CACHE 1;
4624
13867
 
 
13868
 
4625
13869
ALTER SEQUENCE sourcepackagerecipe_id_seq OWNED BY sourcepackagerecipe.id;
4626
13870
 
 
13871
 
4627
13872
CREATE TABLE sourcepackagerecipebuild (
4628
13873
    id integer NOT NULL,
4629
13874
    distroseries integer NOT NULL,
4630
13875
    requester integer NOT NULL,
4631
 
    recipe integer NOT NULL,
 
13876
    recipe integer,
4632
13877
    manifest integer,
4633
13878
    package_build integer NOT NULL
4634
13879
);
4635
13880
 
 
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
 
4636
13900
CREATE SEQUENCE sourcepackagerecipebuild_id_seq
 
13901
    START WITH 1
4637
13902
    INCREMENT BY 1
4638
13903
    NO MAXVALUE
4639
13904
    NO MINVALUE
4640
13905
    CACHE 1;
4641
13906
 
 
13907
 
4642
13908
ALTER SEQUENCE sourcepackagerecipebuild_id_seq OWNED BY sourcepackagerecipebuild.id;
4643
13909
 
 
13910
 
4644
13911
CREATE TABLE sourcepackagerecipebuildjob (
4645
13912
    id integer NOT NULL,
4646
13913
    job integer NOT NULL,
4647
 
    sourcepackage_recipe_build integer
 
13914
    sourcepackage_recipe_build integer NOT NULL
4648
13915
);
4649
13916
 
 
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
 
4650
13924
CREATE SEQUENCE sourcepackagerecipebuildjob_id_seq
 
13925
    START WITH 1
4651
13926
    INCREMENT BY 1
4652
13927
    NO MAXVALUE
4653
13928
    NO MINVALUE
4654
13929
    CACHE 1;
4655
13930
 
 
13931
 
4656
13932
ALTER SEQUENCE sourcepackagerecipebuildjob_id_seq OWNED BY sourcepackagerecipebuildjob.id;
4657
13933
 
 
13934
 
4658
13935
CREATE TABLE sourcepackagerecipedata (
4659
13936
    id integer NOT NULL,
4660
13937
    base_branch integer NOT NULL,
4666
13943
    CONSTRAINT sourcepackagerecipedata__recipe_or_build_is_not_null CHECK (((sourcepackage_recipe IS NULL) <> (sourcepackage_recipe_build IS NULL)))
4667
13944
);
4668
13945
 
 
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
 
4669
13968
CREATE SEQUENCE sourcepackagerecipedata_id_seq
 
13969
    START WITH 1
4670
13970
    INCREMENT BY 1
4671
13971
    NO MAXVALUE
4672
13972
    NO MINVALUE
4673
13973
    CACHE 1;
4674
13974
 
 
13975
 
4675
13976
ALTER SEQUENCE sourcepackagerecipedata_id_seq OWNED BY sourcepackagerecipedata.id;
4676
13977
 
 
13978
 
4677
13979
CREATE TABLE sourcepackagerecipedatainstruction (
4678
13980
    id integer NOT NULL,
4679
13981
    name text NOT NULL,
4685
13987
    directory text,
4686
13988
    recipe_data integer NOT NULL,
4687
13989
    parent_instruction integer,
4688
 
    CONSTRAINT sourcepackagerecipedatainstruction__directory_not_null CHECK ((((type = 1) AND (directory IS NULL)) OR ((type = 2) AND (directory IS NOT NULL))))
 
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))))
4689
13993
);
4690
13994
 
 
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
 
4691
14029
CREATE SEQUENCE sourcepackagerecipedatainstruction_id_seq
 
14030
    START WITH 1
4692
14031
    INCREMENT BY 1
4693
14032
    NO MAXVALUE
4694
14033
    NO MINVALUE
4695
14034
    CACHE 1;
4696
14035
 
 
14036
 
4697
14037
ALTER SEQUENCE sourcepackagerecipedatainstruction_id_seq OWNED BY sourcepackagerecipedatainstruction.id;
4698
14038
 
 
14039
 
4699
14040
CREATE TABLE sourcepackagerecipedistroseries (
4700
14041
    id integer NOT NULL,
4701
14042
    sourcepackagerecipe integer NOT NULL,
4702
14043
    distroseries integer NOT NULL
4703
14044
);
4704
14045
 
 
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
 
4705
14056
CREATE SEQUENCE sourcepackagerecipedistroseries_id_seq
 
14057
    START WITH 1
4706
14058
    INCREMENT BY 1
4707
14059
    NO MAXVALUE
4708
14060
    NO MINVALUE
4709
14061
    CACHE 1;
4710
14062
 
 
14063
 
4711
14064
ALTER SEQUENCE sourcepackagerecipedistroseries_id_seq OWNED BY sourcepackagerecipedistroseries.id;
4712
14065
 
 
14066
 
4713
14067
CREATE SEQUENCE sourcepackagerelease_id_seq
 
14068
    START WITH 1
4714
14069
    INCREMENT BY 1
4715
14070
    NO MAXVALUE
4716
14071
    NO MINVALUE
4717
14072
    CACHE 1;
4718
14073
 
 
14074
 
4719
14075
ALTER SEQUENCE sourcepackagerelease_id_seq OWNED BY sourcepackagerelease.id;
4720
14076
 
 
14077
 
4721
14078
CREATE SEQUENCE sourcepackagereleasefile_id_seq
 
14079
    START WITH 1
4722
14080
    INCREMENT BY 1
4723
14081
    NO MAXVALUE
4724
14082
    NO MINVALUE
4725
14083
    CACHE 1;
4726
14084
 
 
14085
 
4727
14086
ALTER SEQUENCE sourcepackagereleasefile_id_seq OWNED BY sourcepackagereleasefile.id;
4728
14087
 
 
14088
 
4729
14089
CREATE TABLE specification (
4730
14090
    id integer NOT NULL,
4731
14091
    name text NOT NULL,
4774
14134
    CONSTRAINT valid_url CHECK (valid_absolute_url(specurl))
4775
14135
);
4776
14136
 
 
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
 
4777
14210
CREATE SEQUENCE specification_id_seq
 
14211
    START WITH 1
4778
14212
    INCREMENT BY 1
4779
14213
    NO MAXVALUE
4780
14214
    NO MINVALUE
4781
14215
    CACHE 1;
4782
14216
 
 
14217
 
4783
14218
ALTER SEQUENCE specification_id_seq OWNED BY specification.id;
4784
14219
 
 
14220
 
4785
14221
CREATE TABLE specificationbranch (
4786
14222
    id integer NOT NULL,
4787
14223
    datecreated timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
4791
14227
    registrant integer NOT NULL
4792
14228
);
4793
14229
 
 
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
 
4794
14243
CREATE SEQUENCE specificationbranch_id_seq
 
14244
    START WITH 1
4795
14245
    INCREMENT BY 1
4796
14246
    NO MAXVALUE
4797
14247
    NO MINVALUE
4798
14248
    CACHE 1;
4799
14249
 
 
14250
 
4800
14251
ALTER SEQUENCE specificationbranch_id_seq OWNED BY specificationbranch.id;
4801
14252
 
 
14253
 
4802
14254
CREATE TABLE specificationbug (
4803
14255
    id integer NOT NULL,
4804
14256
    specification integer NOT NULL,
4805
14257
    bug integer NOT NULL
4806
14258
);
4807
14259
 
 
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
 
4808
14264
CREATE SEQUENCE specificationbug_id_seq
 
14265
    START WITH 1
4809
14266
    INCREMENT BY 1
4810
14267
    NO MAXVALUE
4811
14268
    NO MINVALUE
4812
14269
    CACHE 1;
4813
14270
 
 
14271
 
4814
14272
ALTER SEQUENCE specificationbug_id_seq OWNED BY specificationbug.id;
4815
14273
 
 
14274
 
4816
14275
CREATE TABLE specificationdependency (
4817
14276
    id integer NOT NULL,
4818
14277
    specification integer NOT NULL,
4821
14280
    CONSTRAINT specificationdependency_not_self CHECK ((specification <> dependency))
4822
14281
);
4823
14282
 
 
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
 
4824
14293
CREATE SEQUENCE specificationdependency_id_seq
 
14294
    START WITH 1
4825
14295
    INCREMENT BY 1
4826
14296
    NO MAXVALUE
4827
14297
    NO MINVALUE
4828
14298
    CACHE 1;
4829
14299
 
 
14300
 
4830
14301
ALTER SEQUENCE specificationdependency_id_seq OWNED BY specificationdependency.id;
4831
14302
 
 
14303
 
4832
14304
CREATE TABLE specificationfeedback (
4833
14305
    id integer NOT NULL,
4834
14306
    specification integer NOT NULL,
4838
14310
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
4839
14311
);
4840
14312
 
 
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
 
4841
14326
CREATE SEQUENCE specificationfeedback_id_seq
 
14327
    START WITH 1
4842
14328
    INCREMENT BY 1
4843
14329
    NO MAXVALUE
4844
14330
    NO MINVALUE
4845
14331
    CACHE 1;
4846
14332
 
 
14333
 
4847
14334
ALTER SEQUENCE specificationfeedback_id_seq OWNED BY specificationfeedback.id;
4848
14335
 
 
14336
 
4849
14337
CREATE TABLE specificationmessage (
4850
14338
    id integer NOT NULL,
4851
14339
    specification integer,
4853
14341
    visible boolean DEFAULT true NOT NULL
4854
14342
);
4855
14343
 
 
14344
 
 
14345
COMMENT ON TABLE specificationmessage IS 'Comments and discussion on a Specification.';
 
14346
 
 
14347
 
4856
14348
CREATE SEQUENCE specificationmessage_id_seq
 
14349
    START WITH 1
4857
14350
    INCREMENT BY 1
4858
14351
    NO MAXVALUE
4859
14352
    NO MINVALUE
4860
14353
    CACHE 1;
4861
14354
 
 
14355
 
4862
14356
ALTER SEQUENCE specificationmessage_id_seq OWNED BY specificationmessage.id;
4863
14357
 
 
14358
 
4864
14359
CREATE TABLE specificationsubscription (
4865
14360
    id integer NOT NULL,
4866
14361
    specification integer NOT NULL,
4869
14364
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
4870
14365
);
4871
14366
 
 
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
 
4872
14374
CREATE SEQUENCE specificationsubscription_id_seq
 
14375
    START WITH 1
4873
14376
    INCREMENT BY 1
4874
14377
    NO MAXVALUE
4875
14378
    NO MINVALUE
4876
14379
    CACHE 1;
4877
14380
 
 
14381
 
4878
14382
ALTER SEQUENCE specificationsubscription_id_seq OWNED BY specificationsubscription.id;
4879
14383
 
 
14384
 
4880
14385
CREATE TABLE spokenin (
4881
14386
    language integer NOT NULL,
4882
14387
    country integer NOT NULL,
4883
14388
    id integer DEFAULT nextval(('spokenin_id_seq'::text)::regclass) NOT NULL
4884
14389
);
4885
14390
 
 
14391
 
4886
14392
CREATE SEQUENCE spokenin_id_seq
 
14393
    START WITH 1
4887
14394
    INCREMENT BY 1
4888
14395
    NO MAXVALUE
4889
14396
    NO MINVALUE
4890
14397
    CACHE 1;
4891
14398
 
 
14399
 
4892
14400
ALTER SEQUENCE spokenin_id_seq OWNED BY spokenin.id;
4893
14401
 
 
14402
 
4894
14403
CREATE TABLE sprint (
4895
14404
    id integer NOT NULL,
4896
14405
    owner integer NOT NULL,
4911
14420
    CONSTRAINT sprint_starts_before_ends CHECK ((time_starts < time_ends))
4912
14421
);
4913
14422
 
 
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
 
4914
14445
CREATE SEQUENCE sprint_id_seq
 
14446
    START WITH 1
4915
14447
    INCREMENT BY 1
4916
14448
    NO MAXVALUE
4917
14449
    NO MINVALUE
4918
14450
    CACHE 1;
4919
14451
 
 
14452
 
4920
14453
ALTER SEQUENCE sprint_id_seq OWNED BY sprint.id;
4921
14454
 
 
14455
 
4922
14456
CREATE TABLE sprintattendance (
4923
14457
    id integer NOT NULL,
4924
14458
    attendee integer NOT NULL,
4930
14464
    CONSTRAINT sprintattendance_starts_before_ends CHECK ((time_starts < time_ends))
4931
14465
);
4932
14466
 
 
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
 
4933
14486
CREATE SEQUENCE sprintattendance_id_seq
 
14487
    START WITH 1
4934
14488
    INCREMENT BY 1
4935
14489
    NO MAXVALUE
4936
14490
    NO MINVALUE
4937
14491
    CACHE 1;
4938
14492
 
 
14493
 
4939
14494
ALTER SEQUENCE sprintattendance_id_seq OWNED BY sprintattendance.id;
4940
14495
 
 
14496
 
4941
14497
CREATE TABLE sprintspecification (
4942
14498
    id integer NOT NULL,
4943
14499
    sprint integer NOT NULL,
4951
14507
    CONSTRAINT sprintspecification_decision_recorded CHECK (((status = 30) OR ((decider IS NOT NULL) AND (date_decided IS NOT NULL))))
4952
14508
);
4953
14509
 
 
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
 
4954
14529
CREATE SEQUENCE sprintspecification_id_seq
 
14530
    START WITH 1
4955
14531
    INCREMENT BY 1
4956
14532
    NO MAXVALUE
4957
14533
    NO MINVALUE
4958
14534
    CACHE 1;
4959
14535
 
 
14536
 
4960
14537
ALTER SEQUENCE sprintspecification_id_seq OWNED BY sprintspecification.id;
4961
14538
 
 
14539
 
4962
14540
CREATE TABLE sshkey (
4963
14541
    id integer NOT NULL,
4964
14542
    person integer,
4968
14546
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
4969
14547
);
4970
14548
 
 
14549
 
4971
14550
CREATE SEQUENCE sshkey_id_seq
 
14551
    START WITH 1
4972
14552
    INCREMENT BY 1
4973
14553
    NO MAXVALUE
4974
14554
    NO MINVALUE
4975
14555
    CACHE 1;
4976
14556
 
 
14557
 
4977
14558
ALTER SEQUENCE sshkey_id_seq OWNED BY sshkey.id;
4978
14559
 
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;
5014
14560
 
5015
14561
CREATE TABLE structuralsubscription (
5016
14562
    id integer NOT NULL,
5023
14569
    sourcepackagename integer,
5024
14570
    subscriber integer NOT NULL,
5025
14571
    subscribed_by integer NOT NULL,
5026
 
    bug_notification_level integer NOT NULL,
5027
 
    blueprint_notification_level integer NOT NULL,
5028
14572
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
5029
14573
    date_last_updated timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
5030
14574
    CONSTRAINT one_target CHECK ((null_count(ARRAY[product, productseries, project, distroseries, distribution, milestone]) = 5)),
5031
14575
    CONSTRAINT sourcepackagename_requires_distribution CHECK (((sourcepackagename IS NULL) OR (distribution IS NOT NULL)))
5032
14576
);
5033
14577
 
 
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
 
5034
14615
CREATE SEQUENCE structuralsubscription_id_seq
 
14616
    START WITH 1
5035
14617
    INCREMENT BY 1
5036
14618
    NO MAXVALUE
5037
14619
    NO MINVALUE
5038
14620
    CACHE 1;
5039
14621
 
 
14622
 
5040
14623
ALTER SEQUENCE structuralsubscription_id_seq OWNED BY structuralsubscription.id;
5041
14624
 
 
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
 
5042
14661
CREATE TABLE suggestivepotemplate (
5043
14662
    potemplate integer NOT NULL
5044
14663
);
5045
14664
 
 
14665
 
 
14666
COMMENT ON TABLE suggestivepotemplate IS 'Cache of POTemplates that can provide external translation suggestions.';
 
14667
 
 
14668
 
5046
14669
CREATE TABLE teammembership (
5047
14670
    id integer NOT NULL,
5048
14671
    person integer NOT NULL,
5065
14688
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
5066
14689
);
5067
14690
 
 
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
 
5068
14750
CREATE SEQUENCE teammembership_id_seq
 
14751
    START WITH 1
5069
14752
    INCREMENT BY 1
5070
14753
    NO MAXVALUE
5071
14754
    NO MINVALUE
5072
14755
    CACHE 1;
5073
14756
 
 
14757
 
5074
14758
ALTER SEQUENCE teammembership_id_seq OWNED BY teammembership.id;
5075
14759
 
 
14760
 
5076
14761
CREATE TABLE teamparticipation (
5077
14762
    id integer NOT NULL,
5078
14763
    team integer NOT NULL,
5079
14764
    person integer NOT NULL
5080
14765
);
5081
14766
 
 
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
 
5082
14777
CREATE SEQUENCE teamparticipation_id_seq
 
14778
    START WITH 1
5083
14779
    INCREMENT BY 1
5084
14780
    NO MAXVALUE
5085
14781
    NO MINVALUE
5086
14782
    CACHE 1;
5087
14783
 
 
14784
 
5088
14785
ALTER SEQUENCE teamparticipation_id_seq OWNED BY teamparticipation.id;
5089
14786
 
 
14787
 
5090
14788
CREATE TABLE temporaryblobstorage (
5091
14789
    id integer NOT NULL,
5092
14790
    uuid text NOT NULL,
5094
14792
    file_alias integer NOT NULL
5095
14793
);
5096
14794
 
 
14795
 
5097
14796
CREATE SEQUENCE temporaryblobstorage_id_seq
 
14797
    START WITH 1
5098
14798
    INCREMENT BY 1
5099
14799
    NO MAXVALUE
5100
14800
    NO MINVALUE
5101
14801
    CACHE 1;
5102
14802
 
 
14803
 
5103
14804
ALTER SEQUENCE temporaryblobstorage_id_seq OWNED BY temporaryblobstorage.id;
5104
14805
 
 
14806
 
5105
14807
CREATE TABLE translationgroup (
5106
14808
    id integer NOT NULL,
5107
14809
    name text NOT NULL,
5112
14814
    translation_guide_url text
5113
14815
);
5114
14816
 
 
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
 
5115
14824
CREATE SEQUENCE translationgroup_id_seq
 
14825
    START WITH 1
5116
14826
    INCREMENT BY 1
5117
14827
    NO MAXVALUE
5118
14828
    NO MINVALUE
5119
14829
    CACHE 1;
5120
14830
 
 
14831
 
5121
14832
ALTER SEQUENCE translationgroup_id_seq OWNED BY translationgroup.id;
5122
14833
 
 
14834
 
5123
14835
CREATE TABLE translationimportqueueentry (
5124
14836
    id integer NOT NULL,
5125
14837
    path text NOT NULL,
5129
14841
    distroseries integer,
5130
14842
    sourcepackagename integer,
5131
14843
    productseries integer,
5132
 
    is_published boolean NOT NULL,
 
14844
    by_maintainer boolean NOT NULL,
5133
14845
    pofile integer,
5134
14846
    potemplate integer,
5135
14847
    status integer DEFAULT 5 NOT NULL,
5139
14851
    CONSTRAINT valid_link CHECK ((((productseries IS NULL) <> (distroseries IS NULL)) AND ((distroseries IS NULL) = (sourcepackagename IS NULL))))
5140
14852
);
5141
14853
 
 
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
 
5142
14900
CREATE SEQUENCE translationimportqueueentry_id_seq
 
14901
    START WITH 1
5143
14902
    INCREMENT BY 1
5144
14903
    NO MAXVALUE
5145
14904
    NO MINVALUE
5146
14905
    CACHE 1;
5147
14906
 
 
14907
 
5148
14908
ALTER SEQUENCE translationimportqueueentry_id_seq OWNED BY translationimportqueueentry.id;
5149
14909
 
 
14910
 
5150
14911
CREATE TABLE translationmessage (
5151
14912
    id integer NOT NULL,
5152
 
    pofile integer,
5153
14913
    potmsgset integer NOT NULL,
5154
14914
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
5155
14915
    submitter integer NOT NULL,
5162
14922
    comment text,
5163
14923
    origin integer NOT NULL,
5164
14924
    validation_status integer DEFAULT 0 NOT NULL,
5165
 
    is_current boolean DEFAULT false NOT NULL,
 
14925
    is_current_ubuntu boolean DEFAULT false NOT NULL,
5166
14926
    is_fuzzy boolean DEFAULT false NOT NULL,
5167
 
    is_imported boolean DEFAULT false NOT NULL,
 
14927
    is_current_upstream boolean DEFAULT false NOT NULL,
5168
14928
    was_obsolete_in_last_import boolean DEFAULT false NOT NULL,
5169
14929
    was_fuzzy_in_last_import boolean DEFAULT false NOT NULL,
5170
14930
    msgstr4 integer,
5171
14931
    msgstr5 integer,
5172
14932
    potemplate integer,
5173
14933
    language integer,
5174
 
    variant text,
5175
14934
    CONSTRAINT translationmessage__reviewer__date_reviewed__valid CHECK (((reviewer IS NULL) = (date_reviewed IS NULL)))
5176
14935
);
5177
14936
 
 
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
 
5178
15019
CREATE SEQUENCE translationmessage_id_seq
 
15020
    START WITH 1
5179
15021
    INCREMENT BY 1
5180
15022
    NO MAXVALUE
5181
15023
    NO MINVALUE
5182
15024
    CACHE 1;
5183
15025
 
 
15026
 
5184
15027
ALTER SEQUENCE translationmessage_id_seq OWNED BY translationmessage.id;
5185
15028
 
 
15029
 
5186
15030
CREATE TABLE translationrelicensingagreement (
5187
15031
    id integer NOT NULL,
5188
15032
    person integer NOT NULL,
5190
15034
    date_decided timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL
5191
15035
);
5192
15036
 
 
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
 
5193
15050
CREATE SEQUENCE translationrelicensingagreement_id_seq
 
15051
    START WITH 1
5194
15052
    INCREMENT BY 1
5195
15053
    NO MAXVALUE
5196
15054
    NO MINVALUE
5197
15055
    CACHE 1;
5198
15056
 
 
15057
 
5199
15058
ALTER SEQUENCE translationrelicensingagreement_id_seq OWNED BY translationrelicensingagreement.id;
5200
15059
 
 
15060
 
5201
15061
CREATE SEQUENCE translationtemplateitem_id_seq
 
15062
    START WITH 1
5202
15063
    INCREMENT BY 1
5203
15064
    NO MAXVALUE
5204
15065
    NO MINVALUE
5205
15066
    CACHE 1;
5206
15067
 
 
15068
 
5207
15069
ALTER SEQUENCE translationtemplateitem_id_seq OWNED BY translationtemplateitem.id;
5208
15070
 
 
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
 
5209
15099
CREATE TABLE translator (
5210
15100
    id integer NOT NULL,
5211
15101
    translationgroup integer NOT NULL,
5215
15105
    style_guide_url text
5216
15106
);
5217
15107
 
 
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
 
5218
15124
CREATE SEQUENCE translator_id_seq
 
15125
    START WITH 1
5219
15126
    INCREMENT BY 1
5220
15127
    NO MAXVALUE
5221
15128
    NO MINVALUE
5222
15129
    CACHE 1;
5223
15130
 
 
15131
 
5224
15132
ALTER SEQUENCE translator_id_seq OWNED BY translator.id;
5225
15133
 
 
15134
 
5226
15135
CREATE TABLE usertouseremail (
5227
15136
    id integer NOT NULL,
5228
15137
    sender integer NOT NULL,
5232
15141
    message_id text NOT NULL
5233
15142
);
5234
15143
 
 
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
 
5235
15163
CREATE SEQUENCE usertouseremail_id_seq
 
15164
    START WITH 1
5236
15165
    INCREMENT BY 1
5237
15166
    NO MAXVALUE
5238
15167
    NO MINVALUE
5239
15168
    CACHE 1;
5240
15169
 
 
15170
 
5241
15171
ALTER SEQUENCE usertouseremail_id_seq OWNED BY usertouseremail.id;
5242
15172
 
 
15173
 
5243
15174
CREATE VIEW validpersoncache AS
5244
15175
    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));
5245
15176
 
 
15177
 
 
15178
COMMENT ON VIEW validpersoncache IS 'A materialized view listing the Person.ids of all valid people (but not teams).';
 
15179
 
 
15180
 
5246
15181
CREATE VIEW validpersonorteamcache AS
5247
15182
    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)));
5248
15183
 
 
15184
 
5249
15185
CREATE TABLE vote (
5250
15186
    id integer NOT NULL,
5251
15187
    person integer,
5255
15191
    token text NOT NULL
5256
15192
);
5257
15193
 
 
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
 
5258
15213
CREATE SEQUENCE vote_id_seq
 
15214
    START WITH 1
5259
15215
    INCREMENT BY 1
5260
15216
    NO MAXVALUE
5261
15217
    NO MINVALUE
5262
15218
    CACHE 1;
5263
15219
 
 
15220
 
5264
15221
ALTER SEQUENCE vote_id_seq OWNED BY vote.id;
5265
15222
 
 
15223
 
5266
15224
CREATE TABLE votecast (
5267
15225
    id integer NOT NULL,
5268
15226
    person integer NOT NULL,
5269
15227
    poll integer NOT NULL
5270
15228
);
5271
15229
 
 
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
 
5272
15240
CREATE SEQUENCE votecast_id_seq
 
15241
    START WITH 1
5273
15242
    INCREMENT BY 1
5274
15243
    NO MAXVALUE
5275
15244
    NO MINVALUE
5276
15245
    CACHE 1;
5277
15246
 
 
15247
 
5278
15248
ALTER SEQUENCE votecast_id_seq OWNED BY votecast.id;
5279
15249
 
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;
5299
15250
 
5300
15251
CREATE TABLE wikiname (
5301
15252
    id integer NOT NULL,
5304
15255
    wikiname text NOT NULL
5305
15256
);
5306
15257
 
 
15258
 
5307
15259
CREATE SEQUENCE wikiname_id_seq
 
15260
    START WITH 1
5308
15261
    INCREMENT BY 1
5309
15262
    NO MAXVALUE
5310
15263
    NO MINVALUE
5311
15264
    CACHE 1;
5312
15265
 
 
15266
 
5313
15267
ALTER SEQUENCE wikiname_id_seq OWNED BY wikiname.id;
5314
15268
 
 
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
 
5315
15279
ALTER TABLE account ALTER COLUMN id SET DEFAULT nextval('account_id_seq'::regclass);
5316
15280
 
 
15281
 
5317
15282
ALTER TABLE accountpassword ALTER COLUMN id SET DEFAULT nextval('accountpassword_id_seq'::regclass);
5318
15283
 
 
15284
 
5319
15285
ALTER TABLE announcement ALTER COLUMN id SET DEFAULT nextval('announcement_id_seq'::regclass);
5320
15286
 
 
15287
 
5321
15288
ALTER TABLE answercontact ALTER COLUMN id SET DEFAULT nextval('answercontact_id_seq'::regclass);
5322
15289
 
 
15290
 
5323
15291
ALTER TABLE apportjob ALTER COLUMN id SET DEFAULT nextval('apportjob_id_seq'::regclass);
5324
15292
 
 
15293
 
5325
15294
ALTER TABLE archive ALTER COLUMN id SET DEFAULT nextval('archive_id_seq'::regclass);
5326
15295
 
 
15296
 
5327
15297
ALTER TABLE archivearch ALTER COLUMN id SET DEFAULT nextval('archivearch_id_seq'::regclass);
5328
15298
 
 
15299
 
5329
15300
ALTER TABLE archiveauthtoken ALTER COLUMN id SET DEFAULT nextval('archiveauthtoken_id_seq'::regclass);
5330
15301
 
 
15302
 
5331
15303
ALTER TABLE archivedependency ALTER COLUMN id SET DEFAULT nextval('archivedependency_id_seq'::regclass);
5332
15304
 
 
15305
 
5333
15306
ALTER TABLE archivejob ALTER COLUMN id SET DEFAULT nextval('archivejob_id_seq'::regclass);
5334
15307
 
 
15308
 
5335
15309
ALTER TABLE archivepermission ALTER COLUMN id SET DEFAULT nextval('archivepermission_id_seq'::regclass);
5336
15310
 
 
15311
 
5337
15312
ALTER TABLE archivesubscriber ALTER COLUMN id SET DEFAULT nextval('archivesubscriber_id_seq'::regclass);
5338
15313
 
5339
 
ALTER TABLE authtoken ALTER COLUMN id SET DEFAULT nextval('authtoken_id_seq'::regclass);
5340
15314
 
5341
15315
ALTER TABLE binarypackagebuild ALTER COLUMN id SET DEFAULT nextval('binarypackagebuild_id_seq'::regclass);
5342
15316
 
 
15317
 
5343
15318
ALTER TABLE binarypackagename ALTER COLUMN id SET DEFAULT nextval('binarypackagename_id_seq'::regclass);
5344
15319
 
 
15320
 
 
15321
ALTER TABLE binarypackagepath ALTER COLUMN id SET DEFAULT nextval('binarypackagepath_id_seq'::regclass);
 
15322
 
 
15323
 
5345
15324
ALTER TABLE binarypackagepublishinghistory ALTER COLUMN id SET DEFAULT nextval('binarypackagepublishinghistory_id_seq'::regclass);
5346
15325
 
 
15326
 
5347
15327
ALTER TABLE binarypackagerelease ALTER COLUMN id SET DEFAULT nextval('binarypackagerelease_id_seq'::regclass);
5348
15328
 
 
15329
 
5349
15330
ALTER TABLE binarypackagereleasedownloadcount ALTER COLUMN id SET DEFAULT nextval('binarypackagereleasedownloadcount_id_seq'::regclass);
5350
15331
 
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);
5356
15332
 
5357
15333
ALTER TABLE branch ALTER COLUMN id SET DEFAULT nextval('branch_id_seq'::regclass);
5358
15334
 
 
15335
 
5359
15336
ALTER TABLE branchjob ALTER COLUMN id SET DEFAULT nextval('branchjob_id_seq'::regclass);
5360
15337
 
 
15338
 
5361
15339
ALTER TABLE branchmergeproposal ALTER COLUMN id SET DEFAULT nextval('branchmergeproposal_id_seq'::regclass);
5362
15340
 
 
15341
 
5363
15342
ALTER TABLE branchmergeproposaljob ALTER COLUMN id SET DEFAULT nextval('branchmergeproposaljob_id_seq'::regclass);
5364
15343
 
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);
 
15344
 
 
15345
ALTER TABLE branchmergequeue ALTER COLUMN id SET DEFAULT nextval('branchmergequeue_id_seq'::regclass);
 
15346
 
5368
15347
 
5369
15348
ALTER TABLE branchsubscription ALTER COLUMN id SET DEFAULT nextval('branchsubscription_id_seq'::regclass);
5370
15349
 
 
15350
 
5371
15351
ALTER TABLE branchvisibilitypolicy ALTER COLUMN id SET DEFAULT nextval('branchvisibilitypolicy_id_seq'::regclass);
5372
15352
 
 
15353
 
5373
15354
ALTER TABLE bug ALTER COLUMN id SET DEFAULT nextval('bug_id_seq'::regclass);
5374
15355
 
 
15356
 
5375
15357
ALTER TABLE bugactivity ALTER COLUMN id SET DEFAULT nextval('bugactivity_id_seq'::regclass);
5376
15358
 
 
15359
 
5377
15360
ALTER TABLE bugaffectsperson ALTER COLUMN id SET DEFAULT nextval('bugaffectsperson_id_seq'::regclass);
5378
15361
 
 
15362
 
5379
15363
ALTER TABLE bugattachment ALTER COLUMN id SET DEFAULT nextval('bugattachment_id_seq'::regclass);
5380
15364
 
 
15365
 
5381
15366
ALTER TABLE bugbranch ALTER COLUMN id SET DEFAULT nextval('bugbranch_id_seq'::regclass);
5382
15367
 
 
15368
 
5383
15369
ALTER TABLE bugcve ALTER COLUMN id SET DEFAULT nextval('bugcve_id_seq'::regclass);
5384
15370
 
 
15371
 
5385
15372
ALTER TABLE bugjob ALTER COLUMN id SET DEFAULT nextval('bugjob_id_seq'::regclass);
5386
15373
 
 
15374
 
5387
15375
ALTER TABLE bugmessage ALTER COLUMN id SET DEFAULT nextval('bugmessage_id_seq'::regclass);
5388
15376
 
 
15377
 
5389
15378
ALTER TABLE bugnomination ALTER COLUMN id SET DEFAULT nextval('bugnomination_id_seq'::regclass);
5390
15379
 
 
15380
 
5391
15381
ALTER TABLE bugnotification ALTER COLUMN id SET DEFAULT nextval('bugnotification_id_seq'::regclass);
5392
15382
 
 
15383
 
5393
15384
ALTER TABLE bugnotificationattachment ALTER COLUMN id SET DEFAULT nextval('bugnotificationattachment_id_seq'::regclass);
5394
15385
 
 
15386
 
5395
15387
ALTER TABLE bugnotificationrecipient ALTER COLUMN id SET DEFAULT nextval('bugnotificationrecipient_id_seq'::regclass);
5396
15388
 
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);
5400
15389
 
5401
15390
ALTER TABLE bugsubscription ALTER COLUMN id SET DEFAULT nextval('bugsubscription_id_seq'::regclass);
5402
15391
 
 
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
 
5403
15411
ALTER TABLE bugtag ALTER COLUMN id SET DEFAULT nextval('bugtag_id_seq'::regclass);
5404
15412
 
 
15413
 
5405
15414
ALTER TABLE bugtask ALTER COLUMN id SET DEFAULT nextval('bugtask_id_seq'::regclass);
5406
15415
 
 
15416
 
5407
15417
ALTER TABLE bugtracker ALTER COLUMN id SET DEFAULT nextval('bugtracker_id_seq'::regclass);
5408
15418
 
 
15419
 
5409
15420
ALTER TABLE bugtrackeralias ALTER COLUMN id SET DEFAULT nextval('bugtrackeralias_id_seq'::regclass);
5410
15421
 
 
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
 
5411
15429
ALTER TABLE bugtrackerperson ALTER COLUMN id SET DEFAULT nextval('bugtrackerperson_id_seq'::regclass);
5412
15430
 
 
15431
 
5413
15432
ALTER TABLE bugwatch ALTER COLUMN id SET DEFAULT nextval('bugwatch_id_seq'::regclass);
5414
15433
 
 
15434
 
5415
15435
ALTER TABLE bugwatchactivity ALTER COLUMN id SET DEFAULT nextval('bugwatchactivity_id_seq'::regclass);
5416
15436
 
 
15437
 
5417
15438
ALTER TABLE builder ALTER COLUMN id SET DEFAULT nextval('builder_id_seq'::regclass);
5418
15439
 
 
15440
 
5419
15441
ALTER TABLE buildfarmjob ALTER COLUMN id SET DEFAULT nextval('buildfarmjob_id_seq'::regclass);
5420
15442
 
 
15443
 
5421
15444
ALTER TABLE buildpackagejob ALTER COLUMN id SET DEFAULT nextval('buildpackagejob_id_seq'::regclass);
5422
15445
 
 
15446
 
5423
15447
ALTER TABLE buildqueue ALTER COLUMN id SET DEFAULT nextval('buildqueue_id_seq'::regclass);
5424
15448
 
 
15449
 
5425
15450
ALTER TABLE codeimport ALTER COLUMN id SET DEFAULT nextval('codeimport_id_seq'::regclass);
5426
15451
 
 
15452
 
5427
15453
ALTER TABLE codeimportevent ALTER COLUMN id SET DEFAULT nextval('codeimportevent_id_seq'::regclass);
5428
15454
 
 
15455
 
5429
15456
ALTER TABLE codeimporteventdata ALTER COLUMN id SET DEFAULT nextval('codeimporteventdata_id_seq'::regclass);
5430
15457
 
 
15458
 
5431
15459
ALTER TABLE codeimportjob ALTER COLUMN id SET DEFAULT nextval('codeimportjob_id_seq'::regclass);
5432
15460
 
 
15461
 
5433
15462
ALTER TABLE codeimportmachine ALTER COLUMN id SET DEFAULT nextval('codeimportmachine_id_seq'::regclass);
5434
15463
 
 
15464
 
5435
15465
ALTER TABLE codeimportresult ALTER COLUMN id SET DEFAULT nextval('codeimportresult_id_seq'::regclass);
5436
15466
 
 
15467
 
5437
15468
ALTER TABLE codereviewmessage ALTER COLUMN id SET DEFAULT nextval('codereviewmessage_id_seq'::regclass);
5438
15469
 
 
15470
 
5439
15471
ALTER TABLE codereviewvote ALTER COLUMN id SET DEFAULT nextval('codereviewvote_id_seq'::regclass);
5440
15472
 
 
15473
 
5441
15474
ALTER TABLE commercialsubscription ALTER COLUMN id SET DEFAULT nextval('commercialsubscription_id_seq'::regclass);
5442
15475
 
 
15476
 
5443
15477
ALTER TABLE component ALTER COLUMN id SET DEFAULT nextval('component_id_seq'::regclass);
5444
15478
 
 
15479
 
5445
15480
ALTER TABLE componentselection ALTER COLUMN id SET DEFAULT nextval('componentselection_id_seq'::regclass);
5446
15481
 
 
15482
 
5447
15483
ALTER TABLE continent ALTER COLUMN id SET DEFAULT nextval('continent_id_seq'::regclass);
5448
15484
 
 
15485
 
5449
15486
ALTER TABLE country ALTER COLUMN id SET DEFAULT nextval('country_id_seq'::regclass);
5450
15487
 
 
15488
 
5451
15489
ALTER TABLE customlanguagecode ALTER COLUMN id SET DEFAULT nextval('customlanguagecode_id_seq'::regclass);
5452
15490
 
 
15491
 
5453
15492
ALTER TABLE cve ALTER COLUMN id SET DEFAULT nextval('cve_id_seq'::regclass);
5454
15493
 
 
15494
 
5455
15495
ALTER TABLE cvereference ALTER COLUMN id SET DEFAULT nextval('cvereference_id_seq'::regclass);
5456
15496
 
 
15497
 
5457
15498
ALTER TABLE diff ALTER COLUMN id SET DEFAULT nextval('diff_id_seq'::regclass);
5458
15499
 
 
15500
 
5459
15501
ALTER TABLE distribution ALTER COLUMN id SET DEFAULT nextval('distribution_id_seq'::regclass);
5460
15502
 
5461
 
ALTER TABLE distributionbounty ALTER COLUMN id SET DEFAULT nextval('distributionbounty_id_seq'::regclass);
 
15503
 
 
15504
ALTER TABLE distributionjob ALTER COLUMN id SET DEFAULT nextval('distributionjob_id_seq'::regclass);
 
15505
 
5462
15506
 
5463
15507
ALTER TABLE distributionmirror ALTER COLUMN id SET DEFAULT nextval('distributionmirror_id_seq'::regclass);
5464
15508
 
 
15509
 
5465
15510
ALTER TABLE distributionsourcepackage ALTER COLUMN id SET DEFAULT nextval('distributionsourcepackage_id_seq'::regclass);
5466
15511
 
 
15512
 
5467
15513
ALTER TABLE distributionsourcepackagecache ALTER COLUMN id SET DEFAULT nextval('distributionsourcepackagecache_id_seq'::regclass);
5468
15514
 
 
15515
 
5469
15516
ALTER TABLE distroarchseries ALTER COLUMN id SET DEFAULT nextval('distroarchseries_id_seq'::regclass);
5470
15517
 
5471
 
ALTER TABLE distrocomponentuploader ALTER COLUMN id SET DEFAULT nextval('distrocomponentuploader_id_seq'::regclass);
5472
15518
 
5473
15519
ALTER TABLE distroseries ALTER COLUMN id SET DEFAULT nextval('distroseries_id_seq'::regclass);
5474
15520
 
 
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
 
5475
15528
ALTER TABLE distroserieslanguage ALTER COLUMN id SET DEFAULT nextval('distroserieslanguage_id_seq'::regclass);
5476
15529
 
 
15530
 
5477
15531
ALTER TABLE distroseriespackagecache ALTER COLUMN id SET DEFAULT nextval('distroseriespackagecache_id_seq'::regclass);
5478
15532
 
 
15533
 
 
15534
ALTER TABLE distroseriesparent ALTER COLUMN id SET DEFAULT nextval('distroseriesparent_id_seq'::regclass);
 
15535
 
 
15536
 
5479
15537
ALTER TABLE emailaddress ALTER COLUMN id SET DEFAULT nextval('emailaddress_id_seq'::regclass);
5480
15538
 
 
15539
 
5481
15540
ALTER TABLE entitlement ALTER COLUMN id SET DEFAULT nextval('entitlement_id_seq'::regclass);
5482
15541
 
 
15542
 
5483
15543
ALTER TABLE faq ALTER COLUMN id SET DEFAULT nextval('faq_id_seq'::regclass);
5484
15544
 
 
15545
 
5485
15546
ALTER TABLE featuredproject ALTER COLUMN id SET DEFAULT nextval('featuredproject_id_seq'::regclass);
5486
15547
 
 
15548
 
 
15549
ALTER TABLE featureflagchangelogentry ALTER COLUMN id SET DEFAULT nextval('featureflagchangelogentry_id_seq'::regclass);
 
15550
 
 
15551
 
5487
15552
ALTER TABLE flatpackagesetinclusion ALTER COLUMN id SET DEFAULT nextval('flatpackagesetinclusion_id_seq'::regclass);
5488
15553
 
 
15554
 
5489
15555
ALTER TABLE fticache ALTER COLUMN id SET DEFAULT nextval('fticache_id_seq'::regclass);
5490
15556
 
 
15557
 
5491
15558
ALTER TABLE gpgkey ALTER COLUMN id SET DEFAULT nextval('gpgkey_id_seq'::regclass);
5492
15559
 
 
15560
 
5493
15561
ALTER TABLE hwdevice ALTER COLUMN id SET DEFAULT nextval('hwdevice_id_seq'::regclass);
5494
15562
 
 
15563
 
5495
15564
ALTER TABLE hwdeviceclass ALTER COLUMN id SET DEFAULT nextval('hwdeviceclass_id_seq'::regclass);
5496
15565
 
 
15566
 
5497
15567
ALTER TABLE hwdevicedriverlink ALTER COLUMN id SET DEFAULT nextval('hwdevicedriverlink_id_seq'::regclass);
5498
15568
 
 
15569
 
5499
15570
ALTER TABLE hwdevicenamevariant ALTER COLUMN id SET DEFAULT nextval('hwdevicenamevariant_id_seq'::regclass);
5500
15571
 
 
15572
 
5501
15573
ALTER TABLE hwdmihandle ALTER COLUMN id SET DEFAULT nextval('hwdmihandle_id_seq'::regclass);
5502
15574
 
 
15575
 
5503
15576
ALTER TABLE hwdmivalue ALTER COLUMN id SET DEFAULT nextval('hwdmivalue_id_seq'::regclass);
5504
15577
 
 
15578
 
5505
15579
ALTER TABLE hwdriver ALTER COLUMN id SET DEFAULT nextval('hwdriver_id_seq'::regclass);
5506
15580
 
 
15581
 
5507
15582
ALTER TABLE hwsubmission ALTER COLUMN id SET DEFAULT nextval('hwsubmission_id_seq'::regclass);
5508
15583
 
 
15584
 
5509
15585
ALTER TABLE hwsubmissionbug ALTER COLUMN id SET DEFAULT nextval('hwsubmissionbug_id_seq'::regclass);
5510
15586
 
 
15587
 
5511
15588
ALTER TABLE hwsubmissiondevice ALTER COLUMN id SET DEFAULT nextval('hwsubmissiondevice_id_seq'::regclass);
5512
15589
 
 
15590
 
5513
15591
ALTER TABLE hwsystemfingerprint ALTER COLUMN id SET DEFAULT nextval('hwsystemfingerprint_id_seq'::regclass);
5514
15592
 
 
15593
 
5515
15594
ALTER TABLE hwtest ALTER COLUMN id SET DEFAULT nextval('hwtest_id_seq'::regclass);
5516
15595
 
 
15596
 
5517
15597
ALTER TABLE hwtestanswer ALTER COLUMN id SET DEFAULT nextval('hwtestanswer_id_seq'::regclass);
5518
15598
 
 
15599
 
5519
15600
ALTER TABLE hwtestanswerchoice ALTER COLUMN id SET DEFAULT nextval('hwtestanswerchoice_id_seq'::regclass);
5520
15601
 
 
15602
 
5521
15603
ALTER TABLE hwtestanswercount ALTER COLUMN id SET DEFAULT nextval('hwtestanswercount_id_seq'::regclass);
5522
15604
 
 
15605
 
5523
15606
ALTER TABLE hwtestanswercountdevice ALTER COLUMN id SET DEFAULT nextval('hwtestanswercountdevice_id_seq'::regclass);
5524
15607
 
 
15608
 
5525
15609
ALTER TABLE hwtestanswerdevice ALTER COLUMN id SET DEFAULT nextval('hwtestanswerdevice_id_seq'::regclass);
5526
15610
 
 
15611
 
5527
15612
ALTER TABLE hwvendorid ALTER COLUMN id SET DEFAULT nextval('hwvendorid_id_seq'::regclass);
5528
15613
 
 
15614
 
5529
15615
ALTER TABLE hwvendorname ALTER COLUMN id SET DEFAULT nextval('hwvendorname_id_seq'::regclass);
5530
15616
 
 
15617
 
 
15618
ALTER TABLE incrementaldiff ALTER COLUMN id SET DEFAULT nextval('incrementaldiff_id_seq'::regclass);
 
15619
 
 
15620
 
5531
15621
ALTER TABLE ircid ALTER COLUMN id SET DEFAULT nextval('ircid_id_seq'::regclass);
5532
15622
 
 
15623
 
5533
15624
ALTER TABLE jabberid ALTER COLUMN id SET DEFAULT nextval('jabberid_id_seq'::regclass);
5534
15625
 
 
15626
 
5535
15627
ALTER TABLE job ALTER COLUMN id SET DEFAULT nextval('job_id_seq'::regclass);
5536
15628
 
 
15629
 
5537
15630
ALTER TABLE karma ALTER COLUMN id SET DEFAULT nextval('karma_id_seq'::regclass);
5538
15631
 
 
15632
 
5539
15633
ALTER TABLE karmaaction ALTER COLUMN id SET DEFAULT nextval('karmaaction_id_seq'::regclass);
5540
15634
 
 
15635
 
5541
15636
ALTER TABLE karmacache ALTER COLUMN id SET DEFAULT nextval('karmacache_id_seq'::regclass);
5542
15637
 
 
15638
 
5543
15639
ALTER TABLE karmacategory ALTER COLUMN id SET DEFAULT nextval('karmacategory_id_seq'::regclass);
5544
15640
 
 
15641
 
5545
15642
ALTER TABLE karmatotalcache ALTER COLUMN id SET DEFAULT nextval('karmatotalcache_id_seq'::regclass);
5546
15643
 
 
15644
 
5547
15645
ALTER TABLE language ALTER COLUMN id SET DEFAULT nextval('language_id_seq'::regclass);
5548
15646
 
 
15647
 
5549
15648
ALTER TABLE languagepack ALTER COLUMN id SET DEFAULT nextval('languagepack_id_seq'::regclass);
5550
15649
 
 
15650
 
 
15651
ALTER TABLE launchpaddatabaseupdatelog ALTER COLUMN id SET DEFAULT nextval('launchpaddatabaseupdatelog_id_seq'::regclass);
 
15652
 
 
15653
 
5551
15654
ALTER TABLE launchpadstatistic ALTER COLUMN id SET DEFAULT nextval('launchpadstatistic_id_seq'::regclass);
5552
15655
 
 
15656
 
5553
15657
ALTER TABLE libraryfilealias ALTER COLUMN id SET DEFAULT nextval('libraryfilealias_id_seq'::regclass);
5554
15658
 
 
15659
 
5555
15660
ALTER TABLE libraryfilecontent ALTER COLUMN id SET DEFAULT nextval('libraryfilecontent_id_seq'::regclass);
5556
15661
 
 
15662
 
5557
15663
ALTER TABLE libraryfiledownloadcount ALTER COLUMN id SET DEFAULT nextval('libraryfiledownloadcount_id_seq'::regclass);
5558
15664
 
 
15665
 
5559
15666
ALTER TABLE logintoken ALTER COLUMN id SET DEFAULT nextval('logintoken_id_seq'::regclass);
5560
15667
 
 
15668
 
5561
15669
ALTER TABLE mailinglist ALTER COLUMN id SET DEFAULT nextval('mailinglist_id_seq'::regclass);
5562
15670
 
5563
 
ALTER TABLE mailinglistban ALTER COLUMN id SET DEFAULT nextval('mailinglistban_id_seq'::regclass);
5564
15671
 
5565
15672
ALTER TABLE mailinglistsubscription ALTER COLUMN id SET DEFAULT nextval('mailinglistsubscription_id_seq'::regclass);
5566
15673
 
5567
 
ALTER TABLE mentoringoffer ALTER COLUMN id SET DEFAULT nextval('mentoringoffer_id_seq'::regclass);
5568
15674
 
5569
15675
ALTER TABLE mergedirectivejob ALTER COLUMN id SET DEFAULT nextval('mergedirectivejob_id_seq'::regclass);
5570
15676
 
 
15677
 
5571
15678
ALTER TABLE message ALTER COLUMN id SET DEFAULT nextval('message_id_seq'::regclass);
5572
15679
 
 
15680
 
5573
15681
ALTER TABLE messageapproval ALTER COLUMN id SET DEFAULT nextval('messageapproval_id_seq'::regclass);
5574
15682
 
 
15683
 
5575
15684
ALTER TABLE messagechunk ALTER COLUMN id SET DEFAULT nextval('messagechunk_id_seq'::regclass);
5576
15685
 
 
15686
 
5577
15687
ALTER TABLE milestone ALTER COLUMN id SET DEFAULT nextval('milestone_id_seq'::regclass);
5578
15688
 
 
15689
 
5579
15690
ALTER TABLE mirror ALTER COLUMN id SET DEFAULT nextval('mirror_id_seq'::regclass);
5580
15691
 
 
15692
 
5581
15693
ALTER TABLE mirrorcdimagedistroseries ALTER COLUMN id SET DEFAULT nextval('mirrorcdimagedistroseries_id_seq'::regclass);
5582
15694
 
 
15695
 
5583
15696
ALTER TABLE mirrorcontent ALTER COLUMN id SET DEFAULT nextval('mirrorcontent_id_seq'::regclass);
5584
15697
 
 
15698
 
5585
15699
ALTER TABLE mirrordistroarchseries ALTER COLUMN id SET DEFAULT nextval('mirrordistroarchseries_id_seq'::regclass);
5586
15700
 
 
15701
 
5587
15702
ALTER TABLE mirrordistroseriessource ALTER COLUMN id SET DEFAULT nextval('mirrordistroseriessource_id_seq'::regclass);
5588
15703
 
 
15704
 
5589
15705
ALTER TABLE mirrorproberecord ALTER COLUMN id SET DEFAULT nextval('mirrorproberecord_id_seq'::regclass);
5590
15706
 
 
15707
 
5591
15708
ALTER TABLE mirrorsourcecontent ALTER COLUMN id SET DEFAULT nextval('mirrorsourcecontent_id_seq'::regclass);
5592
15709
 
 
15710
 
5593
15711
ALTER TABLE nameblacklist ALTER COLUMN id SET DEFAULT nextval('nameblacklist_id_seq'::regclass);
5594
15712
 
 
15713
 
5595
15714
ALTER TABLE oauthaccesstoken ALTER COLUMN id SET DEFAULT nextval('oauthaccesstoken_id_seq'::regclass);
5596
15715
 
 
15716
 
5597
15717
ALTER TABLE oauthconsumer ALTER COLUMN id SET DEFAULT nextval('oauthconsumer_id_seq'::regclass);
5598
15718
 
5599
 
ALTER TABLE oauthnonce ALTER COLUMN id SET DEFAULT nextval('oauthnonce_id_seq'::regclass);
5600
15719
 
5601
15720
ALTER TABLE oauthrequesttoken ALTER COLUMN id SET DEFAULT nextval('oauthrequesttoken_id_seq'::regclass);
5602
15721
 
 
15722
 
5603
15723
ALTER TABLE officialbugtag ALTER COLUMN id SET DEFAULT nextval('officialbugtag_id_seq'::regclass);
5604
15724
 
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);
5610
15725
 
5611
15726
ALTER TABLE packagebuild ALTER COLUMN id SET DEFAULT nextval('packagebuild_id_seq'::regclass);
5612
15727
 
 
15728
 
 
15729
ALTER TABLE packagecopyjob ALTER COLUMN id SET DEFAULT nextval('packagecopyjob_id_seq'::regclass);
 
15730
 
 
15731
 
5613
15732
ALTER TABLE packagecopyrequest ALTER COLUMN id SET DEFAULT nextval('packagecopyrequest_id_seq'::regclass);
5614
15733
 
 
15734
 
5615
15735
ALTER TABLE packagediff ALTER COLUMN id SET DEFAULT nextval('packagediff_id_seq'::regclass);
5616
15736
 
5617
 
ALTER TABLE packageselection ALTER COLUMN id SET DEFAULT nextval('packageselection_id_seq'::regclass);
5618
15737
 
5619
15738
ALTER TABLE packageset ALTER COLUMN id SET DEFAULT nextval('packageset_id_seq'::regclass);
5620
15739
 
 
15740
 
5621
15741
ALTER TABLE packagesetgroup ALTER COLUMN id SET DEFAULT nextval('packagesetgroup_id_seq'::regclass);
5622
15742
 
 
15743
 
5623
15744
ALTER TABLE packagesetinclusion ALTER COLUMN id SET DEFAULT nextval('packagesetinclusion_id_seq'::regclass);
5624
15745
 
 
15746
 
5625
15747
ALTER TABLE packagesetsources ALTER COLUMN id SET DEFAULT nextval('packagesetsources_id_seq'::regclass);
5626
15748
 
 
15749
 
5627
15750
ALTER TABLE packageupload ALTER COLUMN id SET DEFAULT nextval('packageupload_id_seq'::regclass);
5628
15751
 
 
15752
 
5629
15753
ALTER TABLE packageuploadbuild ALTER COLUMN id SET DEFAULT nextval('packageuploadbuild_id_seq'::regclass);
5630
15754
 
 
15755
 
5631
15756
ALTER TABLE packageuploadcustom ALTER COLUMN id SET DEFAULT nextval('packageuploadcustom_id_seq'::regclass);
5632
15757
 
 
15758
 
5633
15759
ALTER TABLE packageuploadsource ALTER COLUMN id SET DEFAULT nextval('packageuploadsource_id_seq'::regclass);
5634
15760
 
 
15761
 
 
15762
ALTER TABLE packagingjob ALTER COLUMN id SET DEFAULT nextval('packagingjob_id_seq'::regclass);
 
15763
 
 
15764
 
5635
15765
ALTER TABLE parsedapachelog ALTER COLUMN id SET DEFAULT nextval('parsedapachelog_id_seq'::regclass);
5636
15766
 
 
15767
 
5637
15768
ALTER TABLE person ALTER COLUMN id SET DEFAULT nextval('person_id_seq'::regclass);
5638
15769
 
 
15770
 
5639
15771
ALTER TABLE personlanguage ALTER COLUMN id SET DEFAULT nextval('personlanguage_id_seq'::regclass);
5640
15772
 
 
15773
 
5641
15774
ALTER TABLE personlocation ALTER COLUMN id SET DEFAULT nextval('personlocation_id_seq'::regclass);
5642
15775
 
 
15776
 
5643
15777
ALTER TABLE personnotification ALTER COLUMN id SET DEFAULT nextval('personnotification_id_seq'::regclass);
5644
15778
 
 
15779
 
 
15780
ALTER TABLE persontransferjob ALTER COLUMN id SET DEFAULT nextval('persontransferjob_id_seq'::regclass);
 
15781
 
 
15782
 
5645
15783
ALTER TABLE pillarname ALTER COLUMN id SET DEFAULT nextval('pillarname_id_seq'::regclass);
5646
15784
 
 
15785
 
5647
15786
ALTER TABLE pocketchroot ALTER COLUMN id SET DEFAULT nextval('pocketchroot_id_seq'::regclass);
5648
15787
 
5649
 
ALTER TABLE pocomment ALTER COLUMN id SET DEFAULT nextval('pocomment_id_seq'::regclass);
5650
15788
 
5651
15789
ALTER TABLE poexportrequest ALTER COLUMN id SET DEFAULT nextval('poexportrequest_id_seq'::regclass);
5652
15790
 
 
15791
 
5653
15792
ALTER TABLE pofile ALTER COLUMN id SET DEFAULT nextval('pofile_id_seq'::regclass);
5654
15793
 
 
15794
 
5655
15795
ALTER TABLE pofiletranslator ALTER COLUMN id SET DEFAULT nextval('pofiletranslator_id_seq'::regclass);
5656
15796
 
 
15797
 
5657
15798
ALTER TABLE poll ALTER COLUMN id SET DEFAULT nextval('poll_id_seq'::regclass);
5658
15799
 
 
15800
 
5659
15801
ALTER TABLE polloption ALTER COLUMN id SET DEFAULT nextval('polloption_id_seq'::regclass);
5660
15802
 
 
15803
 
5661
15804
ALTER TABLE pomsgid ALTER COLUMN id SET DEFAULT nextval('pomsgid_id_seq'::regclass);
5662
15805
 
5663
 
ALTER TABLE posubscription ALTER COLUMN id SET DEFAULT nextval('posubscription_id_seq'::regclass);
5664
15806
 
5665
15807
ALTER TABLE potemplate ALTER COLUMN id SET DEFAULT nextval('potemplate_id_seq'::regclass);
5666
15808
 
 
15809
 
5667
15810
ALTER TABLE potmsgset ALTER COLUMN id SET DEFAULT nextval('potmsgset_id_seq'::regclass);
5668
15811
 
 
15812
 
5669
15813
ALTER TABLE potranslation ALTER COLUMN id SET DEFAULT nextval('potranslation_id_seq'::regclass);
5670
15814
 
 
15815
 
5671
15816
ALTER TABLE previewdiff ALTER COLUMN id SET DEFAULT nextval('previewdiff_id_seq'::regclass);
5672
15817
 
 
15818
 
5673
15819
ALTER TABLE processor ALTER COLUMN id SET DEFAULT nextval('processor_id_seq'::regclass);
5674
15820
 
 
15821
 
5675
15822
ALTER TABLE processorfamily ALTER COLUMN id SET DEFAULT nextval('processorfamily_id_seq'::regclass);
5676
15823
 
 
15824
 
5677
15825
ALTER TABLE product ALTER COLUMN id SET DEFAULT nextval('product_id_seq'::regclass);
5678
15826
 
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);
5682
15827
 
5683
15828
ALTER TABLE productlicense ALTER COLUMN id SET DEFAULT nextval('productlicense_id_seq'::regclass);
5684
15829
 
 
15830
 
5685
15831
ALTER TABLE productrelease ALTER COLUMN id SET DEFAULT nextval('productrelease_id_seq'::regclass);
5686
15832
 
 
15833
 
5687
15834
ALTER TABLE productseries ALTER COLUMN id SET DEFAULT nextval('productseries_id_seq'::regclass);
5688
15835
 
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);
5692
15836
 
5693
15837
ALTER TABLE project ALTER COLUMN id SET DEFAULT nextval('project_id_seq'::regclass);
5694
15838
 
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);
 
15839
 
 
15840
ALTER TABLE publisherconfig ALTER COLUMN id SET DEFAULT nextval('publisherconfig_id_seq'::regclass);
 
15841
 
5700
15842
 
5701
15843
ALTER TABLE question ALTER COLUMN id SET DEFAULT nextval('question_id_seq'::regclass);
5702
15844
 
 
15845
 
5703
15846
ALTER TABLE questionbug ALTER COLUMN id SET DEFAULT nextval('questionbug_id_seq'::regclass);
5704
15847
 
 
15848
 
 
15849
ALTER TABLE questionjob ALTER COLUMN id SET DEFAULT nextval('questionjob_id_seq'::regclass);
 
15850
 
 
15851
 
5705
15852
ALTER TABLE questionmessage ALTER COLUMN id SET DEFAULT nextval('questionmessage_id_seq'::regclass);
5706
15853
 
 
15854
 
5707
15855
ALTER TABLE questionreopening ALTER COLUMN id SET DEFAULT nextval('questionreopening_id_seq'::regclass);
5708
15856
 
 
15857
 
5709
15858
ALTER TABLE questionsubscription ALTER COLUMN id SET DEFAULT nextval('questionsubscription_id_seq'::regclass);
5710
15859
 
5711
 
ALTER TABLE requestedcds ALTER COLUMN id SET DEFAULT nextval('requestedcds_id_seq'::regclass);
5712
15860
 
5713
15861
ALTER TABLE revision ALTER COLUMN id SET DEFAULT nextval('revision_id_seq'::regclass);
5714
15862
 
 
15863
 
5715
15864
ALTER TABLE revisionauthor ALTER COLUMN id SET DEFAULT nextval('revisionauthor_id_seq'::regclass);
5716
15865
 
 
15866
 
5717
15867
ALTER TABLE revisioncache ALTER COLUMN id SET DEFAULT nextval('revisioncache_id_seq'::regclass);
5718
15868
 
 
15869
 
5719
15870
ALTER TABLE revisionparent ALTER COLUMN id SET DEFAULT nextval('revisionparent_id_seq'::regclass);
5720
15871
 
 
15872
 
5721
15873
ALTER TABLE revisionproperty ALTER COLUMN id SET DEFAULT nextval('revisionproperty_id_seq'::regclass);
5722
15874
 
 
15875
 
5723
15876
ALTER TABLE scriptactivity ALTER COLUMN id SET DEFAULT nextval('scriptactivity_id_seq'::regclass);
5724
15877
 
 
15878
 
5725
15879
ALTER TABLE section ALTER COLUMN id SET DEFAULT nextval('section_id_seq'::regclass);
5726
15880
 
 
15881
 
5727
15882
ALTER TABLE sectionselection ALTER COLUMN id SET DEFAULT nextval('sectionselection_id_seq'::regclass);
5728
15883
 
 
15884
 
5729
15885
ALTER TABLE seriessourcepackagebranch ALTER COLUMN id SET DEFAULT nextval('seriessourcepackagebranch_id_seq'::regclass);
5730
15886
 
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);
5746
15887
 
5747
15888
ALTER TABLE signedcodeofconduct ALTER COLUMN id SET DEFAULT nextval('signedcodeofconduct_id_seq'::regclass);
5748
15889
 
 
15890
 
5749
15891
ALTER TABLE sourcepackageformatselection ALTER COLUMN id SET DEFAULT nextval('sourcepackageformatselection_id_seq'::regclass);
5750
15892
 
 
15893
 
5751
15894
ALTER TABLE sourcepackagename ALTER COLUMN id SET DEFAULT nextval('sourcepackagename_id_seq'::regclass);
5752
15895
 
 
15896
 
5753
15897
ALTER TABLE sourcepackagepublishinghistory ALTER COLUMN id SET DEFAULT nextval('sourcepackagepublishinghistory_id_seq'::regclass);
5754
15898
 
 
15899
 
5755
15900
ALTER TABLE sourcepackagerecipe ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipe_id_seq'::regclass);
5756
15901
 
 
15902
 
5757
15903
ALTER TABLE sourcepackagerecipebuild ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipebuild_id_seq'::regclass);
5758
15904
 
 
15905
 
5759
15906
ALTER TABLE sourcepackagerecipebuildjob ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipebuildjob_id_seq'::regclass);
5760
15907
 
 
15908
 
5761
15909
ALTER TABLE sourcepackagerecipedata ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedata_id_seq'::regclass);
5762
15910
 
 
15911
 
5763
15912
ALTER TABLE sourcepackagerecipedatainstruction ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedatainstruction_id_seq'::regclass);
5764
15913
 
 
15914
 
5765
15915
ALTER TABLE sourcepackagerecipedistroseries ALTER COLUMN id SET DEFAULT nextval('sourcepackagerecipedistroseries_id_seq'::regclass);
5766
15916
 
 
15917
 
5767
15918
ALTER TABLE sourcepackagerelease ALTER COLUMN id SET DEFAULT nextval('sourcepackagerelease_id_seq'::regclass);
5768
15919
 
 
15920
 
5769
15921
ALTER TABLE specification ALTER COLUMN id SET DEFAULT nextval('specification_id_seq'::regclass);
5770
15922
 
 
15923
 
5771
15924
ALTER TABLE specificationbranch ALTER COLUMN id SET DEFAULT nextval('specificationbranch_id_seq'::regclass);
5772
15925
 
 
15926
 
5773
15927
ALTER TABLE specificationbug ALTER COLUMN id SET DEFAULT nextval('specificationbug_id_seq'::regclass);
5774
15928
 
 
15929
 
5775
15930
ALTER TABLE specificationdependency ALTER COLUMN id SET DEFAULT nextval('specificationdependency_id_seq'::regclass);
5776
15931
 
 
15932
 
5777
15933
ALTER TABLE specificationfeedback ALTER COLUMN id SET DEFAULT nextval('specificationfeedback_id_seq'::regclass);
5778
15934
 
 
15935
 
5779
15936
ALTER TABLE specificationmessage ALTER COLUMN id SET DEFAULT nextval('specificationmessage_id_seq'::regclass);
5780
15937
 
 
15938
 
5781
15939
ALTER TABLE specificationsubscription ALTER COLUMN id SET DEFAULT nextval('specificationsubscription_id_seq'::regclass);
5782
15940
 
 
15941
 
5783
15942
ALTER TABLE sprint ALTER COLUMN id SET DEFAULT nextval('sprint_id_seq'::regclass);
5784
15943
 
 
15944
 
5785
15945
ALTER TABLE sprintattendance ALTER COLUMN id SET DEFAULT nextval('sprintattendance_id_seq'::regclass);
5786
15946
 
 
15947
 
5787
15948
ALTER TABLE sprintspecification ALTER COLUMN id SET DEFAULT nextval('sprintspecification_id_seq'::regclass);
5788
15949
 
 
15950
 
5789
15951
ALTER TABLE sshkey ALTER COLUMN id SET DEFAULT nextval('sshkey_id_seq'::regclass);
5790
15952
 
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);
5794
15953
 
5795
15954
ALTER TABLE structuralsubscription ALTER COLUMN id SET DEFAULT nextval('structuralsubscription_id_seq'::regclass);
5796
15955
 
 
15956
 
 
15957
ALTER TABLE subunitstream ALTER COLUMN id SET DEFAULT nextval('subunitstream_id_seq'::regclass);
 
15958
 
 
15959
 
5797
15960
ALTER TABLE teammembership ALTER COLUMN id SET DEFAULT nextval('teammembership_id_seq'::regclass);
5798
15961
 
 
15962
 
5799
15963
ALTER TABLE teamparticipation ALTER COLUMN id SET DEFAULT nextval('teamparticipation_id_seq'::regclass);
5800
15964
 
 
15965
 
5801
15966
ALTER TABLE temporaryblobstorage ALTER COLUMN id SET DEFAULT nextval('temporaryblobstorage_id_seq'::regclass);
5802
15967
 
 
15968
 
5803
15969
ALTER TABLE translationgroup ALTER COLUMN id SET DEFAULT nextval('translationgroup_id_seq'::regclass);
5804
15970
 
 
15971
 
5805
15972
ALTER TABLE translationimportqueueentry ALTER COLUMN id SET DEFAULT nextval('translationimportqueueentry_id_seq'::regclass);
5806
15973
 
 
15974
 
5807
15975
ALTER TABLE translationmessage ALTER COLUMN id SET DEFAULT nextval('translationmessage_id_seq'::regclass);
5808
15976
 
 
15977
 
5809
15978
ALTER TABLE translationrelicensingagreement ALTER COLUMN id SET DEFAULT nextval('translationrelicensingagreement_id_seq'::regclass);
5810
15979
 
 
15980
 
5811
15981
ALTER TABLE translationtemplateitem ALTER COLUMN id SET DEFAULT nextval('translationtemplateitem_id_seq'::regclass);
5812
15982
 
 
15983
 
 
15984
ALTER TABLE translationtemplatesbuild ALTER COLUMN id SET DEFAULT nextval('translationtemplatesbuild_id_seq'::regclass);
 
15985
 
 
15986
 
5813
15987
ALTER TABLE translator ALTER COLUMN id SET DEFAULT nextval('translator_id_seq'::regclass);
5814
15988
 
 
15989
 
5815
15990
ALTER TABLE usertouseremail ALTER COLUMN id SET DEFAULT nextval('usertouseremail_id_seq'::regclass);
5816
15991
 
 
15992
 
5817
15993
ALTER TABLE vote ALTER COLUMN id SET DEFAULT nextval('vote_id_seq'::regclass);
5818
15994
 
 
15995
 
5819
15996
ALTER TABLE votecast ALTER COLUMN id SET DEFAULT nextval('votecast_id_seq'::regclass);
5820
15997
 
5821
 
ALTER TABLE webserviceban ALTER COLUMN id SET DEFAULT nextval('webserviceban_id_seq'::regclass);
5822
15998
 
5823
15999
ALTER TABLE wikiname ALTER COLUMN id SET DEFAULT nextval('wikiname_id_seq'::regclass);
5824
16000
 
5825
 
ALTER TABLE ONLY account
5826
 
    ADD CONSTRAINT account_openid_identifier_key UNIQUE (openid_identifier);
 
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
 
5827
16013
 
5828
16014
ALTER TABLE ONLY account
5829
16015
    ADD CONSTRAINT account_pkey PRIMARY KEY (id);
5830
16016
 
 
16017
 
5831
16018
ALTER TABLE ONLY accountpassword
5832
16019
    ADD CONSTRAINT accountpassword_account_key UNIQUE (account);
5833
16020
 
 
16021
 
5834
16022
ALTER TABLE ONLY accountpassword
5835
16023
    ADD CONSTRAINT accountpassword_pkey PRIMARY KEY (id);
5836
16024
 
 
16025
 
5837
16026
ALTER TABLE ONLY announcement
5838
16027
    ADD CONSTRAINT announcement_pkey PRIMARY KEY (id);
5839
16028
 
 
16029
 
5840
16030
ALTER TABLE ONLY apportjob
5841
16031
    ADD CONSTRAINT apportjob__job__key UNIQUE (job);
5842
16032
 
 
16033
 
5843
16034
ALTER TABLE ONLY apportjob
5844
16035
    ADD CONSTRAINT apportjob_pkey PRIMARY KEY (id);
5845
16036
 
5846
16037
ALTER TABLE apportjob CLUSTER ON apportjob_pkey;
5847
16038
 
 
16039
 
5848
16040
ALTER TABLE ONLY archive
5849
16041
    ADD CONSTRAINT archive_pkey PRIMARY KEY (id);
5850
16042
 
 
16043
 
5851
16044
ALTER TABLE ONLY archivearch
5852
16045
    ADD CONSTRAINT archivearch__processorfamily__archive__key UNIQUE (processorfamily, archive);
5853
16046
 
 
16047
 
5854
16048
ALTER TABLE ONLY archivearch
5855
16049
    ADD CONSTRAINT archivearch_pkey PRIMARY KEY (id);
5856
16050
 
 
16051
 
5857
16052
ALTER TABLE ONLY archiveauthtoken
5858
16053
    ADD CONSTRAINT archiveauthtoken_pkey PRIMARY KEY (id);
5859
16054
 
 
16055
 
5860
16056
ALTER TABLE ONLY archiveauthtoken
5861
16057
    ADD CONSTRAINT archiveauthtoken_token_key UNIQUE (token);
5862
16058
 
 
16059
 
5863
16060
ALTER TABLE ONLY archivedependency
5864
16061
    ADD CONSTRAINT archivedependency__unique UNIQUE (archive, dependency);
5865
16062
 
 
16063
 
5866
16064
ALTER TABLE ONLY archivedependency
5867
16065
    ADD CONSTRAINT archivedependency_pkey PRIMARY KEY (id);
5868
16066
 
 
16067
 
5869
16068
ALTER TABLE ONLY archivejob
5870
16069
    ADD CONSTRAINT archivejob__job__key UNIQUE (job);
5871
16070
 
 
16071
 
5872
16072
ALTER TABLE ONLY archivejob
5873
16073
    ADD CONSTRAINT archivejob_pkey PRIMARY KEY (id);
5874
16074
 
 
16075
 
5875
16076
ALTER TABLE ONLY archivepermission
5876
16077
    ADD CONSTRAINT archivepermission_pkey PRIMARY KEY (id);
5877
16078
 
 
16079
 
5878
16080
ALTER TABLE ONLY archivesubscriber
5879
16081
    ADD CONSTRAINT archivesubscriber_pkey PRIMARY KEY (id);
5880
16082
 
 
16083
 
5881
16084
ALTER TABLE ONLY revisionauthor
5882
16085
    ADD CONSTRAINT archuserid_archuserid_key UNIQUE (name);
5883
16086
 
 
16087
 
5884
16088
ALTER TABLE ONLY revisionauthor
5885
16089
    ADD CONSTRAINT archuserid_pkey PRIMARY KEY (id);
5886
16090
 
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);
5892
16091
 
5893
16092
ALTER TABLE ONLY binarypackagerelease
5894
16093
    ADD CONSTRAINT binarypackage_pkey PRIMARY KEY (id);
5895
16094
 
 
16095
 
5896
16096
ALTER TABLE ONLY binarypackagebuild
5897
16097
    ADD CONSTRAINT binarypackagebuild_pkey PRIMARY KEY (id);
5898
16098
 
 
16099
 
5899
16100
ALTER TABLE ONLY binarypackagefile
5900
16101
    ADD CONSTRAINT binarypackagefile_pkey PRIMARY KEY (id);
5901
16102
 
 
16103
 
5902
16104
ALTER TABLE ONLY binarypackagename
5903
16105
    ADD CONSTRAINT binarypackagename_name_key UNIQUE (name);
5904
16106
 
 
16107
 
5905
16108
ALTER TABLE ONLY binarypackagename
5906
16109
    ADD CONSTRAINT binarypackagename_pkey PRIMARY KEY (id);
5907
16110
 
 
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
 
5908
16120
ALTER TABLE ONLY binarypackagerelease
5909
16121
    ADD CONSTRAINT binarypackagerelease_binarypackagename_key UNIQUE (binarypackagename, build, version);
5910
16122
 
5911
 
ALTER TABLE binarypackagerelease CLUSTER ON binarypackagerelease_binarypackagename_key;
5912
16123
 
5913
16124
ALTER TABLE ONLY binarypackagerelease
5914
16125
    ADD CONSTRAINT binarypackagerelease_build_name_uniq UNIQUE (build, binarypackagename);
5915
16126
 
 
16127
 
 
16128
ALTER TABLE ONLY binarypackagereleasecontents
 
16129
    ADD CONSTRAINT binarypackagereleasecontents_pkey PRIMARY KEY (binarypackagerelease, binarypackagepath);
 
16130
 
 
16131
 
5916
16132
ALTER TABLE ONLY binarypackagereleasedownloadcount
5917
16133
    ADD CONSTRAINT binarypackagereleasedownloadcount__archive__binary_package_rele UNIQUE (archive, binary_package_release, day, country);
5918
16134
 
 
16135
 
5919
16136
ALTER TABLE ONLY binarypackagereleasedownloadcount
5920
16137
    ADD CONSTRAINT binarypackagereleasedownloadcount_pkey PRIMARY KEY (id);
5921
16138
 
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);
5939
16139
 
5940
16140
ALTER TABLE ONLY branch
5941
16141
    ADD CONSTRAINT branch__unique_name__key UNIQUE (unique_name);
5942
16142
 
 
16143
 
5943
16144
ALTER TABLE ONLY branch
5944
16145
    ADD CONSTRAINT branch_pkey PRIMARY KEY (id);
5945
16146
 
 
16147
 
5946
16148
ALTER TABLE ONLY branch
5947
16149
    ADD CONSTRAINT branch_url_unique UNIQUE (url);
5948
16150
 
 
16151
 
5949
16152
ALTER TABLE ONLY branchjob
5950
16153
    ADD CONSTRAINT branchjob_job_key UNIQUE (job);
5951
16154
 
 
16155
 
5952
16156
ALTER TABLE ONLY branchjob
5953
16157
    ADD CONSTRAINT branchjob_pkey PRIMARY KEY (id);
5954
16158
 
5955
16159
ALTER TABLE branchjob CLUSTER ON branchjob_pkey;
5956
16160
 
 
16161
 
5957
16162
ALTER TABLE ONLY branchmergeproposal
5958
16163
    ADD CONSTRAINT branchmergeproposal_pkey PRIMARY KEY (id);
5959
16164
 
 
16165
 
5960
16166
ALTER TABLE ONLY branchmergeproposaljob
5961
16167
    ADD CONSTRAINT branchmergeproposaljob_job_key UNIQUE (job);
5962
16168
 
 
16169
 
5963
16170
ALTER TABLE ONLY branchmergeproposaljob
5964
16171
    ADD CONSTRAINT branchmergeproposaljob_pkey PRIMARY KEY (id);
5965
16172
 
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);
 
16173
 
 
16174
ALTER TABLE ONLY branchmergequeue
 
16175
    ADD CONSTRAINT branchmergequeue_pkey PRIMARY KEY (id);
 
16176
 
5971
16177
 
5972
16178
ALTER TABLE ONLY branchsubscription
5973
16179
    ADD CONSTRAINT branchsubscription__person__branch__key UNIQUE (person, branch);
5974
16180
 
 
16181
 
5975
16182
ALTER TABLE ONLY branchsubscription
5976
16183
    ADD CONSTRAINT branchsubscription_pkey PRIMARY KEY (id);
5977
16184
 
 
16185
 
5978
16186
ALTER TABLE ONLY branchvisibilitypolicy
5979
16187
    ADD CONSTRAINT branchvisibilitypolicy_pkey PRIMARY KEY (id);
5980
16188
 
 
16189
 
5981
16190
ALTER TABLE ONLY bugbranch
5982
16191
    ADD CONSTRAINT bug_branch_unique UNIQUE (bug, branch);
5983
16192
 
5984
 
ALTER TABLE ONLY bug
5985
 
    ADD CONSTRAINT bug_name_key UNIQUE (name);
5986
16193
 
5987
16194
ALTER TABLE ONLY bug
5988
16195
    ADD CONSTRAINT bug_pkey PRIMARY KEY (id);
5989
16196
 
 
16197
 
5990
16198
ALTER TABLE ONLY bugactivity
5991
16199
    ADD CONSTRAINT bugactivity_pkey PRIMARY KEY (id);
5992
16200
 
 
16201
 
5993
16202
ALTER TABLE ONLY bugaffectsperson
5994
16203
    ADD CONSTRAINT bugaffectsperson_bug_person_uniq UNIQUE (bug, person);
5995
16204
 
 
16205
 
5996
16206
ALTER TABLE ONLY bugaffectsperson
5997
16207
    ADD CONSTRAINT bugaffectsperson_pkey PRIMARY KEY (id);
5998
16208
 
 
16209
 
5999
16210
ALTER TABLE ONLY bugattachment
6000
16211
    ADD CONSTRAINT bugattachment_pkey PRIMARY KEY (id);
6001
16212
 
 
16213
 
6002
16214
ALTER TABLE ONLY bugbranch
6003
16215
    ADD CONSTRAINT bugbranch_pkey PRIMARY KEY (id);
6004
16216
 
 
16217
 
6005
16218
ALTER TABLE ONLY bugcve
6006
16219
    ADD CONSTRAINT bugcve_bug_cve_uniq UNIQUE (bug, cve);
6007
16220
 
 
16221
 
6008
16222
ALTER TABLE ONLY bugcve
6009
16223
    ADD CONSTRAINT bugcve_pkey PRIMARY KEY (id);
6010
16224
 
 
16225
 
6011
16226
ALTER TABLE ONLY bugjob
6012
16227
    ADD CONSTRAINT bugjob__job__key UNIQUE (job);
6013
16228
 
 
16229
 
6014
16230
ALTER TABLE ONLY bugjob
6015
16231
    ADD CONSTRAINT bugjob_pkey PRIMARY KEY (id);
6016
16232
 
6017
16233
ALTER TABLE bugjob CLUSTER ON bugjob_pkey;
6018
16234
 
 
16235
 
 
16236
ALTER TABLE ONLY bugmessage
 
16237
    ADD CONSTRAINT bugmessage__bug__index__key UNIQUE (bug, index);
 
16238
 
 
16239
 
6019
16240
ALTER TABLE ONLY bugmessage
6020
16241
    ADD CONSTRAINT bugmessage__bug__message__key UNIQUE (bug, message);
6021
16242
 
 
16243
 
6022
16244
ALTER TABLE ONLY bugmessage
6023
16245
    ADD CONSTRAINT bugmessage__bugwatch__remote_comment_id__key UNIQUE (bugwatch, remote_comment_id);
6024
16246
 
 
16247
 
6025
16248
ALTER TABLE ONLY bugmessage
6026
16249
    ADD CONSTRAINT bugmessage_pkey PRIMARY KEY (id);
6027
16250
 
 
16251
 
 
16252
ALTER TABLE ONLY bugmute
 
16253
    ADD CONSTRAINT bugmute_pkey PRIMARY KEY (person, bug);
 
16254
 
 
16255
 
6028
16256
ALTER TABLE ONLY bugnomination
6029
16257
    ADD CONSTRAINT bugnomination_pkey PRIMARY KEY (id);
6030
16258
 
 
16259
 
6031
16260
ALTER TABLE ONLY bugnotification
6032
16261
    ADD CONSTRAINT bugnotification__bug__message__unq UNIQUE (bug, message);
6033
16262
 
 
16263
 
6034
16264
ALTER TABLE ONLY bugnotification
6035
16265
    ADD CONSTRAINT bugnotification_pkey PRIMARY KEY (id);
6036
16266
 
6037
 
ALTER TABLE bugnotification CLUSTER ON bugnotification_pkey;
6038
16267
 
6039
16268
ALTER TABLE ONLY bugnotificationarchive
6040
16269
    ADD CONSTRAINT bugnotificationarchive__bug__message__key UNIQUE (bug, message);
6041
16270
 
 
16271
 
6042
16272
ALTER TABLE ONLY bugnotificationarchive
6043
16273
    ADD CONSTRAINT bugnotificationarchive_pk PRIMARY KEY (id);
6044
16274
 
 
16275
 
6045
16276
ALTER TABLE ONLY bugnotificationattachment
6046
16277
    ADD CONSTRAINT bugnotificationattachment_pkey PRIMARY KEY (id);
6047
16278
 
 
16279
 
 
16280
ALTER TABLE ONLY bugnotificationfilter
 
16281
    ADD CONSTRAINT bugnotificationfilter_pkey PRIMARY KEY (bug_notification, bug_subscription_filter);
 
16282
 
 
16283
 
6048
16284
ALTER TABLE ONLY bugnotificationrecipient
6049
16285
    ADD CONSTRAINT bugnotificationrecipient__bug_notificaion__person__key UNIQUE (bug_notification, person);
6050
16286
 
 
16287
 
6051
16288
ALTER TABLE ONLY bugnotificationrecipient
6052
16289
    ADD CONSTRAINT bugnotificationrecipient_pkey PRIMARY KEY (id);
6053
16290
 
 
16291
 
6054
16292
ALTER TABLE ONLY bugnotificationrecipientarchive
6055
16293
    ADD CONSTRAINT bugnotificationrecipientarchive_pk PRIMARY KEY (id);
6056
16294
 
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);
6068
16295
 
6069
16296
ALTER TABLE ONLY bugsubscription
6070
16297
    ADD CONSTRAINT bugsubscription_pkey PRIMARY KEY (id);
6071
16298
 
 
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
 
6072
16328
ALTER TABLE ONLY bugtracker
6073
16329
    ADD CONSTRAINT bugsystem_pkey PRIMARY KEY (id);
6074
16330
 
 
16331
 
6075
16332
ALTER TABLE ONLY bugtag
6076
16333
    ADD CONSTRAINT bugtag__tag__bug__key UNIQUE (tag, bug);
6077
16334
 
 
16335
 
6078
16336
ALTER TABLE ONLY bugtag
6079
16337
    ADD CONSTRAINT bugtag_pkey PRIMARY KEY (id);
6080
16338
 
 
16339
 
6081
16340
ALTER TABLE ONLY bugtask
6082
16341
    ADD CONSTRAINT bugtask_pkey PRIMARY KEY (id);
6083
16342
 
 
16343
 
6084
16344
ALTER TABLE ONLY bugtrackeralias
6085
16345
    ADD CONSTRAINT bugtracker__base_url__key UNIQUE (base_url);
6086
16346
 
 
16347
 
6087
16348
ALTER TABLE ONLY bugtrackeralias
6088
16349
    ADD CONSTRAINT bugtrackeralias_pkey PRIMARY KEY (id);
6089
16350
 
 
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
 
6090
16372
ALTER TABLE ONLY bugtrackerperson
6091
16373
    ADD CONSTRAINT bugtrackerperson__bugtracker__name__key UNIQUE (bugtracker, name);
6092
16374
 
 
16375
 
6093
16376
ALTER TABLE ONLY bugtrackerperson
6094
16377
    ADD CONSTRAINT bugtrackerperson_pkey PRIMARY KEY (id);
6095
16378
 
 
16379
 
6096
16380
ALTER TABLE ONLY bugwatch
6097
16381
    ADD CONSTRAINT bugwatch_bugtask_target UNIQUE (id, bug);
6098
16382
 
 
16383
 
6099
16384
ALTER TABLE ONLY bugwatch
6100
16385
    ADD CONSTRAINT bugwatch_pkey PRIMARY KEY (id);
6101
16386
 
 
16387
 
6102
16388
ALTER TABLE ONLY bugwatchactivity
6103
16389
    ADD CONSTRAINT bugwatchactivity_pkey PRIMARY KEY (id);
6104
16390
 
 
16391
 
6105
16392
ALTER TABLE ONLY builder
6106
16393
    ADD CONSTRAINT builder_pkey PRIMARY KEY (id);
6107
16394
 
 
16395
 
6108
16396
ALTER TABLE ONLY builder
6109
16397
    ADD CONSTRAINT builder_url_key UNIQUE (url);
6110
16398
 
 
16399
 
6111
16400
ALTER TABLE ONLY buildfarmjob
6112
16401
    ADD CONSTRAINT buildfarmjob_pkey PRIMARY KEY (id);
6113
16402
 
 
16403
 
6114
16404
ALTER TABLE ONLY buildpackagejob
6115
16405
    ADD CONSTRAINT buildpackagejob__build__key UNIQUE (build);
6116
16406
 
 
16407
 
6117
16408
ALTER TABLE ONLY buildpackagejob
6118
16409
    ADD CONSTRAINT buildpackagejob__job__key UNIQUE (job);
6119
16410
 
 
16411
 
6120
16412
ALTER TABLE ONLY buildpackagejob
6121
16413
    ADD CONSTRAINT buildpackagejob_pkey PRIMARY KEY (id);
6122
16414
 
 
16415
 
6123
16416
ALTER TABLE ONLY buildqueue
6124
16417
    ADD CONSTRAINT buildqueue__job__key UNIQUE (job);
6125
16418
 
 
16419
 
6126
16420
ALTER TABLE ONLY buildqueue
6127
16421
    ADD CONSTRAINT buildqueue_pkey PRIMARY KEY (id);
6128
16422
 
 
16423
 
6129
16424
ALTER TABLE ONLY revision
6130
16425
    ADD CONSTRAINT changeset_pkey PRIMARY KEY (id);
6131
16426
 
 
16427
 
6132
16428
ALTER TABLE ONLY codeimport
6133
16429
    ADD CONSTRAINT codeimport_branch_key UNIQUE (branch);
6134
16430
 
 
16431
 
6135
16432
ALTER TABLE ONLY codeimport
6136
16433
    ADD CONSTRAINT codeimport_pkey PRIMARY KEY (id);
6137
16434
 
 
16435
 
6138
16436
ALTER TABLE ONLY codeimportevent
6139
16437
    ADD CONSTRAINT codeimportevent_pkey PRIMARY KEY (id);
6140
16438
 
 
16439
 
6141
16440
ALTER TABLE ONLY codeimporteventdata
6142
16441
    ADD CONSTRAINT codeimporteventdata__event__data_type__key UNIQUE (event, data_type);
6143
16442
 
 
16443
 
6144
16444
ALTER TABLE ONLY codeimporteventdata
6145
16445
    ADD CONSTRAINT codeimporteventdata_pkey PRIMARY KEY (id);
6146
16446
 
 
16447
 
6147
16448
ALTER TABLE ONLY codeimportjob
6148
16449
    ADD CONSTRAINT codeimportjob__code_import__key UNIQUE (code_import);
6149
16450
 
 
16451
 
6150
16452
ALTER TABLE ONLY codeimportjob
6151
16453
    ADD CONSTRAINT codeimportjob_pkey PRIMARY KEY (id);
6152
16454
 
 
16455
 
6153
16456
ALTER TABLE ONLY codeimportmachine
6154
16457
    ADD CONSTRAINT codeimportmachine_hostname_key UNIQUE (hostname);
6155
16458
 
 
16459
 
6156
16460
ALTER TABLE ONLY codeimportmachine
6157
16461
    ADD CONSTRAINT codeimportmachine_pkey PRIMARY KEY (id);
6158
16462
 
 
16463
 
6159
16464
ALTER TABLE ONLY codeimportresult
6160
16465
    ADD CONSTRAINT codeimportresult_pkey PRIMARY KEY (id);
6161
16466
 
 
16467
 
6162
16468
ALTER TABLE ONLY codereviewmessage
6163
16469
    ADD CONSTRAINT codereviewmessage__branch_merge_proposal__id_key UNIQUE (branch_merge_proposal, id);
6164
16470
 
 
16471
 
6165
16472
ALTER TABLE ONLY codereviewmessage
6166
16473
    ADD CONSTRAINT codereviewmessage_message_key UNIQUE (message);
6167
16474
 
 
16475
 
6168
16476
ALTER TABLE ONLY codereviewmessage
6169
16477
    ADD CONSTRAINT codereviewmessage_pkey PRIMARY KEY (id);
6170
16478
 
 
16479
 
6171
16480
ALTER TABLE ONLY codereviewvote
6172
16481
    ADD CONSTRAINT codereviewvote_pkey PRIMARY KEY (id);
6173
16482
 
 
16483
 
6174
16484
ALTER TABLE ONLY commercialsubscription
6175
16485
    ADD CONSTRAINT commercialsubscription_pkey PRIMARY KEY (id);
6176
16486
 
 
16487
 
6177
16488
ALTER TABLE ONLY component
6178
16489
    ADD CONSTRAINT component_name_key UNIQUE (name);
6179
16490
 
 
16491
 
6180
16492
ALTER TABLE ONLY component
6181
16493
    ADD CONSTRAINT component_pkey PRIMARY KEY (id);
6182
16494
 
 
16495
 
6183
16496
ALTER TABLE ONLY componentselection
6184
16497
    ADD CONSTRAINT componentselection__distroseries__component__key UNIQUE (distroseries, component);
6185
16498
 
 
16499
 
6186
16500
ALTER TABLE ONLY componentselection
6187
16501
    ADD CONSTRAINT componentselection_pkey PRIMARY KEY (id);
6188
16502
 
 
16503
 
6189
16504
ALTER TABLE ONLY continent
6190
16505
    ADD CONSTRAINT continent_code_key UNIQUE (code);
6191
16506
 
 
16507
 
6192
16508
ALTER TABLE ONLY continent
6193
16509
    ADD CONSTRAINT continent_name_key UNIQUE (name);
6194
16510
 
 
16511
 
6195
16512
ALTER TABLE ONLY continent
6196
16513
    ADD CONSTRAINT continent_pkey PRIMARY KEY (id);
6197
16514
 
 
16515
 
6198
16516
ALTER TABLE ONLY country
6199
16517
    ADD CONSTRAINT country_code2_uniq UNIQUE (iso3166code2);
6200
16518
 
 
16519
 
6201
16520
ALTER TABLE ONLY country
6202
16521
    ADD CONSTRAINT country_code3_uniq UNIQUE (iso3166code3);
6203
16522
 
 
16523
 
6204
16524
ALTER TABLE ONLY country
6205
16525
    ADD CONSTRAINT country_name_uniq UNIQUE (name);
6206
16526
 
 
16527
 
6207
16528
ALTER TABLE ONLY country
6208
16529
    ADD CONSTRAINT country_pkey PRIMARY KEY (id);
6209
16530
 
 
16531
 
6210
16532
ALTER TABLE ONLY customlanguagecode
6211
16533
    ADD CONSTRAINT customlanguagecode_pkey PRIMARY KEY (id);
6212
16534
 
 
16535
 
6213
16536
ALTER TABLE ONLY cve
6214
16537
    ADD CONSTRAINT cve_pkey PRIMARY KEY (id);
6215
16538
 
 
16539
 
6216
16540
ALTER TABLE ONLY cve
6217
16541
    ADD CONSTRAINT cve_sequence_uniq UNIQUE (sequence);
6218
16542
 
 
16543
 
6219
16544
ALTER TABLE ONLY cvereference
6220
16545
    ADD CONSTRAINT cvereference_pkey PRIMARY KEY (id);
6221
16546
 
 
16547
 
6222
16548
ALTER TABLE ONLY databasecpustats
6223
16549
    ADD CONSTRAINT databasecpustats_pkey PRIMARY KEY (date_created, username);
6224
16550
 
 
16551
 
 
16552
ALTER TABLE ONLY databasediskutilization
 
16553
    ADD CONSTRAINT databasediskutilization_pkey PRIMARY KEY (date_created, sort);
 
16554
 
 
16555
 
6225
16556
ALTER TABLE ONLY databasereplicationlag
6226
16557
    ADD CONSTRAINT databasereplicationlag_pkey PRIMARY KEY (node);
6227
16558
 
 
16559
 
6228
16560
ALTER TABLE ONLY databasetablestats
6229
16561
    ADD CONSTRAINT databasetablestats_pkey PRIMARY KEY (date_created, schemaname, relname);
6230
16562
 
6231
16563
ALTER TABLE databasetablestats CLUSTER ON databasetablestats_pkey;
6232
16564
 
 
16565
 
6233
16566
ALTER TABLE ONLY diff
6234
16567
    ADD CONSTRAINT diff_pkey PRIMARY KEY (id);
6235
16568
 
 
16569
 
6236
16570
ALTER TABLE ONLY distribution
6237
16571
    ADD CONSTRAINT distribution_name_key UNIQUE (name);
6238
16572
 
 
16573
 
6239
16574
ALTER TABLE ONLY distribution
6240
16575
    ADD CONSTRAINT distribution_pkey PRIMARY KEY (id);
6241
16576
 
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);
 
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
 
6247
16585
 
6248
16586
ALTER TABLE ONLY distributionmirror
6249
16587
    ADD CONSTRAINT distributionmirror_ftp_base_url_key UNIQUE (ftp_base_url);
6250
16588
 
 
16589
 
6251
16590
ALTER TABLE ONLY distributionmirror
6252
16591
    ADD CONSTRAINT distributionmirror_http_base_url_key UNIQUE (http_base_url);
6253
16592
 
 
16593
 
6254
16594
ALTER TABLE ONLY distributionmirror
6255
16595
    ADD CONSTRAINT distributionmirror_name_key UNIQUE (name);
6256
16596
 
 
16597
 
6257
16598
ALTER TABLE ONLY distributionmirror
6258
16599
    ADD CONSTRAINT distributionmirror_pkey PRIMARY KEY (id);
6259
16600
 
 
16601
 
6260
16602
ALTER TABLE ONLY distributionmirror
6261
16603
    ADD CONSTRAINT distributionmirror_rsync_base_url_key UNIQUE (rsync_base_url);
6262
16604
 
 
16605
 
6263
16606
ALTER TABLE ONLY distributionsourcepackage
6264
16607
    ADD CONSTRAINT distributionpackage__sourcepackagename__distribution__key UNIQUE (sourcepackagename, distribution);
6265
16608
 
6266
16609
ALTER TABLE distributionsourcepackage CLUSTER ON distributionpackage__sourcepackagename__distribution__key;
6267
16610
 
 
16611
 
6268
16612
ALTER TABLE ONLY distributionsourcepackage
6269
16613
    ADD CONSTRAINT distributionsourcepackage_pkey PRIMARY KEY (id);
6270
16614
 
 
16615
 
6271
16616
ALTER TABLE ONLY distributionsourcepackagecache
6272
16617
    ADD CONSTRAINT distributionsourcepackagecache__distribution__sourcepackagename UNIQUE (distribution, sourcepackagename, archive);
6273
16618
 
 
16619
 
6274
16620
ALTER TABLE ONLY distributionsourcepackagecache
6275
16621
    ADD CONSTRAINT distributionsourcepackagecache_pkey PRIMARY KEY (id);
6276
16622
 
 
16623
 
6277
16624
ALTER TABLE ONLY distroarchseries
6278
16625
    ADD CONSTRAINT distroarchrelease_pkey PRIMARY KEY (id);
6279
16626
 
 
16627
 
6280
16628
ALTER TABLE ONLY distroarchseries
6281
16629
    ADD CONSTRAINT distroarchseries__architecturetag__distroseries__key UNIQUE (architecturetag, distroseries);
6282
16630
 
 
16631
 
6283
16632
ALTER TABLE ONLY distroarchseries
6284
16633
    ADD CONSTRAINT distroarchseries__processorfamily__distroseries__key UNIQUE (processorfamily, distroseries);
6285
16634
 
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);
 
16635
 
 
16636
ALTER TABLE ONLY distroseries
 
16637
    ADD CONSTRAINT distrorelease__distribution__name__key UNIQUE (distribution, name);
 
16638
 
6297
16639
 
6298
16640
ALTER TABLE ONLY distroseries
6299
16641
    ADD CONSTRAINT distrorelease_pkey PRIMARY KEY (id);
6300
16642
 
 
16643
 
6301
16644
ALTER TABLE ONLY distroserieslanguage
6302
16645
    ADD CONSTRAINT distroreleaselanguage_distrorelease_language_uniq UNIQUE (distroseries, language);
6303
16646
 
 
16647
 
6304
16648
ALTER TABLE ONLY distroserieslanguage
6305
16649
    ADD CONSTRAINT distroreleaselanguage_pkey PRIMARY KEY (id);
6306
16650
 
 
16651
 
6307
16652
ALTER TABLE ONLY distroseriespackagecache
6308
16653
    ADD CONSTRAINT distroreleasepackagecache_pkey PRIMARY KEY (id);
6309
16654
 
 
16655
 
6310
16656
ALTER TABLE ONLY packageupload
6311
16657
    ADD CONSTRAINT distroreleasequeue_pkey PRIMARY KEY (id);
6312
16658
 
 
16659
 
6313
16660
ALTER TABLE ONLY packageuploadbuild
6314
16661
    ADD CONSTRAINT distroreleasequeuebuild__distroreleasequeue__build__unique UNIQUE (packageupload, build);
6315
16662
 
 
16663
 
6316
16664
ALTER TABLE ONLY packageuploadbuild
6317
16665
    ADD CONSTRAINT distroreleasequeuebuild_pkey PRIMARY KEY (id);
6318
16666
 
 
16667
 
6319
16668
ALTER TABLE ONLY packageuploadcustom
6320
16669
    ADD CONSTRAINT distroreleasequeuecustom_pkey PRIMARY KEY (id);
6321
16670
 
 
16671
 
6322
16672
ALTER TABLE ONLY packageuploadsource
6323
16673
    ADD CONSTRAINT distroreleasequeuesource_pkey PRIMARY KEY (id);
6324
16674
 
 
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
 
6325
16696
ALTER TABLE ONLY distroseriespackagecache
6326
16697
    ADD CONSTRAINT distroseriespackagecache__distroseries__binarypackagename__arch UNIQUE (distroseries, binarypackagename, archive);
6327
16698
 
 
16699
 
 
16700
ALTER TABLE ONLY distroseriesparent
 
16701
    ADD CONSTRAINT distroseriesparent_pkey PRIMARY KEY (id);
 
16702
 
 
16703
 
6328
16704
ALTER TABLE ONLY emailaddress
6329
16705
    ADD CONSTRAINT emailaddress_pkey PRIMARY KEY (id);
6330
16706
 
 
16707
 
6331
16708
ALTER TABLE ONLY entitlement
6332
16709
    ADD CONSTRAINT entitlement_pkey PRIMARY KEY (id);
6333
16710
 
 
16711
 
6334
16712
ALTER TABLE ONLY faq
6335
16713
    ADD CONSTRAINT faq_pkey PRIMARY KEY (id);
6336
16714
 
 
16715
 
6337
16716
ALTER TABLE ONLY featureflag
6338
16717
    ADD CONSTRAINT feature_flag_pkey PRIMARY KEY (scope, flag);
6339
16718
 
 
16719
 
6340
16720
ALTER TABLE ONLY featureflag
6341
16721
    ADD CONSTRAINT feature_flag_unique_priority_per_flag UNIQUE (flag, priority);
6342
16722
 
 
16723
 
6343
16724
ALTER TABLE ONLY featuredproject
6344
16725
    ADD CONSTRAINT featuredproject_pkey PRIMARY KEY (id);
6345
16726
 
 
16727
 
 
16728
ALTER TABLE ONLY featureflagchangelogentry
 
16729
    ADD CONSTRAINT featureflagchangelogentry_pkey PRIMARY KEY (id);
 
16730
 
 
16731
 
6346
16732
ALTER TABLE ONLY flatpackagesetinclusion
6347
16733
    ADD CONSTRAINT flatpackagesetinclusion__parent__child__key UNIQUE (parent, child);
6348
16734
 
 
16735
 
6349
16736
ALTER TABLE ONLY flatpackagesetinclusion
6350
16737
    ADD CONSTRAINT flatpackagesetinclusion_pkey PRIMARY KEY (id);
6351
16738
 
 
16739
 
6352
16740
ALTER TABLE ONLY fticache
6353
16741
    ADD CONSTRAINT fticache_pkey PRIMARY KEY (id);
6354
16742
 
 
16743
 
6355
16744
ALTER TABLE ONLY fticache
6356
16745
    ADD CONSTRAINT fticache_tablename_key UNIQUE (tablename);
6357
16746
 
 
16747
 
6358
16748
ALTER TABLE ONLY gpgkey
6359
16749
    ADD CONSTRAINT gpgkey_fingerprint_key UNIQUE (fingerprint);
6360
16750
 
 
16751
 
6361
16752
ALTER TABLE ONLY gpgkey
6362
16753
    ADD CONSTRAINT gpgkey_owner_key UNIQUE (owner, id);
6363
16754
 
 
16755
 
6364
16756
ALTER TABLE ONLY gpgkey
6365
16757
    ADD CONSTRAINT gpgkey_pkey PRIMARY KEY (id);
6366
16758
 
 
16759
 
6367
16760
ALTER TABLE ONLY hwdevice
6368
16761
    ADD CONSTRAINT hwdevice__bus_vendor_id__bus_product_id__variant__key UNIQUE (bus_vendor_id, bus_product_id, variant);
6369
16762
 
 
16763
 
6370
16764
ALTER TABLE ONLY hwdevice
6371
16765
    ADD CONSTRAINT hwdevice_pkey PRIMARY KEY (id);
6372
16766
 
 
16767
 
6373
16768
ALTER TABLE ONLY hwdeviceclass
6374
16769
    ADD CONSTRAINT hwdeviceclass_pkey PRIMARY KEY (id);
6375
16770
 
 
16771
 
6376
16772
ALTER TABLE ONLY hwdevicedriverlink
6377
16773
    ADD CONSTRAINT hwdevicedriverlink_pkey PRIMARY KEY (id);
6378
16774
 
 
16775
 
6379
16776
ALTER TABLE ONLY hwdevicenamevariant
6380
16777
    ADD CONSTRAINT hwdevicenamevariant__vendor_name__product_name__device__key UNIQUE (vendor_name, product_name, device);
6381
16778
 
 
16779
 
6382
16780
ALTER TABLE ONLY hwdevicenamevariant
6383
16781
    ADD CONSTRAINT hwdevicenamevariant_pkey PRIMARY KEY (id);
6384
16782
 
 
16783
 
6385
16784
ALTER TABLE ONLY hwdmihandle
6386
16785
    ADD CONSTRAINT hwdmihandle_pkey PRIMARY KEY (id);
6387
16786
 
 
16787
 
6388
16788
ALTER TABLE ONLY hwdmivalue
6389
16789
    ADD CONSTRAINT hwdmivalue_pkey PRIMARY KEY (id);
6390
16790
 
 
16791
 
6391
16792
ALTER TABLE ONLY hwdriver
6392
16793
    ADD CONSTRAINT hwdriver__package_name__name__key UNIQUE (package_name, name);
6393
16794
 
 
16795
 
6394
16796
ALTER TABLE ONLY hwdriver
6395
16797
    ADD CONSTRAINT hwdriver_pkey PRIMARY KEY (id);
6396
16798
 
 
16799
 
6397
16800
ALTER TABLE ONLY hwsubmission
6398
16801
    ADD CONSTRAINT hwsubmission__submission_key__key UNIQUE (submission_key);
6399
16802
 
 
16803
 
6400
16804
ALTER TABLE ONLY hwsubmission
6401
16805
    ADD CONSTRAINT hwsubmission_pkey PRIMARY KEY (id);
6402
16806
 
 
16807
 
6403
16808
ALTER TABLE ONLY hwsubmissionbug
6404
16809
    ADD CONSTRAINT hwsubmissionbug__submission__bug__key UNIQUE (submission, bug);
6405
16810
 
 
16811
 
6406
16812
ALTER TABLE ONLY hwsubmissionbug
6407
16813
    ADD CONSTRAINT hwsubmissionbug_pkey PRIMARY KEY (id);
6408
16814
 
 
16815
 
6409
16816
ALTER TABLE ONLY hwsubmissiondevice
6410
16817
    ADD CONSTRAINT hwsubmissiondevice_pkey PRIMARY KEY (id);
6411
16818
 
 
16819
 
6412
16820
ALTER TABLE ONLY hwsystemfingerprint
6413
16821
    ADD CONSTRAINT hwsystemfingerprint__fingerprint__key UNIQUE (fingerprint);
6414
16822
 
 
16823
 
6415
16824
ALTER TABLE ONLY hwsystemfingerprint
6416
16825
    ADD CONSTRAINT hwsystemfingerprint_pkey PRIMARY KEY (id);
6417
16826
 
 
16827
 
6418
16828
ALTER TABLE ONLY hwtest
6419
16829
    ADD CONSTRAINT hwtest_pkey PRIMARY KEY (id);
6420
16830
 
 
16831
 
6421
16832
ALTER TABLE ONLY hwtestanswer
6422
16833
    ADD CONSTRAINT hwtestanswer_pkey PRIMARY KEY (id);
6423
16834
 
 
16835
 
6424
16836
ALTER TABLE ONLY hwtestanswerchoice
6425
16837
    ADD CONSTRAINT hwtestanswerchoice__choice__test__key UNIQUE (choice, test);
6426
16838
 
 
16839
 
6427
16840
ALTER TABLE ONLY hwtestanswerchoice
6428
16841
    ADD CONSTRAINT hwtestanswerchoice__test__id__key UNIQUE (test, id);
6429
16842
 
 
16843
 
6430
16844
ALTER TABLE ONLY hwtestanswerchoice
6431
16845
    ADD CONSTRAINT hwtestanswerchoice_pkey PRIMARY KEY (id);
6432
16846
 
 
16847
 
6433
16848
ALTER TABLE ONLY hwtestanswercount
6434
16849
    ADD CONSTRAINT hwtestanswercount_pkey PRIMARY KEY (id);
6435
16850
 
 
16851
 
6436
16852
ALTER TABLE ONLY hwtestanswercountdevice
6437
16853
    ADD CONSTRAINT hwtestanswercountdevice__answer__device_driver__key UNIQUE (answer, device_driver);
6438
16854
 
 
16855
 
6439
16856
ALTER TABLE ONLY hwtestanswercountdevice
6440
16857
    ADD CONSTRAINT hwtestanswercountdevice_pkey PRIMARY KEY (id);
6441
16858
 
 
16859
 
6442
16860
ALTER TABLE ONLY hwtestanswerdevice
6443
16861
    ADD CONSTRAINT hwtestanswerdevice__answer__device_driver__key UNIQUE (answer, device_driver);
6444
16862
 
 
16863
 
6445
16864
ALTER TABLE ONLY hwtestanswerdevice
6446
16865
    ADD CONSTRAINT hwtestanswerdevice_pkey PRIMARY KEY (id);
6447
16866
 
 
16867
 
6448
16868
ALTER TABLE ONLY hwvendorid
6449
16869
    ADD CONSTRAINT hwvendorid__bus_vendor_id__vendor_name__key UNIQUE (bus, vendor_id_for_bus, vendor_name);
6450
16870
 
 
16871
 
6451
16872
ALTER TABLE ONLY hwvendorid
6452
16873
    ADD CONSTRAINT hwvendorid_pkey PRIMARY KEY (id);
6453
16874
 
 
16875
 
6454
16876
ALTER TABLE ONLY hwvendorname
6455
16877
    ADD CONSTRAINT hwvendorname_pkey PRIMARY KEY (id);
6456
16878
 
 
16879
 
 
16880
ALTER TABLE ONLY incrementaldiff
 
16881
    ADD CONSTRAINT incrementaldiff_pkey PRIMARY KEY (id);
 
16882
 
 
16883
 
6457
16884
ALTER TABLE ONLY ircid
6458
16885
    ADD CONSTRAINT ircid_pkey PRIMARY KEY (id);
6459
16886
 
 
16887
 
6460
16888
ALTER TABLE ONLY jabberid
6461
16889
    ADD CONSTRAINT jabberid_jabberid_key UNIQUE (jabberid);
6462
16890
 
 
16891
 
6463
16892
ALTER TABLE ONLY jabberid
6464
16893
    ADD CONSTRAINT jabberid_pkey PRIMARY KEY (id);
6465
16894
 
 
16895
 
6466
16896
ALTER TABLE ONLY job
6467
16897
    ADD CONSTRAINT job__status__id__key UNIQUE (status, id);
6468
16898
 
 
16899
 
6469
16900
ALTER TABLE ONLY job
6470
16901
    ADD CONSTRAINT job_pkey PRIMARY KEY (id);
6471
16902
 
6472
16903
ALTER TABLE job CLUSTER ON job_pkey;
6473
16904
 
 
16905
 
6474
16906
ALTER TABLE ONLY karma
6475
16907
    ADD CONSTRAINT karma_pkey PRIMARY KEY (id);
6476
16908
 
 
16909
 
6477
16910
ALTER TABLE ONLY karmaaction
6478
16911
    ADD CONSTRAINT karmaaction_name_uniq UNIQUE (name);
6479
16912
 
 
16913
 
6480
16914
ALTER TABLE ONLY karmaaction
6481
16915
    ADD CONSTRAINT karmaaction_pkey PRIMARY KEY (id);
6482
16916
 
 
16917
 
6483
16918
ALTER TABLE ONLY karmacache
6484
16919
    ADD CONSTRAINT karmacache_pkey PRIMARY KEY (id);
6485
16920
 
 
16921
 
6486
16922
ALTER TABLE ONLY karmacategory
6487
16923
    ADD CONSTRAINT karmacategory_pkey PRIMARY KEY (id);
6488
16924
 
 
16925
 
6489
16926
ALTER TABLE ONLY karmatotalcache
6490
16927
    ADD CONSTRAINT karmatotalcache_person_key UNIQUE (person);
6491
16928
 
 
16929
 
6492
16930
ALTER TABLE ONLY karmatotalcache
6493
16931
    ADD CONSTRAINT karmatotalcache_pkey PRIMARY KEY (id);
6494
16932
 
 
16933
 
6495
16934
ALTER TABLE ONLY language
6496
16935
    ADD CONSTRAINT language_code_key UNIQUE (code);
6497
16936
 
 
16937
 
6498
16938
ALTER TABLE ONLY language
6499
16939
    ADD CONSTRAINT language_pkey PRIMARY KEY (id);
6500
16940
 
 
16941
 
6501
16942
ALTER TABLE ONLY languagepack
6502
16943
    ADD CONSTRAINT languagepack_pkey PRIMARY KEY (id);
6503
16944
 
 
16945
 
6504
16946
ALTER TABLE ONLY launchpaddatabaserevision
6505
16947
    ADD CONSTRAINT launchpaddatabaserevision_pkey PRIMARY KEY (major, minor, patch);
6506
16948
 
 
16949
 
 
16950
ALTER TABLE ONLY launchpaddatabaseupdatelog
 
16951
    ADD CONSTRAINT launchpaddatabaseupdatelog_pkey PRIMARY KEY (id);
 
16952
 
 
16953
 
6507
16954
ALTER TABLE ONLY launchpadstatistic
6508
16955
    ADD CONSTRAINT launchpadstatistic_pkey PRIMARY KEY (id);
6509
16956
 
 
16957
 
6510
16958
ALTER TABLE ONLY launchpadstatistic
6511
16959
    ADD CONSTRAINT launchpadstatistics_uniq_name UNIQUE (name);
6512
16960
 
 
16961
 
6513
16962
ALTER TABLE ONLY libraryfilealias
6514
16963
    ADD CONSTRAINT libraryfilealias_pkey PRIMARY KEY (id);
6515
16964
 
6516
16965
ALTER TABLE libraryfilealias CLUSTER ON libraryfilealias_pkey;
6517
16966
 
 
16967
 
6518
16968
ALTER TABLE ONLY libraryfilecontent
6519
16969
    ADD CONSTRAINT libraryfilecontent_pkey PRIMARY KEY (id);
6520
16970
 
6521
16971
ALTER TABLE libraryfilecontent CLUSTER ON libraryfilecontent_pkey;
6522
16972
 
 
16973
 
6523
16974
ALTER TABLE ONLY libraryfiledownloadcount
6524
16975
    ADD CONSTRAINT libraryfiledownloadcount__libraryfilealias__day__country__key UNIQUE (libraryfilealias, day, country);
6525
16976
 
 
16977
 
6526
16978
ALTER TABLE ONLY libraryfiledownloadcount
6527
16979
    ADD CONSTRAINT libraryfiledownloadcount_pkey PRIMARY KEY (id);
6528
16980
 
 
16981
 
6529
16982
ALTER TABLE ONLY logintoken
6530
16983
    ADD CONSTRAINT logintoken_pkey PRIMARY KEY (id);
6531
16984
 
 
16985
 
6532
16986
ALTER TABLE ONLY logintoken
6533
16987
    ADD CONSTRAINT logintoken_token_key UNIQUE (token);
6534
16988
 
 
16989
 
6535
16990
ALTER TABLE ONLY lp_account
6536
16991
    ADD CONSTRAINT lp_account__openid_identifier__key UNIQUE (openid_identifier);
6537
16992
 
 
16993
 
6538
16994
ALTER TABLE ONLY lp_account
6539
16995
    ADD CONSTRAINT lp_account_pkey PRIMARY KEY (id);
6540
16996
 
 
16997
 
 
16998
ALTER TABLE ONLY lp_openididentifier
 
16999
    ADD CONSTRAINT lp_openididentifier_pkey PRIMARY KEY (identifier);
 
17000
 
 
17001
 
6541
17002
ALTER TABLE ONLY lp_person
6542
17003
    ADD CONSTRAINT lp_person__account__key UNIQUE (account);
6543
17004
 
 
17005
 
6544
17006
ALTER TABLE ONLY lp_person
6545
17007
    ADD CONSTRAINT lp_person__name__key UNIQUE (name);
6546
17008
 
 
17009
 
6547
17010
ALTER TABLE ONLY lp_person
6548
17011
    ADD CONSTRAINT lp_person_pkey PRIMARY KEY (id);
6549
17012
 
 
17013
 
6550
17014
ALTER TABLE ONLY lp_personlocation
6551
17015
    ADD CONSTRAINT lp_personlocation__person__key UNIQUE (person);
6552
17016
 
 
17017
 
6553
17018
ALTER TABLE ONLY lp_personlocation
6554
17019
    ADD CONSTRAINT lp_personlocation_pkey PRIMARY KEY (id);
6555
17020
 
 
17021
 
6556
17022
ALTER TABLE ONLY lp_teamparticipation
6557
17023
    ADD CONSTRAINT lp_teamparticipation_pkey PRIMARY KEY (id);
6558
17024
 
 
17025
 
6559
17026
ALTER TABLE ONLY lp_teamparticipation
6560
17027
    ADD CONSTRAINT lp_teamperticipation__team__person__key UNIQUE (team, person);
6561
17028
 
 
17029
 
6562
17030
ALTER TABLE ONLY mailinglist
6563
17031
    ADD CONSTRAINT mailinglist_pkey PRIMARY KEY (id);
6564
17032
 
 
17033
 
6565
17034
ALTER TABLE ONLY mailinglist
6566
17035
    ADD CONSTRAINT mailinglist_team_key UNIQUE (team);
6567
17036
 
6568
 
ALTER TABLE ONLY mailinglistban
6569
 
    ADD CONSTRAINT mailinglistban_pkey PRIMARY KEY (id);
6570
17037
 
6571
17038
ALTER TABLE ONLY mailinglistsubscription
6572
17039
    ADD CONSTRAINT mailinglistsubscription_pkey PRIMARY KEY (id);
6573
17040
 
 
17041
 
6574
17042
ALTER TABLE ONLY teammembership
6575
17043
    ADD CONSTRAINT membership_person_key UNIQUE (person, team);
6576
17044
 
 
17045
 
6577
17046
ALTER TABLE ONLY teammembership
6578
17047
    ADD CONSTRAINT membership_pkey PRIMARY KEY (id);
6579
17048
 
6580
 
ALTER TABLE ONLY mentoringoffer
6581
 
    ADD CONSTRAINT mentoringoffer_pkey PRIMARY KEY (id);
6582
17049
 
6583
17050
ALTER TABLE ONLY mergedirectivejob
6584
17051
    ADD CONSTRAINT mergedirectivejob_job_key UNIQUE (job);
6585
17052
 
 
17053
 
6586
17054
ALTER TABLE ONLY mergedirectivejob
6587
17055
    ADD CONSTRAINT mergedirectivejob_pkey PRIMARY KEY (id);
6588
17056
 
 
17057
 
6589
17058
ALTER TABLE ONLY message
6590
17059
    ADD CONSTRAINT message_pkey PRIMARY KEY (id);
6591
17060
 
 
17061
ALTER TABLE message CLUSTER ON message_pkey;
 
17062
 
 
17063
 
6592
17064
ALTER TABLE ONLY messageapproval
6593
17065
    ADD CONSTRAINT messageapproval_pkey PRIMARY KEY (id);
6594
17066
 
 
17067
 
6595
17068
ALTER TABLE ONLY messagechunk
6596
17069
    ADD CONSTRAINT messagechunk_message_idx UNIQUE (message, sequence);
6597
17070
 
 
17071
 
6598
17072
ALTER TABLE ONLY messagechunk
6599
17073
    ADD CONSTRAINT messagechunk_pkey PRIMARY KEY (id);
6600
17074
 
 
17075
 
6601
17076
ALTER TABLE ONLY milestone
6602
17077
    ADD CONSTRAINT milestone_distribution_id_key UNIQUE (distribution, id);
6603
17078
 
 
17079
 
6604
17080
ALTER TABLE ONLY milestone
6605
17081
    ADD CONSTRAINT milestone_name_distribution_key UNIQUE (name, distribution);
6606
17082
 
 
17083
 
6607
17084
ALTER TABLE ONLY milestone
6608
17085
    ADD CONSTRAINT milestone_name_product_key UNIQUE (name, product);
6609
17086
 
 
17087
 
6610
17088
ALTER TABLE ONLY milestone
6611
17089
    ADD CONSTRAINT milestone_pkey PRIMARY KEY (id);
6612
17090
 
6613
17091
ALTER TABLE milestone CLUSTER ON milestone_pkey;
6614
17092
 
 
17093
 
6615
17094
ALTER TABLE ONLY milestone
6616
17095
    ADD CONSTRAINT milestone_product_id_key UNIQUE (product, id);
6617
17096
 
 
17097
 
6618
17098
ALTER TABLE ONLY mirror
6619
17099
    ADD CONSTRAINT mirror_name_key UNIQUE (name);
6620
17100
 
 
17101
 
6621
17102
ALTER TABLE ONLY mirror
6622
17103
    ADD CONSTRAINT mirror_pkey PRIMARY KEY (id);
6623
17104
 
 
17105
 
6624
17106
ALTER TABLE ONLY mirrorcdimagedistroseries
6625
17107
    ADD CONSTRAINT mirrorcdimagedistrorelease_pkey PRIMARY KEY (id);
6626
17108
 
 
17109
 
6627
17110
ALTER TABLE ONLY mirrorcdimagedistroseries
6628
17111
    ADD CONSTRAINT mirrorcdimagedistroseries__unq UNIQUE (distroseries, flavour, distribution_mirror);
6629
17112
 
 
17113
 
6630
17114
ALTER TABLE ONLY mirrorcontent
6631
17115
    ADD CONSTRAINT mirrorcontent_pkey PRIMARY KEY (id);
6632
17116
 
 
17117
 
6633
17118
ALTER TABLE ONLY mirrordistroarchseries
6634
17119
    ADD CONSTRAINT mirrordistroarchrelease_pkey PRIMARY KEY (id);
6635
17120
 
 
17121
 
6636
17122
ALTER TABLE ONLY mirrordistroseriessource
6637
17123
    ADD CONSTRAINT mirrordistroreleasesource_pkey PRIMARY KEY (id);
6638
17124
 
 
17125
 
6639
17126
ALTER TABLE ONLY mirrorproberecord
6640
17127
    ADD CONSTRAINT mirrorproberecord_pkey PRIMARY KEY (id);
6641
17128
 
 
17129
 
6642
17130
ALTER TABLE ONLY mirrorsourcecontent
6643
17131
    ADD CONSTRAINT mirrorsourcecontent_pkey PRIMARY KEY (id);
6644
17132
 
 
17133
 
6645
17134
ALTER TABLE ONLY nameblacklist
6646
17135
    ADD CONSTRAINT nameblacklist__regexp__key UNIQUE (regexp);
6647
17136
 
 
17137
 
6648
17138
ALTER TABLE ONLY nameblacklist
6649
17139
    ADD CONSTRAINT nameblacklist_pkey PRIMARY KEY (id);
6650
17140
 
 
17141
 
6651
17142
ALTER TABLE ONLY oauthaccesstoken
6652
17143
    ADD CONSTRAINT oauthaccesstoken_key_key UNIQUE (key);
6653
17144
 
 
17145
 
6654
17146
ALTER TABLE ONLY oauthaccesstoken
6655
17147
    ADD CONSTRAINT oauthaccesstoken_pkey PRIMARY KEY (id);
6656
17148
 
 
17149
 
6657
17150
ALTER TABLE ONLY oauthconsumer
6658
17151
    ADD CONSTRAINT oauthconsumer_key_key UNIQUE (key);
6659
17152
 
 
17153
 
6660
17154
ALTER TABLE ONLY oauthconsumer
6661
17155
    ADD CONSTRAINT oauthconsumer_pkey PRIMARY KEY (id);
6662
17156
 
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;
 
17157
 
 
17158
ALTER TABLE ONLY oauthnonce
 
17159
    ADD CONSTRAINT oauthnonce_pkey PRIMARY KEY (access_token, request_timestamp, nonce);
 
17160
 
6670
17161
 
6671
17162
ALTER TABLE ONLY oauthrequesttoken
6672
17163
    ADD CONSTRAINT oauthrequesttoken_key_key UNIQUE (key);
6673
17164
 
 
17165
 
6674
17166
ALTER TABLE ONLY oauthrequesttoken
6675
17167
    ADD CONSTRAINT oauthrequesttoken_pkey PRIMARY KEY (id);
6676
17168
 
 
17169
 
6677
17170
ALTER TABLE ONLY officialbugtag
6678
17171
    ADD CONSTRAINT officialbugtag_pkey PRIMARY KEY (id);
6679
17172
 
6680
 
ALTER TABLE ONLY openidassociation
6681
 
    ADD CONSTRAINT openidassociation_pkey PRIMARY KEY (server_url, handle);
6682
17173
 
6683
17174
ALTER TABLE ONLY openidconsumerassociation
6684
17175
    ADD CONSTRAINT openidconsumerassociation_pkey PRIMARY KEY (server_url, handle);
6685
17176
 
 
17177
 
6686
17178
ALTER TABLE ONLY openidconsumernonce
6687
17179
    ADD CONSTRAINT openidconsumernonce_pkey PRIMARY KEY (server_url, "timestamp", salt);
6688
17180
 
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);
 
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
 
6703
17189
 
6704
17190
ALTER TABLE ONLY packagebuild
6705
17191
    ADD CONSTRAINT packagebuild_pkey PRIMARY KEY (id);
6706
17192
 
 
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
 
6707
17202
ALTER TABLE ONLY packagecopyrequest
6708
17203
    ADD CONSTRAINT packagecopyrequest_pkey PRIMARY KEY (id);
6709
17204
 
 
17205
 
6710
17206
ALTER TABLE ONLY packagediff
6711
17207
    ADD CONSTRAINT packagediff_pkey PRIMARY KEY (id);
6712
17208
 
 
17209
 
6713
17210
ALTER TABLE ONLY packagesetinclusion
6714
17211
    ADD CONSTRAINT packagepayerinclusion__parent__child__key UNIQUE (parent, child);
6715
17212
 
 
17213
 
6716
17214
ALTER TABLE ONLY binarypackagepublishinghistory
6717
17215
    ADD CONSTRAINT packagepublishinghistory_pkey PRIMARY KEY (id);
6718
17216
 
6719
 
ALTER TABLE ONLY packageselection
6720
 
    ADD CONSTRAINT packageselection_pkey PRIMARY KEY (id);
6721
17217
 
6722
17218
ALTER TABLE ONLY packageset
6723
17219
    ADD CONSTRAINT packageset__name__distroseries__key UNIQUE (name, distroseries);
6724
17220
 
 
17221
 
6725
17222
ALTER TABLE ONLY packageset
6726
17223
    ADD CONSTRAINT packageset_pkey PRIMARY KEY (id);
6727
17224
 
 
17225
 
6728
17226
ALTER TABLE ONLY packagesetgroup
6729
17227
    ADD CONSTRAINT packagesetgroup_pkey PRIMARY KEY (id);
6730
17228
 
 
17229
 
6731
17230
ALTER TABLE ONLY packagesetinclusion
6732
17231
    ADD CONSTRAINT packagesetinclusion_pkey PRIMARY KEY (id);
6733
17232
 
 
17233
 
6734
17234
ALTER TABLE ONLY packagesetsources
6735
17235
    ADD CONSTRAINT packagesetsources__packageset__sourcepackagename__key UNIQUE (packageset, sourcepackagename);
6736
17236
 
 
17237
 
6737
17238
ALTER TABLE ONLY packagesetsources
6738
17239
    ADD CONSTRAINT packagesetsources_pkey PRIMARY KEY (id);
6739
17240
 
 
17241
 
6740
17242
ALTER TABLE ONLY packageuploadsource
6741
17243
    ADD CONSTRAINT packageuploadsource__packageupload__key UNIQUE (packageupload);
6742
17244
 
 
17245
 
6743
17246
ALTER TABLE ONLY packaging
6744
17247
    ADD CONSTRAINT packaging__distroseries__sourcepackagename__key UNIQUE (distroseries, sourcepackagename);
6745
17248
 
 
17249
 
6746
17250
ALTER TABLE ONLY packaging
6747
17251
    ADD CONSTRAINT packaging_pkey PRIMARY KEY (id);
6748
17252
 
 
17253
 
 
17254
ALTER TABLE ONLY packagingjob
 
17255
    ADD CONSTRAINT packagingjob_pkey PRIMARY KEY (id);
 
17256
 
 
17257
 
6749
17258
ALTER TABLE ONLY parsedapachelog
6750
17259
    ADD CONSTRAINT parsedapachelog_pkey PRIMARY KEY (id);
6751
17260
 
 
17261
 
6752
17262
ALTER TABLE ONLY person
6753
17263
    ADD CONSTRAINT person__account__key UNIQUE (account);
6754
17264
 
 
17265
 
6755
17266
ALTER TABLE ONLY person
6756
17267
    ADD CONSTRAINT person__name__key UNIQUE (name);
6757
17268
 
 
17269
 
6758
17270
ALTER TABLE ONLY person
6759
17271
    ADD CONSTRAINT person_pkey PRIMARY KEY (id);
6760
17272
 
6761
17273
ALTER TABLE person CLUSTER ON person_pkey;
6762
17274
 
 
17275
 
6763
17276
ALTER TABLE ONLY personlanguage
6764
17277
    ADD CONSTRAINT personlanguage_person_key UNIQUE (person, language);
6765
17278
 
 
17279
 
6766
17280
ALTER TABLE ONLY personlanguage
6767
17281
    ADD CONSTRAINT personlanguage_pkey PRIMARY KEY (id);
6768
17282
 
 
17283
 
6769
17284
ALTER TABLE ONLY personlocation
6770
17285
    ADD CONSTRAINT personlocation_person_key UNIQUE (person);
6771
17286
 
 
17287
 
6772
17288
ALTER TABLE ONLY personlocation
6773
17289
    ADD CONSTRAINT personlocation_pkey PRIMARY KEY (id);
6774
17290
 
 
17291
 
6775
17292
ALTER TABLE ONLY personnotification
6776
17293
    ADD CONSTRAINT personnotification_pkey PRIMARY KEY (id);
6777
17294
 
 
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
 
6778
17308
ALTER TABLE ONLY pillarname
6779
17309
    ADD CONSTRAINT pillarname_name_key UNIQUE (name);
6780
17310
 
 
17311
 
6781
17312
ALTER TABLE ONLY pillarname
6782
17313
    ADD CONSTRAINT pillarname_pkey PRIMARY KEY (id);
6783
17314
 
6784
17315
ALTER TABLE pillarname CLUSTER ON pillarname_pkey;
6785
17316
 
 
17317
 
6786
17318
ALTER TABLE ONLY pocketchroot
6787
17319
    ADD CONSTRAINT pocketchroot_distroarchrelease_key UNIQUE (distroarchseries, pocket);
6788
17320
 
 
17321
 
6789
17322
ALTER TABLE ONLY pocketchroot
6790
17323
    ADD CONSTRAINT pocketchroot_pkey PRIMARY KEY (id);
6791
17324
 
6792
 
ALTER TABLE ONLY pocomment
6793
 
    ADD CONSTRAINT pocomment_pkey PRIMARY KEY (id);
6794
17325
 
6795
17326
ALTER TABLE ONLY poexportrequest
6796
17327
    ADD CONSTRAINT poexportrequest_pkey PRIMARY KEY (id);
6797
17328
 
 
17329
 
6798
17330
ALTER TABLE ONLY pofile
6799
17331
    ADD CONSTRAINT pofile_pkey PRIMARY KEY (id);
6800
17332
 
 
17333
 
 
17334
ALTER TABLE ONLY pofilestatsjob
 
17335
    ADD CONSTRAINT pofilestatsjob_pkey PRIMARY KEY (job);
 
17336
 
 
17337
 
6801
17338
ALTER TABLE ONLY pofiletranslator
6802
17339
    ADD CONSTRAINT pofiletranslator__person__pofile__key UNIQUE (person, pofile);
6803
17340
 
6804
17341
ALTER TABLE pofiletranslator CLUSTER ON pofiletranslator__person__pofile__key;
6805
17342
 
 
17343
 
6806
17344
ALTER TABLE ONLY pofiletranslator
6807
17345
    ADD CONSTRAINT pofiletranslator_pkey PRIMARY KEY (id);
6808
17346
 
 
17347
 
6809
17348
ALTER TABLE ONLY poll
6810
17349
    ADD CONSTRAINT poll_pkey PRIMARY KEY (id);
6811
17350
 
 
17351
 
6812
17352
ALTER TABLE ONLY poll
6813
17353
    ADD CONSTRAINT poll_team_key UNIQUE (team, name);
6814
17354
 
 
17355
 
6815
17356
ALTER TABLE ONLY polloption
6816
17357
    ADD CONSTRAINT polloption_name_key UNIQUE (name, poll);
6817
17358
 
 
17359
 
6818
17360
ALTER TABLE ONLY polloption
6819
17361
    ADD CONSTRAINT polloption_pkey PRIMARY KEY (id);
6820
17362
 
 
17363
 
6821
17364
ALTER TABLE ONLY polloption
6822
17365
    ADD CONSTRAINT polloption_poll_key UNIQUE (poll, id);
6823
17366
 
 
17367
 
6824
17368
ALTER TABLE ONLY pomsgid
6825
17369
    ADD CONSTRAINT pomsgid_pkey PRIMARY KEY (id);
6826
17370
 
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);
6832
17371
 
6833
17372
ALTER TABLE ONLY potemplate
6834
17373
    ADD CONSTRAINT potemplate_pkey PRIMARY KEY (id);
6835
17374
 
 
17375
 
6836
17376
ALTER TABLE ONLY potmsgset
6837
17377
    ADD CONSTRAINT potmsgset_pkey PRIMARY KEY (id);
6838
17378
 
 
17379
 
6839
17380
ALTER TABLE ONLY potranslation
6840
17381
    ADD CONSTRAINT potranslation_pkey PRIMARY KEY (id);
6841
17382
 
 
17383
 
6842
17384
ALTER TABLE ONLY previewdiff
6843
17385
    ADD CONSTRAINT previewdiff_pkey PRIMARY KEY (id);
6844
17386
 
 
17387
 
6845
17388
ALTER TABLE ONLY processor
6846
17389
    ADD CONSTRAINT processor_name_key UNIQUE (name);
6847
17390
 
 
17391
 
6848
17392
ALTER TABLE ONLY processor
6849
17393
    ADD CONSTRAINT processor_pkey PRIMARY KEY (id);
6850
17394
 
 
17395
 
6851
17396
ALTER TABLE ONLY processorfamily
6852
17397
    ADD CONSTRAINT processorfamily_name_key UNIQUE (name);
6853
17398
 
 
17399
 
6854
17400
ALTER TABLE ONLY processorfamily
6855
17401
    ADD CONSTRAINT processorfamily_pkey PRIMARY KEY (id);
6856
17402
 
 
17403
 
6857
17404
ALTER TABLE ONLY product
6858
17405
    ADD CONSTRAINT product_name_key UNIQUE (name);
6859
17406
 
 
17407
ALTER TABLE product CLUSTER ON product_name_key;
 
17408
 
 
17409
 
6860
17410
ALTER TABLE ONLY product
6861
17411
    ADD CONSTRAINT product_pkey PRIMARY KEY (id);
6862
17412
 
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);
6871
17413
 
6872
17414
ALTER TABLE ONLY productlicense
6873
17415
    ADD CONSTRAINT productlicense__product__license__key UNIQUE (product, license);
6874
17416
 
 
17417
 
6875
17418
ALTER TABLE ONLY productlicense
6876
17419
    ADD CONSTRAINT productlicense_pkey PRIMARY KEY (id);
6877
17420
 
 
17421
 
6878
17422
ALTER TABLE ONLY productrelease
6879
17423
    ADD CONSTRAINT productrelease_milestone_key UNIQUE (milestone);
6880
17424
 
 
17425
 
6881
17426
ALTER TABLE ONLY productrelease
6882
17427
    ADD CONSTRAINT productrelease_pkey PRIMARY KEY (id);
6883
17428
 
6884
17429
ALTER TABLE productrelease CLUSTER ON productrelease_pkey;
6885
17430
 
 
17431
 
6886
17432
ALTER TABLE ONLY productreleasefile
6887
17433
    ADD CONSTRAINT productreleasefile_pkey PRIMARY KEY (id);
6888
17434
 
 
17435
 
6889
17436
ALTER TABLE ONLY productseries
6890
17437
    ADD CONSTRAINT productseries__product__name__key UNIQUE (product, name);
6891
17438
 
6892
17439
ALTER TABLE productseries CLUSTER ON productseries__product__name__key;
6893
17440
 
 
17441
 
6894
17442
ALTER TABLE ONLY productseries
6895
17443
    ADD CONSTRAINT productseries_pkey PRIMARY KEY (id);
6896
17444
 
 
17445
 
6897
17446
ALTER TABLE ONLY productseries
6898
17447
    ADD CONSTRAINT productseries_product_series_uniq UNIQUE (product, id);
6899
17448
 
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);
6911
17449
 
6912
17450
ALTER TABLE ONLY project
6913
17451
    ADD CONSTRAINT project_name_key UNIQUE (name);
6914
17452
 
 
17453
 
6915
17454
ALTER TABLE ONLY project
6916
17455
    ADD CONSTRAINT project_pkey PRIMARY KEY (id);
6917
17456
 
6918
17457
ALTER TABLE project CLUSTER ON project_pkey;
6919
17458
 
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);
 
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
 
6943
17471
 
6944
17472
ALTER TABLE ONLY revision
6945
17473
    ADD CONSTRAINT revision__id__revision_date__key UNIQUE (id, revision_date);
6946
17474
 
6947
 
ALTER TABLE ONLY branchrevision
6948
 
    ADD CONSTRAINT revision__revision__branch__key UNIQUE (revision, branch);
6949
17475
 
6950
17476
ALTER TABLE ONLY revision
6951
17477
    ADD CONSTRAINT revision_revision_id_unique UNIQUE (revision_id);
6952
17478
 
 
17479
 
6953
17480
ALTER TABLE ONLY revisioncache
6954
17481
    ADD CONSTRAINT revisioncache_pkey PRIMARY KEY (id);
6955
17482
 
6956
 
ALTER TABLE ONLY branchrevision
6957
 
    ADD CONSTRAINT revisionnumber_branch_id_unique UNIQUE (branch, id);
6958
17483
 
6959
17484
ALTER TABLE ONLY branchrevision
6960
17485
    ADD CONSTRAINT revisionnumber_branch_sequence_unique UNIQUE (branch, sequence);
6961
17486
 
 
17487
 
6962
17488
ALTER TABLE ONLY branchrevision
6963
 
    ADD CONSTRAINT revisionnumber_pkey PRIMARY KEY (id);
 
17489
    ADD CONSTRAINT revisionnumber_pkey PRIMARY KEY (revision, branch);
 
17490
 
6964
17491
 
6965
17492
ALTER TABLE ONLY revisionparent
6966
17493
    ADD CONSTRAINT revisionparent_pkey PRIMARY KEY (id);
6967
17494
 
 
17495
 
6968
17496
ALTER TABLE ONLY revisionparent
6969
17497
    ADD CONSTRAINT revisionparent_unique UNIQUE (revision, parent_id);
6970
17498
 
 
17499
 
6971
17500
ALTER TABLE ONLY revisionproperty
6972
17501
    ADD CONSTRAINT revisionproperty__revision__name__key UNIQUE (revision, name);
6973
17502
 
 
17503
 
6974
17504
ALTER TABLE ONLY revisionproperty
6975
17505
    ADD CONSTRAINT revisionproperty_pkey PRIMARY KEY (id);
6976
17506
 
 
17507
 
6977
17508
ALTER TABLE ONLY scriptactivity
6978
17509
    ADD CONSTRAINT scriptactivity_pkey PRIMARY KEY (id);
6979
17510
 
 
17511
 
6980
17512
ALTER TABLE ONLY section
6981
17513
    ADD CONSTRAINT section_name_key UNIQUE (name);
6982
17514
 
 
17515
 
6983
17516
ALTER TABLE ONLY section
6984
17517
    ADD CONSTRAINT section_pkey PRIMARY KEY (id);
6985
17518
 
 
17519
 
6986
17520
ALTER TABLE ONLY sectionselection
6987
17521
    ADD CONSTRAINT sectionselection_pkey PRIMARY KEY (id);
6988
17522
 
 
17523
 
6989
17524
ALTER TABLE ONLY seriessourcepackagebranch
6990
17525
    ADD CONSTRAINT seriessourcepackagebranch__ds__spn__pocket__key UNIQUE (distroseries, sourcepackagename, pocket);
6991
17526
 
 
17527
 
6992
17528
ALTER TABLE ONLY seriessourcepackagebranch
6993
17529
    ADD CONSTRAINT seriessourcepackagebranch_pkey PRIMARY KEY (id);
6994
17530
 
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);
7033
17531
 
7034
17532
ALTER TABLE ONLY signedcodeofconduct
7035
17533
    ADD CONSTRAINT signedcodeofconduct_pkey PRIMARY KEY (id);
7036
17534
 
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);
7042
17535
 
7043
17536
ALTER TABLE ONLY sourcepackageformatselection
7044
17537
    ADD CONSTRAINT sourceformatselection__distroseries__format__key UNIQUE (distroseries, format);
7045
17538
 
 
17539
 
7046
17540
ALTER TABLE ONLY sourcepackageformatselection
7047
17541
    ADD CONSTRAINT sourcepackageformatselection_pkey PRIMARY KEY (id);
7048
17542
 
 
17543
 
7049
17544
ALTER TABLE ONLY sourcepackagename
7050
17545
    ADD CONSTRAINT sourcepackagename_name_key UNIQUE (name);
7051
17546
 
 
17547
 
7052
17548
ALTER TABLE ONLY sourcepackagename
7053
17549
    ADD CONSTRAINT sourcepackagename_pkey PRIMARY KEY (id);
7054
17550
 
 
17551
 
7055
17552
ALTER TABLE ONLY sourcepackagepublishinghistory
7056
17553
    ADD CONSTRAINT sourcepackagepublishinghistory_pkey PRIMARY KEY (id);
7057
17554
 
 
17555
 
7058
17556
ALTER TABLE ONLY sourcepackagerecipe
7059
17557
    ADD CONSTRAINT sourcepackagerecipe__owner__name__key UNIQUE (owner, name);
7060
17558
 
 
17559
 
7061
17560
ALTER TABLE ONLY sourcepackagerecipedistroseries
7062
17561
    ADD CONSTRAINT sourcepackagerecipe_distroseries_unique UNIQUE (sourcepackagerecipe, distroseries);
7063
17562
 
 
17563
 
7064
17564
ALTER TABLE ONLY sourcepackagerecipe
7065
17565
    ADD CONSTRAINT sourcepackagerecipe_pkey PRIMARY KEY (id);
7066
17566
 
 
17567
 
7067
17568
ALTER TABLE ONLY sourcepackagerecipebuild
7068
17569
    ADD CONSTRAINT sourcepackagerecipebuild_pkey PRIMARY KEY (id);
7069
17570
 
 
17571
 
7070
17572
ALTER TABLE ONLY sourcepackagerecipebuildjob
7071
17573
    ADD CONSTRAINT sourcepackagerecipebuildjob__job__key UNIQUE (job);
7072
17574
 
 
17575
 
7073
17576
ALTER TABLE ONLY sourcepackagerecipebuildjob
7074
17577
    ADD CONSTRAINT sourcepackagerecipebuildjob__sourcepackage_recipe_build__key UNIQUE (sourcepackage_recipe_build);
7075
17578
 
 
17579
 
7076
17580
ALTER TABLE ONLY sourcepackagerecipebuildjob
7077
17581
    ADD CONSTRAINT sourcepackagerecipebuildjob_pkey PRIMARY KEY (id);
7078
17582
 
 
17583
 
7079
17584
ALTER TABLE ONLY sourcepackagerecipedata
7080
17585
    ADD CONSTRAINT sourcepackagerecipedata_pkey PRIMARY KEY (id);
7081
17586
 
 
17587
 
7082
17588
ALTER TABLE ONLY sourcepackagerecipedatainstruction
7083
17589
    ADD CONSTRAINT sourcepackagerecipedatainstruction__name__recipe_data__key UNIQUE (name, recipe_data);
7084
17590
 
 
17591
 
7085
17592
ALTER TABLE ONLY sourcepackagerecipedatainstruction
7086
17593
    ADD CONSTRAINT sourcepackagerecipedatainstruction__recipe_data__line_number__k UNIQUE (recipe_data, line_number);
7087
17594
 
 
17595
 
7088
17596
ALTER TABLE ONLY sourcepackagerecipedatainstruction
7089
17597
    ADD CONSTRAINT sourcepackagerecipedatainstruction_pkey PRIMARY KEY (id);
7090
17598
 
 
17599
 
7091
17600
ALTER TABLE ONLY sourcepackagerecipedistroseries
7092
17601
    ADD CONSTRAINT sourcepackagerecipedistroseries_pkey PRIMARY KEY (id);
7093
17602
 
 
17603
 
7094
17604
ALTER TABLE ONLY sourcepackagerelease
7095
17605
    ADD CONSTRAINT sourcepackagerelease_pkey PRIMARY KEY (id);
7096
17606
 
 
17607
 
7097
17608
ALTER TABLE ONLY sourcepackagereleasefile
7098
17609
    ADD CONSTRAINT sourcepackagereleasefile_pkey PRIMARY KEY (id);
7099
17610
 
 
17611
 
7100
17612
ALTER TABLE ONLY specificationbug
7101
17613
    ADD CONSTRAINT specification_bug_uniq UNIQUE (specification, bug);
7102
17614
 
 
17615
 
7103
17616
ALTER TABLE ONLY specification
7104
17617
    ADD CONSTRAINT specification_distribution_name_uniq UNIQUE (distribution, name);
7105
17618
 
 
17619
 
7106
17620
ALTER TABLE ONLY specification
7107
17621
    ADD CONSTRAINT specification_pkey PRIMARY KEY (id);
7108
17622
 
 
17623
 
7109
17624
ALTER TABLE ONLY specification
7110
17625
    ADD CONSTRAINT specification_product_name_uniq UNIQUE (name, product);
7111
17626
 
 
17627
 
7112
17628
ALTER TABLE ONLY specification
7113
17629
    ADD CONSTRAINT specification_specurl_uniq UNIQUE (specurl);
7114
17630
 
 
17631
 
7115
17632
ALTER TABLE ONLY specificationbranch
7116
17633
    ADD CONSTRAINT specificationbranch__spec_branch_unique UNIQUE (branch, specification);
7117
17634
 
 
17635
 
7118
17636
ALTER TABLE ONLY specificationbranch
7119
17637
    ADD CONSTRAINT specificationbranch_pkey PRIMARY KEY (id);
7120
17638
 
 
17639
 
7121
17640
ALTER TABLE ONLY specificationbug
7122
17641
    ADD CONSTRAINT specificationbug_pkey PRIMARY KEY (id);
7123
17642
 
 
17643
 
7124
17644
ALTER TABLE ONLY specificationdependency
7125
17645
    ADD CONSTRAINT specificationdependency_pkey PRIMARY KEY (id);
7126
17646
 
 
17647
 
7127
17648
ALTER TABLE ONLY specificationdependency
7128
17649
    ADD CONSTRAINT specificationdependency_uniq UNIQUE (specification, dependency);
7129
17650
 
 
17651
 
7130
17652
ALTER TABLE ONLY specificationfeedback
7131
17653
    ADD CONSTRAINT specificationfeedback_pkey PRIMARY KEY (id);
7132
17654
 
 
17655
 
7133
17656
ALTER TABLE ONLY specificationmessage
7134
17657
    ADD CONSTRAINT specificationmessage__specification__message__key UNIQUE (specification, message);
7135
17658
 
 
17659
 
7136
17660
ALTER TABLE ONLY specificationmessage
7137
17661
    ADD CONSTRAINT specificationmessage_pkey PRIMARY KEY (id);
7138
17662
 
 
17663
 
7139
17664
ALTER TABLE ONLY specificationsubscription
7140
17665
    ADD CONSTRAINT specificationsubscription_pkey PRIMARY KEY (id);
7141
17666
 
 
17667
 
7142
17668
ALTER TABLE ONLY specificationsubscription
7143
17669
    ADD CONSTRAINT specificationsubscription_spec_person_uniq UNIQUE (specification, person);
7144
17670
 
 
17671
 
7145
17672
ALTER TABLE ONLY spokenin
7146
17673
    ADD CONSTRAINT spokenin__country__language__key UNIQUE (language, country);
7147
17674
 
 
17675
 
7148
17676
ALTER TABLE ONLY spokenin
7149
17677
    ADD CONSTRAINT spokenin_pkey PRIMARY KEY (id);
7150
17678
 
 
17679
 
7151
17680
ALTER TABLE ONLY sprint
7152
17681
    ADD CONSTRAINT sprint_name_uniq UNIQUE (name);
7153
17682
 
 
17683
 
7154
17684
ALTER TABLE ONLY sprint
7155
17685
    ADD CONSTRAINT sprint_pkey PRIMARY KEY (id);
7156
17686
 
 
17687
 
7157
17688
ALTER TABLE ONLY sprintattendance
7158
17689
    ADD CONSTRAINT sprintattendance_attendance_uniq UNIQUE (attendee, sprint);
7159
17690
 
 
17691
 
7160
17692
ALTER TABLE ONLY sprintattendance
7161
17693
    ADD CONSTRAINT sprintattendance_pkey PRIMARY KEY (id);
7162
17694
 
 
17695
 
7163
17696
ALTER TABLE ONLY sprintspecification
7164
17697
    ADD CONSTRAINT sprintspec_uniq UNIQUE (specification, sprint);
7165
17698
 
 
17699
 
7166
17700
ALTER TABLE ONLY sprintspecification
7167
17701
    ADD CONSTRAINT sprintspecification_pkey PRIMARY KEY (id);
7168
17702
 
 
17703
 
7169
17704
ALTER TABLE ONLY sshkey
7170
17705
    ADD CONSTRAINT sshkey_pkey PRIMARY KEY (id);
7171
17706
 
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);
7183
17707
 
7184
17708
ALTER TABLE ONLY structuralsubscription
7185
17709
    ADD CONSTRAINT structuralsubscription_pkey PRIMARY KEY (id);
7186
17710
 
 
17711
 
 
17712
ALTER TABLE ONLY subunitstream
 
17713
    ADD CONSTRAINT subunitstream_pkey PRIMARY KEY (id);
 
17714
 
 
17715
 
7187
17716
ALTER TABLE ONLY suggestivepotemplate
7188
17717
    ADD CONSTRAINT suggestivepotemplate_pkey PRIMARY KEY (potemplate);
7189
17718
 
 
17719
 
7190
17720
ALTER TABLE ONLY answercontact
7191
17721
    ADD CONSTRAINT supportcontact__distribution__sourcepackagename__person__key UNIQUE (distribution, sourcepackagename, person);
7192
17722
 
 
17723
 
7193
17724
ALTER TABLE ONLY answercontact
7194
17725
    ADD CONSTRAINT supportcontact__product__person__key UNIQUE (product, person);
7195
17726
 
 
17727
 
7196
17728
ALTER TABLE ONLY answercontact
7197
17729
    ADD CONSTRAINT supportcontact_pkey PRIMARY KEY (id);
7198
17730
 
 
17731
 
7199
17732
ALTER TABLE ONLY teamparticipation
7200
17733
    ADD CONSTRAINT teamparticipation_pkey PRIMARY KEY (id);
7201
17734
 
 
17735
 
7202
17736
ALTER TABLE ONLY teamparticipation
7203
17737
    ADD CONSTRAINT teamparticipation_team_key UNIQUE (team, person);
7204
17738
 
 
17739
 
7205
17740
ALTER TABLE ONLY temporaryblobstorage
7206
17741
    ADD CONSTRAINT temporaryblobstorage_file_alias_key UNIQUE (file_alias);
7207
17742
 
 
17743
 
7208
17744
ALTER TABLE ONLY temporaryblobstorage
7209
17745
    ADD CONSTRAINT temporaryblobstorage_pkey PRIMARY KEY (id);
7210
17746
 
7211
17747
ALTER TABLE temporaryblobstorage CLUSTER ON temporaryblobstorage_pkey;
7212
17748
 
 
17749
 
7213
17750
ALTER TABLE ONLY temporaryblobstorage
7214
17751
    ADD CONSTRAINT temporaryblobstorage_uuid_key UNIQUE (uuid);
7215
17752
 
 
17753
 
7216
17754
ALTER TABLE ONLY question
7217
17755
    ADD CONSTRAINT ticket_pkey PRIMARY KEY (id);
7218
17756
 
 
17757
 
7219
17758
ALTER TABLE ONLY questionbug
7220
17759
    ADD CONSTRAINT ticketbug_bug_ticket_uniq UNIQUE (bug, question);
7221
17760
 
 
17761
 
7222
17762
ALTER TABLE ONLY questionbug
7223
17763
    ADD CONSTRAINT ticketbug_pkey PRIMARY KEY (id);
7224
17764
 
 
17765
 
7225
17766
ALTER TABLE ONLY questionmessage
7226
17767
    ADD CONSTRAINT ticketmessage_message_ticket_uniq UNIQUE (message, question);
7227
17768
 
 
17769
 
7228
17770
ALTER TABLE ONLY questionmessage
7229
17771
    ADD CONSTRAINT ticketmessage_pkey PRIMARY KEY (id);
7230
17772
 
 
17773
 
7231
17774
ALTER TABLE ONLY questionreopening
7232
17775
    ADD CONSTRAINT ticketreopening_pkey PRIMARY KEY (id);
7233
17776
 
 
17777
 
7234
17778
ALTER TABLE ONLY questionsubscription
7235
17779
    ADD CONSTRAINT ticketsubscription_pkey PRIMARY KEY (id);
7236
17780
 
 
17781
 
7237
17782
ALTER TABLE ONLY questionsubscription
7238
17783
    ADD CONSTRAINT ticketsubscription_ticket_person_uniq UNIQUE (question, person);
7239
17784
 
 
17785
 
7240
17786
ALTER TABLE ONLY translator
7241
17787
    ADD CONSTRAINT translation_translationgroup_key UNIQUE (translationgroup, language);
7242
17788
 
 
17789
 
7243
17790
ALTER TABLE ONLY translationgroup
7244
17791
    ADD CONSTRAINT translationgroup_name_key UNIQUE (name);
7245
17792
 
 
17793
 
7246
17794
ALTER TABLE ONLY translationgroup
7247
17795
    ADD CONSTRAINT translationgroup_pkey PRIMARY KEY (id);
7248
17796
 
 
17797
 
7249
17798
ALTER TABLE ONLY translationimportqueueentry
7250
17799
    ADD CONSTRAINT translationimportqueueentry_pkey PRIMARY KEY (id);
7251
17800
 
 
17801
 
7252
17802
ALTER TABLE ONLY translationmessage
7253
17803
    ADD CONSTRAINT translationmessage_pkey PRIMARY KEY (id);
7254
17804
 
 
17805
 
7255
17806
ALTER TABLE ONLY translationrelicensingagreement
7256
17807
    ADD CONSTRAINT translationrelicensingagreement__person__key UNIQUE (person);
7257
17808
 
 
17809
 
7258
17810
ALTER TABLE ONLY translationrelicensingagreement
7259
17811
    ADD CONSTRAINT translationrelicensingagreement_pkey PRIMARY KEY (id);
7260
17812
 
 
17813
 
7261
17814
ALTER TABLE ONLY translationtemplateitem
7262
17815
    ADD CONSTRAINT translationtemplateitem_pkey PRIMARY KEY (id);
7263
17816
 
 
17817
 
 
17818
ALTER TABLE ONLY translationtemplatesbuild
 
17819
    ADD CONSTRAINT translationtemplatesbuild_pkey PRIMARY KEY (id);
 
17820
 
 
17821
 
7264
17822
ALTER TABLE ONLY translator
7265
17823
    ADD CONSTRAINT translator_pkey PRIMARY KEY (id);
7266
17824
 
 
17825
 
7267
17826
ALTER TABLE ONLY specificationfeedback
7268
17827
    ADD CONSTRAINT unique_spec_requestor_provider UNIQUE (specification, requester, reviewer);
7269
17828
 
 
17829
 
7270
17830
ALTER TABLE ONLY usertouseremail
7271
17831
    ADD CONSTRAINT usertouseremail_pkey PRIMARY KEY (id);
7272
17832
 
 
17833
 
7273
17834
ALTER TABLE ONLY vote
7274
17835
    ADD CONSTRAINT vote_pkey PRIMARY KEY (id);
7275
17836
 
 
17837
 
7276
17838
ALTER TABLE ONLY votecast
7277
17839
    ADD CONSTRAINT votecast_person_key UNIQUE (person, poll);
7278
17840
 
 
17841
 
7279
17842
ALTER TABLE ONLY votecast
7280
17843
    ADD CONSTRAINT votecast_pkey PRIMARY KEY (id);
7281
17844
 
7282
 
ALTER TABLE ONLY webserviceban
7283
 
    ADD CONSTRAINT webserviceban_pkey PRIMARY KEY (id);
7284
17845
 
7285
17846
ALTER TABLE ONLY wikiname
7286
17847
    ADD CONSTRAINT wikiname_pkey PRIMARY KEY (id);
7287
17848
 
 
17849
 
7288
17850
ALTER TABLE ONLY wikiname
7289
17851
    ADD CONSTRAINT wikiname_wikiname_key UNIQUE (wikiname, wiki);
7290
17852
 
7291
 
CREATE INDEX account__old_openid_identifier__idx ON account USING btree (old_openid_identifier);
 
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
 
7292
17880
 
7293
17881
CREATE INDEX announcement__distribution__active__idx ON announcement USING btree (distribution, active) WHERE (distribution IS NOT NULL);
7294
17882
 
 
17883
 
7295
17884
CREATE INDEX announcement__product__active__idx ON announcement USING btree (product, active) WHERE (product IS NOT NULL);
7296
17885
 
 
17886
 
7297
17887
CREATE INDEX announcement__project__active__idx ON announcement USING btree (project, active) WHERE (project IS NOT NULL);
7298
17888
 
 
17889
 
7299
17890
CREATE INDEX announcement__registrant__idx ON announcement USING btree (registrant);
7300
17891
 
 
17892
 
7301
17893
CREATE UNIQUE INDEX answercontact__distribution__person__key ON answercontact USING btree (distribution, person) WHERE (sourcepackagename IS NULL);
7302
17894
 
 
17895
 
7303
17896
CREATE INDEX answercontact__person__idx ON answercontact USING btree (person);
7304
17897
 
 
17898
 
7305
17899
CREATE INDEX apportjob__blob__idx ON apportjob USING btree (blob);
7306
17900
 
7307
 
CREATE INDEX archive__commercial__idx ON archive USING btree (commercial);
7308
17901
 
7309
17902
CREATE UNIQUE INDEX archive__distribution__purpose__key ON archive USING btree (distribution, purpose) WHERE (purpose = ANY (ARRAY[1, 4]));
7310
17903
 
 
17904
 
7311
17905
CREATE INDEX archive__owner__idx ON archive USING btree (owner);
7312
17906
 
 
17907
 
7313
17908
CREATE UNIQUE INDEX archive__owner__key ON archive USING btree (owner, distribution, name);
7314
17909
 
 
17910
 
7315
17911
CREATE INDEX archive__require_virtualized__idx ON archive USING btree (require_virtualized);
7316
17912
 
 
17913
 
7317
17914
CREATE INDEX archive__signing_key__idx ON archive USING btree (signing_key) WHERE (signing_key IS NOT NULL);
7318
17915
 
 
17916
 
7319
17917
CREATE INDEX archive__status__idx ON archive USING btree (status);
7320
17918
 
7321
 
CREATE INDEX archive_fti ON archive USING gist (fti ts2.gist_tsvector_ops);
 
17919
 
 
17920
CREATE INDEX archive_fti ON archive USING gist (fti);
 
17921
 
7322
17922
 
7323
17923
CREATE INDEX archiveauthtoken__archive__idx ON archiveauthtoken USING btree (archive);
7324
17924
 
 
17925
 
7325
17926
CREATE INDEX archiveauthtoken__date_created__idx ON archiveauthtoken USING btree (date_created);
7326
17927
 
 
17928
 
7327
17929
CREATE INDEX archiveauthtoken__person__idx ON archiveauthtoken USING btree (person);
7328
17930
 
 
17931
 
7329
17932
CREATE INDEX archivedependency__archive__idx ON archivedependency USING btree (archive);
7330
17933
 
 
17934
 
7331
17935
CREATE INDEX archivedependency__component__idx ON archivedependency USING btree (component);
7332
17936
 
 
17937
 
7333
17938
CREATE INDEX archivedependency__dependency__idx ON archivedependency USING btree (dependency);
7334
17939
 
 
17940
 
7335
17941
CREATE INDEX archivejob__archive__job_type__idx ON archivejob USING btree (archive, job_type);
7336
17942
 
 
17943
 
7337
17944
CREATE INDEX archivepermission__archive__component__permission__idx ON archivepermission USING btree (archive, component, permission);
7338
17945
 
 
17946
 
7339
17947
CREATE INDEX archivepermission__archive__sourcepackagename__permission__idx ON archivepermission USING btree (archive, sourcepackagename, permission);
7340
17948
 
 
17949
 
7341
17950
CREATE INDEX archivepermission__packageset__idx ON archivepermission USING btree (packageset) WHERE (packageset IS NOT NULL);
7342
17951
 
 
17952
 
7343
17953
CREATE INDEX archivepermission__person__archive__idx ON archivepermission USING btree (person, archive);
7344
17954
 
 
17955
 
7345
17956
CREATE INDEX archivesubscriber__archive__idx ON archivesubscriber USING btree (archive);
7346
17957
 
 
17958
 
7347
17959
CREATE INDEX archivesubscriber__cancelled_by__idx ON archivesubscriber USING btree (cancelled_by) WHERE (cancelled_by IS NOT NULL);
7348
17960
 
 
17961
 
7349
17962
CREATE INDEX archivesubscriber__date_created__idx ON archivesubscriber USING btree (date_created);
7350
17963
 
 
17964
 
7351
17965
CREATE INDEX archivesubscriber__date_expires__idx ON archivesubscriber USING btree (date_expires) WHERE (date_expires IS NOT NULL);
7352
17966
 
 
17967
 
7353
17968
CREATE INDEX archivesubscriber__registrant__idx ON archivesubscriber USING btree (registrant);
7354
17969
 
 
17970
 
7355
17971
CREATE INDEX archivesubscriber__subscriber__idx ON archivesubscriber USING btree (subscriber);
7356
17972
 
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);
7362
17973
 
7363
17974
CREATE INDEX binarypackagebuild__distro_arch_series__idx ON binarypackagebuild USING btree (distro_arch_series);
7364
17975
 
 
17976
 
7365
17977
CREATE UNIQUE INDEX binarypackagebuild__package_build__idx ON binarypackagebuild USING btree (package_build);
7366
17978
 
 
17979
 
7367
17980
CREATE INDEX binarypackagebuild__source_package_release_idx ON binarypackagebuild USING btree (source_package_release);
7368
17981
 
 
17982
 
7369
17983
CREATE INDEX binarypackagefile_binarypackage_idx ON binarypackagefile USING btree (binarypackagerelease);
7370
17984
 
 
17985
 
7371
17986
CREATE INDEX binarypackagefile_libraryfile_idx ON binarypackagefile USING btree (libraryfile);
7372
17987
 
 
17988
 
 
17989
CREATE INDEX binarypackagepublishinghistory__binarypackagename__idx ON binarypackagepublishinghistory USING btree (binarypackagename);
 
17990
 
 
17991
 
7373
17992
CREATE UNIQUE INDEX binarypackagerelease__debug_package__key ON binarypackagerelease USING btree (debug_package);
7374
17993
 
 
17994
 
 
17995
CREATE INDEX binarypackagerelease__version__idx ON binarypackagerelease USING btree (version);
 
17996
 
 
17997
 
7375
17998
CREATE INDEX binarypackagerelease_build_idx ON binarypackagerelease USING btree (build);
7376
17999
 
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);
 
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
 
7392
18006
 
7393
18007
CREATE INDEX branch__date_created__idx ON branch USING btree (date_created);
7394
18008
 
 
18009
 
7395
18010
CREATE UNIQUE INDEX branch__ds__spn__owner__name__key ON branch USING btree (distroseries, sourcepackagename, owner, name) WHERE (distroseries IS NOT NULL);
7396
18011
 
 
18012
 
7397
18013
CREATE INDEX branch__last_scanned__owner__idx ON branch USING btree (last_scanned, owner) WHERE (last_scanned IS NOT NULL);
7398
18014
 
 
18015
 
 
18016
CREATE INDEX branch__merge_queue__idx ON branch USING btree (merge_queue);
 
18017
 
 
18018
 
7399
18019
CREATE INDEX branch__next_mirror_time__idx ON branch USING btree (next_mirror_time) WHERE (next_mirror_time IS NOT NULL);
7400
18020
 
 
18021
 
7401
18022
CREATE UNIQUE INDEX branch__owner__name__key ON branch USING btree (owner, name) WHERE ((product IS NULL) AND (distroseries IS NULL));
7402
18023
 
 
18024
 
7403
18025
CREATE INDEX branch__owner_name__idx ON branch USING btree (owner_name);
7404
18026
 
 
18027
 
7405
18028
CREATE INDEX branch__private__idx ON branch USING btree (private);
7406
18029
 
 
18030
 
7407
18031
CREATE INDEX branch__product__id__idx ON branch USING btree (product, id);
7408
18032
 
7409
18033
ALTER TABLE branch CLUSTER ON branch__product__id__idx;
7410
18034
 
 
18035
 
7411
18036
CREATE UNIQUE INDEX branch__product__owner__name__key ON branch USING btree (product, owner, name) WHERE (product IS NOT NULL);
7412
18037
 
 
18038
 
7413
18039
CREATE INDEX branch__registrant__idx ON branch USING btree (registrant);
7414
18040
 
 
18041
 
7415
18042
CREATE INDEX branch__reviewer__idx ON branch USING btree (reviewer);
7416
18043
 
 
18044
 
7417
18045
CREATE INDEX branch__stacked_on__idx ON branch USING btree (stacked_on) WHERE (stacked_on IS NOT NULL);
7418
18046
 
 
18047
 
7419
18048
CREATE INDEX branch__target_suffix__idx ON branch USING btree (target_suffix);
7420
18049
 
 
18050
 
 
18051
CREATE INDEX branch__transitively_private__idx ON branch USING btree (transitively_private);
 
18052
 
 
18053
 
7421
18054
CREATE INDEX branch_author_idx ON branch USING btree (author);
7422
18055
 
 
18056
 
7423
18057
CREATE INDEX branch_owner_idx ON branch USING btree (owner);
7424
18058
 
 
18059
 
7425
18060
CREATE INDEX branchjob__branch__idx ON branchjob USING btree (branch);
7426
18061
 
 
18062
 
7427
18063
CREATE INDEX branchmergeproposal__dependent_branch__idx ON branchmergeproposal USING btree (dependent_branch);
7428
18064
 
 
18065
 
7429
18066
CREATE INDEX branchmergeproposal__merge_diff__idx ON branchmergeproposal USING btree (merge_diff);
7430
18067
 
 
18068
 
7431
18069
CREATE INDEX branchmergeproposal__merge_log_file__idx ON branchmergeproposal USING btree (merge_log_file);
7432
18070
 
 
18071
 
7433
18072
CREATE INDEX branchmergeproposal__merge_reporter__idx ON branchmergeproposal USING btree (merge_reporter) WHERE (merge_reporter IS NOT NULL);
7434
18073
 
 
18074
 
7435
18075
CREATE INDEX branchmergeproposal__merger__idx ON branchmergeproposal USING btree (merger);
7436
18076
 
 
18077
 
7437
18078
CREATE INDEX branchmergeproposal__queuer__idx ON branchmergeproposal USING btree (queuer);
7438
18079
 
 
18080
 
7439
18081
CREATE INDEX branchmergeproposal__registrant__idx ON branchmergeproposal USING btree (registrant);
7440
18082
 
7441
 
CREATE INDEX branchmergeproposal__review_diff__idx ON branchmergeproposal USING btree (review_diff);
7442
18083
 
7443
18084
CREATE INDEX branchmergeproposal__reviewer__idx ON branchmergeproposal USING btree (reviewer);
7444
18085
 
 
18086
 
7445
18087
CREATE INDEX branchmergeproposal__source_branch__idx ON branchmergeproposal USING btree (source_branch);
7446
18088
 
 
18089
 
7447
18090
CREATE INDEX branchmergeproposal__superseded_by__idx ON branchmergeproposal USING btree (superseded_by) WHERE (superseded_by IS NOT NULL);
7448
18091
 
 
18092
 
7449
18093
CREATE INDEX branchmergeproposal__target_branch__idx ON branchmergeproposal USING btree (target_branch);
7450
18094
 
 
18095
 
7451
18096
CREATE INDEX branchmergeproposaljob__branch_merge_proposal__idx ON branchmergeproposaljob USING btree (branch_merge_proposal);
7452
18097
 
7453
 
CREATE INDEX branchmergerobot__owner__idx ON branchmergerobot USING btree (owner);
7454
 
 
7455
 
CREATE INDEX branchmergerobot__registrant__idx ON branchmergerobot USING btree (registrant);
 
18098
 
 
18099
CREATE INDEX branchmergequeue__registrant__idx ON branchmergequeue USING btree (registrant);
 
18100
 
7456
18101
 
7457
18102
CREATE INDEX branchsubscription__branch__idx ON branchsubscription USING btree (branch);
7458
18103
 
 
18104
 
7459
18105
CREATE INDEX branchsubscription__subscribed_by__idx ON branchsubscription USING btree (subscribed_by);
7460
18106
 
 
18107
 
7461
18108
CREATE INDEX branchvisibilitypolicy__product__idx ON branchvisibilitypolicy USING btree (product) WHERE (product IS NOT NULL);
7462
18109
 
 
18110
 
7463
18111
CREATE INDEX branchvisibilitypolicy__project__idx ON branchvisibilitypolicy USING btree (project) WHERE (project IS NOT NULL);
7464
18112
 
 
18113
 
7465
18114
CREATE INDEX branchvisibilitypolicy__team__idx ON branchvisibilitypolicy USING btree (team) WHERE (team IS NOT NULL);
7466
18115
 
 
18116
 
7467
18117
CREATE UNIQUE INDEX branchvisibilitypolicy__unq ON branchvisibilitypolicy USING btree ((COALESCE(product, (-1))), (COALESCE(project, (-1))), (COALESCE(team, (-1))));
7468
18118
 
 
18119
 
 
18120
CREATE INDEX bug__access_policy__idx ON bug USING btree (access_policy);
 
18121
 
 
18122
 
7469
18123
CREATE INDEX bug__date_last_message__idx ON bug USING btree (date_last_message);
7470
18124
 
 
18125
 
7471
18126
CREATE INDEX bug__date_last_updated__idx ON bug USING btree (date_last_updated);
7472
18127
 
7473
18128
ALTER TABLE bug CLUSTER ON bug__date_last_updated__idx;
7474
18129
 
 
18130
 
7475
18131
CREATE INDEX bug__datecreated__idx ON bug USING btree (datecreated);
7476
18132
 
 
18133
 
7477
18134
CREATE INDEX bug__heat__idx ON bug USING btree (heat);
7478
18135
 
 
18136
 
7479
18137
CREATE INDEX bug__heat_last_updated__idx ON bug USING btree (heat_last_updated);
7480
18138
 
 
18139
 
7481
18140
CREATE INDEX bug__latest_patch_uploaded__idx ON bug USING btree (latest_patch_uploaded);
7482
18141
 
 
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
 
7483
18149
CREATE INDEX bug__users_affected_count__idx ON bug USING btree (users_affected_count);
7484
18150
 
 
18151
 
7485
18152
CREATE INDEX bug__users_unaffected_count__idx ON bug USING btree (users_unaffected_count);
7486
18153
 
 
18154
 
7487
18155
CREATE INDEX bug__who_made_private__idx ON bug USING btree (who_made_private) WHERE (who_made_private IS NOT NULL);
7488
18156
 
 
18157
 
7489
18158
CREATE INDEX bug_duplicateof_idx ON bug USING btree (duplicateof);
7490
18159
 
 
18160
 
7491
18161
CREATE INDEX bug_fti ON bug USING gist (fti);
7492
18162
 
 
18163
 
7493
18164
CREATE INDEX bug_owner_idx ON bug USING btree (owner);
7494
18165
 
 
18166
 
7495
18167
CREATE INDEX bugactivity_bug_datechanged_idx ON bugactivity USING btree (bug, datechanged);
7496
18168
 
 
18169
 
7497
18170
CREATE INDEX bugactivity_datechanged_idx ON bugactivity USING btree (datechanged);
7498
18171
 
 
18172
 
7499
18173
CREATE INDEX bugactivity_person_datechanged_idx ON bugactivity USING btree (person, datechanged);
7500
18174
 
 
18175
 
7501
18176
CREATE INDEX bugaffectsperson__person__idx ON bugaffectsperson USING btree (person);
7502
18177
 
 
18178
 
7503
18179
CREATE INDEX bugattachment__bug__idx ON bugattachment USING btree (bug);
7504
18180
 
 
18181
 
7505
18182
CREATE INDEX bugattachment_libraryfile_idx ON bugattachment USING btree (libraryfile);
7506
18183
 
 
18184
 
7507
18185
CREATE INDEX bugattachment_message_idx ON bugattachment USING btree (message);
7508
18186
 
 
18187
 
7509
18188
CREATE INDEX bugbranch__registrant__idx ON bugbranch USING btree (registrant);
7510
18189
 
 
18190
 
7511
18191
CREATE INDEX bugcve_cve_index ON bugcve USING btree (cve);
7512
18192
 
 
18193
 
7513
18194
CREATE INDEX bugjob__bug__job_type__idx ON bugjob USING btree (bug, job_type);
7514
18195
 
 
18196
 
 
18197
CREATE INDEX bugmessage__owner__index__idx ON bugmessage USING btree (owner, index);
 
18198
 
 
18199
 
7515
18200
CREATE INDEX bugmessage_message_idx ON bugmessage USING btree (message);
7516
18201
 
 
18202
 
 
18203
CREATE INDEX bugmute__bug__idx ON bugmute USING btree (bug);
 
18204
 
 
18205
 
7517
18206
CREATE INDEX bugnomination__bug__idx ON bugnomination USING btree (bug);
7518
18207
 
 
18208
 
7519
18209
CREATE INDEX bugnomination__decider__idx ON bugnomination USING btree (decider) WHERE (decider IS NOT NULL);
7520
18210
 
 
18211
 
7521
18212
CREATE UNIQUE INDEX bugnomination__distroseries__bug__key ON bugnomination USING btree (distroseries, bug) WHERE (distroseries IS NOT NULL);
7522
18213
 
 
18214
 
7523
18215
CREATE INDEX bugnomination__owner__idx ON bugnomination USING btree (owner);
7524
18216
 
 
18217
 
7525
18218
CREATE UNIQUE INDEX bugnomination__productseries__bug__key ON bugnomination USING btree (productseries, bug) WHERE (productseries IS NOT NULL);
7526
18219
 
 
18220
 
7527
18221
CREATE INDEX bugnotification__date_emailed__idx ON bugnotification USING btree (date_emailed);
7528
18222
 
 
18223
ALTER TABLE bugnotification CLUSTER ON bugnotification__date_emailed__idx;
 
18224
 
 
18225
 
7529
18226
CREATE INDEX bugnotificationattachment__bug_notification__idx ON bugnotificationattachment USING btree (bug_notification);
7530
18227
 
 
18228
 
7531
18229
CREATE INDEX bugnotificationattachment__message__idx ON bugnotificationattachment USING btree (message);
7532
18230
 
 
18231
 
 
18232
CREATE INDEX bugnotificationfilter__bug_subscription_filter__idx ON bugnotificationfilter USING btree (bug_subscription_filter);
 
18233
 
 
18234
 
7533
18235
CREATE INDEX bugnotificationrecipient__person__idx ON bugnotificationrecipient USING btree (person);
7534
18236
 
 
18237
 
7535
18238
CREATE INDEX bugnotificationrecipientarchive__bug_notification__idx ON bugnotificationrecipientarchive USING btree (bug_notification);
7536
18239
 
 
18240
 
7537
18241
CREATE INDEX bugnotificationrecipientarchive__person__idx ON bugnotificationrecipientarchive USING btree (person);
7538
18242
 
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);
7550
18243
 
7551
18244
CREATE INDEX bugsubscription__subscribed_by__idx ON bugsubscription USING btree (subscribed_by);
7552
18245
 
 
18246
 
7553
18247
CREATE INDEX bugsubscription_bug_idx ON bugsubscription USING btree (bug);
7554
18248
 
7555
18249
ALTER TABLE bugsubscription CLUSTER ON bugsubscription_bug_idx;
7556
18250
 
 
18251
 
7557
18252
CREATE INDEX bugsubscription_person_idx ON bugsubscription USING btree (person);
7558
18253
 
 
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
 
7559
18330
CREATE INDEX bugtag__bug__idx ON bugtag USING btree (bug);
7560
18331
 
 
18332
 
7561
18333
CREATE INDEX bugtask__assignee__idx ON bugtask USING btree (assignee);
7562
18334
 
 
18335
 
7563
18336
CREATE INDEX bugtask__binarypackagename__idx ON bugtask USING btree (binarypackagename) WHERE (binarypackagename IS NOT NULL);
7564
18337
 
 
18338
 
7565
18339
CREATE INDEX bugtask__bug__idx ON bugtask USING btree (bug);
7566
18340
 
 
18341
 
7567
18342
CREATE INDEX bugtask__bugwatch__idx ON bugtask USING btree (bugwatch) WHERE (bugwatch IS NOT NULL);
7568
18343
 
7569
 
CREATE UNIQUE INDEX bugtask__date_closed__id__idx ON bugtask USING btree (date_closed, id) WHERE (status = 30);
 
18344
 
 
18345
CREATE INDEX bugtask__date_closed__id__idx2 ON bugtask USING btree (date_closed, id DESC);
 
18346
 
7570
18347
 
7571
18348
CREATE INDEX bugtask__date_incomplete__idx ON bugtask USING btree (date_incomplete) WHERE (date_incomplete IS NOT NULL);
7572
18349
 
 
18350
 
7573
18351
CREATE INDEX bugtask__datecreated__idx ON bugtask USING btree (datecreated);
7574
18352
 
 
18353
 
 
18354
CREATE INDEX bugtask__distribution__heat__id__idx ON bugtask USING btree (distribution, heat DESC, id) WHERE (distribution IS NOT NULL);
 
18355
 
 
18356
 
7575
18357
CREATE INDEX bugtask__distribution__sourcepackagename__idx ON bugtask USING btree (distribution, sourcepackagename);
7576
18358
 
7577
18359
ALTER TABLE bugtask CLUSTER ON bugtask__distribution__sourcepackagename__idx;
7578
18360
 
 
18361
 
 
18362
CREATE INDEX bugtask__distribution_sourcepackage__heat__idx ON bugtask USING btree (distribution, sourcepackagename, heat) WHERE (distribution IS NOT NULL);
 
18363
 
 
18364
 
7579
18365
CREATE INDEX bugtask__distroseries__sourcepackagename__idx ON bugtask USING btree (distroseries, sourcepackagename);
7580
18366
 
 
18367
 
 
18368
CREATE INDEX bugtask__distroseries_sourcepackage__heat__idx ON bugtask USING btree (distroseries, sourcepackagename, heat) WHERE (distroseries IS NOT NULL);
 
18369
 
 
18370
 
7581
18371
CREATE INDEX bugtask__milestone__idx ON bugtask USING btree (milestone);
7582
18372
 
 
18373
 
7583
18374
CREATE INDEX bugtask__owner__idx ON bugtask USING btree (owner);
7584
18375
 
 
18376
 
7585
18377
CREATE UNIQUE INDEX bugtask__product__bug__key ON bugtask USING btree (product, bug) WHERE (product IS NOT NULL);
7586
18378
 
 
18379
 
 
18380
CREATE INDEX bugtask__product__heat__id__idx ON bugtask USING btree (product, heat DESC, id) WHERE (product IS NOT NULL);
 
18381
 
 
18382
 
7587
18383
CREATE UNIQUE INDEX bugtask__productseries__bug__key ON bugtask USING btree (productseries, bug) WHERE (productseries IS NOT NULL);
7588
18384
 
 
18385
 
 
18386
CREATE INDEX bugtask__productseries__heat__idx ON bugtask USING btree (productseries, heat) WHERE (productseries IS NOT NULL);
 
18387
 
 
18388
 
7589
18389
CREATE INDEX bugtask__sourcepackagename__idx ON bugtask USING btree (sourcepackagename) WHERE (sourcepackagename IS NOT NULL);
7590
18390
 
 
18391
 
7591
18392
CREATE INDEX bugtask__status__idx ON bugtask USING btree (status);
7592
18393
 
 
18394
 
7593
18395
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));
7594
18396
 
7595
 
CREATE INDEX bugtask_fti ON bugtask USING gist (fti ts2.gist_tsvector_ops);
 
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
 
7596
18403
 
7597
18404
CREATE UNIQUE INDEX bugtracker_name_key ON bugtracker USING btree (name);
7598
18405
 
 
18406
 
7599
18407
CREATE INDEX bugtracker_owner_idx ON bugtracker USING btree (owner);
7600
18408
 
 
18409
 
7601
18410
CREATE INDEX bugtrackeralias__bugtracker__idx ON bugtrackeralias USING btree (bugtracker);
7602
18411
 
 
18412
 
7603
18413
CREATE INDEX bugtrackerperson__person__idx ON bugtrackerperson USING btree (person);
7604
18414
 
 
18415
 
7605
18416
CREATE INDEX bugwatch__lastchecked__idx ON bugwatch USING btree (lastchecked);
7606
18417
 
 
18418
 
7607
18419
CREATE INDEX bugwatch__next_check__idx ON bugwatch USING btree (next_check);
7608
18420
 
 
18421
 
7609
18422
CREATE INDEX bugwatch__remote_lp_bug_id__idx ON bugwatch USING btree (remote_lp_bug_id) WHERE (remote_lp_bug_id IS NOT NULL);
7610
18423
 
 
18424
 
7611
18425
CREATE INDEX bugwatch__remotebug__idx ON bugwatch USING btree (remotebug);
7612
18426
 
 
18427
 
7613
18428
CREATE INDEX bugwatch_bug_idx ON bugwatch USING btree (bug);
7614
18429
 
 
18430
 
7615
18431
CREATE INDEX bugwatch_bugtracker_idx ON bugwatch USING btree (bugtracker);
7616
18432
 
 
18433
 
7617
18434
CREATE INDEX bugwatch_datecreated_idx ON bugwatch USING btree (datecreated);
7618
18435
 
 
18436
 
7619
18437
CREATE INDEX bugwatch_owner_idx ON bugwatch USING btree (owner);
7620
18438
 
 
18439
 
7621
18440
CREATE INDEX bugwatchactivity__bug_watch__idx ON bugwatchactivity USING btree (bug_watch);
7622
18441
 
7623
18442
ALTER TABLE bugwatchactivity CLUSTER ON bugwatchactivity__bug_watch__idx;
7624
18443
 
7625
 
CREATE INDEX bugwatchactivity__date__idx ON bugwatchactivity USING btree (activity_date);
7626
18444
 
7627
18445
CREATE INDEX builder__owner__idx ON builder USING btree (owner);
7628
18446
 
 
18447
 
7629
18448
CREATE INDEX buildfarmjob__builder_and_status__idx ON buildfarmjob USING btree (builder, status);
7630
18449
 
 
18450
 
7631
18451
CREATE INDEX buildfarmjob__date_created__idx ON buildfarmjob USING btree (date_created);
7632
18452
 
 
18453
 
7633
18454
CREATE INDEX buildfarmjob__date_finished__idx ON buildfarmjob USING btree (date_finished);
7634
18455
 
 
18456
 
7635
18457
CREATE INDEX buildfarmjob__date_started__idx ON buildfarmjob USING btree (date_started);
7636
18458
 
 
18459
 
7637
18460
CREATE INDEX buildfarmjob__log__idx ON buildfarmjob USING btree (log) WHERE (log IS NOT NULL);
7638
18461
 
 
18462
 
7639
18463
CREATE INDEX buildfarmjob__status__idx ON buildfarmjob USING btree (status);
7640
18464
 
 
18465
 
7641
18466
CREATE UNIQUE INDEX buildqueue__builder__id__idx ON buildqueue USING btree (builder, id);
7642
18467
 
7643
18468
ALTER TABLE buildqueue CLUSTER ON buildqueue__builder__id__idx;
7644
18469
 
 
18470
 
7645
18471
CREATE UNIQUE INDEX buildqueue__builder__unq ON buildqueue USING btree (builder) WHERE (builder IS NOT NULL);
7646
18472
 
 
18473
 
7647
18474
CREATE INDEX buildqueue__job_type__idx ON buildqueue USING btree (job_type);
7648
18475
 
 
18476
 
7649
18477
CREATE INDEX buildqueue__processor__virtualized__idx ON buildqueue USING btree (processor, virtualized) WHERE (processor IS NOT NULL);
7650
18478
 
 
18479
 
7651
18480
CREATE INDEX changeset_datecreated_idx ON revision USING btree (date_created);
7652
18481
 
 
18482
 
7653
18483
CREATE INDEX codeimport__assignee__idx ON codeimport USING btree (assignee);
7654
18484
 
 
18485
 
7655
18486
CREATE UNIQUE INDEX codeimport__cvs_root__cvs_module__key ON codeimport USING btree (cvs_root, cvs_module) WHERE (cvs_root IS NOT NULL);
7656
18487
 
 
18488
 
7657
18489
CREATE INDEX codeimport__owner__idx ON codeimport USING btree (owner);
7658
18490
 
 
18491
 
7659
18492
CREATE INDEX codeimport__registrant__idx ON codeimport USING btree (registrant);
7660
18493
 
 
18494
 
7661
18495
CREATE UNIQUE INDEX codeimport__url__idx ON codeimport USING btree (url) WHERE (url IS NOT NULL);
7662
18496
 
 
18497
 
7663
18498
CREATE INDEX codeimportevent__code_import__date_created__id__idx ON codeimportevent USING btree (code_import, date_created, id);
7664
18499
 
 
18500
 
7665
18501
CREATE INDEX codeimportevent__date_created__id__idx ON codeimportevent USING btree (date_created, id);
7666
18502
 
 
18503
 
7667
18504
CREATE INDEX codeimportevent__message__date_created__idx ON codeimportevent USING btree (machine, date_created) WHERE (machine IS NOT NULL);
7668
18505
 
 
18506
 
7669
18507
CREATE INDEX codeimportevent__person__idx ON codeimportevent USING btree (person) WHERE (person IS NOT NULL);
7670
18508
 
 
18509
 
7671
18510
CREATE INDEX codeimportjob__code_import__date_created__idx ON codeimportjob USING btree (code_import, date_created);
7672
18511
 
 
18512
 
7673
18513
CREATE INDEX codeimportjob__machine__date_created__idx ON codeimportjob USING btree (machine, date_created);
7674
18514
 
 
18515
 
7675
18516
CREATE INDEX codeimportjob__requesting_user__idx ON codeimportjob USING btree (requesting_user);
7676
18517
 
 
18518
 
7677
18519
CREATE INDEX codeimportresult__code_import__date_created__idx ON codeimportresult USING btree (code_import, date_created);
7678
18520
 
 
18521
 
7679
18522
CREATE INDEX codeimportresult__log_file__idx ON codeimportresult USING btree (log_file);
7680
18523
 
 
18524
 
7681
18525
CREATE INDEX codeimportresult__machine__date_created__idx ON codeimportresult USING btree (machine, date_created);
7682
18526
 
 
18527
 
7683
18528
CREATE INDEX codeimportresult__requesting_user__idx ON codeimportresult USING btree (requesting_user);
7684
18529
 
 
18530
 
7685
18531
CREATE INDEX codereviewvote__branch_merge_proposal__idx ON codereviewvote USING btree (branch_merge_proposal);
7686
18532
 
 
18533
 
7687
18534
CREATE INDEX codereviewvote__registrant__idx ON codereviewvote USING btree (registrant);
7688
18535
 
 
18536
 
7689
18537
CREATE INDEX codereviewvote__reviewer__idx ON codereviewvote USING btree (reviewer);
7690
18538
 
 
18539
 
7691
18540
CREATE INDEX codereviewvote__vote_message__idx ON codereviewvote USING btree (vote_message);
7692
18541
 
 
18542
 
7693
18543
CREATE INDEX commercialsubscription__product__idx ON commercialsubscription USING btree (product);
7694
18544
 
 
18545
 
7695
18546
CREATE INDEX commercialsubscription__purchaser__idx ON commercialsubscription USING btree (purchaser);
7696
18547
 
 
18548
 
7697
18549
CREATE INDEX commercialsubscription__registrant__idx ON commercialsubscription USING btree (registrant);
7698
18550
 
 
18551
 
7699
18552
CREATE INDEX commercialsubscription__sales_system_id__idx ON commercialsubscription USING btree (sales_system_id);
7700
18553
 
 
18554
 
7701
18555
CREATE UNIQUE INDEX customlanguagecode__distribution__sourcepackagename__code__key ON customlanguagecode USING btree (distribution, sourcepackagename, language_code) WHERE (distribution IS NOT NULL);
7702
18556
 
 
18557
 
7703
18558
CREATE UNIQUE INDEX customlanguagecode__product__code__key ON customlanguagecode USING btree (product, language_code) WHERE (product IS NOT NULL);
7704
18559
 
 
18560
 
7705
18561
CREATE INDEX cve_datecreated_idx ON cve USING btree (datecreated);
7706
18562
 
 
18563
 
7707
18564
CREATE INDEX cve_datemodified_idx ON cve USING btree (datemodified);
7708
18565
 
7709
 
CREATE INDEX cve_fti ON cve USING gist (fti ts2.gist_tsvector_ops);
 
18566
 
 
18567
CREATE INDEX cve_fti ON cve USING gist (fti);
 
18568
 
7710
18569
 
7711
18570
CREATE INDEX cvereference_cve_idx ON cvereference USING btree (cve);
7712
18571
 
 
18572
 
7713
18573
CREATE INDEX diff__diff_text__idx ON diff USING btree (diff_text);
7714
18574
 
 
18575
 
7715
18576
CREATE INDEX distribution__bug_supervisor__idx ON distribution USING btree (bug_supervisor) WHERE (bug_supervisor IS NOT NULL);
7716
18577
 
 
18578
 
7717
18579
CREATE INDEX distribution__driver__idx ON distribution USING btree (driver);
7718
18580
 
 
18581
 
7719
18582
CREATE INDEX distribution__icon__idx ON distribution USING btree (icon) WHERE (icon IS NOT NULL);
7720
18583
 
 
18584
 
7721
18585
CREATE INDEX distribution__language_pack_admin__idx ON distribution USING btree (language_pack_admin);
7722
18586
 
 
18587
 
7723
18588
CREATE INDEX distribution__logo__idx ON distribution USING btree (logo) WHERE (logo IS NOT NULL);
7724
18589
 
 
18590
 
7725
18591
CREATE INDEX distribution__members__idx ON distribution USING btree (members);
7726
18592
 
 
18593
 
7727
18594
CREATE INDEX distribution__mirror_admin__idx ON distribution USING btree (mirror_admin);
7728
18595
 
 
18596
 
7729
18597
CREATE INDEX distribution__mugshot__idx ON distribution USING btree (mugshot) WHERE (mugshot IS NOT NULL);
7730
18598
 
 
18599
 
7731
18600
CREATE INDEX distribution__owner__idx ON distribution USING btree (owner);
7732
18601
 
 
18602
 
 
18603
CREATE INDEX distribution__registrant__idx ON distribution USING btree (registrant);
 
18604
 
 
18605
 
7733
18606
CREATE INDEX distribution__security_contact__idx ON distribution USING btree (security_contact);
7734
18607
 
 
18608
 
7735
18609
CREATE INDEX distribution__upload_admin__idx ON distribution USING btree (upload_admin);
7736
18610
 
7737
 
CREATE INDEX distribution_fti ON distribution USING gist (fti ts2.gist_tsvector_ops);
 
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
 
7738
18617
 
7739
18618
CREATE INDEX distribution_translationgroup_idx ON distribution USING btree (translationgroup);
7740
18619
 
7741
 
CREATE INDEX distributionbounty_distribution_idx ON distributionbounty USING btree (distribution);
7742
18620
 
7743
18621
CREATE UNIQUE INDEX distributionmirror__archive__distribution__country__key ON distributionmirror USING btree (distribution, country, content) WHERE ((country_dns_mirror IS TRUE) AND (content = 1));
7744
18622
 
 
18623
 
7745
18624
CREATE INDEX distributionmirror__country__status__idx ON distributionmirror USING btree (country, status);
7746
18625
 
 
18626
 
7747
18627
CREATE INDEX distributionmirror__owner__idx ON distributionmirror USING btree (owner);
7748
18628
 
 
18629
 
7749
18630
CREATE UNIQUE INDEX distributionmirror__releases__distribution__country__key ON distributionmirror USING btree (distribution, country, content) WHERE ((country_dns_mirror IS TRUE) AND (content = 2));
7750
18631
 
 
18632
 
7751
18633
CREATE INDEX distributionmirror__reviewer__idx ON distributionmirror USING btree (reviewer);
7752
18634
 
 
18635
 
7753
18636
CREATE INDEX distributionmirror__status__idx ON distributionmirror USING btree (status);
7754
18637
 
 
18638
 
7755
18639
CREATE INDEX distributionsourcepackagecache__archive__idx ON distributionsourcepackagecache USING btree (archive);
7756
18640
 
7757
 
CREATE INDEX distributionsourcepackagecache_fti ON distributionsourcepackagecache USING gist (fti ts2.gist_tsvector_ops);
 
18641
 
 
18642
CREATE INDEX distributionsourcepackagecache_fti ON distributionsourcepackagecache USING gist (fti);
 
18643
 
7758
18644
 
7759
18645
CREATE INDEX distroarchseries__distroseries__idx ON distroarchseries USING btree (distroseries);
7760
18646
 
 
18647
 
7761
18648
CREATE INDEX distroarchseries__owner__idx ON distroarchseries USING btree (owner);
7762
18649
 
7763
 
CREATE INDEX distrocomponentuploader_uploader_idx ON distrocomponentuploader USING btree (uploader);
7764
18650
 
7765
18651
CREATE INDEX distroseries__driver__idx ON distroseries USING btree (driver) WHERE (driver IS NOT NULL);
7766
18652
 
7767
 
CREATE INDEX distroseries__owner__idx ON distroseries USING btree (owner);
 
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
 
7768
18686
 
7769
18687
CREATE INDEX distroseriespackagecache__archive__idx ON distroseriespackagecache USING btree (archive);
7770
18688
 
 
18689
 
7771
18690
CREATE INDEX distroseriespackagecache__distroseries__idx ON distroseriespackagecache USING btree (distroseries);
7772
18691
 
7773
 
CREATE INDEX distroseriespackagecache_fti ON distroseriespackagecache USING gist (fti ts2.gist_tsvector_ops);
 
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
 
7774
18701
 
7775
18702
CREATE UNIQUE INDEX emailaddress__account__key ON emailaddress USING btree (account) WHERE ((status = 4) AND (account IS NOT NULL));
7776
18703
 
 
18704
 
 
18705
COMMENT ON INDEX emailaddress__account__key IS 'Ensures that an Account only has one preferred email address';
 
18706
 
 
18707
 
7777
18708
CREATE INDEX emailaddress__account__status__idx ON emailaddress USING btree (account, status);
7778
18709
 
 
18710
 
7779
18711
CREATE UNIQUE INDEX emailaddress__lower_email__key ON emailaddress USING btree (lower(email));
7780
18712
 
 
18713
 
7781
18714
CREATE UNIQUE INDEX emailaddress__person__key ON emailaddress USING btree (person) WHERE ((status = 4) AND (person IS NOT NULL));
7782
18715
 
 
18716
 
 
18717
COMMENT ON INDEX emailaddress__person__key IS 'Ensures that a Person only has one preferred email address';
 
18718
 
 
18719
 
7783
18720
CREATE INDEX emailaddress__person__status__idx ON emailaddress USING btree (person, status);
7784
18721
 
 
18722
 
7785
18723
CREATE INDEX entitlement__approved_by__idx ON entitlement USING btree (approved_by) WHERE (approved_by IS NOT NULL);
7786
18724
 
 
18725
 
7787
18726
CREATE INDEX entitlement__distribution__idx ON entitlement USING btree (distribution) WHERE (distribution IS NOT NULL);
7788
18727
 
 
18728
 
7789
18729
CREATE INDEX entitlement__person__idx ON entitlement USING btree (person);
7790
18730
 
 
18731
 
7791
18732
CREATE INDEX entitlement__product__idx ON entitlement USING btree (product) WHERE (product IS NOT NULL);
7792
18733
 
 
18734
 
7793
18735
CREATE INDEX entitlement__project__idx ON entitlement USING btree (project) WHERE (project IS NOT NULL);
7794
18736
 
 
18737
 
7795
18738
CREATE INDEX entitlement__registrant__idx ON entitlement USING btree (registrant) WHERE (registrant IS NOT NULL);
7796
18739
 
 
18740
 
7797
18741
CREATE INDEX entitlement_lookup_idx ON entitlement USING btree (entitlement_type, date_starts, date_expires, person, state);
7798
18742
 
 
18743
 
7799
18744
CREATE INDEX faq__distribution__idx ON faq USING btree (distribution) WHERE (distribution IS NOT NULL);
7800
18745
 
 
18746
 
7801
18747
CREATE INDEX faq__last_updated_by__idx ON faq USING btree (last_updated_by);
7802
18748
 
 
18749
 
7803
18750
CREATE INDEX faq__owner__idx ON faq USING btree (owner);
7804
18751
 
 
18752
 
7805
18753
CREATE INDEX faq__product__idx ON faq USING btree (product) WHERE (product IS NOT NULL);
7806
18754
 
7807
 
CREATE INDEX faq_fti ON faq USING gist (fti ts2.gist_tsvector_ops);
 
18755
 
 
18756
CREATE INDEX faq_fti ON faq USING gist (fti);
 
18757
 
7808
18758
 
7809
18759
CREATE INDEX featuredproject__pillar_name__idx ON featuredproject USING btree (pillar_name);
7810
18760
 
 
18761
 
 
18762
CREATE INDEX featureflagchangelogentry__person__idx ON featureflagchangelogentry USING btree (person);
 
18763
 
 
18764
 
7811
18765
CREATE INDEX flatpackagesetinclusion__child__idx ON flatpackagesetinclusion USING btree (child);
7812
18766
 
 
18767
 
7813
18768
CREATE INDEX hwdevice__bus_product_id__idx ON hwdevice USING btree (bus_product_id);
7814
18769
 
 
18770
 
7815
18771
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);
7816
18772
 
 
18773
 
7817
18774
CREATE INDEX hwdevice__name__idx ON hwdevice USING btree (name);
7818
18775
 
 
18776
 
7819
18777
CREATE UNIQUE INDEX hwdeviceclass__device__main_class__key ON hwdeviceclass USING btree (device, main_class) WHERE (sub_class IS NULL);
7820
18778
 
 
18779
 
7821
18780
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);
7822
18781
 
 
18782
 
7823
18783
CREATE INDEX hwdeviceclass__main_class__idx ON hwdeviceclass USING btree (main_class);
7824
18784
 
 
18785
 
7825
18786
CREATE INDEX hwdeviceclass__sub_class__idx ON hwdeviceclass USING btree (sub_class);
7826
18787
 
 
18788
 
7827
18789
CREATE UNIQUE INDEX hwdevicedriverlink__device__driver__key ON hwdevicedriverlink USING btree (device, driver) WHERE (driver IS NOT NULL);
7828
18790
 
 
18791
 
7829
18792
CREATE INDEX hwdevicedriverlink__device__idx ON hwdevicedriverlink USING btree (device);
7830
18793
 
 
18794
 
7831
18795
CREATE UNIQUE INDEX hwdevicedriverlink__device__key ON hwdevicedriverlink USING btree (device) WHERE (driver IS NULL);
7832
18796
 
 
18797
 
7833
18798
CREATE INDEX hwdevicedriverlink__driver__idx ON hwdevicedriverlink USING btree (driver);
7834
18799
 
 
18800
 
7835
18801
CREATE INDEX hwdevicenamevariant__device__idx ON hwdevicenamevariant USING btree (device);
7836
18802
 
 
18803
 
7837
18804
CREATE INDEX hwdevicenamevariant__product_name__idx ON hwdevicenamevariant USING btree (product_name);
7838
18805
 
 
18806
 
7839
18807
CREATE INDEX hwdmihandle__submission__idx ON hwdmihandle USING btree (submission);
7840
18808
 
 
18809
 
7841
18810
CREATE INDEX hwdmivalue__hanlde__idx ON hwdmivalue USING btree (handle);
7842
18811
 
 
18812
 
7843
18813
CREATE INDEX hwdriver__name__idx ON hwdriver USING btree (name);
7844
18814
 
 
18815
 
7845
18816
CREATE UNIQUE INDEX hwdriver__name__key ON hwdriver USING btree (name) WHERE (package_name IS NULL);
7846
18817
 
 
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
 
7847
18825
CREATE INDEX hwsubmission__lower_raw_emailaddress__idx ON hwsubmission USING btree (lower(raw_emailaddress));
7848
18826
 
 
18827
 
7849
18828
CREATE INDEX hwsubmission__owner__idx ON hwsubmission USING btree (owner);
7850
18829
 
 
18830
 
7851
18831
CREATE INDEX hwsubmission__raw_emailaddress__idx ON hwsubmission USING btree (raw_emailaddress);
7852
18832
 
 
18833
 
7853
18834
CREATE INDEX hwsubmission__raw_submission__idx ON hwsubmission USING btree (raw_submission);
7854
18835
 
 
18836
 
7855
18837
CREATE INDEX hwsubmission__status__idx ON hwsubmission USING btree (status);
7856
18838
 
 
18839
 
7857
18840
CREATE INDEX hwsubmission__system_fingerprint__idx ON hwsubmission USING btree (system_fingerprint);
7858
18841
 
 
18842
 
7859
18843
CREATE INDEX hwsubmissionbug__bug ON hwsubmissionbug USING btree (bug);
7860
18844
 
 
18845
 
7861
18846
CREATE INDEX hwsubmissiondevice__device_driver_link__idx ON hwsubmissiondevice USING btree (device_driver_link);
7862
18847
 
 
18848
 
 
18849
CREATE INDEX hwsubmissiondevice__parent__idx ON hwsubmissiondevice USING btree (parent);
 
18850
 
 
18851
 
7863
18852
CREATE INDEX hwsubmissiondevice__submission__idx ON hwsubmissiondevice USING btree (submission);
7864
18853
 
 
18854
 
7865
18855
CREATE UNIQUE INDEX hwtest__name__version__key ON hwtest USING btree (name, version) WHERE (namespace IS NULL);
7866
18856
 
 
18857
 
7867
18858
CREATE UNIQUE INDEX hwtest__namespace__name__version__key ON hwtest USING btree (namespace, name, version) WHERE (namespace IS NOT NULL);
7868
18859
 
 
18860
 
7869
18861
CREATE INDEX hwtestanswer__choice__idx ON hwtestanswer USING btree (choice);
7870
18862
 
 
18863
 
7871
18864
CREATE INDEX hwtestanswer__submission__idx ON hwtestanswer USING btree (submission);
7872
18865
 
 
18866
 
7873
18867
CREATE INDEX hwtestanswer__test__idx ON hwtestanswer USING btree (test);
7874
18868
 
 
18869
 
7875
18870
CREATE INDEX hwtestanswerchoice__test__idx ON hwtestanswerchoice USING btree (test);
7876
18871
 
 
18872
 
7877
18873
CREATE INDEX hwtestanswercount__choice__idx ON hwtestanswercount USING btree (choice);
7878
18874
 
 
18875
 
7879
18876
CREATE INDEX hwtestanswercount__distroarchrelease__idx ON hwtestanswercount USING btree (distroarchseries) WHERE (distroarchseries IS NOT NULL);
7880
18877
 
 
18878
 
7881
18879
CREATE INDEX hwtestanswercount__test__idx ON hwtestanswercount USING btree (test);
7882
18880
 
 
18881
 
7883
18882
CREATE INDEX hwtestanswercountdevice__device_driver__idx ON hwtestanswercountdevice USING btree (device_driver);
7884
18883
 
 
18884
 
7885
18885
CREATE INDEX hwtestanswerdevice__device_driver__idx ON hwtestanswerdevice USING btree (device_driver);
7886
18886
 
 
18887
 
7887
18888
CREATE INDEX hwvendorid__vendor_id_for_bus__idx ON hwvendorid USING btree (vendor_id_for_bus);
7888
18889
 
 
18890
 
7889
18891
CREATE INDEX hwvendorid__vendorname__idx ON hwvendorid USING btree (vendor_name);
7890
18892
 
 
18893
 
7891
18894
CREATE UNIQUE INDEX hwvendorname__lc_vendor_name__idx ON hwvendorname USING btree (ulower(name));
7892
18895
 
7893
 
CREATE INDEX hwvendorname__name__idx ON hwdriver USING btree (name);
 
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
 
7894
18908
 
7895
18909
CREATE INDEX ircid_person_idx ON ircid USING btree (person);
7896
18910
 
 
18911
 
7897
18912
CREATE INDEX jabberid_person_idx ON jabberid USING btree (person);
7898
18913
 
 
18914
 
7899
18915
CREATE INDEX job__date_finished__idx ON job USING btree (date_finished) WHERE (date_finished IS NOT NULL);
7900
18916
 
 
18917
 
7901
18918
CREATE INDEX job__lease_expires__idx ON job USING btree (lease_expires);
7902
18919
 
 
18920
 
7903
18921
CREATE INDEX job__requester__key ON job USING btree (requester) WHERE (requester IS NOT NULL);
7904
18922
 
 
18923
 
7905
18924
CREATE INDEX job__scheduled_start__idx ON job USING btree (scheduled_start);
7906
18925
 
 
18926
 
7907
18927
CREATE INDEX karma_person_datecreated_idx ON karma USING btree (person, datecreated);
7908
18928
 
7909
18929
ALTER TABLE karma CLUSTER ON karma_person_datecreated_idx;
7910
18930
 
 
18931
 
7911
18932
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));
7912
18933
 
 
18934
 
7913
18935
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));
7914
18936
 
 
18937
 
7915
18938
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));
7916
18939
 
 
18940
 
7917
18941
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));
7918
18942
 
 
18943
 
7919
18944
CREATE INDEX karmacache__person__category__idx ON karmacache USING btree (person, category);
7920
18945
 
 
18946
 
7921
18947
CREATE INDEX karmacache__product__category__karmavalue__idx ON karmacache USING btree (product, category, karmavalue) WHERE ((category IS NOT NULL) AND (product IS NOT NULL));
7922
18948
 
 
18949
 
7923
18950
CREATE INDEX karmacache__product__karmavalue__idx ON karmacache USING btree (product, karmavalue) WHERE ((category IS NULL) AND (product IS NOT NULL));
7924
18951
 
 
18952
 
7925
18953
CREATE INDEX karmacache__project__category__karmavalue__idx ON karmacache USING btree (project, category, karmavalue) WHERE (project IS NOT NULL);
7926
18954
 
 
18955
 
7927
18956
CREATE INDEX karmacache__project__karmavalue__idx ON karmacache USING btree (project, karmavalue) WHERE ((category IS NULL) AND (project IS NOT NULL));
7928
18957
 
 
18958
 
7929
18959
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));
7930
18960
 
 
18961
 
7931
18962
CREATE INDEX karmacache__sourcepackagename__distribution__karmavalue__idx ON karmacache USING btree (sourcepackagename, distribution, karmavalue) WHERE (sourcepackagename IS NOT NULL);
7932
18963
 
 
18964
 
7933
18965
CREATE INDEX karmacache__sourcepackagename__karmavalue__idx ON karmacache USING btree (sourcepackagename, distribution, karmavalue) WHERE ((category IS NULL) AND (sourcepackagename IS NOT NULL));
7934
18966
 
 
18967
 
7935
18968
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))));
7936
18969
 
 
18970
 
7937
18971
CREATE INDEX karmacache_person_idx ON karmacache USING btree (person);
7938
18972
 
 
18973
 
7939
18974
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));
7940
18975
 
 
18976
 
7941
18977
CREATE UNIQUE INDEX karmatotalcache_karma_total_person_idx ON karmatotalcache USING btree (karma_total, person);
7942
18978
 
 
18979
 
7943
18980
CREATE INDEX languagepack__file__idx ON languagepack USING btree (file);
7944
18981
 
 
18982
 
7945
18983
CREATE INDEX libraryfilealias__expires__idx ON libraryfilealias USING btree (expires);
7946
18984
 
 
18985
 
 
18986
CREATE INDEX libraryfilealias__expires_content_not_null_idx ON libraryfilealias USING btree (expires) WHERE (content IS NOT NULL);
 
18987
 
 
18988
 
7947
18989
CREATE INDEX libraryfilealias__filename__idx ON libraryfilealias USING btree (filename);
7948
18990
 
 
18991
 
7949
18992
CREATE INDEX libraryfilealias_content_idx ON libraryfilealias USING btree (content);
7950
18993
 
 
18994
 
7951
18995
CREATE INDEX libraryfilecontent__md5__idx ON libraryfilecontent USING btree (md5);
7952
18996
 
 
18997
 
7953
18998
CREATE INDEX libraryfilecontent__sha256__idx ON libraryfilecontent USING btree (sha256);
7954
18999
 
 
19000
 
7955
19001
CREATE INDEX libraryfilecontent_sha1_filesize_idx ON libraryfilecontent USING btree (sha1, filesize);
7956
19002
 
 
19003
 
7957
19004
CREATE INDEX logintoken_requester_idx ON logintoken USING btree (requester);
7958
19005
 
 
19006
 
 
19007
CREATE INDEX lp_openididentifier__account__idx ON lp_openididentifier USING btree (account);
 
19008
 
 
19009
 
7959
19010
CREATE INDEX lp_teamparticipation__person__idx ON lp_teamparticipation USING btree (person);
7960
19011
 
 
19012
 
7961
19013
CREATE INDEX mailinglist__date_registered__idx ON mailinglist USING btree (status, date_registered);
7962
19014
 
 
19015
 
7963
19016
CREATE INDEX mailinglist__registrant__idx ON mailinglist USING btree (registrant);
7964
19017
 
 
19018
 
7965
19019
CREATE INDEX mailinglist__reviewer__idx ON mailinglist USING btree (reviewer);
7966
19020
 
 
19021
 
7967
19022
CREATE UNIQUE INDEX mailinglist__team__status__key ON mailinglist USING btree (team, status);
7968
19023
 
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);
7972
19024
 
7973
19025
CREATE INDEX mailinglistsubscription__email_address__idx ON mailinglistsubscription USING btree (email_address) WHERE (email_address IS NOT NULL);
7974
19026
 
 
19027
 
7975
19028
CREATE INDEX mailinglistsubscription__mailing_list__idx ON mailinglistsubscription USING btree (mailing_list);
7976
19029
 
 
19030
 
7977
19031
CREATE UNIQUE INDEX mailinglistsubscription__person__mailing_list__key ON mailinglistsubscription USING btree (person, mailing_list);
7978
19032
 
7979
 
CREATE INDEX mentoringoffer__owner__idx ON mentoringoffer USING btree (owner);
7980
 
 
7981
 
CREATE INDEX mentoringoffer__team__idx ON mentoringoffer USING btree (team);
7982
19033
 
7983
19034
CREATE INDEX mergedirectivejob__merge_directive__idx ON mergedirectivejob USING btree (merge_directive);
7984
19035
 
7985
 
CREATE INDEX message_fti ON message USING gist (fti ts2.gist_tsvector_ops);
 
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
 
7986
19042
 
7987
19043
CREATE INDEX message_owner_idx ON message USING btree (owner);
7988
19044
 
 
19045
 
7989
19046
CREATE INDEX message_parent_idx ON message USING btree (parent);
7990
19047
 
 
19048
 
7991
19049
CREATE INDEX message_raw_idx ON message USING btree (raw) WHERE (raw IS NOT NULL);
7992
19050
 
 
19051
 
7993
19052
CREATE INDEX message_rfc822msgid_idx ON message USING btree (rfc822msgid);
7994
19053
 
 
19054
 
7995
19055
CREATE INDEX messageapproval__disposed_by__idx ON messageapproval USING btree (disposed_by) WHERE (disposed_by IS NOT NULL);
7996
19056
 
 
19057
 
7997
19058
CREATE INDEX messageapproval__mailing_list__status__posted_date__idx ON messageapproval USING btree (mailing_list, status, posted_date);
7998
19059
 
 
19060
 
7999
19061
CREATE INDEX messageapproval__message__idx ON messageapproval USING btree (message);
8000
19062
 
 
19063
 
8001
19064
CREATE INDEX messageapproval__posted_by__idx ON messageapproval USING btree (posted_by);
8002
19065
 
 
19066
 
8003
19067
CREATE INDEX messageapproval__posted_message__idx ON messageapproval USING btree (posted_message);
8004
19068
 
 
19069
 
8005
19070
CREATE INDEX messagechunk_blob_idx ON messagechunk USING btree (blob) WHERE (blob IS NOT NULL);
8006
19071
 
8007
 
CREATE INDEX messagechunk_fti ON messagechunk USING gist (fti ts2.gist_tsvector_ops);
 
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
 
8008
19078
 
8009
19079
CREATE INDEX mirror__owner__idx ON mirror USING btree (owner);
8010
19080
 
 
19081
 
8011
19082
CREATE UNIQUE INDEX mirrordistroarchseries_uniq ON mirrordistroarchseries USING btree (distribution_mirror, distroarchseries, component, pocket);
8012
19083
 
 
19084
 
8013
19085
CREATE UNIQUE INDEX mirrordistroseriessource_uniq ON mirrordistroseriessource USING btree (distribution_mirror, distroseries, component, pocket);
8014
19086
 
 
19087
 
8015
19088
CREATE INDEX mirrorproberecord__date_created__idx ON mirrorproberecord USING btree (date_created);
8016
19089
 
 
19090
 
8017
19091
CREATE INDEX mirrorproberecord__distribution_mirror__date_created__idx ON mirrorproberecord USING btree (distribution_mirror, date_created);
8018
19092
 
 
19093
 
8019
19094
CREATE INDEX mirrorproberecord__log_file__idx ON mirrorproberecord USING btree (log_file) WHERE (log_file IS NOT NULL);
8020
19095
 
 
19096
 
8021
19097
CREATE INDEX oauthaccesstoken__consumer__idx ON oauthaccesstoken USING btree (consumer);
8022
19098
 
 
19099
 
8023
19100
CREATE INDEX oauthaccesstoken__date_expires__idx ON oauthaccesstoken USING btree (date_expires) WHERE (date_expires IS NOT NULL);
8024
19101
 
 
19102
 
8025
19103
CREATE INDEX oauthaccesstoken__distribution__sourcepackagename__idx ON oauthaccesstoken USING btree (distribution, sourcepackagename) WHERE (distribution IS NOT NULL);
8026
19104
 
 
19105
 
8027
19106
CREATE INDEX oauthaccesstoken__person__idx ON oauthaccesstoken USING btree (person);
8028
19107
 
 
19108
 
8029
19109
CREATE INDEX oauthaccesstoken__product__idx ON oauthaccesstoken USING btree (product) WHERE (product IS NOT NULL);
8030
19110
 
 
19111
 
8031
19112
CREATE INDEX oauthaccesstoken__project__idx ON oauthaccesstoken USING btree (project) WHERE (project IS NOT NULL);
8032
19113
 
 
19114
 
8033
19115
CREATE INDEX oauthnonce__access_token__idx ON oauthnonce USING btree (access_token);
8034
19116
 
 
19117
 
8035
19118
CREATE INDEX oauthnonce__request_timestamp__idx ON oauthnonce USING btree (request_timestamp);
8036
19119
 
 
19120
 
8037
19121
CREATE INDEX oauthrequesttoken__consumer__idx ON oauthrequesttoken USING btree (consumer);
8038
19122
 
 
19123
 
8039
19124
CREATE INDEX oauthrequesttoken__date_created__idx ON oauthrequesttoken USING btree (date_created);
8040
19125
 
 
19126
 
8041
19127
CREATE INDEX oauthrequesttoken__distribution__sourcepackagename__idx ON oauthrequesttoken USING btree (distribution, sourcepackagename) WHERE (distribution IS NOT NULL);
8042
19128
 
 
19129
 
8043
19130
CREATE INDEX oauthrequesttoken__person__idx ON oauthrequesttoken USING btree (person) WHERE (person IS NOT NULL);
8044
19131
 
 
19132
 
8045
19133
CREATE INDEX oauthrequesttoken__product__idx ON oauthrequesttoken USING btree (product) WHERE (product IS NOT NULL);
8046
19134
 
 
19135
 
8047
19136
CREATE INDEX oauthrequesttoken__project__idx ON oauthrequesttoken USING btree (project) WHERE (project IS NOT NULL);
8048
19137
 
 
19138
 
8049
19139
CREATE UNIQUE INDEX officialbugtag__distribution__tag__key ON officialbugtag USING btree (distribution, tag) WHERE (distribution IS NOT NULL);
8050
19140
 
 
19141
 
8051
19142
CREATE UNIQUE INDEX officialbugtag__product__tag__key ON officialbugtag USING btree (product, tag) WHERE (product IS NOT NULL);
8052
19143
 
 
19144
 
8053
19145
CREATE UNIQUE INDEX officialbugtag__project__tag__key ON officialbugtag USING btree (project, tag) WHERE (product IS NOT NULL);
8054
19146
 
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);
 
19147
 
 
19148
CREATE INDEX openididentifier__account__idx ON openididentifier USING btree (account);
 
19149
 
8064
19150
 
8065
19151
CREATE INDEX packagebuild__archive__idx ON packagebuild USING btree (archive);
8066
19152
 
 
19153
 
8067
19154
CREATE UNIQUE INDEX packagebuild__build_farm_job__idx ON packagebuild USING btree (build_farm_job);
8068
19155
 
 
19156
 
8069
19157
CREATE INDEX packagebuild__upload_log__idx ON packagebuild USING btree (upload_log) WHERE (upload_log IS NOT NULL);
8070
19158
 
 
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
 
8071
19169
CREATE INDEX packagecopyrequest__datecreated__idx ON packagecopyrequest USING btree (date_created);
8072
19170
 
 
19171
 
8073
19172
CREATE INDEX packagecopyrequest__requester__idx ON packagecopyrequest USING btree (requester);
8074
19173
 
 
19174
 
8075
19175
CREATE INDEX packagecopyrequest__targetarchive__idx ON packagecopyrequest USING btree (target_archive);
8076
19176
 
 
19177
 
8077
19178
CREATE INDEX packagecopyrequest__targetdistroseries__idx ON packagecopyrequest USING btree (target_distroseries) WHERE (target_distroseries IS NOT NULL);
8078
19179
 
 
19180
 
8079
19181
CREATE INDEX packagediff__diff_content__idx ON packagediff USING btree (diff_content);
8080
19182
 
 
19183
 
8081
19184
CREATE INDEX packagediff__from_source__idx ON packagediff USING btree (from_source);
8082
19185
 
 
19186
 
8083
19187
CREATE INDEX packagediff__requester__idx ON packagediff USING btree (requester);
8084
19188
 
 
19189
 
8085
19190
CREATE INDEX packagediff__status__idx ON packagediff USING btree (status);
8086
19191
 
 
19192
 
8087
19193
CREATE INDEX packagediff__to_source__idx ON packagediff USING btree (to_source);
8088
19194
 
 
19195
 
8089
19196
CREATE INDEX packageset__distroseries__idx ON packageset USING btree (distroseries);
8090
19197
 
 
19198
 
8091
19199
CREATE INDEX packageset__owner__idx ON packageset USING btree (owner);
8092
19200
 
 
19201
 
8093
19202
CREATE INDEX packageset__packagesetgroup__idx ON packageset USING btree (packagesetgroup);
8094
19203
 
 
19204
 
8095
19205
CREATE INDEX packagesetgroup__owner__idx ON packagesetgroup USING btree (owner);
8096
19206
 
 
19207
 
8097
19208
CREATE INDEX packagesetinclusion__child__idx ON packagesetinclusion USING btree (child);
8098
19209
 
 
19210
 
8099
19211
CREATE INDEX packagesetsources__sourcepackagename__idx ON packagesetsources USING btree (sourcepackagename);
8100
19212
 
 
19213
 
 
19214
CREATE INDEX packageupload__archive__distroseries__status__idx ON packageupload USING btree (archive, distroseries, status);
 
19215
 
 
19216
 
8101
19217
CREATE INDEX packageupload__changesfile__idx ON packageupload USING btree (changesfile);
8102
19218
 
 
19219
 
8103
19220
CREATE INDEX packageupload__distroseries__key ON packageupload USING btree (distroseries);
8104
19221
 
 
19222
 
8105
19223
CREATE INDEX packageupload__distroseries__status__idx ON packageupload USING btree (distroseries, status);
8106
19224
 
 
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
 
8107
19229
CREATE INDEX packageupload__signing_key__idx ON packageupload USING btree (signing_key);
8108
19230
 
 
19231
 
8109
19232
CREATE INDEX packageuploadbuild__build__idx ON packageuploadbuild USING btree (build);
8110
19233
 
 
19234
 
8111
19235
CREATE INDEX packageuploadcustom__libraryfilealias__idx ON packageuploadcustom USING btree (libraryfilealias);
8112
19236
 
 
19237
 
8113
19238
CREATE INDEX packageuploadcustom__packageupload__idx ON packageuploadcustom USING btree (packageupload);
8114
19239
 
 
19240
 
8115
19241
CREATE INDEX packageuploadsource__sourcepackagerelease__idx ON packageuploadsource USING btree (sourcepackagerelease);
8116
19242
 
8117
 
CREATE INDEX packaging__distroseries__sourcepackagename__idx ON packaging USING btree (distroseries, sourcepackagename);
8118
19243
 
8119
19244
CREATE INDEX packaging__owner__idx ON packaging USING btree (owner);
8120
19245
 
 
19246
 
8121
19247
CREATE INDEX packaging_sourcepackagename_idx ON packaging USING btree (sourcepackagename);
8122
19248
 
 
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
 
8123
19256
CREATE INDEX parsedapachelog__first_line__idx ON parsedapachelog USING btree (first_line);
8124
19257
 
 
19258
 
 
19259
CREATE INDEX person__displayname__idx ON person USING btree (lower(displayname));
 
19260
 
 
19261
 
8125
19262
CREATE INDEX person__icon__idx ON person USING btree (icon) WHERE (icon IS NOT NULL);
8126
19263
 
 
19264
 
8127
19265
CREATE INDEX person__logo__idx ON person USING btree (logo) WHERE (logo IS NOT NULL);
8128
19266
 
 
19267
 
8129
19268
CREATE INDEX person__merged__idx ON person USING btree (merged) WHERE (merged IS NOT NULL);
8130
19269
 
 
19270
 
8131
19271
CREATE INDEX person__mugshot__idx ON person USING btree (mugshot) WHERE (mugshot IS NOT NULL);
8132
19272
 
 
19273
 
8133
19274
CREATE INDEX person__registrant__idx ON person USING btree (registrant);
8134
19275
 
 
19276
 
8135
19277
CREATE INDEX person__teamowner__idx ON person USING btree (teamowner) WHERE (teamowner IS NOT NULL);
8136
19278
 
 
19279
 
8137
19280
CREATE INDEX person_datecreated_idx ON person USING btree (datecreated);
8138
19281
 
8139
 
CREATE INDEX person_fti ON person USING gist (fti ts2.gist_tsvector_ops);
 
19282
 
 
19283
CREATE INDEX person_fti ON person USING gist (fti);
 
19284
 
8140
19285
 
8141
19286
CREATE INDEX person_sorting_idx ON person USING btree (person_sort_key(displayname, name));
8142
19287
 
 
19288
 
8143
19289
CREATE INDEX personlocation__last_modified_by__idx ON personlocation USING btree (last_modified_by);
8144
19290
 
 
19291
 
8145
19292
CREATE INDEX personnotification__date_emailed__idx ON personnotification USING btree (date_emailed);
8146
19293
 
 
19294
 
8147
19295
CREATE INDEX personnotification__person__idx ON personnotification USING btree (person);
8148
19296
 
 
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
 
8149
19304
CREATE INDEX pillarname__alias_for__idx ON pillarname USING btree (alias_for) WHERE (alias_for IS NOT NULL);
8150
19305
 
 
19306
 
8151
19307
CREATE UNIQUE INDEX pillarname__distribution__key ON pillarname USING btree (distribution) WHERE (distribution IS NOT NULL);
8152
19308
 
 
19309
 
8153
19310
CREATE UNIQUE INDEX pillarname__product__key ON pillarname USING btree (product) WHERE (product IS NOT NULL);
8154
19311
 
 
19312
 
8155
19313
CREATE UNIQUE INDEX pillarname__project__key ON pillarname USING btree (project) WHERE (project IS NOT NULL);
8156
19314
 
 
19315
 
8157
19316
CREATE INDEX pocketchroot__chroot__idx ON pocketchroot USING btree (chroot);
8158
19317
 
8159
 
CREATE INDEX pocomment_person_idx ON pocomment USING btree (person);
8160
19318
 
8161
19319
CREATE INDEX poexportrequest__person__idx ON poexportrequest USING btree (person);
8162
19320
 
 
19321
 
8163
19322
CREATE UNIQUE INDEX poexportrequest_duplicate_key ON poexportrequest USING btree (potemplate, person, format, (COALESCE(pofile, (-1))));
8164
19323
 
 
19324
 
8165
19325
CREATE INDEX pofile__from_sourcepackagename__idx ON pofile USING btree (from_sourcepackagename) WHERE (from_sourcepackagename IS NOT NULL);
8166
19326
 
 
19327
 
 
19328
CREATE UNIQUE INDEX pofile__potemplate__language__idx ON pofile USING btree (potemplate, language);
 
19329
 
 
19330
 
8167
19331
CREATE UNIQUE INDEX pofile__potemplate__path__key ON pofile USING btree (potemplate, path);
8168
19332
 
 
19333
 
8169
19334
CREATE UNIQUE INDEX pofile__unreviewed_count__id__key ON pofile USING btree (unreviewed_count, id);
8170
19335
 
 
19336
 
8171
19337
CREATE INDEX pofile_datecreated_idx ON pofile USING btree (datecreated);
8172
19338
 
 
19339
 
8173
19340
CREATE INDEX pofile_language_idx ON pofile USING btree (language);
8174
19341
 
 
19342
 
8175
19343
CREATE INDEX pofile_lasttranslator_idx ON pofile USING btree (lasttranslator);
8176
19344
 
 
19345
 
8177
19346
CREATE INDEX pofile_owner_idx ON pofile USING btree (owner);
8178
19347
 
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);
8184
19348
 
8185
19349
CREATE INDEX pofiletranslator__date_last_touched__idx ON pofiletranslator USING btree (date_last_touched);
8186
19350
 
 
19351
 
8187
19352
CREATE INDEX pofiletranslator__latest_message__idx ON pofiletranslator USING btree (latest_message);
8188
19353
 
 
19354
 
8189
19355
CREATE INDEX pofiletranslator__pofile__idx ON pofiletranslator USING btree (pofile);
8190
19356
 
 
19357
 
8191
19358
CREATE INDEX polloption_poll_idx ON polloption USING btree (poll);
8192
19359
 
 
19360
 
8193
19361
CREATE UNIQUE INDEX pomsgid_msgid_key ON pomsgid USING btree (sha1(msgid));
8194
19362
 
 
19363
 
8195
19364
CREATE INDEX potemplate__date_last_updated__idx ON potemplate USING btree (date_last_updated);
8196
19365
 
 
19366
 
8197
19367
CREATE UNIQUE INDEX potemplate__distroseries__sourcepackagename__name__key ON potemplate USING btree (distroseries, sourcepackagename, name);
8198
19368
 
 
19369
 
8199
19370
CREATE INDEX potemplate__name__idx ON potemplate USING btree (name);
8200
19371
 
 
19372
 
8201
19373
CREATE UNIQUE INDEX potemplate__productseries__name__key ON potemplate USING btree (productseries, name);
8202
19374
 
 
19375
 
8203
19376
CREATE INDEX potemplate__source_file__idx ON potemplate USING btree (source_file) WHERE (source_file IS NOT NULL);
8204
19377
 
 
19378
 
8205
19379
CREATE INDEX potemplate_languagepack_idx ON potemplate USING btree (languagepack);
8206
19380
 
 
19381
 
8207
19382
CREATE INDEX potemplate_owner_idx ON potemplate USING btree (owner);
8208
19383
 
 
19384
 
8209
19385
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));
8210
19386
 
 
19387
 
8211
19388
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));
8212
19389
 
 
19390
 
8213
19391
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));
8214
19392
 
 
19393
 
8215
19394
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));
8216
19395
 
 
19396
 
 
19397
CREATE INDEX potmsgset__potemplate__idx ON potmsgset USING btree (potemplate) WHERE (potemplate IS NOT NULL);
 
19398
 
 
19399
 
8217
19400
CREATE INDEX potmsgset_primemsgid_idx ON potmsgset USING btree (msgid_singular);
8218
19401
 
8219
 
CREATE INDEX potmsgset_sequence_idx ON potmsgset USING btree (sequence);
8220
19402
 
8221
19403
CREATE UNIQUE INDEX potranslation_translation_key ON potranslation USING btree (sha1(translation));
8222
19404
 
 
19405
 
8223
19406
CREATE INDEX previewdiff__diff__idx ON previewdiff USING btree (diff);
8224
19407
 
 
19408
 
8225
19409
CREATE INDEX product__bug_supervisor__idx ON product USING btree (bug_supervisor) WHERE (bug_supervisor IS NOT NULL);
8226
19410
 
 
19411
 
8227
19412
CREATE INDEX product__driver__idx ON product USING btree (driver) WHERE (driver IS NOT NULL);
8228
19413
 
 
19414
 
8229
19415
CREATE INDEX product__icon__idx ON product USING btree (icon) WHERE (icon IS NOT NULL);
8230
19416
 
 
19417
 
8231
19418
CREATE INDEX product__logo__idx ON product USING btree (logo) WHERE (logo IS NOT NULL);
8232
19419
 
 
19420
 
8233
19421
CREATE INDEX product__mugshot__idx ON product USING btree (mugshot) WHERE (mugshot IS NOT NULL);
8234
19422
 
 
19423
 
8235
19424
CREATE INDEX product__registrant__idx ON product USING btree (registrant);
8236
19425
 
 
19426
 
8237
19427
CREATE INDEX product__security_contact__idx ON product USING btree (security_contact) WHERE (security_contact IS NOT NULL);
8238
19428
 
 
19429
 
8239
19430
CREATE INDEX product_active_idx ON product USING btree (active);
8240
19431
 
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);
 
19432
 
 
19433
CREATE INDEX product_fti ON product USING gist (fti);
 
19434
 
8244
19435
 
8245
19436
CREATE INDEX product_owner_idx ON product USING btree (owner);
8246
19437
 
 
19438
 
8247
19439
CREATE INDEX product_project_idx ON product USING btree (project);
8248
19440
 
 
19441
 
8249
19442
CREATE INDEX product_translationgroup_idx ON product USING btree (translationgroup);
8250
19443
 
 
19444
 
8251
19445
CREATE INDEX productlicense__license__idx ON productlicense USING btree (license);
8252
19446
 
 
19447
 
8253
19448
CREATE INDEX productrelease_datecreated_idx ON productrelease USING btree (datecreated);
8254
19449
 
 
19450
 
8255
19451
CREATE INDEX productrelease_owner_idx ON productrelease USING btree (owner);
8256
19452
 
 
19453
 
8257
19454
CREATE INDEX productreleasefile__libraryfile__idx ON productreleasefile USING btree (libraryfile);
8258
19455
 
 
19456
 
8259
19457
CREATE INDEX productreleasefile__signature__idx ON productreleasefile USING btree (signature) WHERE (signature IS NOT NULL);
8260
19458
 
 
19459
 
8261
19460
CREATE INDEX productreleasefile__uploader__idx ON productreleasefile USING btree (uploader);
8262
19461
 
8263
 
CREATE INDEX productreleasefile_fti ON productreleasefile USING gist (fti ts2.gist_tsvector_ops);
 
19462
 
 
19463
CREATE INDEX productreleasefile_fti ON productreleasefile USING gist (fti);
 
19464
 
8264
19465
 
8265
19466
CREATE INDEX productseries__branch__idx ON productseries USING btree (branch) WHERE (branch IS NOT NULL);
8266
19467
 
 
19468
 
8267
19469
CREATE INDEX productseries__driver__idx ON productseries USING btree (driver);
8268
19470
 
 
19471
 
8269
19472
CREATE INDEX productseries__owner__idx ON productseries USING btree (owner);
8270
19473
 
 
19474
 
8271
19475
CREATE INDEX productseries__translations_branch__idx ON productseries USING btree (translations_branch);
8272
19476
 
 
19477
 
8273
19478
CREATE INDEX productseries_datecreated_idx ON productseries USING btree (datecreated);
8274
19479
 
 
19480
 
 
19481
CREATE INDEX productseries_name_sort ON productseries USING btree (version_sort_key(name));
 
19482
 
 
19483
 
8275
19484
CREATE INDEX project__driver__idx ON project USING btree (driver);
8276
19485
 
 
19486
 
8277
19487
CREATE INDEX project__icon__idx ON project USING btree (icon) WHERE (icon IS NOT NULL);
8278
19488
 
 
19489
 
8279
19490
CREATE INDEX project__logo__idx ON project USING btree (logo) WHERE (logo IS NOT NULL);
8280
19491
 
 
19492
 
8281
19493
CREATE INDEX project__mugshot__idx ON project USING btree (mugshot) WHERE (mugshot IS NOT NULL);
8282
19494
 
 
19495
 
8283
19496
CREATE INDEX project__registrant__idx ON project USING btree (registrant);
8284
19497
 
8285
 
CREATE INDEX project_fti ON project USING gist (fti ts2.gist_tsvector_ops);
 
19498
 
 
19499
CREATE INDEX project_fti ON project USING gist (fti);
 
19500
 
8286
19501
 
8287
19502
CREATE INDEX project_owner_idx ON project USING btree (owner);
8288
19503
 
 
19504
 
8289
19505
CREATE INDEX project_translationgroup_idx ON project USING btree (translationgroup);
8290
19506
 
8291
 
CREATE INDEX pushmirroraccess_person_idx ON pushmirroraccess USING btree (person);
 
19507
 
 
19508
CREATE UNIQUE INDEX publisherconfig__distribution__idx ON publisherconfig USING btree (distribution);
 
19509
 
8292
19510
 
8293
19511
CREATE INDEX question__answerer__idx ON question USING btree (answerer);
8294
19512
 
 
19513
 
8295
19514
CREATE INDEX question__assignee__idx ON question USING btree (assignee);
8296
19515
 
 
19516
 
8297
19517
CREATE INDEX question__distribution__sourcepackagename__idx ON question USING btree (distribution, sourcepackagename);
8298
19518
 
 
19519
 
8299
19520
CREATE INDEX question__distro__datecreated__idx ON question USING btree (distribution, datecreated);
8300
19521
 
 
19522
 
8301
19523
CREATE INDEX question__faq__idx ON question USING btree (faq) WHERE (faq IS NOT NULL);
8302
19524
 
 
19525
 
8303
19526
CREATE INDEX question__owner__idx ON question USING btree (owner);
8304
19527
 
 
19528
 
8305
19529
CREATE INDEX question__product__datecreated__idx ON question USING btree (product, datecreated);
8306
19530
 
 
19531
 
8307
19532
CREATE INDEX question__product__idx ON question USING btree (product);
8308
19533
 
 
19534
 
8309
19535
CREATE INDEX question__status__datecreated__idx ON question USING btree (status, datecreated);
8310
19536
 
8311
 
CREATE INDEX question_fti ON question USING gist (fti ts2.gist_tsvector_ops);
 
19537
 
 
19538
CREATE INDEX question_fti ON question USING gist (fti);
 
19539
 
8312
19540
 
8313
19541
CREATE INDEX questionbug__question__idx ON questionbug USING btree (question);
8314
19542
 
 
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
 
8315
19550
CREATE INDEX questionmessage__question__idx ON questionmessage USING btree (question);
8316
19551
 
 
19552
 
8317
19553
CREATE INDEX questionreopening__answerer__idx ON questionreopening USING btree (answerer);
8318
19554
 
 
19555
 
8319
19556
CREATE INDEX questionreopening__datecreated__idx ON questionreopening USING btree (datecreated);
8320
19557
 
 
19558
 
8321
19559
CREATE INDEX questionreopening__question__idx ON questionreopening USING btree (question);
8322
19560
 
 
19561
 
8323
19562
CREATE INDEX questionreopening__reopener__idx ON questionreopening USING btree (reopener);
8324
19563
 
 
19564
 
8325
19565
CREATE INDEX questionsubscription__subscriber__idx ON questionsubscription USING btree (person);
8326
19566
 
8327
 
CREATE INDEX requestedcds_request_architecture_idx ON requestedcds USING btree (request, architecture);
8328
19567
 
8329
19568
CREATE INDEX revision__gpgkey__idx ON revision USING btree (gpgkey) WHERE (gpgkey IS NOT NULL);
8330
19569
 
 
19570
 
8331
19571
CREATE INDEX revision__karma_allocated__idx ON revision USING btree (karma_allocated) WHERE (karma_allocated IS FALSE);
8332
19572
 
 
19573
 
8333
19574
CREATE INDEX revision__revision_author__idx ON revision USING btree (revision_author);
8334
19575
 
 
19576
 
8335
19577
CREATE INDEX revision__revision_date__idx ON revision USING btree (revision_date);
8336
19578
 
 
19579
 
8337
19580
CREATE INDEX revisionauthor__email__idx ON revisionauthor USING btree (email);
8338
19581
 
 
19582
 
8339
19583
CREATE INDEX revisionauthor__lower_email__idx ON revisionauthor USING btree (lower(email));
8340
19584
 
 
19585
 
8341
19586
CREATE INDEX revisionauthor__person__idx ON revisionauthor USING btree (person);
8342
19587
 
 
19588
 
8343
19589
CREATE UNIQUE INDEX revisioncache__distroseries__sourcepackagename__revision__priva ON revisioncache USING btree (distroseries, sourcepackagename, revision, private) WHERE (distroseries IS NOT NULL);
8344
19590
 
 
19591
 
8345
19592
CREATE UNIQUE INDEX revisioncache__product__revision__private__key ON revisioncache USING btree (product, revision, private) WHERE (product IS NOT NULL);
8346
19593
 
 
19594
 
8347
19595
CREATE INDEX revisioncache__revision__idx ON revisioncache USING btree (revision);
8348
19596
 
 
19597
 
8349
19598
CREATE INDEX revisioncache__revision_author__idx ON revisioncache USING btree (revision_author);
8350
19599
 
 
19600
 
8351
19601
CREATE INDEX revisioncache__revision_date__idx ON revisioncache USING btree (revision_date);
8352
19602
 
 
19603
 
8353
19604
CREATE INDEX sbpph__dateremoved__idx ON binarypackagepublishinghistory USING btree (dateremoved) WHERE (dateremoved IS NOT NULL);
8354
19605
 
 
19606
 
8355
19607
CREATE INDEX scriptactivity__name__date_started__idx ON scriptactivity USING btree (name, date_started);
8356
19608
 
 
19609
 
8357
19610
CREATE INDEX securebinarypackagepublishinghistory__archive__status__idx ON binarypackagepublishinghistory USING btree (archive, status);
8358
19611
 
 
19612
 
8359
19613
CREATE INDEX securebinarypackagepublishinghistory__distroarchseries__idx ON binarypackagepublishinghistory USING btree (distroarchseries);
8360
19614
 
 
19615
 
8361
19616
CREATE INDEX securebinarypackagepublishinghistory__removed_by__idx ON binarypackagepublishinghistory USING btree (removed_by) WHERE (removed_by IS NOT NULL);
8362
19617
 
 
19618
 
8363
19619
CREATE INDEX securebinarypackagepublishinghistory__supersededby__idx ON binarypackagepublishinghistory USING btree (supersededby);
8364
19620
 
 
19621
 
8365
19622
CREATE INDEX securebinarypackagepublishinghistory_binarypackagerelease_idx ON binarypackagepublishinghistory USING btree (binarypackagerelease);
8366
19623
 
 
19624
 
8367
19625
CREATE INDEX securebinarypackagepublishinghistory_component_idx ON binarypackagepublishinghistory USING btree (component);
8368
19626
 
 
19627
 
8369
19628
CREATE INDEX securebinarypackagepublishinghistory_pocket_idx ON binarypackagepublishinghistory USING btree (pocket);
8370
19629
 
 
19630
 
8371
19631
CREATE INDEX securebinarypackagepublishinghistory_section_idx ON binarypackagepublishinghistory USING btree (section);
8372
19632
 
 
19633
 
8373
19634
CREATE INDEX securebinarypackagepublishinghistory_status_idx ON binarypackagepublishinghistory USING btree (status);
8374
19635
 
 
19636
 
8375
19637
CREATE INDEX securesourcepackagepublishinghistory__archive__status__idx ON sourcepackagepublishinghistory USING btree (archive, status);
8376
19638
 
 
19639
 
8377
19640
CREATE INDEX securesourcepackagepublishinghistory__distroseries__idx ON sourcepackagepublishinghistory USING btree (distroseries);
8378
19641
 
 
19642
 
8379
19643
CREATE INDEX securesourcepackagepublishinghistory__removed_by__idx ON sourcepackagepublishinghistory USING btree (removed_by) WHERE (removed_by IS NOT NULL);
8380
19644
 
 
19645
 
8381
19646
CREATE INDEX securesourcepackagepublishinghistory_component_idx ON sourcepackagepublishinghistory USING btree (component);
8382
19647
 
 
19648
 
8383
19649
CREATE INDEX securesourcepackagepublishinghistory_pocket_idx ON sourcepackagepublishinghistory USING btree (pocket);
8384
19650
 
 
19651
 
8385
19652
CREATE INDEX securesourcepackagepublishinghistory_section_idx ON sourcepackagepublishinghistory USING btree (section);
8386
19653
 
 
19654
 
8387
19655
CREATE INDEX securesourcepackagepublishinghistory_sourcepackagerelease_idx ON sourcepackagepublishinghistory USING btree (sourcepackagerelease);
8388
19656
 
 
19657
 
8389
19658
CREATE INDEX securesourcepackagepublishinghistory_status_idx ON sourcepackagepublishinghistory USING btree (status);
8390
19659
 
 
19660
 
8391
19661
CREATE INDEX seriessourcepackagebranch__branch__idx ON seriessourcepackagebranch USING btree (branch);
8392
19662
 
 
19663
 
8393
19664
CREATE INDEX seriessourcepackagebranch__registrant__key ON seriessourcepackagebranch USING btree (registrant);
8394
19665
 
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);
8426
19666
 
8427
19667
CREATE INDEX signedcodeofconduct_owner_idx ON signedcodeofconduct USING btree (owner);
8428
19668
 
 
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
 
8429
19679
CREATE INDEX sourcepackagerecipe__daily_build_archive__idx ON sourcepackagerecipe USING btree (daily_build_archive);
8430
19680
 
 
19681
 
8431
19682
CREATE INDEX sourcepackagerecipe__is_stale__build_daily__idx ON sourcepackagerecipe USING btree (is_stale, build_daily);
8432
19683
 
 
19684
 
8433
19685
CREATE INDEX sourcepackagerecipe__registrant__idx ON sourcepackagerecipe USING btree (registrant);
8434
19686
 
 
19687
 
8435
19688
CREATE INDEX sourcepackagerecipebuild__distroseries__idx ON sourcepackagerecipebuild USING btree (distroseries);
8436
19689
 
 
19690
 
8437
19691
CREATE INDEX sourcepackagerecipebuild__manifest__idx ON sourcepackagerecipebuild USING btree (manifest);
8438
19692
 
 
19693
 
8439
19694
CREATE INDEX sourcepackagerecipebuild__recipe__idx ON sourcepackagerecipebuild USING btree (recipe);
8440
19695
 
 
19696
 
8441
19697
CREATE INDEX sourcepackagerecipebuild__requester__idx ON sourcepackagerecipebuild USING btree (requester);
8442
19698
 
 
19699
 
8443
19700
CREATE INDEX sourcepackagerecipedata__base_branch__idx ON sourcepackagerecipedata USING btree (base_branch);
8444
19701
 
 
19702
 
8445
19703
CREATE UNIQUE INDEX sourcepackagerecipedata__sourcepackage_recipe__key ON sourcepackagerecipedata USING btree (sourcepackage_recipe) WHERE (sourcepackage_recipe IS NOT NULL);
8446
19704
 
 
19705
 
8447
19706
CREATE UNIQUE INDEX sourcepackagerecipedata__sourcepackage_recipe_build__key ON sourcepackagerecipedata USING btree (sourcepackage_recipe_build) WHERE (sourcepackage_recipe_build IS NOT NULL);
8448
19707
 
 
19708
 
8449
19709
CREATE INDEX sourcepackagerecipedatainstruction__branch__idx ON sourcepackagerecipedatainstruction USING btree (branch);
8450
19710
 
 
19711
 
8451
19712
CREATE INDEX sourcepackagerelease__changelog__idx ON sourcepackagerelease USING btree (changelog);
8452
19713
 
 
19714
 
8453
19715
CREATE INDEX sourcepackagerelease__sourcepackage_recipe_build__idx ON sourcepackagerelease USING btree (sourcepackage_recipe_build);
8454
19716
 
 
19717
 
8455
19718
CREATE INDEX sourcepackagerelease__upload_archive__idx ON sourcepackagerelease USING btree (upload_archive);
8456
19719
 
 
19720
 
 
19721
CREATE INDEX sourcepackagerelease__version__idx ON sourcepackagerelease USING btree (version);
 
19722
 
 
19723
 
8457
19724
CREATE INDEX sourcepackagerelease_creator_idx ON sourcepackagerelease USING btree (creator);
8458
19725
 
 
19726
 
8459
19727
CREATE INDEX sourcepackagerelease_maintainer_idx ON sourcepackagerelease USING btree (maintainer);
8460
19728
 
 
19729
 
8461
19730
CREATE INDEX sourcepackagerelease_sourcepackagename_idx ON sourcepackagerelease USING btree (sourcepackagename);
8462
19731
 
8463
 
CREATE INDEX sourcepackagerelease_version_sort ON sourcepackagerelease USING btree (debversion_sort_key(version));
8464
19732
 
8465
19733
CREATE INDEX sourcepackagereleasefile_libraryfile_idx ON sourcepackagereleasefile USING btree (libraryfile);
8466
19734
 
 
19735
 
8467
19736
CREATE INDEX sourcepackagereleasefile_sourcepackagerelease_idx ON sourcepackagereleasefile USING btree (sourcepackagerelease);
8468
19737
 
 
19738
 
8469
19739
CREATE INDEX specification__completer__idx ON specification USING btree (completer);
8470
19740
 
 
19741
 
8471
19742
CREATE INDEX specification__goal_decider__idx ON specification USING btree (goal_decider);
8472
19743
 
 
19744
 
8473
19745
CREATE INDEX specification__goal_proposer__idx ON specification USING btree (goal_proposer);
8474
19746
 
 
19747
 
8475
19748
CREATE INDEX specification__starter__idx ON specification USING btree (starter);
8476
19749
 
 
19750
 
8477
19751
CREATE INDEX specification_approver_idx ON specification USING btree (approver);
8478
19752
 
 
19753
 
8479
19754
CREATE INDEX specification_assignee_idx ON specification USING btree (assignee);
8480
19755
 
 
19756
 
8481
19757
CREATE INDEX specification_datecreated_idx ON specification USING btree (datecreated);
8482
19758
 
 
19759
 
8483
19760
CREATE INDEX specification_drafter_idx ON specification USING btree (drafter);
8484
19761
 
8485
 
CREATE INDEX specification_fti ON specification USING gist (fti ts2.gist_tsvector_ops);
 
19762
 
 
19763
CREATE INDEX specification_fti ON specification USING gist (fti);
 
19764
 
8486
19765
 
8487
19766
CREATE INDEX specification_owner_idx ON specification USING btree (owner);
8488
19767
 
 
19768
 
8489
19769
CREATE INDEX specificationbranch__registrant__idx ON specificationbranch USING btree (registrant);
8490
19770
 
 
19771
 
8491
19772
CREATE INDEX specificationbranch__specification__idx ON specificationbranch USING btree (specification);
8492
19773
 
 
19774
 
8493
19775
CREATE INDEX specificationbug_bug_idx ON specificationbug USING btree (bug);
8494
19776
 
 
19777
 
8495
19778
CREATE INDEX specificationbug_specification_idx ON specificationbug USING btree (specification);
8496
19779
 
 
19780
 
8497
19781
CREATE INDEX specificationdependency_dependency_idx ON specificationdependency USING btree (dependency);
8498
19782
 
 
19783
 
8499
19784
CREATE INDEX specificationdependency_specification_idx ON specificationdependency USING btree (specification);
8500
19785
 
 
19786
 
8501
19787
CREATE INDEX specificationfeedback_requester_idx ON specificationfeedback USING btree (requester);
8502
19788
 
 
19789
 
8503
19790
CREATE INDEX specificationfeedback_reviewer_idx ON specificationfeedback USING btree (reviewer);
8504
19791
 
 
19792
 
8505
19793
CREATE INDEX specificationsubscription_specification_idx ON specificationsubscription USING btree (specification);
8506
19794
 
 
19795
 
8507
19796
CREATE INDEX specificationsubscription_subscriber_idx ON specificationsubscription USING btree (person);
8508
19797
 
 
19798
 
8509
19799
CREATE INDEX sprint__driver__idx ON sprint USING btree (driver);
8510
19800
 
 
19801
 
8511
19802
CREATE INDEX sprint__icon__idx ON sprint USING btree (icon) WHERE (icon IS NOT NULL);
8512
19803
 
 
19804
 
8513
19805
CREATE INDEX sprint__logo__idx ON sprint USING btree (logo) WHERE (logo IS NOT NULL);
8514
19806
 
 
19807
 
8515
19808
CREATE INDEX sprint__mugshot__idx ON sprint USING btree (mugshot) WHERE (mugshot IS NOT NULL);
8516
19809
 
 
19810
 
8517
19811
CREATE INDEX sprint__owner__idx ON sprint USING btree (owner);
8518
19812
 
 
19813
 
8519
19814
CREATE INDEX sprint_datecreated_idx ON sprint USING btree (datecreated);
8520
19815
 
 
19816
 
8521
19817
CREATE INDEX sprintattendance_sprint_idx ON sprintattendance USING btree (sprint);
8522
19818
 
 
19819
 
8523
19820
CREATE INDEX sprintspec_sprint_idx ON sprintspecification USING btree (sprint);
8524
19821
 
 
19822
 
8525
19823
CREATE INDEX sprintspecification__decider__idx ON sprintspecification USING btree (decider);
8526
19824
 
 
19825
 
8527
19826
CREATE INDEX sprintspecification__registrant__idx ON sprintspecification USING btree (registrant);
8528
19827
 
 
19828
 
8529
19829
CREATE INDEX sshkey_person_key ON sshkey USING btree (person);
8530
19830
 
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);
 
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
 
8548
19852
 
8549
19853
CREATE INDEX structuralsubscription__subscribed_by__idx ON structuralsubscription USING btree (subscribed_by);
8550
19854
 
 
19855
 
8551
19856
CREATE INDEX structuralsubscription__subscriber__idx ON structuralsubscription USING btree (subscriber);
8552
19857
 
 
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
 
8553
19868
CREATE INDEX teammembership__acknowledged_by__idx ON teammembership USING btree (acknowledged_by) WHERE (acknowledged_by IS NOT NULL);
8554
19869
 
 
19870
 
8555
19871
CREATE INDEX teammembership__last_changed_by__idx ON teammembership USING btree (last_changed_by) WHERE (last_changed_by IS NOT NULL);
8556
19872
 
 
19873
 
8557
19874
CREATE INDEX teammembership__proposed_by__idx ON teammembership USING btree (proposed_by) WHERE (proposed_by IS NOT NULL);
8558
19875
 
 
19876
 
8559
19877
CREATE INDEX teammembership__reviewed_by__idx ON teammembership USING btree (reviewed_by) WHERE (reviewed_by IS NOT NULL);
8560
19878
 
 
19879
 
8561
19880
CREATE INDEX teammembership__team__idx ON teammembership USING btree (team);
8562
19881
 
 
19882
 
8563
19883
CREATE INDEX teamparticipation_person_idx ON teamparticipation USING btree (person);
8564
19884
 
8565
19885
ALTER TABLE teamparticipation CLUSTER ON teamparticipation_person_idx;
8566
19886
 
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));
 
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
 
8584
19902
 
8585
19903
CREATE INDEX translationgroup__owner__idx ON translationgroup USING btree (owner);
8586
19904
 
 
19905
 
8587
19906
CREATE INDEX translationimportqueueentry__content__idx ON translationimportqueueentry USING btree (content) WHERE (content IS NOT NULL);
8588
19907
 
 
19908
 
8589
19909
CREATE INDEX translationimportqueueentry__context__path__idx ON translationimportqueueentry USING btree (distroseries, sourcepackagename, productseries, path);
8590
19910
 
 
19911
 
8591
19912
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))));
8592
19913
 
 
19914
 
8593
19915
CREATE INDEX translationimportqueueentry__path__idx ON translationimportqueueentry USING btree (path);
8594
19916
 
 
19917
 
8595
19918
CREATE INDEX translationimportqueueentry__pofile__idx ON translationimportqueueentry USING btree (pofile) WHERE (pofile IS NOT NULL);
8596
19919
 
 
19920
 
8597
19921
CREATE INDEX translationimportqueueentry__potemplate__idx ON translationimportqueueentry USING btree (potemplate) WHERE (potemplate IS NOT NULL);
8598
19922
 
 
19923
 
8599
19924
CREATE INDEX translationimportqueueentry__productseries__idx ON translationimportqueueentry USING btree (productseries) WHERE (productseries IS NOT NULL);
8600
19925
 
 
19926
 
8601
19927
CREATE INDEX translationimportqueueentry__sourcepackagename__idx ON translationimportqueueentry USING btree (sourcepackagename) WHERE (sourcepackagename IS NOT NULL);
8602
19928
 
 
19929
 
8603
19930
CREATE UNIQUE INDEX translationimportqueueentry__status__dateimported__id__idx ON translationimportqueueentry USING btree (status, dateimported, id);
8604
19931
 
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);
8608
19932
 
8609
19933
CREATE INDEX translationmessage__msgstr0__idx ON translationmessage USING btree (msgstr0);
8610
19934
 
 
19935
 
8611
19936
CREATE INDEX translationmessage__msgstr1__idx ON translationmessage USING btree (msgstr1) WHERE (msgstr1 IS NOT NULL);
8612
19937
 
 
19938
 
8613
19939
CREATE INDEX translationmessage__msgstr2__idx ON translationmessage USING btree (msgstr2) WHERE (msgstr2 IS NOT NULL);
8614
19940
 
 
19941
 
8615
19942
CREATE INDEX translationmessage__msgstr3__idx ON translationmessage USING btree (msgstr3) WHERE (msgstr3 IS NOT NULL);
8616
19943
 
 
19944
 
8617
19945
CREATE INDEX translationmessage__msgstr4__idx ON translationmessage USING btree (msgstr4) WHERE (msgstr4 IS NOT NULL);
8618
19946
 
 
19947
 
8619
19948
CREATE INDEX translationmessage__msgstr5__idx ON translationmessage USING btree (msgstr5) WHERE (msgstr5 IS NOT NULL);
8620
19949
 
8621
 
CREATE INDEX translationmessage__pofile__idx ON translationmessage USING btree (pofile);
 
19950
 
 
19951
CREATE INDEX translationmessage__potemplate__idx ON translationmessage USING btree (potemplate) WHERE (potemplate IS NOT NULL);
 
19952
 
8622
19953
 
8623
19954
CREATE INDEX translationmessage__potmsgset__idx ON translationmessage USING btree (potmsgset);
8624
19955
 
 
19956
 
8625
19957
CREATE INDEX translationmessage__potmsgset__language__idx ON translationmessage USING btree (potmsgset, language);
8626
19958
 
 
19959
 
8627
19960
CREATE INDEX translationmessage__reviewer__idx ON translationmessage USING btree (reviewer);
8628
19961
 
 
19962
 
8629
19963
CREATE INDEX translationmessage__submitter__idx ON translationmessage USING btree (submitter);
8630
19964
 
 
19965
 
8631
19966
CREATE UNIQUE INDEX translationtemplateitem__potemplate__potmsgset__key ON translationtemplateitem USING btree (potemplate, potmsgset);
8632
19967
 
 
19968
 
8633
19969
CREATE INDEX translationtemplateitem__potemplate__sequence__idx ON translationtemplateitem USING btree (potemplate, sequence);
8634
19970
 
 
19971
 
8635
19972
CREATE UNIQUE INDEX translationtemplateitem__potemplate__sequence__key ON translationtemplateitem USING btree (potemplate, sequence) WHERE (sequence > 0);
8636
19973
 
 
19974
 
8637
19975
CREATE INDEX translationtemplateitem__potmsgset__idx ON translationtemplateitem USING btree (potmsgset);
8638
19976
 
 
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
 
8639
19984
CREATE INDEX translator__translator__idx ON translator USING btree (translator);
8640
19985
 
 
19986
 
8641
19987
CREATE INDEX usertouseremail__recipient__idx ON usertouseremail USING btree (recipient);
8642
19988
 
 
19989
 
8643
19990
CREATE INDEX usertouseremail__sender__date_sent__idx ON usertouseremail USING btree (sender, date_sent);
8644
19991
 
 
19992
 
8645
19993
CREATE INDEX vote__person__idx ON vote USING btree (person);
8646
19994
 
 
19995
 
8647
19996
CREATE INDEX votecast_poll_idx ON votecast USING btree (poll);
8648
19997
 
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));
8662
19998
 
8663
19999
CREATE INDEX wikiname_person_idx ON wikiname USING btree (person);
8664
20000
 
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);
8670
20001
 
8671
20002
CREATE TRIGGER bug_latest_patch_uploaded_on_delete_t
8672
20003
    AFTER DELETE ON bugattachment
8673
20004
    FOR EACH ROW
8674
20005
    EXECUTE PROCEDURE bug_update_latest_patch_uploaded_on_delete();
8675
20006
 
 
20007
 
8676
20008
CREATE TRIGGER bug_latest_patch_uploaded_on_insert_update_t
8677
20009
    AFTER INSERT OR UPDATE ON bugattachment
8678
20010
    FOR EACH ROW
8679
20011
    EXECUTE PROCEDURE bug_update_latest_patch_uploaded_on_insert_update();
8680
20012
 
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();
 
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
 
8695
20085
 
8696
20086
CREATE TRIGGER lp_mirror_person_del_t
8697
20087
    AFTER DELETE ON person
8698
20088
    FOR EACH ROW
8699
20089
    EXECUTE PROCEDURE lp_mirror_del();
8700
20090
 
 
20091
 
8701
20092
CREATE TRIGGER lp_mirror_person_ins_t
8702
20093
    AFTER INSERT ON person
8703
20094
    FOR EACH ROW
8704
20095
    EXECUTE PROCEDURE lp_mirror_person_ins();
8705
20096
 
 
20097
 
8706
20098
CREATE TRIGGER lp_mirror_person_upd_t
8707
20099
    AFTER UPDATE ON person
8708
20100
    FOR EACH ROW
8709
20101
    EXECUTE PROCEDURE lp_mirror_person_upd();
8710
20102
 
 
20103
 
8711
20104
CREATE TRIGGER lp_mirror_personlocation_del_t
8712
20105
    AFTER DELETE ON teamparticipation
8713
20106
    FOR EACH ROW
8714
20107
    EXECUTE PROCEDURE lp_mirror_del();
8715
20108
 
 
20109
 
8716
20110
CREATE TRIGGER lp_mirror_personlocation_ins_t
8717
20111
    AFTER INSERT ON personlocation
8718
20112
    FOR EACH ROW
8719
20113
    EXECUTE PROCEDURE lp_mirror_personlocation_ins();
8720
20114
 
 
20115
 
8721
20116
CREATE TRIGGER lp_mirror_personlocation_upd_t
8722
20117
    AFTER UPDATE ON personlocation
8723
20118
    FOR EACH ROW
8724
20119
    EXECUTE PROCEDURE lp_mirror_personlocation_upd();
8725
20120
 
 
20121
 
8726
20122
CREATE TRIGGER lp_mirror_teamparticipation_del_t
8727
20123
    AFTER DELETE ON teamparticipation
8728
20124
    FOR EACH ROW
8729
20125
    EXECUTE PROCEDURE lp_mirror_del();
8730
20126
 
 
20127
 
8731
20128
CREATE TRIGGER lp_mirror_teamparticipation_ins_t
8732
20129
    AFTER INSERT ON teamparticipation
8733
20130
    FOR EACH ROW
8734
20131
    EXECUTE PROCEDURE lp_mirror_teamparticipation_ins();
8735
20132
 
 
20133
 
8736
20134
CREATE TRIGGER lp_mirror_teamparticipation_upd_t
8737
20135
    AFTER UPDATE ON teamparticipation
8738
20136
    FOR EACH ROW
8739
20137
    EXECUTE PROCEDURE lp_mirror_teamparticipation_upd();
8740
20138
 
 
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
 
8741
20158
CREATE TRIGGER mv_branch_distribution_update_t
8742
20159
    AFTER UPDATE ON distribution
8743
20160
    FOR EACH ROW
8744
20161
    EXECUTE PROCEDURE mv_branch_distribution_update();
8745
20162
 
 
20163
 
8746
20164
CREATE TRIGGER mv_branch_distroseries_update_t
8747
20165
    AFTER UPDATE ON distroseries
8748
20166
    FOR EACH ROW
8749
20167
    EXECUTE PROCEDURE mv_branch_distroseries_update();
8750
20168
 
 
20169
 
8751
20170
CREATE TRIGGER mv_branch_person_update_t
8752
20171
    AFTER UPDATE ON person
8753
20172
    FOR EACH ROW
8754
20173
    EXECUTE PROCEDURE mv_branch_person_update();
8755
20174
 
 
20175
 
8756
20176
CREATE TRIGGER mv_branch_product_update_t
8757
20177
    AFTER UPDATE ON product
8758
20178
    FOR EACH ROW
8759
20179
    EXECUTE PROCEDURE mv_branch_product_update();
8760
20180
 
 
20181
 
8761
20182
CREATE TRIGGER mv_pillarname_distribution_t
8762
20183
    AFTER INSERT OR UPDATE ON distribution
8763
20184
    FOR EACH ROW
8764
20185
    EXECUTE PROCEDURE mv_pillarname_distribution();
8765
20186
 
 
20187
 
8766
20188
CREATE TRIGGER mv_pillarname_product_t
8767
20189
    AFTER INSERT OR UPDATE ON product
8768
20190
    FOR EACH ROW
8769
20191
    EXECUTE PROCEDURE mv_pillarname_product();
8770
20192
 
 
20193
 
8771
20194
CREATE TRIGGER mv_pillarname_project_t
8772
20195
    AFTER INSERT OR UPDATE ON project
8773
20196
    FOR EACH ROW
8774
20197
    EXECUTE PROCEDURE mv_pillarname_project();
8775
20198
 
 
20199
 
8776
20200
CREATE TRIGGER mv_pofiletranslator_translationmessage
8777
20201
    AFTER INSERT OR DELETE OR UPDATE ON translationmessage
8778
20202
    FOR EACH ROW
8779
20203
    EXECUTE PROCEDURE mv_pofiletranslator_translationmessage();
8780
20204
 
 
20205
 
8781
20206
CREATE TRIGGER packageset_deleted_trig
8782
20207
    BEFORE DELETE ON packageset
8783
20208
    FOR EACH ROW
8784
20209
    EXECUTE PROCEDURE packageset_deleted_trig();
8785
20210
 
 
20211
 
8786
20212
CREATE TRIGGER packageset_inserted_trig
8787
20213
    AFTER INSERT ON packageset
8788
20214
    FOR EACH ROW
8789
20215
    EXECUTE PROCEDURE packageset_inserted_trig();
8790
20216
 
 
20217
 
8791
20218
CREATE TRIGGER packagesetinclusion_deleted_trig
8792
20219
    BEFORE DELETE ON packagesetinclusion
8793
20220
    FOR EACH ROW
8794
20221
    EXECUTE PROCEDURE packagesetinclusion_deleted_trig();
8795
20222
 
 
20223
 
8796
20224
CREATE TRIGGER packagesetinclusion_inserted_trig
8797
20225
    AFTER INSERT ON packagesetinclusion
8798
20226
    FOR EACH ROW
8799
20227
    EXECUTE PROCEDURE packagesetinclusion_inserted_trig();
8800
20228
 
 
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
 
8801
20236
CREATE TRIGGER set_bug_message_count_t
8802
20237
    AFTER INSERT OR DELETE OR UPDATE ON bugmessage
8803
20238
    FOR EACH ROW
8804
20239
    EXECUTE PROCEDURE set_bug_message_count();
8805
20240
 
 
20241
 
8806
20242
CREATE TRIGGER set_bug_number_of_duplicates_t
8807
20243
    AFTER INSERT OR DELETE OR UPDATE ON bug
8808
20244
    FOR EACH ROW
8809
20245
    EXECUTE PROCEDURE set_bug_number_of_duplicates();
8810
20246
 
 
20247
 
8811
20248
CREATE TRIGGER set_bug_users_affected_count_t
8812
20249
    AFTER INSERT OR DELETE OR UPDATE ON bugaffectsperson
8813
20250
    FOR EACH ROW
8814
20251
    EXECUTE PROCEDURE set_bug_users_affected_count();
8815
20252
 
 
20253
 
8816
20254
CREATE TRIGGER set_bugtask_date_milestone_set_t
8817
20255
    AFTER INSERT OR UPDATE ON bugtask
8818
20256
    FOR EACH ROW
8819
20257
    EXECUTE PROCEDURE set_bugtask_date_milestone_set();
8820
20258
 
 
20259
 
8821
20260
CREATE TRIGGER set_date_last_message_t
8822
20261
    AFTER INSERT OR DELETE OR UPDATE ON bugmessage
8823
20262
    FOR EACH ROW
8824
20263
    EXECUTE PROCEDURE set_bug_date_last_message();
8825
20264
 
 
20265
 
8826
20266
CREATE TRIGGER set_date_status_set_t
8827
20267
    BEFORE UPDATE ON account
8828
20268
    FOR EACH ROW
8829
20269
    EXECUTE PROCEDURE set_date_status_set();
8830
20270
 
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');
8840
20271
 
8841
20272
CREATE TRIGGER tsvectorupdate
8842
20273
    BEFORE INSERT OR UPDATE ON binarypackagerelease
8843
20274
    FOR EACH ROW
8844
20275
    EXECUTE PROCEDURE ts2.ftiupdate('summary', 'b', 'description', 'c');
8845
20276
 
 
20277
 
8846
20278
CREATE TRIGGER tsvectorupdate
8847
20279
    BEFORE INSERT OR UPDATE ON cve
8848
20280
    FOR EACH ROW
8849
20281
    EXECUTE PROCEDURE ts2.ftiupdate('sequence', 'a', 'description', 'b');
8850
20282
 
 
20283
 
8851
20284
CREATE TRIGGER tsvectorupdate
8852
20285
    BEFORE INSERT OR UPDATE ON distroseriespackagecache
8853
20286
    FOR EACH ROW
8854
20287
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'summaries', 'b', 'descriptions', 'c');
8855
20288
 
 
20289
 
8856
20290
CREATE TRIGGER tsvectorupdate
8857
20291
    BEFORE INSERT OR UPDATE ON message
8858
20292
    FOR EACH ROW
8859
20293
    EXECUTE PROCEDURE ts2.ftiupdate('subject', 'b');
8860
20294
 
 
20295
 
8861
20296
CREATE TRIGGER tsvectorupdate
8862
20297
    BEFORE INSERT OR UPDATE ON messagechunk
8863
20298
    FOR EACH ROW
8864
20299
    EXECUTE PROCEDURE ts2.ftiupdate('content', 'c');
8865
20300
 
 
20301
 
8866
20302
CREATE TRIGGER tsvectorupdate
8867
20303
    BEFORE INSERT OR UPDATE ON product
8868
20304
    FOR EACH ROW
8869
20305
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a', 'title', 'b', 'summary', 'c', 'description', 'd');
8870
20306
 
 
20307
 
8871
20308
CREATE TRIGGER tsvectorupdate
8872
20309
    BEFORE INSERT OR UPDATE ON project
8873
20310
    FOR EACH ROW
8874
20311
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a', 'title', 'b', 'summary', 'c', 'description', 'd');
8875
20312
 
8876
 
CREATE TRIGGER tsvectorupdate
8877
 
    BEFORE INSERT OR UPDATE ON shippingrequest
8878
 
    FOR EACH ROW
8879
 
    EXECUTE PROCEDURE ts2.ftiupdate('recipientdisplayname', 'a');
8880
20313
 
8881
20314
CREATE TRIGGER tsvectorupdate
8882
20315
    BEFORE INSERT OR UPDATE ON question
8883
20316
    FOR EACH ROW
8884
20317
    EXECUTE PROCEDURE ts2.ftiupdate('title', 'a', 'description', 'b', 'whiteboard', 'b');
8885
20318
 
 
20319
 
8886
20320
CREATE TRIGGER tsvectorupdate
8887
20321
    BEFORE INSERT OR UPDATE ON bug
8888
20322
    FOR EACH ROW
8889
20323
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'title', 'b', 'description', 'd');
8890
20324
 
 
20325
 
8891
20326
CREATE TRIGGER tsvectorupdate
8892
20327
    BEFORE INSERT OR UPDATE ON person
8893
20328
    FOR EACH ROW
8894
20329
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a');
8895
20330
 
 
20331
 
8896
20332
CREATE TRIGGER tsvectorupdate
8897
20333
    BEFORE INSERT OR UPDATE ON specification
8898
20334
    FOR EACH ROW
8899
20335
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'title', 'a', 'summary', 'b', 'whiteboard', 'd');
8900
20336
 
 
20337
 
8901
20338
CREATE TRIGGER tsvectorupdate
8902
20339
    BEFORE INSERT OR UPDATE ON distribution
8903
20340
    FOR EACH ROW
8904
20341
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'displayname', 'a', 'title', 'b', 'summary', 'c', 'description', 'd');
8905
20342
 
 
20343
 
8906
20344
CREATE TRIGGER tsvectorupdate
8907
20345
    BEFORE INSERT OR UPDATE ON distributionsourcepackagecache
8908
20346
    FOR EACH ROW
8909
20347
    EXECUTE PROCEDURE ts2.ftiupdate('name', 'a', 'binpkgnames', 'b', 'binpkgsummaries', 'c', 'binpkgdescriptions', 'd', 'changelog', 'd');
8910
20348
 
 
20349
 
8911
20350
CREATE TRIGGER tsvectorupdate
8912
20351
    BEFORE INSERT OR UPDATE ON productreleasefile
8913
20352
    FOR EACH ROW
8914
20353
    EXECUTE PROCEDURE ts2.ftiupdate('description', 'd');
8915
20354
 
 
20355
 
8916
20356
CREATE TRIGGER tsvectorupdate
8917
20357
    BEFORE INSERT OR UPDATE ON faq
8918
20358
    FOR EACH ROW
8919
20359
    EXECUTE PROCEDURE ts2.ftiupdate('title', 'a', 'tags', 'b', 'content', 'd');
8920
20360
 
 
20361
 
8921
20362
CREATE TRIGGER tsvectorupdate
8922
20363
    BEFORE INSERT OR UPDATE ON archive
8923
20364
    FOR EACH ROW
8924
20365
    EXECUTE PROCEDURE ts2.ftiupdate('description', 'a', 'package_description_cache', 'b');
8925
20366
 
 
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
 
8926
20374
CREATE TRIGGER update_branch_name_cache_t
8927
20375
    BEFORE INSERT OR UPDATE ON branch
8928
20376
    FOR EACH ROW
8929
20377
    EXECUTE PROCEDURE update_branch_name_cache();
8930
20378
 
 
20379
 
8931
20380
CREATE TRIGGER you_are_your_own_member
8932
20381
    AFTER INSERT ON person
8933
20382
    FOR EACH ROW
8934
20383
    EXECUTE PROCEDURE you_are_your_own_member();
8935
20384
 
 
20385
 
8936
20386
ALTER TABLE ONLY processor
8937
20387
    ADD CONSTRAINT "$1" FOREIGN KEY (family) REFERENCES processorfamily(id);
8938
20388
 
 
20389
 
8939
20390
ALTER TABLE ONLY builder
8940
20391
    ADD CONSTRAINT "$1" FOREIGN KEY (processor) REFERENCES processor(id);
8941
20392
 
 
20393
 
8942
20394
ALTER TABLE ONLY distribution
8943
20395
    ADD CONSTRAINT "$1" FOREIGN KEY (owner) REFERENCES person(id);
8944
20396
 
 
20397
 
8945
20398
ALTER TABLE ONLY libraryfilealias
8946
20399
    ADD CONSTRAINT "$1" FOREIGN KEY (content) REFERENCES libraryfilecontent(id);
8947
20400
 
 
20401
 
8948
20402
ALTER TABLE ONLY productreleasefile
8949
20403
    ADD CONSTRAINT "$1" FOREIGN KEY (productrelease) REFERENCES productrelease(id);
8950
20404
 
 
20405
 
8951
20406
ALTER TABLE ONLY spokenin
8952
20407
    ADD CONSTRAINT "$1" FOREIGN KEY (language) REFERENCES language(id);
8953
20408
 
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);
8959
20409
 
8960
20410
ALTER TABLE ONLY bugsubscription
8961
20411
    ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
8962
20412
 
 
20413
 
8963
20414
ALTER TABLE ONLY bugactivity
8964
20415
    ADD CONSTRAINT "$1" FOREIGN KEY (bug) REFERENCES bug(id);
8965
20416
 
 
20417
 
8966
20418
ALTER TABLE ONLY sshkey
8967
20419
    ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
8968
20420
 
8969
 
ALTER TABLE ONLY pushmirroraccess
8970
 
    ADD CONSTRAINT "$1" FOREIGN KEY (person) REFERENCES person(id);
8971
20421
 
8972
20422
ALTER TABLE ONLY polloption
8973
20423
    ADD CONSTRAINT "$1" FOREIGN KEY (poll) REFERENCES poll(id);
8974
20424
 
 
20425
 
8975
20426
ALTER TABLE ONLY product
8976
20427
    ADD CONSTRAINT "$1" FOREIGN KEY (bug_supervisor) REFERENCES person(id);
8977
20428
 
8978
 
ALTER TABLE ONLY shipitreport
8979
 
    ADD CONSTRAINT "$1" FOREIGN KEY (csvfile) REFERENCES libraryfilealias(id);
8980
20429
 
8981
20430
ALTER TABLE ONLY country
8982
20431
    ADD CONSTRAINT "$1" FOREIGN KEY (continent) REFERENCES continent(id);
8983
20432
 
 
20433
 
8984
20434
ALTER TABLE ONLY sourcepackagereleasefile
8985
20435
    ADD CONSTRAINT "$1" FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id) ON DELETE CASCADE;
8986
20436
 
 
20437
 
8987
20438
ALTER TABLE ONLY builder
8988
20439
    ADD CONSTRAINT "$2" FOREIGN KEY (owner) REFERENCES person(id);
8989
20440
 
 
20441
 
8990
20442
ALTER TABLE ONLY productreleasefile
8991
20443
    ADD CONSTRAINT "$2" FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
8992
20444
 
 
20445
 
8993
20446
ALTER TABLE ONLY sourcepackagereleasefile
8994
20447
    ADD CONSTRAINT "$2" FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
8995
20448
 
 
20449
 
8996
20450
ALTER TABLE ONLY spokenin
8997
20451
    ADD CONSTRAINT "$2" FOREIGN KEY (country) REFERENCES country(id);
8998
20452
 
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);
9004
20453
 
9005
20454
ALTER TABLE ONLY bugsubscription
9006
20455
    ADD CONSTRAINT "$2" FOREIGN KEY (bug) REFERENCES bug(id);
9007
20456
 
 
20457
 
9008
20458
ALTER TABLE ONLY buildqueue
9009
20459
    ADD CONSTRAINT "$2" FOREIGN KEY (builder) REFERENCES builder(id);
9010
20460
 
 
20461
 
9011
20462
ALTER TABLE ONLY distribution
9012
20463
    ADD CONSTRAINT "$2" FOREIGN KEY (members) REFERENCES person(id);
9013
20464
 
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);
9019
20465
 
9020
20466
ALTER TABLE ONLY distribution
9021
20467
    ADD CONSTRAINT "$3" FOREIGN KEY (bug_supervisor) REFERENCES person(id);
9022
20468
 
 
20469
 
9023
20470
ALTER TABLE ONLY pofile
9024
20471
    ADD CONSTRAINT "$3" FOREIGN KEY (from_sourcepackagename) REFERENCES sourcepackagename(id);
9025
20472
 
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);
 
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
 
9031
20509
 
9032
20510
ALTER TABLE ONLY accountpassword
9033
20511
    ADD CONSTRAINT accountpassword_account_fkey FOREIGN KEY (account) REFERENCES account(id) ON DELETE CASCADE;
9034
20512
 
 
20513
 
9035
20514
ALTER TABLE ONLY karma
9036
20515
    ADD CONSTRAINT action_fkey FOREIGN KEY (action) REFERENCES karmaaction(id);
9037
20516
 
 
20517
 
9038
20518
ALTER TABLE ONLY announcement
9039
20519
    ADD CONSTRAINT announcement_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9040
20520
 
 
20521
 
9041
20522
ALTER TABLE ONLY announcement
9042
20523
    ADD CONSTRAINT announcement_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9043
20524
 
 
20525
 
9044
20526
ALTER TABLE ONLY announcement
9045
20527
    ADD CONSTRAINT announcement_project_fkey FOREIGN KEY (project) REFERENCES project(id);
9046
20528
 
 
20529
 
9047
20530
ALTER TABLE ONLY announcement
9048
20531
    ADD CONSTRAINT announcement_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9049
20532
 
 
20533
 
9050
20534
ALTER TABLE ONLY answercontact
9051
20535
    ADD CONSTRAINT answercontact__distribution__fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9052
20536
 
 
20537
 
9053
20538
ALTER TABLE ONLY answercontact
9054
20539
    ADD CONSTRAINT answercontact__person__fkey FOREIGN KEY (person) REFERENCES person(id);
9055
20540
 
 
20541
 
9056
20542
ALTER TABLE ONLY answercontact
9057
20543
    ADD CONSTRAINT answercontact__product__fkey FOREIGN KEY (product) REFERENCES product(id);
9058
20544
 
 
20545
 
9059
20546
ALTER TABLE ONLY answercontact
9060
20547
    ADD CONSTRAINT answercontact__sourcepackagename__fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9061
20548
 
 
20549
 
9062
20550
ALTER TABLE ONLY apportjob
9063
20551
    ADD CONSTRAINT apportjob_blob_fkey FOREIGN KEY (blob) REFERENCES temporaryblobstorage(id);
9064
20552
 
 
20553
 
9065
20554
ALTER TABLE ONLY apportjob
9066
20555
    ADD CONSTRAINT apportjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
9067
20556
 
 
20557
 
9068
20558
ALTER TABLE ONLY archive
9069
20559
    ADD CONSTRAINT archive__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9070
20560
 
 
20561
 
9071
20562
ALTER TABLE ONLY archive
9072
20563
    ADD CONSTRAINT archive__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
9073
20564
 
 
20565
 
9074
20566
ALTER TABLE ONLY archive
9075
20567
    ADD CONSTRAINT archive_signing_key_fkey FOREIGN KEY (signing_key) REFERENCES gpgkey(id);
9076
20568
 
 
20569
 
9077
20570
ALTER TABLE ONLY archivearch
9078
20571
    ADD CONSTRAINT archivearch__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9079
20572
 
 
20573
 
9080
20574
ALTER TABLE ONLY archivearch
9081
20575
    ADD CONSTRAINT archivearch__processorfamily__fk FOREIGN KEY (processorfamily) REFERENCES processorfamily(id);
9082
20576
 
 
20577
 
9083
20578
ALTER TABLE ONLY archiveauthtoken
9084
20579
    ADD CONSTRAINT archiveauthtoken__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9085
20580
 
 
20581
 
9086
20582
ALTER TABLE ONLY archiveauthtoken
9087
20583
    ADD CONSTRAINT archiveauthtoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9088
20584
 
 
20585
 
9089
20586
ALTER TABLE ONLY archivedependency
9090
20587
    ADD CONSTRAINT archivedependency__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9091
20588
 
 
20589
 
9092
20590
ALTER TABLE ONLY archivedependency
9093
20591
    ADD CONSTRAINT archivedependency__dependency__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9094
20592
 
 
20593
 
9095
20594
ALTER TABLE ONLY archivedependency
9096
20595
    ADD CONSTRAINT archivedependency_component_fkey FOREIGN KEY (component) REFERENCES component(id);
9097
20596
 
 
20597
 
9098
20598
ALTER TABLE ONLY archivejob
9099
20599
    ADD CONSTRAINT archivejob__archive__fk FOREIGN KEY (archive) REFERENCES archive(id);
9100
20600
 
 
20601
 
9101
20602
ALTER TABLE ONLY archivejob
9102
20603
    ADD CONSTRAINT archivejob__job__fk FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
9103
20604
 
 
20605
 
9104
20606
ALTER TABLE ONLY archivepermission
9105
20607
    ADD CONSTRAINT archivepermission__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9106
20608
 
 
20609
 
9107
20610
ALTER TABLE ONLY archivepermission
9108
20611
    ADD CONSTRAINT archivepermission__component__fk FOREIGN KEY (component) REFERENCES component(id);
9109
20612
 
 
20613
 
9110
20614
ALTER TABLE ONLY archivepermission
9111
20615
    ADD CONSTRAINT archivepermission__packageset__fk FOREIGN KEY (packageset) REFERENCES packageset(id);
9112
20616
 
 
20617
 
9113
20618
ALTER TABLE ONLY archivepermission
9114
20619
    ADD CONSTRAINT archivepermission__person__fk FOREIGN KEY (person) REFERENCES person(id);
9115
20620
 
 
20621
 
9116
20622
ALTER TABLE ONLY archivepermission
9117
20623
    ADD CONSTRAINT archivepermission__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9118
20624
 
 
20625
 
9119
20626
ALTER TABLE ONLY archivesubscriber
9120
20627
    ADD CONSTRAINT archivesubscriber__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9121
20628
 
 
20629
 
9122
20630
ALTER TABLE ONLY archivesubscriber
9123
20631
    ADD CONSTRAINT archivesubscriber_cancelled_by_fkey FOREIGN KEY (cancelled_by) REFERENCES person(id);
9124
20632
 
 
20633
 
9125
20634
ALTER TABLE ONLY archivesubscriber
9126
20635
    ADD CONSTRAINT archivesubscriber_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9127
20636
 
 
20637
 
9128
20638
ALTER TABLE ONLY archivesubscriber
9129
20639
    ADD CONSTRAINT archivesubscriber_subscriber_fkey FOREIGN KEY (subscriber) REFERENCES person(id);
9130
20640
 
9131
 
ALTER TABLE ONLY authtoken
9132
 
    ADD CONSTRAINT authtoken__requester__fk FOREIGN KEY (requester) REFERENCES account(id);
9133
20641
 
9134
20642
ALTER TABLE ONLY binarypackagebuild
9135
20643
    ADD CONSTRAINT binarypackagebuild__distro_arch_series__fk FOREIGN KEY (distro_arch_series) REFERENCES distroarchseries(id);
9136
20644
 
 
20645
 
9137
20646
ALTER TABLE ONLY binarypackagebuild
9138
20647
    ADD CONSTRAINT binarypackagebuild__package_build__fk FOREIGN KEY (package_build) REFERENCES packagebuild(id);
9139
20648
 
 
20649
 
9140
20650
ALTER TABLE ONLY binarypackagebuild
9141
20651
    ADD CONSTRAINT binarypackagebuild__source_package_release__fk FOREIGN KEY (source_package_release) REFERENCES sourcepackagerelease(id);
9142
20652
 
 
20653
 
9143
20654
ALTER TABLE ONLY binarypackagefile
9144
20655
    ADD CONSTRAINT binarypackagefile_binarypackagerelease_fk FOREIGN KEY (binarypackagerelease) REFERENCES binarypackagerelease(id) ON DELETE CASCADE;
9145
20656
 
 
20657
 
9146
20658
ALTER TABLE ONLY binarypackagefile
9147
20659
    ADD CONSTRAINT binarypackagefile_libraryfile_fk FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
9148
20660
 
 
20661
 
 
20662
ALTER TABLE ONLY binarypackagepublishinghistory
 
20663
    ADD CONSTRAINT binarypackagepublishinghistory_binarypackagename_fkey FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
 
20664
 
 
20665
 
9149
20666
ALTER TABLE ONLY binarypackagepublishinghistory
9150
20667
    ADD CONSTRAINT binarypackagepublishinghistory_supersededby_fk FOREIGN KEY (supersededby) REFERENCES binarypackagebuild(id);
9151
20668
 
 
20669
 
9152
20670
ALTER TABLE ONLY binarypackagerelease
9153
20671
    ADD CONSTRAINT binarypackagerelease_binarypackagename_fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
9154
20672
 
 
20673
 
9155
20674
ALTER TABLE ONLY binarypackagerelease
9156
20675
    ADD CONSTRAINT binarypackagerelease_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id) ON DELETE CASCADE;
9157
20676
 
 
20677
 
9158
20678
ALTER TABLE ONLY binarypackagerelease
9159
20679
    ADD CONSTRAINT binarypackagerelease_component_fk FOREIGN KEY (component) REFERENCES component(id);
9160
20680
 
 
20681
 
9161
20682
ALTER TABLE ONLY binarypackagerelease
9162
20683
    ADD CONSTRAINT binarypackagerelease_debug_package_fkey FOREIGN KEY (debug_package) REFERENCES binarypackagerelease(id);
9163
20684
 
 
20685
 
9164
20686
ALTER TABLE ONLY binarypackagerelease
9165
20687
    ADD CONSTRAINT binarypackagerelease_section_fk FOREIGN KEY (section) REFERENCES section(id);
9166
20688
 
 
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
 
9167
20698
ALTER TABLE ONLY binarypackagereleasedownloadcount
9168
20699
    ADD CONSTRAINT binarypackagereleasedownloadcount_archive_fkey FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9169
20700
 
 
20701
 
9170
20702
ALTER TABLE ONLY binarypackagereleasedownloadcount
9171
20703
    ADD CONSTRAINT binarypackagereleasedownloadcount_binary_package_release_fkey FOREIGN KEY (binary_package_release) REFERENCES binarypackagerelease(id);
9172
20704
 
 
20705
 
9173
20706
ALTER TABLE ONLY binarypackagereleasedownloadcount
9174
20707
    ADD CONSTRAINT binarypackagereleasedownloadcount_country_fkey FOREIGN KEY (country) REFERENCES country(id);
9175
20708
 
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);
 
20709
 
 
20710
ALTER TABLE ONLY branch
 
20711
    ADD CONSTRAINT branch_access_policy_fkey FOREIGN KEY (access_policy) REFERENCES accesspolicy(id);
 
20712
 
9196
20713
 
9197
20714
ALTER TABLE ONLY branch
9198
20715
    ADD CONSTRAINT branch_author_fk FOREIGN KEY (author) REFERENCES person(id);
9199
20716
 
 
20717
 
9200
20718
ALTER TABLE ONLY branch
9201
20719
    ADD CONSTRAINT branch_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9202
20720
 
 
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
 
9203
20726
ALTER TABLE ONLY branch
9204
 
    ADD CONSTRAINT branch_merge_robot_fkey FOREIGN KEY (merge_robot) REFERENCES branchmergerobot(id);
 
20727
    ADD CONSTRAINT branch_merge_queue_fkey FOREIGN KEY (merge_queue) REFERENCES branchmergequeue(id);
 
20728
 
9205
20729
 
9206
20730
ALTER TABLE ONLY branch
9207
20731
    ADD CONSTRAINT branch_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9208
20732
 
 
20733
 
9209
20734
ALTER TABLE ONLY branch
9210
20735
    ADD CONSTRAINT branch_product_fk FOREIGN KEY (product) REFERENCES product(id);
9211
20736
 
 
20737
 
9212
20738
ALTER TABLE ONLY branch
9213
20739
    ADD CONSTRAINT branch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9214
20740
 
 
20741
 
9215
20742
ALTER TABLE ONLY branch
9216
20743
    ADD CONSTRAINT branch_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
9217
20744
 
 
20745
 
9218
20746
ALTER TABLE ONLY branch
9219
20747
    ADD CONSTRAINT branch_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9220
20748
 
 
20749
 
9221
20750
ALTER TABLE ONLY branch
9222
20751
    ADD CONSTRAINT branch_stacked_on_fkey FOREIGN KEY (stacked_on) REFERENCES branch(id);
9223
20752
 
 
20753
 
9224
20754
ALTER TABLE ONLY branchjob
9225
20755
    ADD CONSTRAINT branchjob_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
9226
20756
 
 
20757
 
9227
20758
ALTER TABLE ONLY branchjob
9228
20759
    ADD CONSTRAINT branchjob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
9229
20760
 
 
20761
 
9230
20762
ALTER TABLE ONLY branchmergeproposal
9231
20763
    ADD CONSTRAINT branchmergeproposal_dependent_branch_fkey FOREIGN KEY (dependent_branch) REFERENCES branch(id);
9232
20764
 
 
20765
 
9233
20766
ALTER TABLE ONLY branchmergeproposal
9234
20767
    ADD CONSTRAINT branchmergeproposal_merge_diff_fkey FOREIGN KEY (merge_diff) REFERENCES previewdiff(id);
9235
20768
 
 
20769
 
9236
20770
ALTER TABLE ONLY branchmergeproposal
9237
20771
    ADD CONSTRAINT branchmergeproposal_merge_log_file_fkey FOREIGN KEY (merge_log_file) REFERENCES libraryfilealias(id);
9238
20772
 
 
20773
 
9239
20774
ALTER TABLE ONLY branchmergeproposal
9240
20775
    ADD CONSTRAINT branchmergeproposal_merge_reporter_fkey FOREIGN KEY (merge_reporter) REFERENCES person(id);
9241
20776
 
 
20777
 
9242
20778
ALTER TABLE ONLY branchmergeproposal
9243
20779
    ADD CONSTRAINT branchmergeproposal_merger_fkey FOREIGN KEY (merger) REFERENCES person(id);
9244
20780
 
 
20781
 
9245
20782
ALTER TABLE ONLY branchmergeproposal
9246
20783
    ADD CONSTRAINT branchmergeproposal_queuer_fkey FOREIGN KEY (queuer) REFERENCES person(id);
9247
20784
 
 
20785
 
9248
20786
ALTER TABLE ONLY branchmergeproposal
9249
20787
    ADD CONSTRAINT branchmergeproposal_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9250
20788
 
9251
 
ALTER TABLE ONLY branchmergeproposal
9252
 
    ADD CONSTRAINT branchmergeproposal_review_diff_fkey FOREIGN KEY (review_diff) REFERENCES staticdiff(id);
9253
20789
 
9254
20790
ALTER TABLE ONLY branchmergeproposal
9255
20791
    ADD CONSTRAINT branchmergeproposal_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
9256
20792
 
 
20793
 
9257
20794
ALTER TABLE ONLY branchmergeproposal
9258
20795
    ADD CONSTRAINT branchmergeproposal_source_branch_fkey FOREIGN KEY (source_branch) REFERENCES branch(id);
9259
20796
 
 
20797
 
9260
20798
ALTER TABLE ONLY branchmergeproposal
9261
20799
    ADD CONSTRAINT branchmergeproposal_superseded_by_fkey FOREIGN KEY (superseded_by) REFERENCES branchmergeproposal(id);
9262
20800
 
 
20801
 
9263
20802
ALTER TABLE ONLY branchmergeproposal
9264
20803
    ADD CONSTRAINT branchmergeproposal_target_branch_fkey FOREIGN KEY (target_branch) REFERENCES branch(id);
9265
20804
 
 
20805
 
9266
20806
ALTER TABLE ONLY branchmergeproposaljob
9267
20807
    ADD CONSTRAINT branchmergeproposaljob_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
9268
20808
 
 
20809
 
9269
20810
ALTER TABLE ONLY branchmergeproposaljob
9270
20811
    ADD CONSTRAINT branchmergeproposaljob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
9271
20812
 
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);
 
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
 
9277
20821
 
9278
20822
ALTER TABLE ONLY branchrevision
9279
20823
    ADD CONSTRAINT branchrevision__branch__fk FOREIGN KEY (branch) REFERENCES branch(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
9280
20824
 
 
20825
 
9281
20826
ALTER TABLE ONLY branchrevision
9282
20827
    ADD CONSTRAINT branchrevision__revision__fk FOREIGN KEY (revision) REFERENCES revision(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
9283
20828
 
 
20829
 
9284
20830
ALTER TABLE ONLY branchsubscription
9285
20831
    ADD CONSTRAINT branchsubscription_branch_fk FOREIGN KEY (branch) REFERENCES branch(id);
9286
20832
 
 
20833
 
9287
20834
ALTER TABLE ONLY branchsubscription
9288
20835
    ADD CONSTRAINT branchsubscription_person_fk FOREIGN KEY (person) REFERENCES person(id);
9289
20836
 
 
20837
 
9290
20838
ALTER TABLE ONLY branchsubscription
9291
20839
    ADD CONSTRAINT branchsubscription_subscribed_by_fkey FOREIGN KEY (subscribed_by) REFERENCES person(id);
9292
20840
 
 
20841
 
9293
20842
ALTER TABLE ONLY branchvisibilitypolicy
9294
20843
    ADD CONSTRAINT branchvisibilitypolicy_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9295
20844
 
 
20845
 
9296
20846
ALTER TABLE ONLY branchvisibilitypolicy
9297
20847
    ADD CONSTRAINT branchvisibilitypolicy_project_fkey FOREIGN KEY (project) REFERENCES project(id);
9298
20848
 
 
20849
 
9299
20850
ALTER TABLE ONLY branchvisibilitypolicy
9300
20851
    ADD CONSTRAINT branchvisibilitypolicy_team_fkey FOREIGN KEY (team) REFERENCES person(id);
9301
20852
 
 
20853
 
9302
20854
ALTER TABLE ONLY bug
9303
20855
    ADD CONSTRAINT bug__who_made_private__fk FOREIGN KEY (who_made_private) REFERENCES person(id);
9304
20856
 
 
20857
 
 
20858
ALTER TABLE ONLY bug
 
20859
    ADD CONSTRAINT bug_access_policy_fkey FOREIGN KEY (access_policy) REFERENCES accesspolicy(id);
 
20860
 
 
20861
 
9305
20862
ALTER TABLE ONLY bug
9306
20863
    ADD CONSTRAINT bug_duplicateof_fk FOREIGN KEY (duplicateof) REFERENCES bug(id);
9307
20864
 
 
20865
 
9308
20866
ALTER TABLE ONLY bug
9309
20867
    ADD CONSTRAINT bug_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9310
20868
 
 
20869
 
9311
20870
ALTER TABLE ONLY bugactivity
9312
20871
    ADD CONSTRAINT bugactivity__person__fk FOREIGN KEY (person) REFERENCES person(id);
9313
20872
 
 
20873
 
9314
20874
ALTER TABLE ONLY bugaffectsperson
9315
20875
    ADD CONSTRAINT bugaffectsperson_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
9316
20876
 
 
20877
 
9317
20878
ALTER TABLE ONLY bugaffectsperson
9318
20879
    ADD CONSTRAINT bugaffectsperson_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9319
20880
 
 
20881
 
9320
20882
ALTER TABLE ONLY bugattachment
9321
20883
    ADD CONSTRAINT bugattachment_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
9322
20884
 
 
20885
 
9323
20886
ALTER TABLE ONLY bugattachment
9324
20887
    ADD CONSTRAINT bugattachment_libraryfile_fk FOREIGN KEY (libraryfile) REFERENCES libraryfilealias(id);
9325
20888
 
 
20889
 
9326
20890
ALTER TABLE ONLY bugattachment
9327
20891
    ADD CONSTRAINT bugattachment_message_fk FOREIGN KEY (message) REFERENCES message(id);
9328
20892
 
 
20893
 
9329
20894
ALTER TABLE ONLY bugbranch
9330
20895
    ADD CONSTRAINT bugbranch_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
9331
20896
 
 
20897
 
9332
20898
ALTER TABLE ONLY bugbranch
9333
20899
    ADD CONSTRAINT bugbranch_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
9334
20900
 
 
20901
 
9335
20902
ALTER TABLE ONLY bugbranch
9336
20903
    ADD CONSTRAINT bugbranch_fixed_in_revision_fkey FOREIGN KEY (revision_hint) REFERENCES revision(id);
9337
20904
 
 
20905
 
9338
20906
ALTER TABLE ONLY bugbranch
9339
20907
    ADD CONSTRAINT bugbranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9340
20908
 
 
20909
 
9341
20910
ALTER TABLE ONLY bugcve
9342
20911
    ADD CONSTRAINT bugcve_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
9343
20912
 
 
20913
 
9344
20914
ALTER TABLE ONLY bugcve
9345
20915
    ADD CONSTRAINT bugcve_cve_fk FOREIGN KEY (cve) REFERENCES cve(id);
9346
20916
 
 
20917
 
9347
20918
ALTER TABLE ONLY bugjob
9348
20919
    ADD CONSTRAINT bugjob_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
9349
20920
 
 
20921
 
9350
20922
ALTER TABLE ONLY bugjob
9351
20923
    ADD CONSTRAINT bugjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
9352
20924
 
 
20925
 
9353
20926
ALTER TABLE ONLY bugmessage
9354
20927
    ADD CONSTRAINT bugmessage__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
9355
20928
 
 
20929
 
9356
20930
ALTER TABLE ONLY bugmessage
9357
20931
    ADD CONSTRAINT bugmessage_bugwatch_fkey FOREIGN KEY (bugwatch) REFERENCES bugwatch(id);
9358
20932
 
 
20933
 
9359
20934
ALTER TABLE ONLY bugmessage
9360
20935
    ADD CONSTRAINT bugmessage_message_fk FOREIGN KEY (message) REFERENCES message(id);
9361
20936
 
 
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
 
9362
20946
ALTER TABLE ONLY bugnomination
9363
20947
    ADD CONSTRAINT bugnomination__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
9364
20948
 
 
20949
 
9365
20950
ALTER TABLE ONLY bugnomination
9366
20951
    ADD CONSTRAINT bugnomination__decider__fk FOREIGN KEY (decider) REFERENCES person(id);
9367
20952
 
 
20953
 
9368
20954
ALTER TABLE ONLY bugnomination
9369
20955
    ADD CONSTRAINT bugnomination__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9370
20956
 
 
20957
 
9371
20958
ALTER TABLE ONLY bugnomination
9372
20959
    ADD CONSTRAINT bugnomination__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
9373
20960
 
 
20961
 
9374
20962
ALTER TABLE ONLY bugnomination
9375
20963
    ADD CONSTRAINT bugnomination__productseries__fk FOREIGN KEY (productseries) REFERENCES productseries(id);
9376
20964
 
 
20965
 
 
20966
ALTER TABLE ONLY bugnotification
 
20967
    ADD CONSTRAINT bugnotification_activity_fkey FOREIGN KEY (activity) REFERENCES bugactivity(id);
 
20968
 
 
20969
 
9377
20970
ALTER TABLE ONLY bugnotification
9378
20971
    ADD CONSTRAINT bugnotification_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
9379
20972
 
 
20973
 
9380
20974
ALTER TABLE ONLY bugnotification
9381
20975
    ADD CONSTRAINT bugnotification_message_fkey FOREIGN KEY (message) REFERENCES message(id);
9382
20976
 
 
20977
 
9383
20978
ALTER TABLE ONLY bugnotificationarchive
9384
20979
    ADD CONSTRAINT bugnotificationarchive__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
9385
20980
 
 
20981
 
9386
20982
ALTER TABLE ONLY bugnotificationarchive
9387
20983
    ADD CONSTRAINT bugnotificationarchive__message__fk FOREIGN KEY (message) REFERENCES message(id);
9388
20984
 
 
20985
 
9389
20986
ALTER TABLE ONLY bugnotificationattachment
9390
20987
    ADD CONSTRAINT bugnotificationattachment__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotification(id) ON DELETE CASCADE;
9391
20988
 
 
20989
 
9392
20990
ALTER TABLE ONLY bugnotificationattachment
9393
20991
    ADD CONSTRAINT bugnotificationattachment_message_fkey FOREIGN KEY (message) REFERENCES message(id);
9394
20992
 
 
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
 
9395
21002
ALTER TABLE ONLY bugnotificationrecipient
9396
21003
    ADD CONSTRAINT bugnotificationrecipient__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotification(id) ON DELETE CASCADE;
9397
21004
 
 
21005
 
9398
21006
ALTER TABLE ONLY bugnotificationrecipient
9399
21007
    ADD CONSTRAINT bugnotificationrecipient_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9400
21008
 
 
21009
 
9401
21010
ALTER TABLE ONLY bugnotificationrecipientarchive
9402
21011
    ADD CONSTRAINT bugnotificationrecipientarchive__bug_notification__fk FOREIGN KEY (bug_notification) REFERENCES bugnotificationarchive(id);
9403
21012
 
 
21013
 
9404
21014
ALTER TABLE ONLY bugnotificationrecipientarchive
9405
21015
    ADD CONSTRAINT bugnotificationrecipientarchive__person__fk FOREIGN KEY (person) REFERENCES person(id);
9406
21016
 
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);
9436
21017
 
9437
21018
ALTER TABLE ONLY bugsubscription
9438
21019
    ADD CONSTRAINT bugsubscription_subscribed_by_fkey FOREIGN KEY (subscribed_by) REFERENCES person(id);
9439
21020
 
 
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
 
9440
21098
ALTER TABLE ONLY bugtask
9441
21099
    ADD CONSTRAINT bugtask__assignee__fk FOREIGN KEY (assignee) REFERENCES person(id);
9442
21100
 
 
21101
 
9443
21102
ALTER TABLE ONLY bugtask
9444
21103
    ADD CONSTRAINT bugtask__binarypackagename__fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
9445
21104
 
 
21105
 
9446
21106
ALTER TABLE ONLY bugtask
9447
21107
    ADD CONSTRAINT bugtask__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
9448
21108
 
 
21109
 
9449
21110
ALTER TABLE ONLY bugtask
9450
21111
    ADD CONSTRAINT bugtask__bugwatch__fk FOREIGN KEY (bugwatch) REFERENCES bugwatch(id);
9451
21112
 
 
21113
 
9452
21114
ALTER TABLE ONLY bugtask
9453
21115
    ADD CONSTRAINT bugtask__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9454
21116
 
 
21117
 
9455
21118
ALTER TABLE ONLY bugtask
9456
21119
    ADD CONSTRAINT bugtask__distribution__milestone__fk FOREIGN KEY (distribution, milestone) REFERENCES milestone(distribution, id);
9457
21120
 
 
21121
 
9458
21122
ALTER TABLE ONLY bugtask
9459
21123
    ADD CONSTRAINT bugtask__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9460
21124
 
 
21125
 
9461
21126
ALTER TABLE ONLY bugtask
9462
21127
    ADD CONSTRAINT bugtask__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
9463
21128
 
 
21129
 
9464
21130
ALTER TABLE ONLY bugtask
9465
21131
    ADD CONSTRAINT bugtask__product__fk FOREIGN KEY (product) REFERENCES product(id);
9466
21132
 
 
21133
 
9467
21134
ALTER TABLE ONLY bugtask
9468
21135
    ADD CONSTRAINT bugtask__product__milestone__fk FOREIGN KEY (product, milestone) REFERENCES milestone(product, id);
9469
21136
 
 
21137
 
9470
21138
ALTER TABLE ONLY bugtask
9471
21139
    ADD CONSTRAINT bugtask__productseries__fk FOREIGN KEY (productseries) REFERENCES productseries(id);
9472
21140
 
 
21141
 
9473
21142
ALTER TABLE ONLY bugtask
9474
21143
    ADD CONSTRAINT bugtask__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9475
21144
 
 
21145
 
9476
21146
ALTER TABLE ONLY bugtracker
9477
21147
    ADD CONSTRAINT bugtracker_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9478
21148
 
 
21149
 
9479
21150
ALTER TABLE ONLY bugtrackeralias
9480
21151
    ADD CONSTRAINT bugtrackeralias__bugtracker__fk FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
9481
21152
 
 
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
 
9482
21170
ALTER TABLE ONLY bugtrackerperson
9483
21171
    ADD CONSTRAINT bugtrackerperson_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
9484
21172
 
 
21173
 
9485
21174
ALTER TABLE ONLY bugtrackerperson
9486
21175
    ADD CONSTRAINT bugtrackerperson_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9487
21176
 
 
21177
 
9488
21178
ALTER TABLE ONLY bugwatch
9489
21179
    ADD CONSTRAINT bugwatch_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
9490
21180
 
 
21181
 
9491
21182
ALTER TABLE ONLY bugwatch
9492
21183
    ADD CONSTRAINT bugwatch_bugtracker_fk FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
9493
21184
 
 
21185
 
9494
21186
ALTER TABLE ONLY bugwatch
9495
21187
    ADD CONSTRAINT bugwatch_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9496
21188
 
 
21189
 
9497
21190
ALTER TABLE ONLY bugwatchactivity
9498
21191
    ADD CONSTRAINT bugwatchactivity_bug_watch_fkey FOREIGN KEY (bug_watch) REFERENCES bugwatch(id);
9499
21192
 
 
21193
 
9500
21194
ALTER TABLE ONLY buildfarmjob
9501
21195
    ADD CONSTRAINT buildfarmjob__builder__fk FOREIGN KEY (builder) REFERENCES builder(id);
9502
21196
 
 
21197
 
9503
21198
ALTER TABLE ONLY buildfarmjob
9504
21199
    ADD CONSTRAINT buildfarmjob__log__fk FOREIGN KEY (log) REFERENCES libraryfilealias(id);
9505
21200
 
 
21201
 
9506
21202
ALTER TABLE ONLY buildfarmjob
9507
21203
    ADD CONSTRAINT buildfarmjob__processor__fk FOREIGN KEY (processor) REFERENCES processor(id);
9508
21204
 
 
21205
 
9509
21206
ALTER TABLE ONLY buildpackagejob
9510
21207
    ADD CONSTRAINT buildpackagejob__job__fk FOREIGN KEY (job) REFERENCES job(id);
9511
21208
 
 
21209
 
9512
21210
ALTER TABLE ONLY buildpackagejob
9513
21211
    ADD CONSTRAINT buildpackagejob_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id);
9514
21212
 
 
21213
 
9515
21214
ALTER TABLE ONLY buildqueue
9516
21215
    ADD CONSTRAINT buildqueue__job__fk FOREIGN KEY (job) REFERENCES job(id);
9517
21216
 
 
21217
 
9518
21218
ALTER TABLE ONLY buildqueue
9519
21219
    ADD CONSTRAINT buildqueue__processor__fk FOREIGN KEY (processor) REFERENCES processor(id);
9520
21220
 
 
21221
 
9521
21222
ALTER TABLE ONLY codeimport
9522
21223
    ADD CONSTRAINT codeimport_assignee_fkey FOREIGN KEY (assignee) REFERENCES person(id);
9523
21224
 
 
21225
 
9524
21226
ALTER TABLE ONLY codeimport
9525
21227
    ADD CONSTRAINT codeimport_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
9526
21228
 
 
21229
 
9527
21230
ALTER TABLE ONLY codeimport
9528
21231
    ADD CONSTRAINT codeimport_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
9529
21232
 
 
21233
 
9530
21234
ALTER TABLE ONLY codeimport
9531
21235
    ADD CONSTRAINT codeimport_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9532
21236
 
 
21237
 
9533
21238
ALTER TABLE ONLY codeimportevent
9534
21239
    ADD CONSTRAINT codeimportevent__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id) ON DELETE CASCADE;
9535
21240
 
 
21241
 
9536
21242
ALTER TABLE ONLY codeimportevent
9537
21243
    ADD CONSTRAINT codeimportevent__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
9538
21244
 
 
21245
 
9539
21246
ALTER TABLE ONLY codeimportevent
9540
21247
    ADD CONSTRAINT codeimportevent__person__fk FOREIGN KEY (person) REFERENCES person(id);
9541
21248
 
 
21249
 
9542
21250
ALTER TABLE ONLY codeimporteventdata
9543
21251
    ADD CONSTRAINT codeimporteventdata__event__fk FOREIGN KEY (event) REFERENCES codeimportevent(id) ON DELETE CASCADE;
9544
21252
 
 
21253
 
9545
21254
ALTER TABLE ONLY codeimportjob
9546
21255
    ADD CONSTRAINT codeimportjob__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id);
9547
21256
 
 
21257
 
9548
21258
ALTER TABLE ONLY codeimportjob
9549
21259
    ADD CONSTRAINT codeimportjob__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
9550
21260
 
 
21261
 
9551
21262
ALTER TABLE ONLY codeimportjob
9552
21263
    ADD CONSTRAINT codeimportjob__requesting_user__fk FOREIGN KEY (requesting_user) REFERENCES person(id);
9553
21264
 
 
21265
 
9554
21266
ALTER TABLE ONLY codeimportresult
9555
21267
    ADD CONSTRAINT codeimportresult__code_import__fk FOREIGN KEY (code_import) REFERENCES codeimport(id) ON DELETE CASCADE;
9556
21268
 
 
21269
 
9557
21270
ALTER TABLE ONLY codeimportresult
9558
21271
    ADD CONSTRAINT codeimportresult__log_file__fk FOREIGN KEY (log_file) REFERENCES libraryfilealias(id);
9559
21272
 
 
21273
 
9560
21274
ALTER TABLE ONLY codeimportresult
9561
21275
    ADD CONSTRAINT codeimportresult__machine__fk FOREIGN KEY (machine) REFERENCES codeimportmachine(id);
9562
21276
 
 
21277
 
9563
21278
ALTER TABLE ONLY codeimportresult
9564
21279
    ADD CONSTRAINT codeimportresult__requesting_user__fk FOREIGN KEY (requesting_user) REFERENCES person(id);
9565
21280
 
 
21281
 
9566
21282
ALTER TABLE ONLY codereviewmessage
9567
21283
    ADD CONSTRAINT codereviewmessage_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
9568
21284
 
 
21285
 
9569
21286
ALTER TABLE ONLY codereviewmessage
9570
21287
    ADD CONSTRAINT codereviewmessage_message_fkey FOREIGN KEY (message) REFERENCES message(id);
9571
21288
 
 
21289
 
9572
21290
ALTER TABLE ONLY codereviewvote
9573
21291
    ADD CONSTRAINT codereviewvote_branch_merge_proposal_fkey FOREIGN KEY (branch_merge_proposal) REFERENCES branchmergeproposal(id);
9574
21292
 
 
21293
 
9575
21294
ALTER TABLE ONLY codereviewvote
9576
21295
    ADD CONSTRAINT codereviewvote_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9577
21296
 
 
21297
 
9578
21298
ALTER TABLE ONLY codereviewvote
9579
21299
    ADD CONSTRAINT codereviewvote_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
9580
21300
 
 
21301
 
9581
21302
ALTER TABLE ONLY codereviewvote
9582
21303
    ADD CONSTRAINT codereviewvote_vote_message_fkey FOREIGN KEY (vote_message) REFERENCES codereviewmessage(id);
9583
21304
 
 
21305
 
9584
21306
ALTER TABLE ONLY commercialsubscription
9585
21307
    ADD CONSTRAINT commercialsubscription__product__fk FOREIGN KEY (product) REFERENCES product(id);
9586
21308
 
 
21309
 
9587
21310
ALTER TABLE ONLY commercialsubscription
9588
21311
    ADD CONSTRAINT commercialsubscription__purchaser__fk FOREIGN KEY (purchaser) REFERENCES person(id);
9589
21312
 
 
21313
 
9590
21314
ALTER TABLE ONLY commercialsubscription
9591
21315
    ADD CONSTRAINT commercialsubscription__registrant__fk FOREIGN KEY (registrant) REFERENCES person(id);
9592
21316
 
 
21317
 
9593
21318
ALTER TABLE ONLY componentselection
9594
21319
    ADD CONSTRAINT componentselection__component__fk FOREIGN KEY (component) REFERENCES component(id);
9595
21320
 
 
21321
 
9596
21322
ALTER TABLE ONLY componentselection
9597
21323
    ADD CONSTRAINT componentselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9598
21324
 
 
21325
 
9599
21326
ALTER TABLE ONLY customlanguagecode
9600
21327
    ADD CONSTRAINT customlanguagecode_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9601
21328
 
 
21329
 
9602
21330
ALTER TABLE ONLY customlanguagecode
9603
21331
    ADD CONSTRAINT customlanguagecode_language_fkey FOREIGN KEY (language) REFERENCES language(id);
9604
21332
 
 
21333
 
9605
21334
ALTER TABLE ONLY customlanguagecode
9606
21335
    ADD CONSTRAINT customlanguagecode_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9607
21336
 
 
21337
 
9608
21338
ALTER TABLE ONLY customlanguagecode
9609
21339
    ADD CONSTRAINT customlanguagecode_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9610
21340
 
 
21341
 
9611
21342
ALTER TABLE ONLY cvereference
9612
21343
    ADD CONSTRAINT cvereference_cve_fk FOREIGN KEY (cve) REFERENCES cve(id);
9613
21344
 
 
21345
 
9614
21346
ALTER TABLE ONLY diff
9615
21347
    ADD CONSTRAINT diff_diff_text_fkey FOREIGN KEY (diff_text) REFERENCES libraryfilealias(id);
9616
21348
 
 
21349
 
 
21350
ALTER TABLE ONLY incrementaldiff
 
21351
    ADD CONSTRAINT diff_fk FOREIGN KEY (diff) REFERENCES diff(id) ON DELETE CASCADE;
 
21352
 
 
21353
 
9617
21354
ALTER TABLE ONLY distribution
9618
21355
    ADD CONSTRAINT distribution__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
9619
21356
 
 
21357
 
9620
21358
ALTER TABLE ONLY distribution
9621
21359
    ADD CONSTRAINT distribution__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
9622
21360
 
 
21361
 
9623
21362
ALTER TABLE ONLY distribution
9624
21363
    ADD CONSTRAINT distribution__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
9625
21364
 
 
21365
 
9626
21366
ALTER TABLE ONLY distribution
9627
21367
    ADD CONSTRAINT distribution_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
9628
21368
 
 
21369
 
9629
21370
ALTER TABLE ONLY distribution
9630
21371
    ADD CONSTRAINT distribution_language_pack_admin_fkey FOREIGN KEY (language_pack_admin) REFERENCES person(id);
9631
21372
 
 
21373
 
9632
21374
ALTER TABLE ONLY distribution
9633
21375
    ADD CONSTRAINT distribution_mirror_admin_fkey FOREIGN KEY (mirror_admin) REFERENCES person(id);
9634
21376
 
 
21377
 
 
21378
ALTER TABLE ONLY distribution
 
21379
    ADD CONSTRAINT distribution_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
 
21380
 
 
21381
 
9635
21382
ALTER TABLE ONLY distribution
9636
21383
    ADD CONSTRAINT distribution_security_contact_fkey FOREIGN KEY (security_contact) REFERENCES person(id);
9637
21384
 
 
21385
 
9638
21386
ALTER TABLE ONLY distribution
9639
21387
    ADD CONSTRAINT distribution_translation_focus_fkey FOREIGN KEY (translation_focus) REFERENCES distroseries(id);
9640
21388
 
 
21389
 
9641
21390
ALTER TABLE ONLY distribution
9642
21391
    ADD CONSTRAINT distribution_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
9643
21392
 
 
21393
 
9644
21394
ALTER TABLE ONLY distribution
9645
21395
    ADD CONSTRAINT distribution_upload_admin_fk FOREIGN KEY (upload_admin) REFERENCES person(id);
9646
21396
 
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);
 
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
 
9652
21409
 
9653
21410
ALTER TABLE ONLY distributionmirror
9654
21411
    ADD CONSTRAINT distributionmirror_country_fkey FOREIGN KEY (country) REFERENCES country(id);
9655
21412
 
 
21413
 
9656
21414
ALTER TABLE ONLY distributionmirror
9657
21415
    ADD CONSTRAINT distributionmirror_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9658
21416
 
 
21417
 
9659
21418
ALTER TABLE ONLY distributionmirror
9660
21419
    ADD CONSTRAINT distributionmirror_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
9661
21420
 
 
21421
 
9662
21422
ALTER TABLE ONLY distributionmirror
9663
21423
    ADD CONSTRAINT distributionmirror_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
9664
21424
 
 
21425
 
9665
21426
ALTER TABLE ONLY distributionsourcepackage
9666
21427
    ADD CONSTRAINT distributionpackage__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9667
21428
 
 
21429
 
9668
21430
ALTER TABLE ONLY distributionsourcepackage
9669
21431
    ADD CONSTRAINT distributionpackage__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9670
21432
 
 
21433
 
9671
21434
ALTER TABLE ONLY distributionsourcepackagecache
9672
21435
    ADD CONSTRAINT distributionsourcepackagecache__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9673
21436
 
 
21437
 
9674
21438
ALTER TABLE ONLY distributionsourcepackagecache
9675
21439
    ADD CONSTRAINT distributionsourcepackagecache_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9676
21440
 
 
21441
 
9677
21442
ALTER TABLE ONLY distributionsourcepackagecache
9678
21443
    ADD CONSTRAINT distributionsourcepackagecache_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9679
21444
 
 
21445
 
9680
21446
ALTER TABLE ONLY distroarchseries
9681
21447
    ADD CONSTRAINT distroarchseries__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9682
21448
 
 
21449
 
9683
21450
ALTER TABLE ONLY distroarchseries
9684
21451
    ADD CONSTRAINT distroarchseries__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
9685
21452
 
 
21453
 
9686
21454
ALTER TABLE ONLY distroarchseries
9687
21455
    ADD CONSTRAINT distroarchseries__processorfamily__fk FOREIGN KEY (processorfamily) REFERENCES processorfamily(id);
9688
21456
 
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);
9697
21457
 
9698
21458
ALTER TABLE ONLY distroseries
9699
21459
    ADD CONSTRAINT distrorelease_parentrelease_fk FOREIGN KEY (parent_series) REFERENCES distroseries(id);
9700
21460
 
 
21461
 
9701
21462
ALTER TABLE ONLY distroserieslanguage
9702
21463
    ADD CONSTRAINT distroreleaselanguage_language_fk FOREIGN KEY (language) REFERENCES language(id);
9703
21464
 
 
21465
 
9704
21466
ALTER TABLE ONLY distroseries
9705
21467
    ADD CONSTRAINT distroseries__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9706
21468
 
 
21469
 
9707
21470
ALTER TABLE ONLY distroseries
9708
21471
    ADD CONSTRAINT distroseries__driver__fk FOREIGN KEY (driver) REFERENCES person(id);
9709
21472
 
 
21473
 
9710
21474
ALTER TABLE ONLY distroseries
9711
21475
    ADD CONSTRAINT distroseries__language_pack_base__fk FOREIGN KEY (language_pack_base) REFERENCES languagepack(id);
9712
21476
 
 
21477
 
9713
21478
ALTER TABLE ONLY distroseries
9714
21479
    ADD CONSTRAINT distroseries__language_pack_delta__fk FOREIGN KEY (language_pack_delta) REFERENCES languagepack(id);
9715
21480
 
 
21481
 
9716
21482
ALTER TABLE ONLY distroseries
9717
21483
    ADD CONSTRAINT distroseries__language_pack_proposed__fk FOREIGN KEY (language_pack_proposed) REFERENCES languagepack(id);
9718
21484
 
 
21485
 
9719
21486
ALTER TABLE ONLY distroseries
9720
21487
    ADD CONSTRAINT distroseries__nominatedarchindep__fk FOREIGN KEY (nominatedarchindep) REFERENCES distroarchseries(id);
9721
21488
 
9722
 
ALTER TABLE ONLY distroseries
9723
 
    ADD CONSTRAINT distroseries__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
9724
21489
 
9725
21490
ALTER TABLE ONLY distroseries
9726
21491
    ADD CONSTRAINT distroseries__parent_series__fk FOREIGN KEY (parent_series) REFERENCES distroseries(id);
9727
21492
 
 
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
 
9728
21530
ALTER TABLE ONLY distroserieslanguage
9729
21531
    ADD CONSTRAINT distroserieslanguage__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9730
21532
 
 
21533
 
9731
21534
ALTER TABLE ONLY distroserieslanguage
9732
21535
    ADD CONSTRAINT distroserieslanguage__language__fk FOREIGN KEY (language) REFERENCES language(id);
9733
21536
 
 
21537
 
9734
21538
ALTER TABLE ONLY distroseriespackagecache
9735
21539
    ADD CONSTRAINT distroseriespackagecache__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
9736
21540
 
 
21541
 
9737
21542
ALTER TABLE ONLY distroseriespackagecache
9738
21543
    ADD CONSTRAINT distroseriespackagecache__binarypackagename__fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
9739
21544
 
 
21545
 
9740
21546
ALTER TABLE ONLY distroseriespackagecache
9741
21547
    ADD CONSTRAINT distroseriespackagecache__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9742
21548
 
 
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
 
9743
21562
ALTER TABLE ONLY emailaddress
9744
21563
    ADD CONSTRAINT emailaddress__account__fk FOREIGN KEY (account) REFERENCES account(id) ON DELETE SET NULL;
9745
21564
 
 
21565
 
9746
21566
ALTER TABLE ONLY emailaddress
9747
21567
    ADD CONSTRAINT emailaddress__person__fk FOREIGN KEY (person) REFERENCES person(id);
9748
21568
 
 
21569
 
9749
21570
ALTER TABLE ONLY entitlement
9750
21571
    ADD CONSTRAINT entitlement_approved_by_fkey FOREIGN KEY (approved_by) REFERENCES person(id);
9751
21572
 
 
21573
 
9752
21574
ALTER TABLE ONLY entitlement
9753
21575
    ADD CONSTRAINT entitlement_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9754
21576
 
 
21577
 
9755
21578
ALTER TABLE ONLY entitlement
9756
21579
    ADD CONSTRAINT entitlement_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9757
21580
 
 
21581
 
9758
21582
ALTER TABLE ONLY entitlement
9759
21583
    ADD CONSTRAINT entitlement_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9760
21584
 
 
21585
 
9761
21586
ALTER TABLE ONLY entitlement
9762
21587
    ADD CONSTRAINT entitlement_project_fkey FOREIGN KEY (project) REFERENCES project(id);
9763
21588
 
 
21589
 
9764
21590
ALTER TABLE ONLY entitlement
9765
21591
    ADD CONSTRAINT entitlement_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9766
21592
 
 
21593
 
9767
21594
ALTER TABLE ONLY faq
9768
21595
    ADD CONSTRAINT faq_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9769
21596
 
 
21597
 
9770
21598
ALTER TABLE ONLY faq
9771
21599
    ADD CONSTRAINT faq_last_updated_by_fkey FOREIGN KEY (last_updated_by) REFERENCES person(id);
9772
21600
 
 
21601
 
9773
21602
ALTER TABLE ONLY faq
9774
21603
    ADD CONSTRAINT faq_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
9775
21604
 
 
21605
 
9776
21606
ALTER TABLE ONLY faq
9777
21607
    ADD CONSTRAINT faq_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9778
21608
 
 
21609
 
9779
21610
ALTER TABLE ONLY featuredproject
9780
21611
    ADD CONSTRAINT featuredproject_pillar_name_fkey FOREIGN KEY (pillar_name) REFERENCES pillarname(id);
9781
21612
 
 
21613
 
 
21614
ALTER TABLE ONLY featureflagchangelogentry
 
21615
    ADD CONSTRAINT featureflagchangelogentry_person_fkey FOREIGN KEY (person) REFERENCES person(id);
 
21616
 
 
21617
 
9782
21618
ALTER TABLE ONLY flatpackagesetinclusion
9783
21619
    ADD CONSTRAINT flatpackagesetinclusion__child__fk FOREIGN KEY (child) REFERENCES packageset(id);
9784
21620
 
 
21621
 
9785
21622
ALTER TABLE ONLY flatpackagesetinclusion
9786
21623
    ADD CONSTRAINT flatpackagesetinclusion__parent__fk FOREIGN KEY (parent) REFERENCES packageset(id);
9787
21624
 
 
21625
 
9788
21626
ALTER TABLE ONLY gpgkey
9789
21627
    ADD CONSTRAINT gpgkey_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9790
21628
 
 
21629
 
9791
21630
ALTER TABLE ONLY hwdevice
9792
21631
    ADD CONSTRAINT hwdevice_bus_vendor_id_fkey FOREIGN KEY (bus_vendor_id) REFERENCES hwvendorid(id);
9793
21632
 
 
21633
 
9794
21634
ALTER TABLE ONLY hwdeviceclass
9795
21635
    ADD CONSTRAINT hwdeviceclass_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
9796
21636
 
 
21637
 
9797
21638
ALTER TABLE ONLY hwdevicedriverlink
9798
21639
    ADD CONSTRAINT hwdevicedriverlink_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
9799
21640
 
 
21641
 
9800
21642
ALTER TABLE ONLY hwdevicedriverlink
9801
21643
    ADD CONSTRAINT hwdevicedriverlink_driver_fkey FOREIGN KEY (driver) REFERENCES hwdriver(id);
9802
21644
 
 
21645
 
9803
21646
ALTER TABLE ONLY hwdevicenamevariant
9804
21647
    ADD CONSTRAINT hwdevicenamevariant_device_fkey FOREIGN KEY (device) REFERENCES hwdevice(id);
9805
21648
 
 
21649
 
9806
21650
ALTER TABLE ONLY hwdevicenamevariant
9807
21651
    ADD CONSTRAINT hwdevicenamevariant_vendor_name_fkey FOREIGN KEY (vendor_name) REFERENCES hwvendorname(id);
9808
21652
 
 
21653
 
9809
21654
ALTER TABLE ONLY hwdmihandle
9810
21655
    ADD CONSTRAINT hwdmihandle_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
9811
21656
 
 
21657
 
9812
21658
ALTER TABLE ONLY hwdmivalue
9813
21659
    ADD CONSTRAINT hwdmivalue_handle_fkey FOREIGN KEY (handle) REFERENCES hwdmihandle(id);
9814
21660
 
 
21661
 
9815
21662
ALTER TABLE ONLY hwsubmission
9816
21663
    ADD CONSTRAINT hwsubmission__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
9817
21664
 
 
21665
 
9818
21666
ALTER TABLE ONLY hwsubmission
9819
21667
    ADD CONSTRAINT hwsubmission__owned__fk FOREIGN KEY (owner) REFERENCES person(id);
9820
21668
 
 
21669
 
9821
21670
ALTER TABLE ONLY hwsubmission
9822
21671
    ADD CONSTRAINT hwsubmission__raw_submission__fk FOREIGN KEY (raw_submission) REFERENCES libraryfilealias(id);
9823
21672
 
 
21673
 
9824
21674
ALTER TABLE ONLY hwsubmission
9825
21675
    ADD CONSTRAINT hwsubmission__system_fingerprint__fk FOREIGN KEY (system_fingerprint) REFERENCES hwsystemfingerprint(id);
9826
21676
 
 
21677
 
9827
21678
ALTER TABLE ONLY hwsubmissionbug
9828
21679
    ADD CONSTRAINT hwsubmissionbug_bug_fkey FOREIGN KEY (bug) REFERENCES bug(id);
9829
21680
 
 
21681
 
9830
21682
ALTER TABLE ONLY hwsubmissionbug
9831
21683
    ADD CONSTRAINT hwsubmissionbug_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
9832
21684
 
 
21685
 
9833
21686
ALTER TABLE ONLY hwsubmissiondevice
9834
21687
    ADD CONSTRAINT hwsubmissiondevice_device_driver_link_fkey FOREIGN KEY (device_driver_link) REFERENCES hwdevicedriverlink(id);
9835
21688
 
 
21689
 
9836
21690
ALTER TABLE ONLY hwsubmissiondevice
9837
21691
    ADD CONSTRAINT hwsubmissiondevice_parent_fkey FOREIGN KEY (parent) REFERENCES hwsubmissiondevice(id);
9838
21692
 
 
21693
 
9839
21694
ALTER TABLE ONLY hwsubmissiondevice
9840
21695
    ADD CONSTRAINT hwsubmissiondevice_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
9841
21696
 
 
21697
 
9842
21698
ALTER TABLE ONLY hwtestanswer
9843
21699
    ADD CONSTRAINT hwtestanswer__choice__test__fk FOREIGN KEY (test, choice) REFERENCES hwtestanswerchoice(test, id);
9844
21700
 
 
21701
 
9845
21702
ALTER TABLE ONLY hwtestanswer
9846
21703
    ADD CONSTRAINT hwtestanswer_choice_fkey FOREIGN KEY (choice) REFERENCES hwtestanswerchoice(id);
9847
21704
 
 
21705
 
9848
21706
ALTER TABLE ONLY hwtestanswer
9849
21707
    ADD CONSTRAINT hwtestanswer_language_fkey FOREIGN KEY (language) REFERENCES language(id);
9850
21708
 
 
21709
 
9851
21710
ALTER TABLE ONLY hwtestanswer
9852
21711
    ADD CONSTRAINT hwtestanswer_submission_fkey FOREIGN KEY (submission) REFERENCES hwsubmission(id);
9853
21712
 
 
21713
 
9854
21714
ALTER TABLE ONLY hwtestanswer
9855
21715
    ADD CONSTRAINT hwtestanswer_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
9856
21716
 
 
21717
 
9857
21718
ALTER TABLE ONLY hwtestanswerchoice
9858
21719
    ADD CONSTRAINT hwtestanswerchoice_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
9859
21720
 
 
21721
 
9860
21722
ALTER TABLE ONLY hwtestanswercount
9861
21723
    ADD CONSTRAINT hwtestanswercount_choice_fkey FOREIGN KEY (choice) REFERENCES hwtestanswerchoice(id);
9862
21724
 
 
21725
 
9863
21726
ALTER TABLE ONLY hwtestanswercount
9864
21727
    ADD CONSTRAINT hwtestanswercount_distroarchseries_fkey FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
9865
21728
 
 
21729
 
9866
21730
ALTER TABLE ONLY hwtestanswercount
9867
21731
    ADD CONSTRAINT hwtestanswercount_test_fkey FOREIGN KEY (test) REFERENCES hwtest(id);
9868
21732
 
 
21733
 
9869
21734
ALTER TABLE ONLY hwtestanswercountdevice
9870
21735
    ADD CONSTRAINT hwtestanswercountdevice_answer_fkey FOREIGN KEY (answer) REFERENCES hwtestanswercount(id);
9871
21736
 
 
21737
 
9872
21738
ALTER TABLE ONLY hwtestanswercountdevice
9873
21739
    ADD CONSTRAINT hwtestanswercountdevice_device_driver_fkey FOREIGN KEY (device_driver) REFERENCES hwdevicedriverlink(id);
9874
21740
 
 
21741
 
9875
21742
ALTER TABLE ONLY hwtestanswerdevice
9876
21743
    ADD CONSTRAINT hwtestanswerdevice_answer_fkey FOREIGN KEY (answer) REFERENCES hwtestanswer(id);
9877
21744
 
 
21745
 
9878
21746
ALTER TABLE ONLY hwtestanswerdevice
9879
21747
    ADD CONSTRAINT hwtestanswerdevice_device_driver_fkey FOREIGN KEY (device_driver) REFERENCES hwdevicedriverlink(id);
9880
21748
 
 
21749
 
9881
21750
ALTER TABLE ONLY hwvendorid
9882
21751
    ADD CONSTRAINT hwvendorid_vendor_name_fkey FOREIGN KEY (vendor_name) REFERENCES hwvendorname(id);
9883
21752
 
 
21753
 
9884
21754
ALTER TABLE ONLY ircid
9885
21755
    ADD CONSTRAINT ircid_person_fk FOREIGN KEY (person) REFERENCES person(id);
9886
21756
 
 
21757
 
9887
21758
ALTER TABLE ONLY jabberid
9888
21759
    ADD CONSTRAINT jabberid_person_fk FOREIGN KEY (person) REFERENCES person(id);
9889
21760
 
 
21761
 
 
21762
ALTER TABLE ONLY packagingjob
 
21763
    ADD CONSTRAINT job_fk FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
 
21764
 
 
21765
 
9890
21766
ALTER TABLE ONLY job
9891
21767
    ADD CONSTRAINT job_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
9892
21768
 
 
21769
 
9893
21770
ALTER TABLE ONLY karma
9894
21771
    ADD CONSTRAINT karma_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9895
21772
 
 
21773
 
9896
21774
ALTER TABLE ONLY karma
9897
21775
    ADD CONSTRAINT karma_person_fk FOREIGN KEY (person) REFERENCES person(id);
9898
21776
 
 
21777
 
9899
21778
ALTER TABLE ONLY karma
9900
21779
    ADD CONSTRAINT karma_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9901
21780
 
 
21781
 
9902
21782
ALTER TABLE ONLY karma
9903
21783
    ADD CONSTRAINT karma_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9904
21784
 
 
21785
 
9905
21786
ALTER TABLE ONLY karmaaction
9906
21787
    ADD CONSTRAINT karmaaction_category_fk FOREIGN KEY (category) REFERENCES karmacategory(id);
9907
21788
 
 
21789
 
9908
21790
ALTER TABLE ONLY karmacache
9909
21791
    ADD CONSTRAINT karmacache_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
9910
21792
 
 
21793
 
9911
21794
ALTER TABLE ONLY karmacache
9912
21795
    ADD CONSTRAINT karmacache_product_fkey FOREIGN KEY (product) REFERENCES product(id);
9913
21796
 
 
21797
 
9914
21798
ALTER TABLE ONLY karmacache
9915
21799
    ADD CONSTRAINT karmacache_project_fkey FOREIGN KEY (project) REFERENCES project(id);
9916
21800
 
 
21801
 
9917
21802
ALTER TABLE ONLY karmacache
9918
21803
    ADD CONSTRAINT karmacache_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
9919
21804
 
 
21805
 
9920
21806
ALTER TABLE ONLY karmatotalcache
9921
21807
    ADD CONSTRAINT karmatotalcache_person_fk FOREIGN KEY (person) REFERENCES person(id) ON DELETE CASCADE;
9922
21808
 
 
21809
 
9923
21810
ALTER TABLE ONLY languagepack
9924
21811
    ADD CONSTRAINT languagepack__file__fk FOREIGN KEY (file) REFERENCES libraryfilealias(id);
9925
21812
 
 
21813
 
9926
21814
ALTER TABLE ONLY languagepack
9927
21815
    ADD CONSTRAINT languagepack__updates__fk FOREIGN KEY (updates) REFERENCES languagepack(id);
9928
21816
 
 
21817
 
9929
21818
ALTER TABLE ONLY languagepack
9930
21819
    ADD CONSTRAINT languagepackage__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
9931
21820
 
 
21821
 
9932
21822
ALTER TABLE ONLY libraryfiledownloadcount
9933
21823
    ADD CONSTRAINT libraryfiledownloadcount__libraryfilealias__fk FOREIGN KEY (libraryfilealias) REFERENCES libraryfilealias(id) ON DELETE CASCADE;
9934
21824
 
 
21825
 
9935
21826
ALTER TABLE ONLY libraryfiledownloadcount
9936
21827
    ADD CONSTRAINT libraryfiledownloadcount_country_fkey FOREIGN KEY (country) REFERENCES country(id);
9937
21828
 
 
21829
 
9938
21830
ALTER TABLE ONLY logintoken
9939
21831
    ADD CONSTRAINT logintoken_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
9940
21832
 
 
21833
 
9941
21834
ALTER TABLE ONLY mailinglist
9942
21835
    ADD CONSTRAINT mailinglist_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
9943
21836
 
 
21837
 
9944
21838
ALTER TABLE ONLY mailinglist
9945
21839
    ADD CONSTRAINT mailinglist_reviewer_fkey FOREIGN KEY (reviewer) REFERENCES person(id);
9946
21840
 
 
21841
 
9947
21842
ALTER TABLE ONLY mailinglist
9948
21843
    ADD CONSTRAINT mailinglist_team_fkey FOREIGN KEY (team) REFERENCES person(id);
9949
21844
 
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);
9955
21845
 
9956
21846
ALTER TABLE ONLY mailinglistsubscription
9957
21847
    ADD CONSTRAINT mailinglistsubscription__email_address_fk FOREIGN KEY (email_address) REFERENCES emailaddress(id) ON DELETE CASCADE;
9958
21848
 
 
21849
 
9959
21850
ALTER TABLE ONLY mailinglistsubscription
9960
21851
    ADD CONSTRAINT mailinglistsubscription_mailing_list_fkey FOREIGN KEY (mailing_list) REFERENCES mailinglist(id);
9961
21852
 
 
21853
 
9962
21854
ALTER TABLE ONLY mailinglistsubscription
9963
21855
    ADD CONSTRAINT mailinglistsubscription_person_fkey FOREIGN KEY (person) REFERENCES person(id);
9964
21856
 
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);
9976
21857
 
9977
21858
ALTER TABLE ONLY mergedirectivejob
9978
21859
    ADD CONSTRAINT mergedirectivejob_job_fkey FOREIGN KEY (job) REFERENCES job(id) ON DELETE CASCADE;
9979
21860
 
 
21861
 
9980
21862
ALTER TABLE ONLY mergedirectivejob
9981
21863
    ADD CONSTRAINT mergedirectivejob_merge_directive_fkey FOREIGN KEY (merge_directive) REFERENCES libraryfilealias(id);
9982
21864
 
 
21865
 
9983
21866
ALTER TABLE ONLY message
9984
21867
    ADD CONSTRAINT message_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
9985
21868
 
 
21869
 
9986
21870
ALTER TABLE ONLY message
9987
21871
    ADD CONSTRAINT message_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
9988
21872
 
 
21873
 
9989
21874
ALTER TABLE ONLY message
9990
21875
    ADD CONSTRAINT message_parent_fk FOREIGN KEY (parent) REFERENCES message(id);
9991
21876
 
 
21877
 
9992
21878
ALTER TABLE ONLY message
9993
21879
    ADD CONSTRAINT message_raw_fk FOREIGN KEY (raw) REFERENCES libraryfilealias(id);
9994
21880
 
 
21881
 
9995
21882
ALTER TABLE ONLY messageapproval
9996
21883
    ADD CONSTRAINT messageapproval_disposed_by_fkey FOREIGN KEY (disposed_by) REFERENCES person(id);
9997
21884
 
 
21885
 
9998
21886
ALTER TABLE ONLY messageapproval
9999
21887
    ADD CONSTRAINT messageapproval_mailing_list_fkey FOREIGN KEY (mailing_list) REFERENCES mailinglist(id);
10000
21888
 
 
21889
 
10001
21890
ALTER TABLE ONLY messageapproval
10002
21891
    ADD CONSTRAINT messageapproval_message_fkey FOREIGN KEY (message) REFERENCES message(id);
10003
21892
 
 
21893
 
10004
21894
ALTER TABLE ONLY messageapproval
10005
21895
    ADD CONSTRAINT messageapproval_posted_by_fkey FOREIGN KEY (posted_by) REFERENCES person(id);
10006
21896
 
 
21897
 
10007
21898
ALTER TABLE ONLY messageapproval
10008
21899
    ADD CONSTRAINT messageapproval_posted_message_fkey FOREIGN KEY (posted_message) REFERENCES libraryfilealias(id);
10009
21900
 
 
21901
 
10010
21902
ALTER TABLE ONLY messagechunk
10011
21903
    ADD CONSTRAINT messagechunk_blob_fk FOREIGN KEY (blob) REFERENCES libraryfilealias(id);
10012
21904
 
 
21905
 
10013
21906
ALTER TABLE ONLY messagechunk
10014
21907
    ADD CONSTRAINT messagechunk_message_fk FOREIGN KEY (message) REFERENCES message(id);
10015
21908
 
 
21909
 
10016
21910
ALTER TABLE ONLY milestone
10017
21911
    ADD CONSTRAINT milestone__distroseries__distribution__fk FOREIGN KEY (distroseries, distribution) REFERENCES distroseries(id, distribution);
10018
21912
 
 
21913
 
10019
21914
ALTER TABLE ONLY milestone
10020
21915
    ADD CONSTRAINT milestone__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10021
21916
 
 
21917
 
10022
21918
ALTER TABLE ONLY milestone
10023
21919
    ADD CONSTRAINT milestone_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
10024
21920
 
 
21921
 
10025
21922
ALTER TABLE ONLY milestone
10026
21923
    ADD CONSTRAINT milestone_product_fk FOREIGN KEY (product) REFERENCES product(id);
10027
21924
 
 
21925
 
10028
21926
ALTER TABLE ONLY milestone
10029
21927
    ADD CONSTRAINT milestone_product_series_fk FOREIGN KEY (product, productseries) REFERENCES productseries(product, id);
10030
21928
 
 
21929
 
10031
21930
ALTER TABLE ONLY milestone
10032
21931
    ADD CONSTRAINT milestone_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
10033
21932
 
 
21933
 
10034
21934
ALTER TABLE ONLY mirror
10035
21935
    ADD CONSTRAINT mirror_country_fk FOREIGN KEY (country) REFERENCES country(id);
10036
21936
 
 
21937
 
10037
21938
ALTER TABLE ONLY mirror
10038
21939
    ADD CONSTRAINT mirror_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10039
21940
 
 
21941
 
10040
21942
ALTER TABLE ONLY mirrorcdimagedistroseries
10041
21943
    ADD CONSTRAINT mirrorcdimagedistroseries__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
10042
21944
 
 
21945
 
10043
21946
ALTER TABLE ONLY mirrorcdimagedistroseries
10044
21947
    ADD CONSTRAINT mirrorcdimagedistroseries__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10045
21948
 
 
21949
 
10046
21950
ALTER TABLE ONLY mirrorcontent
10047
21951
    ADD CONSTRAINT mirrorcontent__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
10048
21952
 
 
21953
 
10049
21954
ALTER TABLE ONLY mirrorcontent
10050
21955
    ADD CONSTRAINT mirrorcontent_component_fk FOREIGN KEY (component) REFERENCES component(id);
10051
21956
 
 
21957
 
10052
21958
ALTER TABLE ONLY mirrorcontent
10053
21959
    ADD CONSTRAINT mirrorcontent_mirror_fk FOREIGN KEY (mirror) REFERENCES mirror(id);
10054
21960
 
 
21961
 
10055
21962
ALTER TABLE ONLY mirrordistroarchseries
10056
21963
    ADD CONSTRAINT mirrordistroarchseries__component__fk FOREIGN KEY (component) REFERENCES component(id);
10057
21964
 
 
21965
 
10058
21966
ALTER TABLE ONLY mirrordistroarchseries
10059
21967
    ADD CONSTRAINT mirrordistroarchseries__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
10060
21968
 
 
21969
 
10061
21970
ALTER TABLE ONLY mirrordistroarchseries
10062
21971
    ADD CONSTRAINT mirrordistroarchseries__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
10063
21972
 
 
21973
 
10064
21974
ALTER TABLE ONLY mirrordistroseriessource
10065
21975
    ADD CONSTRAINT mirrordistroseriessource__component__fk FOREIGN KEY (component) REFERENCES component(id);
10066
21976
 
 
21977
 
10067
21978
ALTER TABLE ONLY mirrordistroseriessource
10068
21979
    ADD CONSTRAINT mirrordistroseriessource__distribution_mirror__fk FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
10069
21980
 
 
21981
 
10070
21982
ALTER TABLE ONLY mirrordistroseriessource
10071
21983
    ADD CONSTRAINT mirrordistroseriessource__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10072
21984
 
 
21985
 
10073
21986
ALTER TABLE ONLY mirrorproberecord
10074
21987
    ADD CONSTRAINT mirrorproberecord_distribution_mirror_fkey FOREIGN KEY (distribution_mirror) REFERENCES distributionmirror(id);
10075
21988
 
 
21989
 
10076
21990
ALTER TABLE ONLY mirrorproberecord
10077
21991
    ADD CONSTRAINT mirrorproberecord_log_file_fkey FOREIGN KEY (log_file) REFERENCES libraryfilealias(id);
10078
21992
 
 
21993
 
10079
21994
ALTER TABLE ONLY mirrorsourcecontent
10080
21995
    ADD CONSTRAINT mirrorsourcecontent__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10081
21996
 
 
21997
 
10082
21998
ALTER TABLE ONLY mirrorsourcecontent
10083
21999
    ADD CONSTRAINT mirrorsourcecontent_component_fk FOREIGN KEY (component) REFERENCES component(id);
10084
22000
 
 
22001
 
10085
22002
ALTER TABLE ONLY mirrorsourcecontent
10086
22003
    ADD CONSTRAINT mirrorsourcecontent_mirror_fk FOREIGN KEY (mirror) REFERENCES mirror(id);
10087
22004
 
 
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
 
10088
22014
ALTER TABLE ONLY oauthaccesstoken
10089
22015
    ADD CONSTRAINT oauthaccesstoken_consumer_fkey FOREIGN KEY (consumer) REFERENCES oauthconsumer(id);
10090
22016
 
 
22017
 
10091
22018
ALTER TABLE ONLY oauthaccesstoken
10092
22019
    ADD CONSTRAINT oauthaccesstoken_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
10093
22020
 
 
22021
 
10094
22022
ALTER TABLE ONLY oauthaccesstoken
10095
22023
    ADD CONSTRAINT oauthaccesstoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
10096
22024
 
 
22025
 
10097
22026
ALTER TABLE ONLY oauthaccesstoken
10098
22027
    ADD CONSTRAINT oauthaccesstoken_product_fkey FOREIGN KEY (product) REFERENCES product(id);
10099
22028
 
 
22029
 
10100
22030
ALTER TABLE ONLY oauthaccesstoken
10101
22031
    ADD CONSTRAINT oauthaccesstoken_project_fkey FOREIGN KEY (project) REFERENCES project(id);
10102
22032
 
 
22033
 
10103
22034
ALTER TABLE ONLY oauthaccesstoken
10104
22035
    ADD CONSTRAINT oauthaccesstoken_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10105
22036
 
 
22037
 
10106
22038
ALTER TABLE ONLY oauthnonce
10107
22039
    ADD CONSTRAINT oauthnonce__access_token__fk FOREIGN KEY (access_token) REFERENCES oauthaccesstoken(id) ON DELETE CASCADE;
10108
22040
 
 
22041
 
10109
22042
ALTER TABLE ONLY oauthrequesttoken
10110
22043
    ADD CONSTRAINT oauthrequesttoken_consumer_fkey FOREIGN KEY (consumer) REFERENCES oauthconsumer(id);
10111
22044
 
 
22045
 
10112
22046
ALTER TABLE ONLY oauthrequesttoken
10113
22047
    ADD CONSTRAINT oauthrequesttoken_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
10114
22048
 
 
22049
 
10115
22050
ALTER TABLE ONLY oauthrequesttoken
10116
22051
    ADD CONSTRAINT oauthrequesttoken_person_fkey FOREIGN KEY (person) REFERENCES person(id);
10117
22052
 
 
22053
 
10118
22054
ALTER TABLE ONLY oauthrequesttoken
10119
22055
    ADD CONSTRAINT oauthrequesttoken_product_fkey FOREIGN KEY (product) REFERENCES product(id);
10120
22056
 
 
22057
 
10121
22058
ALTER TABLE ONLY oauthrequesttoken
10122
22059
    ADD CONSTRAINT oauthrequesttoken_project_fkey FOREIGN KEY (project) REFERENCES project(id);
10123
22060
 
 
22061
 
10124
22062
ALTER TABLE ONLY oauthrequesttoken
10125
22063
    ADD CONSTRAINT oauthrequesttoken_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10126
22064
 
 
22065
 
10127
22066
ALTER TABLE ONLY officialbugtag
10128
22067
    ADD CONSTRAINT officialbugtag_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
10129
22068
 
 
22069
 
10130
22070
ALTER TABLE ONLY officialbugtag
10131
22071
    ADD CONSTRAINT officialbugtag_product_fkey FOREIGN KEY (product) REFERENCES product(id);
10132
22072
 
 
22073
 
10133
22074
ALTER TABLE ONLY officialbugtag
10134
22075
    ADD CONSTRAINT officialbugtag_project_fkey FOREIGN KEY (project) REFERENCES project(id);
10135
22076
 
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);
 
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
 
10144
22085
 
10145
22086
ALTER TABLE ONLY packagebuild
10146
22087
    ADD CONSTRAINT packagebuild__archive__fk FOREIGN KEY (archive) REFERENCES archive(id);
10147
22088
 
 
22089
 
10148
22090
ALTER TABLE ONLY packagebuild
10149
22091
    ADD CONSTRAINT packagebuild__build_farm_job__fk FOREIGN KEY (build_farm_job) REFERENCES buildfarmjob(id);
10150
22092
 
 
22093
 
10151
22094
ALTER TABLE ONLY packagebuild
10152
22095
    ADD CONSTRAINT packagebuild__log__fk FOREIGN KEY (upload_log) REFERENCES libraryfilealias(id);
10153
22096
 
 
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
 
10154
22114
ALTER TABLE ONLY packagecopyrequest
10155
22115
    ADD CONSTRAINT packagecopyrequest__sourcearchive__fk FOREIGN KEY (source_archive) REFERENCES archive(id) ON DELETE CASCADE;
10156
22116
 
 
22117
 
10157
22118
ALTER TABLE ONLY packagecopyrequest
10158
22119
    ADD CONSTRAINT packagecopyrequest__targetarchive__fk FOREIGN KEY (target_archive) REFERENCES archive(id) ON DELETE CASCADE;
10159
22120
 
 
22121
 
10160
22122
ALTER TABLE ONLY packagecopyrequest
10161
22123
    ADD CONSTRAINT packagecopyrequest_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
10162
22124
 
 
22125
 
10163
22126
ALTER TABLE ONLY packagecopyrequest
10164
22127
    ADD CONSTRAINT packagecopyrequest_sourcecomponent_fk FOREIGN KEY (source_component) REFERENCES component(id);
10165
22128
 
 
22129
 
10166
22130
ALTER TABLE ONLY packagecopyrequest
10167
22131
    ADD CONSTRAINT packagecopyrequest_sourcedistroseries_fk FOREIGN KEY (source_distroseries) REFERENCES distroseries(id);
10168
22132
 
 
22133
 
10169
22134
ALTER TABLE ONLY packagecopyrequest
10170
22135
    ADD CONSTRAINT packagecopyrequest_targetcomponent_fk FOREIGN KEY (target_component) REFERENCES component(id);
10171
22136
 
 
22137
 
10172
22138
ALTER TABLE ONLY packagecopyrequest
10173
22139
    ADD CONSTRAINT packagecopyrequest_targetdistroseries_fk FOREIGN KEY (target_distroseries) REFERENCES distroseries(id);
10174
22140
 
 
22141
 
10175
22142
ALTER TABLE ONLY packagediff
10176
22143
    ADD CONSTRAINT packagediff_diff_content_fkey FOREIGN KEY (diff_content) REFERENCES libraryfilealias(id);
10177
22144
 
 
22145
 
10178
22146
ALTER TABLE ONLY packagediff
10179
22147
    ADD CONSTRAINT packagediff_from_source_fkey FOREIGN KEY (from_source) REFERENCES sourcepackagerelease(id);
10180
22148
 
 
22149
 
10181
22150
ALTER TABLE ONLY packagediff
10182
22151
    ADD CONSTRAINT packagediff_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
10183
22152
 
 
22153
 
10184
22154
ALTER TABLE ONLY packagediff
10185
22155
    ADD CONSTRAINT packagediff_to_source_fkey FOREIGN KEY (to_source) REFERENCES sourcepackagerelease(id);
10186
22156
 
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);
10201
22157
 
10202
22158
ALTER TABLE ONLY packageset
10203
22159
    ADD CONSTRAINT packageset__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10204
22160
 
 
22161
 
10205
22162
ALTER TABLE ONLY packageset
10206
22163
    ADD CONSTRAINT packageset__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
10207
22164
 
 
22165
 
10208
22166
ALTER TABLE ONLY packageset
10209
22167
    ADD CONSTRAINT packageset__packagesetgroup__fk FOREIGN KEY (packagesetgroup) REFERENCES packagesetgroup(id);
10210
22168
 
 
22169
 
10211
22170
ALTER TABLE ONLY packagesetgroup
10212
22171
    ADD CONSTRAINT packagesetgroup__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
10213
22172
 
 
22173
 
10214
22174
ALTER TABLE ONLY packagesetinclusion
10215
22175
    ADD CONSTRAINT packagesetinclusion__child__fk FOREIGN KEY (child) REFERENCES packageset(id);
10216
22176
 
 
22177
 
10217
22178
ALTER TABLE ONLY packagesetinclusion
10218
22179
    ADD CONSTRAINT packagesetinclusion__parent__fk FOREIGN KEY (parent) REFERENCES packageset(id);
10219
22180
 
 
22181
 
10220
22182
ALTER TABLE ONLY packagesetsources
10221
22183
    ADD CONSTRAINT packagesetsources__packageset__fk FOREIGN KEY (packageset) REFERENCES packageset(id);
10222
22184
 
 
22185
 
10223
22186
ALTER TABLE ONLY packageupload
10224
22187
    ADD CONSTRAINT packageupload__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
10225
22188
 
 
22189
 
10226
22190
ALTER TABLE ONLY packageupload
10227
22191
    ADD CONSTRAINT packageupload__changesfile__fk FOREIGN KEY (changesfile) REFERENCES libraryfilealias(id);
10228
22192
 
 
22193
 
10229
22194
ALTER TABLE ONLY packageupload
10230
22195
    ADD CONSTRAINT packageupload__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10231
22196
 
 
22197
 
 
22198
ALTER TABLE ONLY packageupload
 
22199
    ADD CONSTRAINT packageupload__package_copy_job__fk FOREIGN KEY (package_copy_job) REFERENCES packagecopyjob(id);
 
22200
 
 
22201
 
10232
22202
ALTER TABLE ONLY packageupload
10233
22203
    ADD CONSTRAINT packageupload__signing_key__fk FOREIGN KEY (signing_key) REFERENCES gpgkey(id);
10234
22204
 
 
22205
 
10235
22206
ALTER TABLE ONLY packageuploadbuild
10236
22207
    ADD CONSTRAINT packageuploadbuild__packageupload__fk FOREIGN KEY (packageupload) REFERENCES packageupload(id) ON DELETE CASCADE;
10237
22208
 
 
22209
 
10238
22210
ALTER TABLE ONLY packageuploadbuild
10239
22211
    ADD CONSTRAINT packageuploadbuild_build_fk FOREIGN KEY (build) REFERENCES binarypackagebuild(id);
10240
22212
 
 
22213
 
10241
22214
ALTER TABLE ONLY packageuploadcustom
10242
22215
    ADD CONSTRAINT packageuploadcustom_libraryfilealias_fk FOREIGN KEY (libraryfilealias) REFERENCES libraryfilealias(id);
10243
22216
 
 
22217
 
10244
22218
ALTER TABLE ONLY packageuploadcustom
10245
22219
    ADD CONSTRAINT packageuploadcustom_packageupload_fk FOREIGN KEY (packageupload) REFERENCES packageupload(id);
10246
22220
 
 
22221
 
10247
22222
ALTER TABLE ONLY packageuploadsource
10248
22223
    ADD CONSTRAINT packageuploadsource__packageupload__fk FOREIGN KEY (packageupload) REFERENCES packageupload(id) ON DELETE CASCADE;
10249
22224
 
 
22225
 
10250
22226
ALTER TABLE ONLY packageuploadsource
10251
22227
    ADD CONSTRAINT packageuploadsource__sourcepackagerelease__fk FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id);
10252
22228
 
 
22229
 
10253
22230
ALTER TABLE ONLY packaging
10254
22231
    ADD CONSTRAINT packaging__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10255
22232
 
 
22233
 
10256
22234
ALTER TABLE ONLY packaging
10257
22235
    ADD CONSTRAINT packaging_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10258
22236
 
 
22237
 
10259
22238
ALTER TABLE ONLY packaging
10260
22239
    ADD CONSTRAINT packaging_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
10261
22240
 
 
22241
 
10262
22242
ALTER TABLE ONLY packaging
10263
22243
    ADD CONSTRAINT packaging_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10264
22244
 
 
22245
 
10265
22246
ALTER TABLE ONLY person
10266
22247
    ADD CONSTRAINT person__account__fk FOREIGN KEY (account) REFERENCES account(id);
10267
22248
 
 
22249
 
10268
22250
ALTER TABLE ONLY person
10269
22251
    ADD CONSTRAINT person__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
10270
22252
 
 
22253
 
10271
22254
ALTER TABLE ONLY person
10272
22255
    ADD CONSTRAINT person__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
10273
22256
 
 
22257
 
10274
22258
ALTER TABLE ONLY person
10275
22259
    ADD CONSTRAINT person__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
10276
22260
 
 
22261
 
10277
22262
ALTER TABLE ONLY karmacache
10278
22263
    ADD CONSTRAINT person_fk FOREIGN KEY (person) REFERENCES person(id);
10279
22264
 
 
22265
 
10280
22266
ALTER TABLE ONLY person
10281
22267
    ADD CONSTRAINT person_language_fk FOREIGN KEY (language) REFERENCES language(id);
10282
22268
 
 
22269
 
10283
22270
ALTER TABLE ONLY person
10284
22271
    ADD CONSTRAINT person_merged_fk FOREIGN KEY (merged) REFERENCES person(id);
10285
22272
 
 
22273
 
10286
22274
ALTER TABLE ONLY person
10287
22275
    ADD CONSTRAINT person_registrant_fk FOREIGN KEY (registrant) REFERENCES person(id);
10288
22276
 
 
22277
 
10289
22278
ALTER TABLE ONLY person
10290
22279
    ADD CONSTRAINT person_teamowner_fk FOREIGN KEY (teamowner) REFERENCES person(id);
10291
22280
 
 
22281
 
10292
22282
ALTER TABLE ONLY personlanguage
10293
22283
    ADD CONSTRAINT personlanguage_language_fk FOREIGN KEY (language) REFERENCES language(id);
10294
22284
 
 
22285
 
10295
22286
ALTER TABLE ONLY personlanguage
10296
22287
    ADD CONSTRAINT personlanguage_person_fk FOREIGN KEY (person) REFERENCES person(id);
10297
22288
 
 
22289
 
10298
22290
ALTER TABLE ONLY personlocation
10299
22291
    ADD CONSTRAINT personlocation_last_modified_by_fkey FOREIGN KEY (last_modified_by) REFERENCES person(id);
10300
22292
 
 
22293
 
10301
22294
ALTER TABLE ONLY personlocation
10302
22295
    ADD CONSTRAINT personlocation_person_fkey FOREIGN KEY (person) REFERENCES person(id);
10303
22296
 
 
22297
 
10304
22298
ALTER TABLE ONLY personnotification
10305
22299
    ADD CONSTRAINT personnotification_person_fkey FOREIGN KEY (person) REFERENCES person(id);
10306
22300
 
 
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
 
10307
22318
ALTER TABLE ONLY pillarname
10308
22319
    ADD CONSTRAINT pillarname__alias_for__fk FOREIGN KEY (alias_for) REFERENCES pillarname(id);
10309
22320
 
 
22321
 
10310
22322
ALTER TABLE ONLY pillarname
10311
22323
    ADD CONSTRAINT pillarname_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id) ON DELETE CASCADE;
10312
22324
 
 
22325
 
10313
22326
ALTER TABLE ONLY pillarname
10314
22327
    ADD CONSTRAINT pillarname_product_fkey FOREIGN KEY (product) REFERENCES product(id) ON DELETE CASCADE;
10315
22328
 
 
22329
 
10316
22330
ALTER TABLE ONLY pillarname
10317
22331
    ADD CONSTRAINT pillarname_project_fkey FOREIGN KEY (project) REFERENCES project(id) ON DELETE CASCADE;
10318
22332
 
 
22333
 
10319
22334
ALTER TABLE ONLY pocketchroot
10320
22335
    ADD CONSTRAINT pocketchroot__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
10321
22336
 
 
22337
 
10322
22338
ALTER TABLE ONLY pocketchroot
10323
22339
    ADD CONSTRAINT pocketchroot__libraryfilealias__fk FOREIGN KEY (chroot) REFERENCES libraryfilealias(id);
10324
22340
 
 
22341
 
10325
22342
ALTER TABLE ONLY poexportrequest
10326
22343
    ADD CONSTRAINT poeportrequest_potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
10327
22344
 
 
22345
 
10328
22346
ALTER TABLE ONLY poexportrequest
10329
22347
    ADD CONSTRAINT poexportrequest_person_fk FOREIGN KEY (person) REFERENCES person(id);
10330
22348
 
 
22349
 
10331
22350
ALTER TABLE ONLY poexportrequest
10332
22351
    ADD CONSTRAINT poexportrequest_pofile_fk FOREIGN KEY (pofile) REFERENCES pofile(id);
10333
22352
 
 
22353
 
10334
22354
ALTER TABLE ONLY pofile
10335
22355
    ADD CONSTRAINT pofile_language_fk FOREIGN KEY (language) REFERENCES language(id);
10336
22356
 
 
22357
 
10337
22358
ALTER TABLE ONLY pofile
10338
22359
    ADD CONSTRAINT pofile_lasttranslator_fk FOREIGN KEY (lasttranslator) REFERENCES person(id);
10339
22360
 
 
22361
 
10340
22362
ALTER TABLE ONLY pofile
10341
22363
    ADD CONSTRAINT pofile_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10342
22364
 
 
22365
 
10343
22366
ALTER TABLE ONLY pofile
10344
22367
    ADD CONSTRAINT pofile_potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
10345
22368
 
 
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
 
10346
22378
ALTER TABLE ONLY pofiletranslator
10347
22379
    ADD CONSTRAINT pofiletranslator__latest_message__fk FOREIGN KEY (latest_message) REFERENCES translationmessage(id) DEFERRABLE INITIALLY DEFERRED;
10348
22380
 
 
22381
 
10349
22382
ALTER TABLE ONLY pofiletranslator
10350
22383
    ADD CONSTRAINT pofiletranslator__person__fk FOREIGN KEY (person) REFERENCES person(id);
10351
22384
 
 
22385
 
10352
22386
ALTER TABLE ONLY pofiletranslator
10353
22387
    ADD CONSTRAINT pofiletranslator__pofile__fk FOREIGN KEY (pofile) REFERENCES pofile(id);
10354
22388
 
 
22389
 
10355
22390
ALTER TABLE ONLY poll
10356
22391
    ADD CONSTRAINT poll_team_fk FOREIGN KEY (team) REFERENCES person(id);
10357
22392
 
 
22393
 
10358
22394
ALTER TABLE ONLY potemplate
10359
22395
    ADD CONSTRAINT potemplate__distrorelease__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10360
22396
 
 
22397
 
10361
22398
ALTER TABLE ONLY potemplate
10362
22399
    ADD CONSTRAINT potemplate__from_sourcepackagename__fk FOREIGN KEY (from_sourcepackagename) REFERENCES sourcepackagename(id);
10363
22400
 
 
22401
 
10364
22402
ALTER TABLE ONLY potemplate
10365
22403
    ADD CONSTRAINT potemplate__source_file__fk FOREIGN KEY (source_file) REFERENCES libraryfilealias(id);
10366
22404
 
 
22405
 
10367
22406
ALTER TABLE ONLY potemplate
10368
22407
    ADD CONSTRAINT potemplate_binarypackagename_fk FOREIGN KEY (binarypackagename) REFERENCES binarypackagename(id);
10369
22408
 
 
22409
 
 
22410
ALTER TABLE ONLY packagingjob
 
22411
    ADD CONSTRAINT potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
 
22412
 
 
22413
 
10370
22414
ALTER TABLE ONLY potemplate
10371
22415
    ADD CONSTRAINT potemplate_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10372
22416
 
 
22417
 
10373
22418
ALTER TABLE ONLY potemplate
10374
22419
    ADD CONSTRAINT potemplate_productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
10375
22420
 
 
22421
 
10376
22422
ALTER TABLE ONLY potemplate
10377
22423
    ADD CONSTRAINT potemplate_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10378
22424
 
 
22425
 
10379
22426
ALTER TABLE ONLY potmsgset
10380
22427
    ADD CONSTRAINT potmsgset__msgid_plural__fk FOREIGN KEY (msgid_plural) REFERENCES pomsgid(id);
10381
22428
 
 
22429
 
10382
22430
ALTER TABLE ONLY potmsgset
10383
22431
    ADD CONSTRAINT potmsgset_potemplate_fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
10384
22432
 
 
22433
 
10385
22434
ALTER TABLE ONLY potmsgset
10386
22435
    ADD CONSTRAINT potmsgset_primemsgid_fk FOREIGN KEY (msgid_singular) REFERENCES pomsgid(id);
10387
22436
 
 
22437
 
10388
22438
ALTER TABLE ONLY previewdiff
10389
22439
    ADD CONSTRAINT previewdiff_diff_fkey FOREIGN KEY (diff) REFERENCES diff(id) ON DELETE CASCADE;
10390
22440
 
 
22441
 
10391
22442
ALTER TABLE ONLY product
10392
22443
    ADD CONSTRAINT product__development_focus__fk FOREIGN KEY (development_focus) REFERENCES productseries(id);
10393
22444
 
 
22445
 
10394
22446
ALTER TABLE ONLY product
10395
22447
    ADD CONSTRAINT product__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
10396
22448
 
 
22449
 
10397
22450
ALTER TABLE ONLY product
10398
22451
    ADD CONSTRAINT product__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
10399
22452
 
 
22453
 
10400
22454
ALTER TABLE ONLY product
10401
22455
    ADD CONSTRAINT product__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
10402
22456
 
 
22457
 
10403
22458
ALTER TABLE ONLY product
10404
22459
    ADD CONSTRAINT product__translation_focus__fk FOREIGN KEY (translation_focus) REFERENCES productseries(id);
10405
22460
 
 
22461
 
10406
22462
ALTER TABLE ONLY product
10407
22463
    ADD CONSTRAINT product_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
10408
22464
 
 
22465
 
10409
22466
ALTER TABLE ONLY product
10410
22467
    ADD CONSTRAINT product_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
10411
22468
 
 
22469
 
10412
22470
ALTER TABLE ONLY product
10413
22471
    ADD CONSTRAINT product_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10414
22472
 
 
22473
 
10415
22474
ALTER TABLE ONLY product
10416
22475
    ADD CONSTRAINT product_project_fk FOREIGN KEY (project) REFERENCES project(id);
10417
22476
 
 
22477
 
10418
22478
ALTER TABLE ONLY product
10419
22479
    ADD CONSTRAINT product_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
10420
22480
 
 
22481
 
10421
22482
ALTER TABLE ONLY product
10422
22483
    ADD CONSTRAINT product_security_contact_fkey FOREIGN KEY (security_contact) REFERENCES person(id);
10423
22484
 
 
22485
 
10424
22486
ALTER TABLE ONLY product
10425
22487
    ADD CONSTRAINT product_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
10426
22488
 
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);
10435
22489
 
10436
22490
ALTER TABLE ONLY productlicense
10437
22491
    ADD CONSTRAINT productlicense_product_fkey FOREIGN KEY (product) REFERENCES product(id);
10438
22492
 
 
22493
 
10439
22494
ALTER TABLE ONLY productrelease
10440
22495
    ADD CONSTRAINT productrelease_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id);
10441
22496
 
 
22497
 
10442
22498
ALTER TABLE ONLY productrelease
10443
22499
    ADD CONSTRAINT productrelease_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10444
22500
 
 
22501
 
10445
22502
ALTER TABLE ONLY productreleasefile
10446
22503
    ADD CONSTRAINT productreleasefile__signature__fk FOREIGN KEY (signature) REFERENCES libraryfilealias(id);
10447
22504
 
 
22505
 
10448
22506
ALTER TABLE ONLY productreleasefile
10449
22507
    ADD CONSTRAINT productreleasefile__uploader__fk FOREIGN KEY (uploader) REFERENCES person(id);
10450
22508
 
 
22509
 
10451
22510
ALTER TABLE ONLY productseries
10452
22511
    ADD CONSTRAINT productseries_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
10453
22512
 
 
22513
 
10454
22514
ALTER TABLE ONLY productseries
10455
22515
    ADD CONSTRAINT productseries_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
10456
22516
 
 
22517
 
 
22518
ALTER TABLE ONLY packagingjob
 
22519
    ADD CONSTRAINT productseries_fk FOREIGN KEY (productseries) REFERENCES productseries(id);
 
22520
 
 
22521
 
10457
22522
ALTER TABLE ONLY productseries
10458
22523
    ADD CONSTRAINT productseries_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10459
22524
 
 
22525
 
10460
22526
ALTER TABLE ONLY productseries
10461
22527
    ADD CONSTRAINT productseries_product_fk FOREIGN KEY (product) REFERENCES product(id);
10462
22528
 
 
22529
 
10463
22530
ALTER TABLE ONLY productseries
10464
22531
    ADD CONSTRAINT productseries_translations_branch_fkey FOREIGN KEY (translations_branch) REFERENCES branch(id);
10465
22532
 
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);
10474
22533
 
10475
22534
ALTER TABLE ONLY project
10476
22535
    ADD CONSTRAINT project__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
10477
22536
 
 
22537
 
10478
22538
ALTER TABLE ONLY project
10479
22539
    ADD CONSTRAINT project__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
10480
22540
 
 
22541
 
10481
22542
ALTER TABLE ONLY project
10482
22543
    ADD CONSTRAINT project__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
10483
22544
 
 
22545
 
10484
22546
ALTER TABLE ONLY project
10485
22547
    ADD CONSTRAINT project_bugtracker_fkey FOREIGN KEY (bugtracker) REFERENCES bugtracker(id);
10486
22548
 
 
22549
 
10487
22550
ALTER TABLE ONLY project
10488
22551
    ADD CONSTRAINT project_driver_fk FOREIGN KEY (driver) REFERENCES person(id);
10489
22552
 
 
22553
 
10490
22554
ALTER TABLE ONLY project
10491
22555
    ADD CONSTRAINT project_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10492
22556
 
 
22557
 
10493
22558
ALTER TABLE ONLY project
10494
22559
    ADD CONSTRAINT project_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
10495
22560
 
 
22561
 
10496
22562
ALTER TABLE ONLY project
10497
22563
    ADD CONSTRAINT project_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
10498
22564
 
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);
 
22565
 
 
22566
ALTER TABLE ONLY publisherconfig
 
22567
    ADD CONSTRAINT publisherconfig__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
 
22568
 
10510
22569
 
10511
22570
ALTER TABLE ONLY question
10512
22571
    ADD CONSTRAINT question__answer__fk FOREIGN KEY (answer) REFERENCES questionmessage(id);
10513
22572
 
 
22573
 
10514
22574
ALTER TABLE ONLY question
10515
22575
    ADD CONSTRAINT question__answerer__fk FOREIGN KEY (answerer) REFERENCES person(id);
10516
22576
 
 
22577
 
10517
22578
ALTER TABLE ONLY question
10518
22579
    ADD CONSTRAINT question__assignee__fk FOREIGN KEY (assignee) REFERENCES person(id);
10519
22580
 
 
22581
 
10520
22582
ALTER TABLE ONLY question
10521
22583
    ADD CONSTRAINT question__distribution__fk FOREIGN KEY (distribution) REFERENCES distribution(id);
10522
22584
 
 
22585
 
10523
22586
ALTER TABLE ONLY question
10524
22587
    ADD CONSTRAINT question__faq__fk FOREIGN KEY (faq) REFERENCES faq(id);
10525
22588
 
 
22589
 
10526
22590
ALTER TABLE ONLY question
10527
22591
    ADD CONSTRAINT question__language__fkey FOREIGN KEY (language) REFERENCES language(id);
10528
22592
 
 
22593
 
10529
22594
ALTER TABLE ONLY question
10530
22595
    ADD CONSTRAINT question__owner__fk FOREIGN KEY (owner) REFERENCES person(id);
10531
22596
 
 
22597
 
10532
22598
ALTER TABLE ONLY question
10533
22599
    ADD CONSTRAINT question__product__fk FOREIGN KEY (product) REFERENCES product(id);
10534
22600
 
 
22601
 
10535
22602
ALTER TABLE ONLY question
10536
22603
    ADD CONSTRAINT question__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10537
22604
 
 
22605
 
10538
22606
ALTER TABLE ONLY questionbug
10539
22607
    ADD CONSTRAINT questionbug__bug__fk FOREIGN KEY (bug) REFERENCES bug(id);
10540
22608
 
 
22609
 
10541
22610
ALTER TABLE ONLY questionbug
10542
22611
    ADD CONSTRAINT questionbug__question__fk FOREIGN KEY (question) REFERENCES question(id);
10543
22612
 
 
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
 
10544
22622
ALTER TABLE ONLY questionmessage
10545
22623
    ADD CONSTRAINT questionmessage__message__fk FOREIGN KEY (message) REFERENCES message(id);
10546
22624
 
 
22625
 
10547
22626
ALTER TABLE ONLY questionmessage
10548
22627
    ADD CONSTRAINT questionmessage__question__fk FOREIGN KEY (question) REFERENCES question(id);
10549
22628
 
 
22629
 
10550
22630
ALTER TABLE ONLY questionreopening
10551
22631
    ADD CONSTRAINT questionreopening__answerer__fk FOREIGN KEY (answerer) REFERENCES person(id);
10552
22632
 
 
22633
 
10553
22634
ALTER TABLE ONLY questionreopening
10554
22635
    ADD CONSTRAINT questionreopening__question__fk FOREIGN KEY (question) REFERENCES question(id);
10555
22636
 
 
22637
 
10556
22638
ALTER TABLE ONLY questionreopening
10557
22639
    ADD CONSTRAINT questionreopening__reopener__fk FOREIGN KEY (reopener) REFERENCES person(id);
10558
22640
 
 
22641
 
10559
22642
ALTER TABLE ONLY questionsubscription
10560
22643
    ADD CONSTRAINT questionsubscription__person__fk FOREIGN KEY (person) REFERENCES person(id);
10561
22644
 
 
22645
 
10562
22646
ALTER TABLE ONLY questionsubscription
10563
22647
    ADD CONSTRAINT questionsubscription__question__fk FOREIGN KEY (question) REFERENCES question(id);
10564
22648
 
10565
 
ALTER TABLE ONLY requestedcds
10566
 
    ADD CONSTRAINT requestedcds_request_fk FOREIGN KEY (request) REFERENCES shippingrequest(id);
10567
22649
 
10568
22650
ALTER TABLE ONLY teammembership
10569
22651
    ADD CONSTRAINT reviewer_fk FOREIGN KEY (last_changed_by) REFERENCES person(id);
10570
22652
 
 
22653
 
10571
22654
ALTER TABLE ONLY revision
10572
22655
    ADD CONSTRAINT revision_gpgkey_fk FOREIGN KEY (gpgkey) REFERENCES gpgkey(id);
10573
22656
 
 
22657
 
10574
22658
ALTER TABLE ONLY revision
10575
22659
    ADD CONSTRAINT revision_revision_author_fk FOREIGN KEY (revision_author) REFERENCES revisionauthor(id);
10576
22660
 
 
22661
 
10577
22662
ALTER TABLE ONLY revisionauthor
10578
22663
    ADD CONSTRAINT revisionauthor_person_fkey FOREIGN KEY (person) REFERENCES person(id);
10579
22664
 
 
22665
 
10580
22666
ALTER TABLE ONLY revisioncache
10581
22667
    ADD CONSTRAINT revisioncache__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10582
22668
 
 
22669
 
10583
22670
ALTER TABLE ONLY revisioncache
10584
22671
    ADD CONSTRAINT revisioncache__product__fk FOREIGN KEY (product) REFERENCES product(id);
10585
22672
 
 
22673
 
10586
22674
ALTER TABLE ONLY revisioncache
10587
22675
    ADD CONSTRAINT revisioncache__revision__fk FOREIGN KEY (revision) REFERENCES revision(id);
10588
22676
 
 
22677
 
10589
22678
ALTER TABLE ONLY revisioncache
10590
22679
    ADD CONSTRAINT revisioncache__revision_author__fk FOREIGN KEY (revision_author) REFERENCES revisionauthor(id);
10591
22680
 
 
22681
 
10592
22682
ALTER TABLE ONLY revisioncache
10593
22683
    ADD CONSTRAINT revisioncache__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10594
22684
 
 
22685
 
10595
22686
ALTER TABLE ONLY revisionparent
10596
22687
    ADD CONSTRAINT revisionparent_revision_fk FOREIGN KEY (revision) REFERENCES revision(id);
10597
22688
 
 
22689
 
10598
22690
ALTER TABLE ONLY revisionproperty
10599
22691
    ADD CONSTRAINT revisionproperty__revision__fk FOREIGN KEY (revision) REFERENCES revision(id);
10600
22692
 
 
22693
 
10601
22694
ALTER TABLE ONLY sectionselection
10602
22695
    ADD CONSTRAINT sectionselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10603
22696
 
 
22697
 
10604
22698
ALTER TABLE ONLY sectionselection
10605
22699
    ADD CONSTRAINT sectionselection__section__fk FOREIGN KEY (section) REFERENCES section(id);
10606
22700
 
 
22701
 
10607
22702
ALTER TABLE ONLY binarypackagepublishinghistory
10608
22703
    ADD CONSTRAINT securebinarypackagepublishinghistory__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
10609
22704
 
 
22705
 
10610
22706
ALTER TABLE ONLY binarypackagepublishinghistory
10611
22707
    ADD CONSTRAINT securebinarypackagepublishinghistory__distroarchseries__fk FOREIGN KEY (distroarchseries) REFERENCES distroarchseries(id);
10612
22708
 
 
22709
 
10613
22710
ALTER TABLE ONLY binarypackagepublishinghistory
10614
22711
    ADD CONSTRAINT securebinarypackagepublishinghistory_binarypackagerelease_fk FOREIGN KEY (binarypackagerelease) REFERENCES binarypackagerelease(id);
10615
22712
 
 
22713
 
10616
22714
ALTER TABLE ONLY binarypackagepublishinghistory
10617
22715
    ADD CONSTRAINT securebinarypackagepublishinghistory_component_fk FOREIGN KEY (component) REFERENCES component(id);
10618
22716
 
 
22717
 
10619
22718
ALTER TABLE ONLY binarypackagepublishinghistory
10620
22719
    ADD CONSTRAINT securebinarypackagepublishinghistory_removedby_fk FOREIGN KEY (removed_by) REFERENCES person(id);
10621
22720
 
 
22721
 
10622
22722
ALTER TABLE ONLY binarypackagepublishinghistory
10623
22723
    ADD CONSTRAINT securebinarypackagepublishinghistory_section_fk FOREIGN KEY (section) REFERENCES section(id);
10624
22724
 
 
22725
 
10625
22726
ALTER TABLE ONLY sourcepackagepublishinghistory
10626
22727
    ADD CONSTRAINT securesourcepackagepublishinghistory__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10627
22728
 
 
22729
 
10628
22730
ALTER TABLE ONLY sourcepackagepublishinghistory
10629
22731
    ADD CONSTRAINT securesourcepackagepublishinghistory_component_fk FOREIGN KEY (component) REFERENCES component(id);
10630
22732
 
 
22733
 
10631
22734
ALTER TABLE ONLY sourcepackagepublishinghistory
10632
22735
    ADD CONSTRAINT securesourcepackagepublishinghistory_removedby_fk FOREIGN KEY (removed_by) REFERENCES person(id);
10633
22736
 
 
22737
 
10634
22738
ALTER TABLE ONLY sourcepackagepublishinghistory
10635
22739
    ADD CONSTRAINT securesourcepackagepublishinghistory_section_fk FOREIGN KEY (section) REFERENCES section(id);
10636
22740
 
 
22741
 
10637
22742
ALTER TABLE ONLY sourcepackagepublishinghistory
10638
22743
    ADD CONSTRAINT securesourcepackagepublishinghistory_sourcepackagerelease_fk FOREIGN KEY (sourcepackagerelease) REFERENCES sourcepackagerelease(id);
10639
22744
 
 
22745
 
10640
22746
ALTER TABLE ONLY sourcepackagepublishinghistory
10641
22747
    ADD CONSTRAINT securesourcepackagepublishinghistory_supersededby_fk FOREIGN KEY (supersededby) REFERENCES sourcepackagerelease(id);
10642
22748
 
 
22749
 
10643
22750
ALTER TABLE ONLY seriessourcepackagebranch
10644
22751
    ADD CONSTRAINT seriessourcepackagebranch_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
10645
22752
 
 
22753
 
10646
22754
ALTER TABLE ONLY seriessourcepackagebranch
10647
22755
    ADD CONSTRAINT seriessourcepackagebranch_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10648
22756
 
 
22757
 
10649
22758
ALTER TABLE ONLY seriessourcepackagebranch
10650
22759
    ADD CONSTRAINT seriessourcepackagebranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
10651
22760
 
 
22761
 
10652
22762
ALTER TABLE ONLY seriessourcepackagebranch
10653
22763
    ADD CONSTRAINT seriessourcepackagebranch_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10654
22764
 
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);
10675
22765
 
10676
22766
ALTER TABLE ONLY signedcodeofconduct
10677
22767
    ADD CONSTRAINT signedcodeofconduct_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10678
22768
 
 
22769
 
10679
22770
ALTER TABLE ONLY signedcodeofconduct
10680
22771
    ADD CONSTRAINT signedcodeofconduct_signingkey_fk FOREIGN KEY (owner, signingkey) REFERENCES gpgkey(owner, id) ON UPDATE CASCADE;
10681
22772
 
 
22773
 
10682
22774
ALTER TABLE ONLY sourcepackageformatselection
10683
22775
    ADD CONSTRAINT sourceformatselection__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10684
22776
 
 
22777
 
 
22778
ALTER TABLE ONLY packagingjob
 
22779
    ADD CONSTRAINT sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
 
22780
 
 
22781
 
10685
22782
ALTER TABLE ONLY packagesetsources
10686
22783
    ADD CONSTRAINT sourcepackagenamesources__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10687
22784
 
 
22785
 
10688
22786
ALTER TABLE ONLY sourcepackagepublishinghistory
10689
22787
    ADD CONSTRAINT sourcepackagepublishinghistory__archive__fk FOREIGN KEY (archive) REFERENCES archive(id) ON DELETE CASCADE;
10690
22788
 
 
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
 
10691
22802
ALTER TABLE ONLY sourcepackagerecipe
10692
22803
    ADD CONSTRAINT sourcepackagerecipe_daily_build_archive_fkey FOREIGN KEY (daily_build_archive) REFERENCES archive(id);
10693
22804
 
 
22805
 
10694
22806
ALTER TABLE ONLY sourcepackagerecipe
10695
22807
    ADD CONSTRAINT sourcepackagerecipe_owner_fkey FOREIGN KEY (owner) REFERENCES person(id);
10696
22808
 
 
22809
 
10697
22810
ALTER TABLE ONLY sourcepackagerecipe
10698
22811
    ADD CONSTRAINT sourcepackagerecipe_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
10699
22812
 
 
22813
 
10700
22814
ALTER TABLE ONLY sourcepackagerecipebuild
10701
22815
    ADD CONSTRAINT sourcepackagerecipebuild_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10702
22816
 
 
22817
 
10703
22818
ALTER TABLE ONLY sourcepackagerecipebuild
10704
22819
    ADD CONSTRAINT sourcepackagerecipebuild_manifest_fkey FOREIGN KEY (manifest) REFERENCES sourcepackagerecipedata(id);
10705
22820
 
 
22821
 
10706
22822
ALTER TABLE ONLY sourcepackagerecipebuild
10707
22823
    ADD CONSTRAINT sourcepackagerecipebuild_package_build_fkey FOREIGN KEY (package_build) REFERENCES packagebuild(id);
10708
22824
 
 
22825
 
10709
22826
ALTER TABLE ONLY sourcepackagerecipebuild
10710
22827
    ADD CONSTRAINT sourcepackagerecipebuild_recipe_fkey FOREIGN KEY (recipe) REFERENCES sourcepackagerecipe(id);
10711
22828
 
 
22829
 
10712
22830
ALTER TABLE ONLY sourcepackagerecipebuild
10713
22831
    ADD CONSTRAINT sourcepackagerecipebuild_requester_fkey FOREIGN KEY (requester) REFERENCES person(id);
10714
22832
 
 
22833
 
10715
22834
ALTER TABLE ONLY sourcepackagerecipebuildjob
10716
22835
    ADD CONSTRAINT sourcepackagerecipebuildjob_job_fkey FOREIGN KEY (job) REFERENCES job(id);
10717
22836
 
 
22837
 
10718
22838
ALTER TABLE ONLY sourcepackagerecipebuildjob
10719
22839
    ADD CONSTRAINT sourcepackagerecipebuildjob_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
10720
22840
 
 
22841
 
10721
22842
ALTER TABLE ONLY sourcepackagerecipedata
10722
22843
    ADD CONSTRAINT sourcepackagerecipedata_base_branch_fkey FOREIGN KEY (base_branch) REFERENCES branch(id);
10723
22844
 
 
22845
 
10724
22846
ALTER TABLE ONLY sourcepackagerecipedata
10725
22847
    ADD CONSTRAINT sourcepackagerecipedata_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
10726
22848
 
 
22849
 
10727
22850
ALTER TABLE ONLY sourcepackagerecipedata
10728
22851
    ADD CONSTRAINT sourcepackagerecipedata_sourcepackage_recipe_fkey FOREIGN KEY (sourcepackage_recipe) REFERENCES sourcepackagerecipe(id);
10729
22852
 
 
22853
 
10730
22854
ALTER TABLE ONLY sourcepackagerecipedatainstruction
10731
22855
    ADD CONSTRAINT sourcepackagerecipedatainstruction_branch_fkey FOREIGN KEY (branch) REFERENCES branch(id);
10732
22856
 
 
22857
 
10733
22858
ALTER TABLE ONLY sourcepackagerecipedatainstruction
10734
22859
    ADD CONSTRAINT sourcepackagerecipedatainstruction_parent_instruction_fkey FOREIGN KEY (parent_instruction) REFERENCES sourcepackagerecipedatainstruction(id);
10735
22860
 
 
22861
 
10736
22862
ALTER TABLE ONLY sourcepackagerecipedatainstruction
10737
22863
    ADD CONSTRAINT sourcepackagerecipedatainstruction_recipe_data_fkey FOREIGN KEY (recipe_data) REFERENCES sourcepackagerecipedata(id);
10738
22864
 
 
22865
 
10739
22866
ALTER TABLE ONLY sourcepackagerecipedistroseries
10740
22867
    ADD CONSTRAINT sourcepackagerecipedistroseries_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10741
22868
 
 
22869
 
10742
22870
ALTER TABLE ONLY sourcepackagerecipedistroseries
10743
22871
    ADD CONSTRAINT sourcepackagerecipedistroseries_sourcepackagerecipe_fkey FOREIGN KEY (sourcepackagerecipe) REFERENCES sourcepackagerecipe(id);
10744
22872
 
 
22873
 
10745
22874
ALTER TABLE ONLY sourcepackagerelease
10746
22875
    ADD CONSTRAINT sourcepackagerelease__creator__fk FOREIGN KEY (creator) REFERENCES person(id);
10747
22876
 
 
22877
 
10748
22878
ALTER TABLE ONLY sourcepackagerelease
10749
22879
    ADD CONSTRAINT sourcepackagerelease__dscsigningkey FOREIGN KEY (dscsigningkey) REFERENCES gpgkey(id);
10750
22880
 
 
22881
 
10751
22882
ALTER TABLE ONLY sourcepackagerelease
10752
22883
    ADD CONSTRAINT sourcepackagerelease__upload_archive__fk FOREIGN KEY (upload_archive) REFERENCES archive(id);
10753
22884
 
 
22885
 
10754
22886
ALTER TABLE ONLY sourcepackagerelease
10755
22887
    ADD CONSTRAINT sourcepackagerelease__upload_distroseries__fk FOREIGN KEY (upload_distroseries) REFERENCES distroseries(id);
10756
22888
 
 
22889
 
10757
22890
ALTER TABLE ONLY sourcepackagerelease
10758
22891
    ADD CONSTRAINT sourcepackagerelease_changelog_fkey FOREIGN KEY (changelog) REFERENCES libraryfilealias(id);
10759
22892
 
 
22893
 
10760
22894
ALTER TABLE ONLY sourcepackagerelease
10761
22895
    ADD CONSTRAINT sourcepackagerelease_component_fk FOREIGN KEY (component) REFERENCES component(id);
10762
22896
 
 
22897
 
10763
22898
ALTER TABLE ONLY sourcepackagerelease
10764
22899
    ADD CONSTRAINT sourcepackagerelease_maintainer_fk FOREIGN KEY (maintainer) REFERENCES person(id);
10765
22900
 
 
22901
 
10766
22902
ALTER TABLE ONLY sourcepackagerelease
10767
22903
    ADD CONSTRAINT sourcepackagerelease_section FOREIGN KEY (section) REFERENCES section(id);
10768
22904
 
 
22905
 
10769
22906
ALTER TABLE ONLY sourcepackagerelease
10770
22907
    ADD CONSTRAINT sourcepackagerelease_sourcepackage_recipe_build_fkey FOREIGN KEY (sourcepackage_recipe_build) REFERENCES sourcepackagerecipebuild(id);
10771
22908
 
 
22909
 
10772
22910
ALTER TABLE ONLY sourcepackagerelease
10773
22911
    ADD CONSTRAINT sourcepackagerelease_sourcepackagename_fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10774
22912
 
 
22913
 
10775
22914
ALTER TABLE ONLY specification
10776
22915
    ADD CONSTRAINT specification__distroseries__distribution__fk FOREIGN KEY (distroseries, distribution) REFERENCES distroseries(id, distribution);
10777
22916
 
 
22917
 
10778
22918
ALTER TABLE ONLY specification
10779
22919
    ADD CONSTRAINT specification_approver_fk FOREIGN KEY (approver) REFERENCES person(id);
10780
22920
 
 
22921
 
10781
22922
ALTER TABLE ONLY specification
10782
22923
    ADD CONSTRAINT specification_assignee_fk FOREIGN KEY (assignee) REFERENCES person(id);
10783
22924
 
 
22925
 
10784
22926
ALTER TABLE ONLY specification
10785
22927
    ADD CONSTRAINT specification_completer_fkey FOREIGN KEY (completer) REFERENCES person(id);
10786
22928
 
 
22929
 
10787
22930
ALTER TABLE ONLY specification
10788
22931
    ADD CONSTRAINT specification_distribution_fk FOREIGN KEY (distribution) REFERENCES distribution(id);
10789
22932
 
 
22933
 
10790
22934
ALTER TABLE ONLY specification
10791
22935
    ADD CONSTRAINT specification_distribution_milestone_fk FOREIGN KEY (distribution, milestone) REFERENCES milestone(distribution, id);
10792
22936
 
 
22937
 
10793
22938
ALTER TABLE ONLY specification
10794
22939
    ADD CONSTRAINT specification_drafter_fk FOREIGN KEY (drafter) REFERENCES person(id);
10795
22940
 
 
22941
 
10796
22942
ALTER TABLE ONLY specification
10797
22943
    ADD CONSTRAINT specification_goal_decider_fkey FOREIGN KEY (goal_decider) REFERENCES person(id);
10798
22944
 
 
22945
 
10799
22946
ALTER TABLE ONLY specification
10800
22947
    ADD CONSTRAINT specification_goal_proposer_fkey FOREIGN KEY (goal_proposer) REFERENCES person(id);
10801
22948
 
 
22949
 
10802
22950
ALTER TABLE ONLY specification
10803
22951
    ADD CONSTRAINT specification_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10804
22952
 
 
22953
 
10805
22954
ALTER TABLE ONLY specification
10806
22955
    ADD CONSTRAINT specification_product_fk FOREIGN KEY (product) REFERENCES product(id);
10807
22956
 
 
22957
 
10808
22958
ALTER TABLE ONLY specification
10809
22959
    ADD CONSTRAINT specification_product_milestone_fk FOREIGN KEY (product, milestone) REFERENCES milestone(product, id);
10810
22960
 
 
22961
 
10811
22962
ALTER TABLE ONLY specification
10812
22963
    ADD CONSTRAINT specification_productseries_valid FOREIGN KEY (product, productseries) REFERENCES productseries(product, id);
10813
22964
 
 
22965
 
10814
22966
ALTER TABLE ONLY specification
10815
22967
    ADD CONSTRAINT specification_starter_fkey FOREIGN KEY (starter) REFERENCES person(id);
10816
22968
 
 
22969
 
10817
22970
ALTER TABLE ONLY specification
10818
22971
    ADD CONSTRAINT specification_superseded_by_fk FOREIGN KEY (superseded_by) REFERENCES specification(id);
10819
22972
 
 
22973
 
10820
22974
ALTER TABLE ONLY specificationbranch
10821
22975
    ADD CONSTRAINT specificationbranch__branch__fk FOREIGN KEY (branch) REFERENCES branch(id);
10822
22976
 
 
22977
 
10823
22978
ALTER TABLE ONLY specificationbranch
10824
22979
    ADD CONSTRAINT specificationbranch__specification__fk FOREIGN KEY (specification) REFERENCES specification(id);
10825
22980
 
 
22981
 
10826
22982
ALTER TABLE ONLY specificationbranch
10827
22983
    ADD CONSTRAINT specificationbranch_registrant_fkey FOREIGN KEY (registrant) REFERENCES person(id);
10828
22984
 
 
22985
 
10829
22986
ALTER TABLE ONLY specificationbug
10830
22987
    ADD CONSTRAINT specificationbug_bug_fk FOREIGN KEY (bug) REFERENCES bug(id);
10831
22988
 
 
22989
 
10832
22990
ALTER TABLE ONLY specificationbug
10833
22991
    ADD CONSTRAINT specificationbug_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
10834
22992
 
 
22993
 
10835
22994
ALTER TABLE ONLY specificationdependency
10836
22995
    ADD CONSTRAINT specificationdependency_dependency_fk FOREIGN KEY (dependency) REFERENCES specification(id);
10837
22996
 
 
22997
 
10838
22998
ALTER TABLE ONLY specificationdependency
10839
22999
    ADD CONSTRAINT specificationdependency_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
10840
23000
 
 
23001
 
10841
23002
ALTER TABLE ONLY specificationfeedback
10842
23003
    ADD CONSTRAINT specificationfeedback_provider_fk FOREIGN KEY (reviewer) REFERENCES person(id);
10843
23004
 
 
23005
 
10844
23006
ALTER TABLE ONLY specificationfeedback
10845
23007
    ADD CONSTRAINT specificationfeedback_requester_fk FOREIGN KEY (requester) REFERENCES person(id);
10846
23008
 
 
23009
 
10847
23010
ALTER TABLE ONLY specificationfeedback
10848
23011
    ADD CONSTRAINT specificationfeedback_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
10849
23012
 
 
23013
 
10850
23014
ALTER TABLE ONLY specificationmessage
10851
23015
    ADD CONSTRAINT specificationmessage__message__fk FOREIGN KEY (message) REFERENCES message(id);
10852
23016
 
 
23017
 
10853
23018
ALTER TABLE ONLY specificationmessage
10854
23019
    ADD CONSTRAINT specificationmessage__specification__fk FOREIGN KEY (specification) REFERENCES specification(id);
10855
23020
 
 
23021
 
10856
23022
ALTER TABLE ONLY specificationsubscription
10857
23023
    ADD CONSTRAINT specificationsubscription_person_fk FOREIGN KEY (person) REFERENCES person(id);
10858
23024
 
 
23025
 
10859
23026
ALTER TABLE ONLY specificationsubscription
10860
23027
    ADD CONSTRAINT specificationsubscription_specification_fk FOREIGN KEY (specification) REFERENCES specification(id);
10861
23028
 
 
23029
 
10862
23030
ALTER TABLE ONLY sprint
10863
23031
    ADD CONSTRAINT sprint__icon__fk FOREIGN KEY (icon) REFERENCES libraryfilealias(id);
10864
23032
 
 
23033
 
10865
23034
ALTER TABLE ONLY sprint
10866
23035
    ADD CONSTRAINT sprint__logo__fk FOREIGN KEY (logo) REFERENCES libraryfilealias(id);
10867
23036
 
 
23037
 
10868
23038
ALTER TABLE ONLY sprint
10869
23039
    ADD CONSTRAINT sprint__mugshot__fk FOREIGN KEY (mugshot) REFERENCES libraryfilealias(id);
10870
23040
 
 
23041
 
10871
23042
ALTER TABLE ONLY sprint
10872
23043
    ADD CONSTRAINT sprint_driver_fkey FOREIGN KEY (driver) REFERENCES person(id);
10873
23044
 
 
23045
 
10874
23046
ALTER TABLE ONLY sprint
10875
23047
    ADD CONSTRAINT sprint_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10876
23048
 
 
23049
 
10877
23050
ALTER TABLE ONLY sprintattendance
10878
23051
    ADD CONSTRAINT sprintattendance_attendee_fk FOREIGN KEY (attendee) REFERENCES person(id);
10879
23052
 
 
23053
 
10880
23054
ALTER TABLE ONLY sprintattendance
10881
23055
    ADD CONSTRAINT sprintattendance_sprint_fk FOREIGN KEY (sprint) REFERENCES sprint(id);
10882
23056
 
 
23057
 
10883
23058
ALTER TABLE ONLY sprintspecification
10884
23059
    ADD CONSTRAINT sprintspec_spec_fk FOREIGN KEY (specification) REFERENCES specification(id);
10885
23060
 
 
23061
 
10886
23062
ALTER TABLE ONLY sprintspecification
10887
23063
    ADD CONSTRAINT sprintspec_sprint_fk FOREIGN KEY (sprint) REFERENCES sprint(id);
10888
23064
 
 
23065
 
10889
23066
ALTER TABLE ONLY sprintspecification
10890
23067
    ADD CONSTRAINT sprintspecification__nominator__fk FOREIGN KEY (registrant) REFERENCES person(id);
10891
23068
 
 
23069
 
10892
23070
ALTER TABLE ONLY sprintspecification
10893
23071
    ADD CONSTRAINT sprintspecification_decider_fkey FOREIGN KEY (decider) REFERENCES person(id);
10894
23072
 
10895
 
ALTER TABLE ONLY staticdiff
10896
 
    ADD CONSTRAINT staticdiff_diff_fkey FOREIGN KEY (diff) REFERENCES diff(id) ON DELETE CASCADE;
10897
23073
 
10898
23074
ALTER TABLE ONLY structuralsubscription
10899
23075
    ADD CONSTRAINT structuralsubscription_distribution_fkey FOREIGN KEY (distribution) REFERENCES distribution(id);
10900
23076
 
 
23077
 
10901
23078
ALTER TABLE ONLY structuralsubscription
10902
23079
    ADD CONSTRAINT structuralsubscription_distroseries_fkey FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10903
23080
 
 
23081
 
10904
23082
ALTER TABLE ONLY structuralsubscription
10905
23083
    ADD CONSTRAINT structuralsubscription_milestone_fkey FOREIGN KEY (milestone) REFERENCES milestone(id);
10906
23084
 
 
23085
 
10907
23086
ALTER TABLE ONLY structuralsubscription
10908
23087
    ADD CONSTRAINT structuralsubscription_product_fkey FOREIGN KEY (product) REFERENCES product(id);
10909
23088
 
 
23089
 
10910
23090
ALTER TABLE ONLY structuralsubscription
10911
23091
    ADD CONSTRAINT structuralsubscription_productseries_fkey FOREIGN KEY (productseries) REFERENCES productseries(id);
10912
23092
 
 
23093
 
10913
23094
ALTER TABLE ONLY structuralsubscription
10914
23095
    ADD CONSTRAINT structuralsubscription_project_fkey FOREIGN KEY (project) REFERENCES project(id);
10915
23096
 
 
23097
 
10916
23098
ALTER TABLE ONLY structuralsubscription
10917
23099
    ADD CONSTRAINT structuralsubscription_sourcepackagename_fkey FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10918
23100
 
 
23101
 
10919
23102
ALTER TABLE ONLY structuralsubscription
10920
23103
    ADD CONSTRAINT structuralsubscription_subscribed_by_fkey FOREIGN KEY (subscribed_by) REFERENCES person(id);
10921
23104
 
 
23105
 
10922
23106
ALTER TABLE ONLY structuralsubscription
10923
23107
    ADD CONSTRAINT structuralsubscription_subscriber_fkey FOREIGN KEY (subscriber) REFERENCES person(id);
10924
23108
 
 
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
 
10925
23126
ALTER TABLE ONLY teammembership
10926
23127
    ADD CONSTRAINT teammembership_acknowledged_by_fkey FOREIGN KEY (acknowledged_by) REFERENCES person(id);
10927
23128
 
 
23129
 
10928
23130
ALTER TABLE ONLY teammembership
10929
23131
    ADD CONSTRAINT teammembership_person_fk FOREIGN KEY (person) REFERENCES person(id);
10930
23132
 
 
23133
 
10931
23134
ALTER TABLE ONLY teammembership
10932
23135
    ADD CONSTRAINT teammembership_proposed_by_fkey FOREIGN KEY (proposed_by) REFERENCES person(id);
10933
23136
 
 
23137
 
10934
23138
ALTER TABLE ONLY teammembership
10935
23139
    ADD CONSTRAINT teammembership_reviewed_by_fkey FOREIGN KEY (reviewed_by) REFERENCES person(id);
10936
23140
 
 
23141
 
10937
23142
ALTER TABLE ONLY teammembership
10938
23143
    ADD CONSTRAINT teammembership_team_fk FOREIGN KEY (team) REFERENCES person(id);
10939
23144
 
 
23145
 
10940
23146
ALTER TABLE ONLY teamparticipation
10941
23147
    ADD CONSTRAINT teamparticipation_person_fk FOREIGN KEY (person) REFERENCES person(id);
10942
23148
 
 
23149
 
10943
23150
ALTER TABLE ONLY teamparticipation
10944
23151
    ADD CONSTRAINT teamparticipation_team_fk FOREIGN KEY (team) REFERENCES person(id);
10945
23152
 
 
23153
 
10946
23154
ALTER TABLE ONLY temporaryblobstorage
10947
23155
    ADD CONSTRAINT temporaryblobstorage_file_alias_fkey FOREIGN KEY (file_alias) REFERENCES libraryfilealias(id);
10948
23156
 
 
23157
 
10949
23158
ALTER TABLE ONLY translationgroup
10950
23159
    ADD CONSTRAINT translationgroup_owner_fk FOREIGN KEY (owner) REFERENCES person(id);
10951
23160
 
 
23161
 
10952
23162
ALTER TABLE ONLY translationimportqueueentry
10953
23163
    ADD CONSTRAINT translationimportqueueentry__content__fk FOREIGN KEY (content) REFERENCES libraryfilealias(id);
10954
23164
 
 
23165
 
10955
23166
ALTER TABLE ONLY translationimportqueueentry
10956
23167
    ADD CONSTRAINT translationimportqueueentry__distroseries__fk FOREIGN KEY (distroseries) REFERENCES distroseries(id);
10957
23168
 
 
23169
 
10958
23170
ALTER TABLE ONLY translationimportqueueentry
10959
23171
    ADD CONSTRAINT translationimportqueueentry__importer__fk FOREIGN KEY (importer) REFERENCES person(id);
10960
23172
 
 
23173
 
10961
23174
ALTER TABLE ONLY translationimportqueueentry
10962
23175
    ADD CONSTRAINT translationimportqueueentry__pofile__fk FOREIGN KEY (pofile) REFERENCES pofile(id);
10963
23176
 
 
23177
 
10964
23178
ALTER TABLE ONLY translationimportqueueentry
10965
23179
    ADD CONSTRAINT translationimportqueueentry__potemplate__fk FOREIGN KEY (potemplate) REFERENCES potemplate(id);
10966
23180
 
 
23181
 
10967
23182
ALTER TABLE ONLY translationimportqueueentry
10968
23183
    ADD CONSTRAINT translationimportqueueentry__productseries__fk FOREIGN KEY (productseries) REFERENCES productseries(id);
10969
23184
 
 
23185
 
10970
23186
ALTER TABLE ONLY translationimportqueueentry
10971
23187
    ADD CONSTRAINT translationimportqueueentry__sourcepackagename__fk FOREIGN KEY (sourcepackagename) REFERENCES sourcepackagename(id);
10972
23188
 
 
23189
 
10973
23190
ALTER TABLE ONLY translationmessage
10974
23191
    ADD CONSTRAINT translationmessage__msgstr0__fk FOREIGN KEY (msgstr0) REFERENCES potranslation(id);
10975
23192
 
 
23193
 
10976
23194
ALTER TABLE ONLY translationmessage
10977
23195
    ADD CONSTRAINT translationmessage__msgstr1__fk FOREIGN KEY (msgstr1) REFERENCES potranslation(id);
10978
23196
 
 
23197
 
10979
23198
ALTER TABLE ONLY translationmessage
10980
23199
    ADD CONSTRAINT translationmessage__msgstr2__fk FOREIGN KEY (msgstr2) REFERENCES potranslation(id);
10981
23200
 
 
23201
 
10982
23202
ALTER TABLE ONLY translationmessage
10983
23203
    ADD CONSTRAINT translationmessage__msgstr3__fk FOREIGN KEY (msgstr3) REFERENCES potranslation(id);
10984
23204
 
 
23205
 
10985
23206
ALTER TABLE ONLY translationmessage
10986
23207
    ADD CONSTRAINT translationmessage__msgstr4__fk FOREIGN KEY (msgstr4) REFERENCES potranslation(id);
10987
23208
 
 
23209
 
10988
23210
ALTER TABLE ONLY translationmessage
10989
23211
    ADD CONSTRAINT translationmessage__msgstr5__fk FOREIGN KEY (msgstr5) REFERENCES potranslation(id);
10990
23212
 
10991
 
ALTER TABLE ONLY translationmessage
10992
 
    ADD CONSTRAINT translationmessage__pofile__fk FOREIGN KEY (pofile) REFERENCES pofile(id);
10993
23213
 
10994
23214
ALTER TABLE ONLY translationmessage
10995
23215
    ADD CONSTRAINT translationmessage__potmsgset__fk FOREIGN KEY (potmsgset) REFERENCES potmsgset(id);
10996
23216
 
 
23217
 
10997
23218
ALTER TABLE ONLY translationmessage
10998
23219
    ADD CONSTRAINT translationmessage__reviewer__fk FOREIGN KEY (reviewer) REFERENCES person(id);
10999
23220
 
 
23221
 
11000
23222
ALTER TABLE ONLY translationmessage
11001
23223
    ADD CONSTRAINT translationmessage__submitter__fk FOREIGN KEY (submitter) REFERENCES person(id);
11002
23224
 
 
23225
 
11003
23226
ALTER TABLE ONLY translationmessage
11004
23227
    ADD CONSTRAINT translationmessage_language_fkey FOREIGN KEY (language) REFERENCES language(id);
11005
23228
 
 
23229
 
11006
23230
ALTER TABLE ONLY translationmessage
11007
23231
    ADD CONSTRAINT translationmessage_potemplate_fkey FOREIGN KEY (potemplate) REFERENCES potemplate(id);
11008
23232
 
 
23233
 
11009
23234
ALTER TABLE ONLY translationrelicensingagreement
11010
23235
    ADD CONSTRAINT translationrelicensingagreement__person__fk FOREIGN KEY (person) REFERENCES person(id);
11011
23236
 
 
23237
 
11012
23238
ALTER TABLE ONLY translationtemplateitem
11013
23239
    ADD CONSTRAINT translationtemplateitem_potemplate_fkey FOREIGN KEY (potemplate) REFERENCES potemplate(id);
11014
23240
 
 
23241
 
11015
23242
ALTER TABLE ONLY translationtemplateitem
11016
23243
    ADD CONSTRAINT translationtemplateitem_potmsgset_fkey FOREIGN KEY (potmsgset) REFERENCES potmsgset(id);
11017
23244
 
 
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
 
11018
23254
ALTER TABLE ONLY translator
11019
23255
    ADD CONSTRAINT translator_language_fk FOREIGN KEY (language) REFERENCES language(id);
11020
23256
 
 
23257
 
11021
23258
ALTER TABLE ONLY translator
11022
23259
    ADD CONSTRAINT translator_person_fk FOREIGN KEY (translator) REFERENCES person(id);
11023
23260
 
 
23261
 
11024
23262
ALTER TABLE ONLY translator
11025
23263
    ADD CONSTRAINT translator_translationgroup_fk FOREIGN KEY (translationgroup) REFERENCES translationgroup(id);
11026
23264
 
 
23265
 
11027
23266
ALTER TABLE ONLY usertouseremail
11028
23267
    ADD CONSTRAINT usertouseremail__recipient__fk FOREIGN KEY (recipient) REFERENCES person(id);
11029
23268
 
 
23269
 
11030
23270
ALTER TABLE ONLY usertouseremail
11031
23271
    ADD CONSTRAINT usertouseremail__sender__fk FOREIGN KEY (sender) REFERENCES person(id);
11032
23272
 
 
23273
 
11033
23274
ALTER TABLE ONLY vote
11034
23275
    ADD CONSTRAINT vote_person_fk FOREIGN KEY (person) REFERENCES person(id);
11035
23276
 
 
23277
 
11036
23278
ALTER TABLE ONLY vote
11037
23279
    ADD CONSTRAINT vote_poll_fk FOREIGN KEY (poll) REFERENCES poll(id);
11038
23280
 
 
23281
 
11039
23282
ALTER TABLE ONLY vote
11040
23283
    ADD CONSTRAINT vote_poll_option_fk FOREIGN KEY (poll, option) REFERENCES polloption(poll, id);
11041
23284
 
 
23285
 
11042
23286
ALTER TABLE ONLY votecast
11043
23287
    ADD CONSTRAINT votecast_person_fk FOREIGN KEY (person) REFERENCES person(id);
11044
23288
 
 
23289
 
11045
23290
ALTER TABLE ONLY votecast
11046
23291
    ADD CONSTRAINT votecast_poll_fk FOREIGN KEY (poll) REFERENCES poll(id);
11047
23292
 
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);
11056
23293
 
11057
23294
ALTER TABLE ONLY wikiname
11058
23295
    ADD CONSTRAINT wikiname_person_fk FOREIGN KEY (person) REFERENCES person(id);
11059
23296
 
11060
 
\i /usr/share/postgresql/8.4/contrib/debversion.sql
 
23297
 
11061
23298