X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sql%2Fdebbugs_schema.sql;h=4b154786878e4d036fbc8c76360b0f27e5575b33;hb=3b3855979305a17e95200a4f4acf6afd7662f6af;hp=b20ceb079addd81025837184a66b94d36b1f7616;hpb=70488da6aef2f2d3f0ad9f839fc0bde73d686c0a;p=debbugs.git diff --git a/sql/debbugs_schema.sql b/sql/debbugs_schema.sql index b20ceb0..4b15478 100644 --- a/sql/debbugs_schema.sql +++ b/sql/debbugs_schema.sql @@ -1,4 +1,4 @@ - +-- -*- mode: sql; sql-product: postgres; -*- DROP TABLE bug_status_cache CASCADE; DROP VIEW bug_package CASCADE; DROP VIEW binary_versions CASCADE; @@ -113,7 +113,8 @@ CREATE TABLE bug ( -- submitter would ideally be NOT NULL, but there are some ancient bugs which do not have submitters submitter INT REFERENCES correspondent(id), submitter_full TEXT NOT NULL DEFAULT '', - unknown_packages TEXT NOT NULL DEfAULT '' + unknown_packages TEXT NOT NULL DEFAULT '', + unknown_affects TEXT NOT NULL DEFAULT '' ); CREATE INDEX bug_idx_owner ON bug(owner); CREATE INDEX bug_idx_submitter ON bug(submitter); @@ -139,6 +140,7 @@ INSERT INTO column_comments VALUES ('bug','done','Individual who did the -done; INSERT INTO column_comments VALUES ('bug','owner','Individual who owns this bug; empty if no one owns it'); INSERT INTO column_comments VALUES ('bug','submitter','Individual who submitted this bug; empty if there is no submitter'); INSERT INTO column_comments VALUES ('bug','unknown_packages','Package name if the package is not known'); +INSERT INTO column_comments VALUES ('bug','unknown_affects','Package name if the affected package is not known'); @@ -441,7 +443,10 @@ CREATE TABLE bug_status_cache ( modified TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL, asof TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL ); -CREATE UNIQUE INDEX bug_status_cache_bug_suite_arch_idx ON bug_status_cache(bug,suite,arch); +CREATE UNIQUE INDEX bug_status_cache_bug_suite_arch_idx ON + bug_status_cache(bug,suite,arch); +CREATE UNIQUE INDEX bug_status_cache_bug_col_suite_col_arch_idx ON + bug_status_cache(bug,COALESCE(suite,0),COALESCE(arch,0)); CREATE INDEX bug_status_cache_idx_bug ON bug_status_cache(bug); CREATE INDEX bug_status_cache_idx_status ON bug_status_cache(status); CREATE INDEX bug_status_cache_idx_arch ON bug_status_cache(arch); @@ -569,9 +574,9 @@ CREATE VIEW bug_status --(id,bug_num,tags,subject, WHERE bsp.bug=b.id) AS package ) AS package, b.submitter_full AS originator, - b.log_modified AS log_modified, - b.creation AS date, - b.last_modified AS last_modified, + EXTRACT(EPOCH FROM b.log_modified) AS log_modified, + EXTRACT(EPOCH FROM b.creation) AS date, + EXTRACT(EPOCH FROM b.last_modified) AS last_modified, b.done_full AS done, string_agg(bb.blocks::text,' ' ORDER BY bb.blocks) AS blocks, string_agg(bbb.bug::text,' ' ORDER BY bbb.bug) AS blockedby,