[Collab-qa-commits] r1694 - in udd: sql udd
Lucas Nussbaum
lucas at alioth.debian.org
Sun Feb 21 11:09:24 UTC 2010
Author: lucas
Date: 2010-02-21 11:09:22 +0000 (Sun, 21 Feb 2010)
New Revision: 1694
Modified:
udd/sql/setup.sql
udd/sql/upgrade.sql
udd/udd/bugs_gatherer.pl
Log:
import bugs_blocks/blockedby info
Modified: udd/sql/setup.sql
===================================================================
--- udd/sql/setup.sql 2010-02-21 10:28:52 UTC (rev 1693)
+++ udd/sql/setup.sql 2010-02-21 11:09:22 UTC (rev 1694)
@@ -216,6 +216,14 @@
CREATE TABLE bugs_tags
(id int REFERENCES bugs, tag text, PRIMARY KEY (id, tag));
+CREATE TABLE bugs_blocks
+ (id int REFERENCES bugs, blocked int,
+PRIMARY KEY(id, blocked));
+
+CREATE TABLE bugs_blockedby
+ (id int REFERENCES bugs, blocker int,
+PRIMARY KEY(id, blocker));
+
CREATE TABLE archived_bugs
(id int PRIMARY KEY, package text, source text, arrival timestamp, status text,
severity bugs_severity, submitter text, submitter_name text,
@@ -244,6 +252,14 @@
CREATE TABLE archived_bugs_tags
(id int REFERENCES archived_bugs, tag text, PRIMARY KEY (id, tag));
+CREATE TABLE archived_bugs_blocks
+ (id int REFERENCES bugs, blocked int,
+PRIMARY KEY(id, blocked));
+
+CREATE TABLE archived_bugs_blockedby
+ (id int REFERENCES bugs, blocker int,
+PRIMARY KEY(id, blocker));
+
-- usertags are either for archived or unarchived bugs, so we can't add a
-- foreign key here.
CREATE TABLE bugs_usertags
@@ -291,12 +307,16 @@
GRANT SELECT ON bugs_found_in TO PUBLIC;
GRANT SELECT ON bugs_fixed_in TO PUBLIC;
GRANT SELECT ON bugs_tags TO PUBLIC;
+GRANT SELECT ON bugs_blocks TO PUBLIC;
+GRANT SELECT ON bugs_blockedby TO PUBLIC;
GRANT SELECT ON archived_bugs TO PUBLIC;
GRANT SELECT ON archived_bugs_packages TO PUBLIC;
GRANT SELECT ON archived_bugs_merged_with TO PUBLIC;
GRANT SELECT ON archived_bugs_found_in TO PUBLIC;
GRANT SELECT ON archived_bugs_fixed_in TO PUBLIC;
GRANT SELECT ON archived_bugs_tags TO PUBLIC;
+GRANT SELECT ON archived_bugs_blocks TO PUBLIC;
+GRANT SELECT ON archived_bugs_blockedby TO PUBLIC;
GRANT SELECT ON bugs_rt_affects_stable TO PUBLIC;
GRANT SELECT ON bugs_rt_affects_testing_and_unstable TO PUBLIC;
GRANT SELECT ON bugs_rt_affects_unstable TO PUBLIC;
Modified: udd/sql/upgrade.sql
===================================================================
--- udd/sql/upgrade.sql 2010-02-21 10:28:52 UTC (rev 1693)
+++ udd/sql/upgrade.sql 2010-02-21 11:09:22 UTC (rev 1694)
@@ -286,3 +286,26 @@
ALTER TABLE ddtp ALTER COLUMN release TYPE release USING release::release;
ALTER TABLE packages_distrelcomparch ALTER COLUMN release TYPE release USING release::release;
ALTER TABLE ubuntu_packages_distrelcomparch ALTER COLUMN release TYPE release USING release::release;
+
+CREATE TABLE bugs_blocks
+ (id int REFERENCES bugs, blocked int,
+PRIMARY KEY(id, blocked));
+
+CREATE TABLE bugs_blockedby
+ (id int REFERENCES bugs, blocker int,
+PRIMARY KEY(id, blocker));
+
+CREATE TABLE archived_bugs_blocks
+ (id int REFERENCES bugs, blocked int,
+PRIMARY KEY(id, blocked));
+
+CREATE TABLE archived_bugs_blockedby
+ (id int REFERENCES bugs, blocker int,
+PRIMARY KEY(id, blocker));
+
+
+GRANT SELECT ON bugs_blocks TO PUBLIC;
+GRANT SELECT ON bugs_blockedby TO PUBLIC;
+
+GRANT SELECT ON archived_bugs_blocks TO PUBLIC;
+GRANT SELECT ON archived_bugs_blockedby TO PUBLIC;
Modified: udd/udd/bugs_gatherer.pl
===================================================================
--- udd/udd/bugs_gatherer.pl 2010-02-21 10:28:52 UTC (rev 1693)
+++ udd/udd/bugs_gatherer.pl 2010-02-21 11:09:22 UTC (rev 1694)
@@ -167,7 +167,7 @@
$t = time();
foreach my $prefix ($table, $archived_table) {
- foreach my $postfix (qw{_packages _merged_with _found_in _fixed_in _tags}, '') {
+ foreach my $postfix (qw{_packages _merged_with _found_in _fixed_in _tags _blocks _blockedby}, '') {
my $sth = $dbh->prepare("DELETE FROM $prefix$postfix WHERE id = \$1");
map {
$sth->execute($_) or die $!;
@@ -186,6 +186,8 @@
my $insert_bugs_fixed_handle = $dbh->prepare("INSERT INTO ${table}_fixed_in (id, version) VALUES (\$1, \$2)");
my $insert_bugs_merged_handle = $dbh->prepare("INSERT INTO ${table}_merged_with (id, merged_with) VALUES (\$1, \$2)");
my $insert_bugs_tags_handle = $dbh->prepare("INSERT INTO ${table}_tags (id, tag) VALUES (\$1, \$2)");
+ my $insert_bugs_blocks_handle = $dbh->prepare("INSERT INTO ${table}_blocks (id, blocked) VALUES (\$1, \$2)");
+ my $insert_bugs_blockedby_handle = $dbh->prepare("INSERT INTO ${table}_blockedby (id, blocker) VALUES (\$1, \$2)");
$insert_bugs_handle->bind_param(4, undef, SQL_INTEGER);
$insert_bugs_handle->bind_param(18, undef, SQL_INTEGER);
@@ -326,6 +328,12 @@
foreach my $mergee (without_duplicates(split / /, $bug{mergedwith})) {
$insert_bugs_merged_handle->execute($bug_nr, $mergee) or die $!;
}
+ foreach my $blocked (without_duplicates(split / /, $bug{blocks})) {
+ $insert_bugs_blocks_handle->execute($bug_nr, $blocked) or die $!;
+ }
+ foreach my $blocker (without_duplicates(split / /, $bug{blockedby})) {
+ $insert_bugs_blockedby_handle->execute($bug_nr, $blocker) or die $!;
+ }
foreach my $tag (without_duplicates(@tags)) {
$insert_bugs_tags_handle->execute($bug_nr, $tag) or die $!;
}
More information about the Collab-qa-commits
mailing list