Ian Campbell [Fri, 24 Oct 2014 10:23:51 +0000 (11:23 +0100)]
test: Add message with + in msgid to corpus.
I initially thought this was a URL unescaping bug in emesinae, but actually the
browser was encoding + as %20 (space) not %2B. Still, useful to have around.
Ian Campbell [Wed, 22 Jan 2014 12:36:36 +0000 (12:36 +0000)]
Actually prune messages from bugs
We were recording the pruning in the database but not reflecting it when
displaying a bug.
Seen in bug #1 in the test suite and http://bugs.xenproject.org/xen/bug/36 in
real life. Add support to the test suite for validating the set of messages
which end up in a bug.
Ian Campbell [Tue, 2 Jul 2013 12:47:13 +0000 (13:47 +0100)]
Add sort order to tags.
An existing DB can be upgraded with:
8<-------------------------------------------------
BEGIN TRANSACTION;
ALTER TABLE tags RENAME TO tmp_tags;
create table tags (
tag_id integer not null primary key autoincrement,
namespace varchar, -- "component", "affects" etc
name varchar,
sort_order integer default 0,
-- the following refer to the default visibility and setting in the search page.
active bool default true, -- searched for by default
advanced bool default false -- only shown in advanced search pane
);
INSERT OR IGNORE INTO tags(tag_id, namespace, name, active, advanced)
SELECT tag_id, namespace, name, active, advanced FROM tmp_tags;
DROP TABLE tmp_tags;
COMMIT;
8<-------------------------------------------------
Ian Campbell [Thu, 6 Jun 2013 15:09:59 +0000 (16:09 +0100)]
Support tagging bugs, use to implement affected version tracking
An existing DB can be upgraded with:
8<-------------------------------------------------
create table tags (
tag_id integer not null primary key autoincrement,
namespace varchar, -- "component", "affects" etc
name varchar,
-- the following refer to the default visibility and setting in the search page.
active bool default true, -- searched for by default
advanced bool default false -- only shown in advanced search pane
);
Ian Campbell [Thu, 30 May 2013 11:18:42 +0000 (12:18 +0100)]
db: Use a compound key for the refs table, ref_id is unneeded
An existing DB can be upgraded with:
8<-------------------------------------------------
BEGIN TRANSACTION;
ALTER TABLE refs RENAME TO tmp_refs;
create table refs (
parent_id integer not null references messages ( message_id ),
child_id integer not null references messages ( message_id ),
primary key ( parent_id, child_id )
);
INSERT OR IGNORE INTO refs(parent_id, child_id)
SELECT parent_id, child_id FROM tmp_refs;
DROP TABLE tmp_refs;
COMMIT;
8<-------------------------------------------------
Ian Campbell [Wed, 29 May 2013 11:13:12 +0000 (12:13 +0100)]
DB: restructuring of the fields
* Primary key for each table FOO is now consistently FOO_id rather than just ID.
* Fields which are taken from mail headers have a _hdr suffix.
* Fields which are taken raw from user input have a _raw suffix.
An existing DB can be upgraded with:
8<-------------------------------------------------
BEGIN TRANSACTION;
ALTER TABLE messages RENAME TO tmp_messages;
create table messages (
message_id integer primary key autoincrement,
msgid_hdr_raw varchar not null unique,
present bool default false, -- following fields valid iff true
ALTER TABLE refs RENAME TO tmp_refs;
create table refs (
ref_id integer primary key autoincrement,
parent_id integer references messages ( message_id ),
child_id integer references messages ( message_id )
);
INSERT INTO refs(ref_id, parent_id, child_id)
SELECT id,parentid,childid
FROM tmp_refs;
DROP TABLE tmp_refs;
ALTER TABLE bugs RENAME TO tmp_bugs;
create table bugs (
bug_id integer primary key autoincrement,
title_raw varchar,
creationdate integer,
lastchangedate integer,
owner_raw varchar,
severity varchar,
open bool default true
-- xxx other fields
-- tags? component?
-- affected branches?
);
INSERT INTO bugs(bug_id,title_raw,creationdate,lastchangedate,owner_raw,severity,open)
SELECT id,title,creationdate, lastchangedate,owner,severity,open
FROM tmp_bugs;
DROP TABLE tmp_bugs;
ALTER TABLE bug2message RENAME TO tmp_bug2message;
create table bug2message (
bug2message_id integer primary key autoincrement,
include bool default true, -- if true then graft, if false then exclude
bug_id integer not null references bugs ( bug_id ),
message_id integer not null references messages ( message_id )
);
INSERT INTO bug2message(bug2message_id,include,bug_id,message_id)
SELECT id,include,bugid,messageid
FROM tmp_bug2message;
DROP TABLE tmp_bug2message;