~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to database/launchpad.sql

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2004-08-05 09:55:29 UTC
  • mfrom: (unknown (missing))
  • Revision ID: Arch-1:rocketfuel@canonical.com%launchpad--devel--0--patch-35
Made make debugging-on and make debugging-off turn on and off apidoc in addition to the debug skin.
Patches applied:

 * steve.alexander@canonical.com/launchpad--devel--0--patch-25
   merge from rocketfuel

 * steve.alexander@canonical.com/launchpad--devel--0--patch-26
   made apidoc include precious

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
/*
6
6
 
7
 
  CONVENTIONS
8
 
        - all dates and timestamps MUST be in UTC
9
7
  TODO
 
8
 
10
9
        - re-evalutate some of the "text" field types, they might need
11
10
          to be "bytea"
12
11
          unless we can guarantee utf-8
 
12
        - add sample data for the schemas
13
13
        - make sure names are only [a-z][0-9][-.+] and can only start
14
14
          with [a-z]
15
15
        - set DEFAULT's for datestamps (now) and others
19
19
  CHANGES
20
20
 
21
21
 
22
 
  v0.99-dev:
23
 
        - add BugAttachmentContent.id for Stuart Bishop
24
 
        - and move the BugAttachment.name to BugAttachmentContent
25
 
        - make ProductRelease.version NOT NULL and add a .changelog
26
 
        - don't require homepageurl for Project or Product
27
 
        - add ChangesetFileHash.id for Robert Weir
28
 
        - rename UpstreamRelease to ProductRelease
29
 
  v0.98:
 
22
  v0.98-dev:
30
23
        - merge SourceSource table from Andrew Bennetts
31
24
        - change SourceSource.homepageurl to SourceSource.product
32
25
        - BugInfestation: dateverified and verifiedby need to be NULL
33
26
          if its not verified
34
27
        - set a lot of datecreated and lastverified etc fields to
35
 
          DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC')
 
28
          DEFAULT CURRENT_TIMESTAMP
36
29
        - use Andrew Bennett's way of putting comments inside the table
37
30
          def, above the
38
31
          line being commented, it makes lines shorter.
57
50
          - move add POMsgSet.current
58
51
          - add POTranslationSighting.deprecated
59
52
          - rename POTranslationSighting.lastseen -> .lasttouched
60
 
        - make Project.product NOT NULL
61
 
        - add stats gathering to POTemplate and POFile
62
53
  v0.97:
63
54
        - rename Membership.label to Membership.role
64
55
        - rename EmailAddress.label to EmailAddress.status
127
118
          Product and a Sourcepackage
128
119
  v0.92:
129
120
        - make Schema and Label have name, title, description
130
 
        - added filenames for ProductreleaseFile, SourcepackageFile
 
121
        - added filenames for UpstreamreleaseFile, SourcepackageFile
131
122
          and BinarypackageBuildFile
132
123
        - linked BinarypackageBuild to DistroRelease instead of
133
124
          DistroArchRelease
177
168
DROP TABLE ProjectBugsystem;
178
169
DROP TABLE BugWatch;
179
170
DROP TABLE BugSystem;
180
 
DROP TABLE BugAttachmentContent;
 
171
DROP TABLE BugattachmentContent;
181
172
DROP TABLE BugAttachment;
182
173
DROP TABLE POTranslationSighting;
183
174
DROP TABLE POMsgIDSighting;
213
204
DROP TABLE Sourcepackage;
214
205
DROP TABLE ArchConfigEntry;
215
206
DROP TABLE ArchConfig;
216
 
DROP TABLE ProductReleaseFile;
217
 
DROP TABLE ProductRelease;
 
207
DROP TABLE UpstreamReleaseFile;
 
208
DROP TABLE UpstreamRelease;
218
209
DROP TABLE ChangesetFileHash;
219
210
DROP TABLE ChangesetFile;
220
211
DROP TABLE ChangesetFileName;
512
503
  archarchive            integer NOT NULL REFERENCES ArchArchive,
513
504
  category               text NOT NULL,
514
505
  branch                 text,
515
 
  version                text,
516
 
  visible                boolean NOT NULL
 
506
  version                text
517
507
);
518
508
 
519
509
 
527
517
  archnamespace          integer NOT NULL REFERENCES ArchNamespace,
528
518
  title                  text NOT NULL,
529
519
  description            text NOT NULL,
 
520
  visible                boolean NOT NULL,
530
521
  owner                  integer REFERENCES Person
531
522
);
532
523
 
583
574
  A cryptographic hash of a changeset file.
584
575
*/
585
576
CREATE TABLE ChangesetFileHash (
586
 
  id                serial PRIMARY KEY,
587
577
  changesetfile     integer NOT NULL REFERENCES ChangesetFile,
588
578
  /* see Hash Algorithms schema */
589
579
  hashalg           integer NOT NULL,
629
619
*/
630
620
CREATE TABLE Manifest (
631
621
  id               serial PRIMARY KEY,
632
 
  datecreated      timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
 
622
  datecreated      timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
633
623
  owner            integer NOT NULL REFERENCES Person
634
624
);
635
625
 
684
674
    name         text NOT NULL UNIQUE,
685
675
    title        text NOT NULL,
686
676
    description  text NOT NULL,
687
 
    datecreated  timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
688
 
    homepageurl  text
 
677
    datecreated  timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
 
678
    homepageurl  text NOT NULL
689
679
    );
690
680
 
691
681
 
719
709
  name          text NOT NULL,
720
710
  title         text NOT NULL,
721
711
  description   text NOT NULL,
722
 
  datecreated   timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
723
 
  homepageurl   text,
 
712
  datecreated   timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
 
713
  homepageurl   text NOT NULL,
724
714
  manifest      integer REFERENCES Manifest,
725
715
  UNIQUE ( project, name ),
726
716
  -- ( id, project ) must be unique so it can be a foreign key
742
732
 
743
733
 
744
734
/*
745
 
  ProductRelease
746
 
  A specific tarball release of Product.
 
735
  UpstreamRelease
 
736
  A specific tarball release of Upstream.
747
737
*/
748
 
CREATE TABLE ProductRelease (
 
738
CREATE TABLE UpstreamRelease (
749
739
  id               serial PRIMARY KEY,
750
740
  product          integer NOT NULL REFERENCES Product,
751
741
  datereleased     timestamp NOT NULL,
752
742
  -- the version without anything else, "1.3.29"
753
 
  version          text NOT NULL,
 
743
  version          text,
754
744
  -- the GSV Name "The Warty Web Release"
755
745
  title            text,
756
746
  description      text,
757
 
  changelog        text,
758
 
  owner            integer NOT NULL REFERENCES Person,
 
747
  owner            integer REFERENCES Person,
759
748
  UNIQUE ( product, version )
760
749
);
761
750
 
762
751
 
763
 
 
764
752
/*
765
753
   BUTTRESS phase 2
766
754
*/
775
763
  name             text NOT NULL,
776
764
  title            text NOT NULL,
777
765
  description      text NOT NULL,
778
 
  productrelease  integer REFERENCES ProductRelease,
 
766
  upstreamrelease  integer REFERENCES UpstreamRelease,
779
767
  owner            integer REFERENCES Person
780
768
);
781
769
 
943
931
 
944
932
 
945
933
/*
946
 
  ProductReleaseFile
947
 
  A file from an Product Coderelease. Usually this would be a tarball.
 
934
  UpstreamReleaseFile
 
935
  A file from an Upstream Coderelease. Usually this would be a tarball.
948
936
*/
949
 
CREATE TABLE ProductReleaseFile (
950
 
  productrelease integer NOT NULL REFERENCES ProductRelease,
 
937
CREATE TABLE UpstreamReleaseFile (
 
938
  upstreamrelease integer NOT NULL REFERENCES UpstreamRelease,
951
939
  launchpadfile   integer NOT NULL REFERENCES LaunchpadFile,
952
 
  -- see Product File Type schema
 
940
  -- see Upstream File Type schema
953
941
  filetype        integer NOT NULL,
954
942
  filename        text NOT NULL
955
943
);
1032
1020
  creator                integer NOT NULL REFERENCES Person,
1033
1021
  -- "2.0.48-3"
1034
1022
  version                text NOT NULL,
1035
 
  dateuploaded           timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
 
1023
  dateuploaded           timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1036
1024
  -- see Source Package Urgency schema
1037
1025
  urgency                integer NOT NULL,
1038
1026
  dscsigningkey          integer REFERENCES GPGKey,
1168
1156
 
1169
1157
/*
1170
1158
  LIBRARIAN. TRACKING UPSTREAM AND SOURCE PACKAGE RELEASES.
1171
 
  This section is devoted to data that tracks product and distribution
 
1159
  This section is devoted to data that tracks upstream and distribution
1172
1160
  SOURCE PACKAGE releases. So, for example, Apache 2.0.48 is an
1173
 
  ProductRelease. Apache 2.0.48-3 is a Debian SourcepackageRelease.
 
1161
  UpstreamRelease. Apache 2.0.48-3 is a Debian SourcepackageRelease.
1174
1162
  We have data tables for both of those, and the Coderelease table is
1175
1163
  the data that is common to any kind of Coderelease. This subsystem also
1176
1164
  keeps track of the actual files associated with Codereleases, such as
1181
1169
 
1182
1170
/*
1183
1171
  Coderelease
1184
 
  A release of software. Could be an Product release or
 
1172
  A release of software. Could be an Upstream release or
1185
1173
  a SourcepackageRelease.
1186
1174
*/
1187
1175
CREATE TABLE Coderelease (
1188
1176
  id                   serial PRIMARY KEY,
1189
 
  productrelease      integer REFERENCES ProductRelease,
 
1177
  upstreamrelease      integer REFERENCES UpstreamRelease,
1190
1178
  sourcepackagerelease integer REFERENCES SourcepackageRelease,
1191
1179
  manifest             integer REFERENCES Manifest,
1192
 
  CHECK ( NOT ( productrelease IS NULL AND sourcepackagerelease IS NULL ) ),
1193
 
  CHECK ( NOT ( productrelease IS NOT NULL AND sourcepackagerelease IS NOT NULL ) )
1194
 
); -- EITHER productrelease OR sourcepackagerelease must not be NULL
 
1180
  CHECK ( NOT ( upstreamrelease IS NULL AND sourcepackagerelease IS NULL ) ),
 
1181
  CHECK ( NOT ( upstreamrelease IS NOT NULL AND sourcepackagerelease IS NOT NULL ) )
 
1182
); -- EITHER upstreamrelease OR sourcepackagerelease must not be NULL
1195
1183
 
1196
1184
 
1197
1185
 
1198
1186
 
1199
1187
/*
1200
1188
  CodereleaseRelationship
1201
 
  Maps the relationships between releases (product and
 
1189
  Maps the relationships between releases (upstream and
1202
1190
  sourcepackage).
1203
1191
*/
1204
1192
CREATE TABLE CodereleaseRelationship (
1272
1260
 
1273
1261
 
1274
1262
/*
 
1263
 The TranslationEffort table. Stores information about each active
 
1264
 translation effort. Note, a translationeffort is an aggregation of
 
1265
 resources. For example, the Gnome Translation Project, which aims to
 
1266
 translate the PO files for many gnome applications. This is a point
 
1267
 for the translation team to rally around.
 
1268
*/
 
1269
CREATE TABLE TranslationEffort (
 
1270
  id                    serial PRIMARY KEY,
 
1271
  owner                 integer NOT NULL REFERENCES Person,
 
1272
  project               integer NOT NULL REFERENCES Project,
 
1273
  name                  text NOT NULL UNIQUE,
 
1274
  title                 text NOT NULL,
 
1275
  description           text NOT NULL
 
1276
);
 
1277
 
 
1278
 
 
1279
 
 
1280
 
 
1281
 
 
1282
/*
 
1283
  POTInheritance
 
1284
  A handle on an inheritance sequence for POT files.
 
1285
CREATE TABLE POTInheritance (
 
1286
  id                    serial PRIMARY KEY,
 
1287
  title                 text,
 
1288
  description           text
 
1289
);
 
1290
*/
 
1291
 
 
1292
 
 
1293
 
 
1294
/*
 
1295
  License
 
1296
  A license. We need quite a bit more in the long term
 
1297
  to track licence compatibility etc.
 
1298
*/
 
1299
CREATE TABLE License (
 
1300
  id                    serial PRIMARY KEY,
 
1301
  legalese              text NOT NULL
 
1302
);
 
1303
 
 
1304
 
 
1305
 
 
1306
/*
 
1307
  POTemplate
 
1308
  A PO Template File, which is the first thing that Rosetta will set
 
1309
  about translating.
 
1310
*/
 
1311
CREATE TABLE POTemplate (
 
1312
  id                    serial PRIMARY KEY,
 
1313
  project               integer NOT NULL REFERENCES Project,
 
1314
  product               integer REFERENCES Product,
 
1315
  branch                integer REFERENCES Branch,
 
1316
  changeset             integer REFERENCES Changeset,
 
1317
  name                  text NOT NULL UNIQUE,
 
1318
  title                 text NOT NULL,
 
1319
  description           text NOT NULL,
 
1320
  copyright             text NOT NULL,
 
1321
  license               integer NOT NULL REFERENCES License,
 
1322
  datecreated           timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
 
1323
  path                  text NOT NULL,
 
1324
  iscurrent             boolean NOT NULL,
 
1325
  owner                 integer REFERENCES Person,
 
1326
  -- EITHER branch OR changeset:
 
1327
  CHECK ( NOT ( branch IS NULL AND changeset IS NULL ) ),
 
1328
  CHECK ( NOT ( branch IS NOT NULL AND changeset IS NOT NULL ) ),
 
1329
  -- make sure, if we refer to a Product, that it is from
 
1330
  -- the same Project
 
1331
  FOREIGN KEY ( product, project ) REFERENCES Product ( id, project )
 
1332
);
 
1333
 
 
1334
 
 
1335
 
 
1336
/*
1275
1337
  POMsgID
1276
1338
  A PO or POT File MessageID
1277
1339
*/
1336
1398
 
1337
1399
 
1338
1400
/*
1339
 
  POTInheritance
1340
 
  A handle on an inheritance sequence for POT files.
1341
 
CREATE TABLE POTInheritance (
1342
 
  id                    serial PRIMARY KEY,
1343
 
  title                 text,
1344
 
  description           text
1345
 
);
1346
 
*/
1347
 
 
1348
 
 
1349
 
 
1350
 
/*
1351
 
  License
1352
 
  A license. We need quite a bit more in the long term
1353
 
  to track licence compatibility etc.
1354
 
*/
1355
 
CREATE TABLE License (
1356
 
  id                    serial PRIMARY KEY,
1357
 
  legalese              text NOT NULL
1358
 
);
1359
 
 
1360
 
 
1361
 
 
1362
 
/*
1363
 
  POTemplate
1364
 
  A PO Template File, which is the first thing that Rosetta will set
1365
 
  about translating.
1366
 
*/
1367
 
CREATE TABLE POTemplate (
1368
 
  id                    serial PRIMARY KEY,
1369
 
  project               integer NOT NULL REFERENCES Project,
1370
 
  product               integer NOT NULL REFERENCES Product,
1371
 
  branch                integer REFERENCES Branch,
1372
 
  -- see Translation Priority schema
1373
 
  priority              integer NOT NULL,
1374
 
  changeset             integer REFERENCES Changeset,
1375
 
  name                  text NOT NULL UNIQUE,
1376
 
  title                 text NOT NULL,
1377
 
  description           text NOT NULL,
1378
 
  copyright             text NOT NULL,
1379
 
  license               integer NOT NULL REFERENCES License,
1380
 
  datecreated           timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
1381
 
  path                  text NOT NULL,
1382
 
  iscurrent             boolean NOT NULL,
1383
 
  -- the total number of POMsgSet's associated with this POTemplate
1384
 
  -- when we last parsed the Template.
1385
 
  messagecount          integer NOT NULL,
1386
 
  owner                 integer REFERENCES Person,
1387
 
  -- EITHER branch OR changeset:
1388
 
  CHECK ( NOT ( branch IS NULL AND changeset IS NULL ) ),
1389
 
  CHECK ( NOT ( branch IS NOT NULL AND changeset IS NOT NULL ) ),
1390
 
  -- make sure, if we refer to a Product, that it is from
1391
 
  -- the same Project
1392
 
  FOREIGN KEY ( product, project ) REFERENCES Product ( id, project )
1393
 
);
1394
 
 
1395
 
 
1396
 
 
1397
 
/*
1398
1401
  POFile
1399
1402
  A PO File. This is a language-specific set of translations.
1400
1403
*/
1401
1404
CREATE TABLE POFile (
1402
1405
  id                   serial PRIMARY KEY,
1403
 
  potemplate           integer NOT NULL REFERENCES POTemplate,
 
1406
  potemplate              integer NOT NULL REFERENCES POTemplate,
1404
1407
  language             integer NOT NULL REFERENCES Language,
1405
1408
  title                text,
1406
1409
  description          text,
1408
1411
  header               text,  -- the contents of the NULL msgstr
1409
1412
  lasttranslator       integer REFERENCES Person,
1410
1413
  license              integer REFERENCES License,
1411
 
  -- the number of msgsets matched to the potemplate that have a
1412
 
  -- non-fuzzy translation in the PO file when we last parsed it
1413
 
  currentcount         integer NOT NULL,
1414
 
  -- the number of msgsets where we have a newer translation in
1415
 
  -- rosetta than the one in the PO file when we last parsed it
1416
 
  updatescount         integer NOT NULL,
1417
 
  -- the number of msgsets where we have a translation in rosetta
1418
 
  -- but there was no translation in the PO file when we last parsed it
1419
 
  rosettacount         integer NOT NULL,
1420
 
  -- the timestamp when we last parsed this PO file
1421
 
  lastparsed           timestamp,
 
1414
  completeness         integer,  -- between 0 and 100
1422
1415
  owner                integer REFERENCES Person,
1423
1416
  -- the number of plural forms needed to translate this
1424
1417
  -- pofile.
1505
1498
  language             integer NOT NULL REFERENCES Language,
1506
1499
  potranslation        integer NOT NULL REFERENCES POTranslation,
1507
1500
  license              integer NOT NULL REFERENCES License,
1508
 
  dateprovided         timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
1509
 
  datetouched          timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
 
1501
  dateprovided         timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
 
1502
  datetouched          timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1510
1503
  pluralform           integer,
1511
1504
  CHECK ( pluralform >= 0 )
1512
1505
);
1527
1520
  language            integer REFERENCES Language,
1528
1521
  potranslation       integer REFERENCES POTranslation,
1529
1522
  commenttext         text NOT NULL,
1530
 
  datecreated         timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
 
1523
  datecreated         timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1531
1524
  person              integer REFERENCES Person
1532
1525
);
1533
1526
 
1535
1528
 
1536
1529
 
1537
1530
/*
1538
 
 The TranslationEffort table. Stores information about each active
1539
 
 translation effort. Note, a translationeffort is an aggregation of
1540
 
 resources. For example, the Gnome Translation Project, which aims to
1541
 
 translate the PO files for many gnome applications. This is a point
1542
 
 for the translation team to rally around.
1543
 
*/
1544
 
CREATE TABLE TranslationEffort (
1545
 
  id                    serial PRIMARY KEY,
1546
 
  owner                 integer NOT NULL REFERENCES Person,
1547
 
  project               integer NOT NULL REFERENCES Project,
1548
 
  name                  text NOT NULL UNIQUE,
1549
 
  title                 text NOT NULL,
1550
 
  description           text NOT NULL
1551
 
);
1552
 
 
1553
 
 
1554
 
 
1555
 
/*
1556
1531
  TranslationeffortPOTemplateRelationship
1557
1532
  A translation project incorporates a POTfile that is under translation.
1558
1533
  The inheritance pointer allows this project to specify a custom
1560
1535
*/
1561
1536
CREATE TABLE TranslationeffortPOTemplateRelationship (
1562
1537
  translationeffort  integer NOT NULL REFERENCES TranslationEffort ON DELETE CASCADE,
1563
 
  potemplate         integer NOT NULL REFERENCES POTemplate,
1564
 
  -- see Translation Priority schema
1565
 
  priority           integer NOT NULL,
 
1538
  potemplate            integer NOT NULL REFERENCES POTemplate,
1566
1539
  UNIQUE (translationeffort , potemplate)
1567
1540
);
1568
1541
 
1599
1572
*/
1600
1573
CREATE TABLE Bug (
1601
1574
  id                      serial PRIMARY KEY,
1602
 
  datecreated             timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
 
1575
  datecreated             timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1603
1576
  nickname                text UNIQUE,
1604
1577
  title                   text NOT NULL,
1605
1578
  description             text NOT NULL,
1641
1614
  explicit         boolean NOT NULL,
1642
1615
  -- see Bug Infestation Status schema
1643
1616
  infestation      integer NOT NULL,
1644
 
  datecreated      timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
 
1617
  datecreated      timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1645
1618
  creator          integer NOT NULL REFERENCES Person,
1646
1619
  dateverified     timestamp,
1647
1620
  verifiedby       integer REFERENCES Person,
1648
 
  lastmodified     timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
 
1621
  lastmodified     timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1649
1622
  lastmodifiedby   integer NOT NULL REFERENCES Person,
1650
1623
  PRIMARY KEY ( bug, coderelease )
1651
1624
);
1731
1704
  bugreftype  integer NOT NULL,
1732
1705
  data        text NOT NULL,
1733
1706
  description text NOT NULL,
1734
 
  datecreated timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
 
1707
  datecreated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1735
1708
  owner       integer NOT NULL REFERENCES Person
1736
1709
);
1737
1710
 
1777
1750
/*
1778
1751
  BugWatch
1779
1752
  This is a table of bugs in remote bug systems (for example, upstream
1780
 
  bugzilla instances) which we want to monitor for status changes.
 
1753
  bugzilla's) which we want to monitor for status changes.
1781
1754
*/
1782
1755
CREATE TABLE BugWatch (
1783
1756
  id               serial PRIMARY KEY,
1785
1758
  bugsystem        integer NOT NULL REFERENCES BugSystem,
1786
1759
  remotebug        text NOT NULL, -- unique identifier of bug in that system
1787
1760
  remotestatus     text NOT NULL, -- textual representation of status
1788
 
  lastchanged      timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
1789
 
  lastchecked      timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
1790
 
  datecreated      timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
 
1761
  lastchanged      timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
 
1762
  lastchecked      timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
 
1763
  datecreated      timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1791
1764
  owner            integer NOT NULL REFERENCES Person
1792
1765
);
1793
1766
 
1816
1789
CREATE TABLE BugAttachment (
1817
1790
  id              serial PRIMARY KEY,
1818
1791
  bug             integer NOT NULL REFERENCES Bug,
1819
 
  -- name (filename) is in BugAttachmentContent
 
1792
  name            text NOT NULL,
1820
1793
  title           text NOT NULL,
1821
1794
  description     text NOT NULL
1822
1795
);
1824
1797
 
1825
1798
 
1826
1799
/*
1827
 
  BugAttachmentContent
 
1800
  BugattachmentContent
1828
1801
  The actual content of a bug attachment. There can be multiple
1829
1802
  uploads over time, each revision gets a changecomment.
1830
1803
*/
1831
 
CREATE TABLE BugAttachmentContent (
1832
 
  id             serial PRIMARY KEY,
 
1804
CREATE TABLE BugattachmentContent (
1833
1805
  bugattachment  integer NOT NULL REFERENCES BugAttachment,
1834
 
  daterevised    timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
 
1806
  daterevised    timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1835
1807
  changecomment  text NOT NULL,
1836
1808
  content        bytea NOT NULL,
1837
 
  filename       text NOT NULL,
1838
1809
  mimetype       text,
1839
 
  owner          integer REFERENCES Person
 
1810
  owner          integer REFERENCES Person,
 
1811
  PRIMARY KEY ( bugattachment, daterevised )
1840
1812
);
1841
1813
 
1842
1814
 
1877
1849
CREATE TABLE BugMessage (
1878
1850
  id                   serial PRIMARY KEY,
1879
1851
  bug                  integer NOT NULL REFERENCES Bug,
1880
 
  datecreated          timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC'),
 
1852
  datecreated          timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1881
1853
  -- short title or subject of comment / message
1882
1854
  title                text NOT NULL,
1883
1855
  -- the message or full email with headers
1934
1906
  newbranchcategory         text,
1935
1907
  newbranchbranch           text,
1936
1908
  newbranchversion          text,
1937
 
  packagedistro             text,
1938
 
  packagefiles_collapsed    text,
1939
1909
  owner                     integer NOT NULL REFERENCES Person
1940
1910
);
1941
1911