You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(22) |
Nov
(1) |
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(7) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Jeff S. <jsq...@us...> - 2004-05-30 11:58:25
|
jsquyres 04/05/30 04:58:18
Added: libmaildb/db/mysql/doc import_mbox.pl index_cat.pl
Log:
Two prototype scripts (require perl CPAN module Mail::Box) to experiment
with the database schema.
Revision Changes Path
1.1 maildb/libmaildb/db/mysql/doc/import_mbox.pl
Index: import_mbox.pl
===================================================================
#!/usr/bin/env perl
use strict;
use Mail::Box::Manager;
use Mail::Address;
use Data::Dumper;
use File::Temp qw/tempfile/;
use File::Basename qw/basename/;
use File::Path;
# Use "require" because fink puts things in odd places
my $mac_dir = "/sw/lib/perl5/5.8.1/darwin-thread-multi-2level";
push(@INC, $mac_dir)
if (-d $mac_dir);
use DBI;
# Sanity check
die "Nothing to do!"
if ($#ARGV < 0);
# Globals
my $dsn = "DBI:mysql:database=maildb;host=localhost";
my $dbh;
my $db_name = "maildb";
my $maildb_uid;
my $maildb_username;
my $cat_id;
my $inbox_cat_id;
my $config;
my $empty;
my $want_debug = 0;
my $total_imported_folders = 0;
my $total_imported_messages = 0;
my $total_imported_messages_incl_embedded = 0;
my $msg_dir_default = "/var/spool/maildb";
my $max_short_body_length_default = 1048570;
my $FLAG_VALID = 0x1;
my $FLAG_HAS_CHILDREN = 0x2;
my $FLAG_DELETED = 0x4;
my $FLAG_DRAFT = 0x8;
my $FLAG_FLAGGED = 0x16;
my $FLAG_NEW = 0x32;
my $FLAG_REPLIED = 0x64;
my $FLAG_SEEN = 0x128;
# Do everything
connect_to_db();
set_default_config();
check_user_in_db();
make_inbox_cat();
mkdir_msg_dir();
close_db();
import_folders();
print "Stats:
Total imported folders: $total_imported_folders
Total imported messages: $total_imported_messages
Total imported messages (including embedded): $total_imported_messages_incl_embedded\n";
exit(0);
#############################################################################
#
# debugging print
#
sub debug {
my ($str) = @_;
print $str
if ($want_debug);
}
#############################################################################
#
# Connect to the db
#
sub connect_to_db {
$dbh = DBI->connect($dsn, "maildb", "maildb");
$empty = $dbh->quote("");
}
#############################################################################
#
# Execute an SQL query and return the results
#
my $sql_results;
sub sql_select {
my ($sql) = @_;
# Check to ensure that the previous results were freed
$sql_results->finish()
if ($sql_results);
# Now prepare and execute the new query
# debug "Running SQL: $sql\n";
$sql_results = $dbh->prepare($sql);
if (!$sql_results) {
die "Unable to prepare SQL: $sql: " . $dbh->errstr . "\n";
}
if (!$sql_results->execute) {
die "Unable to execute SQL: $sql: " . $dbh->errstr . "\n";
}
# Done. Return the handle to the new results.
$sql_results;
}
sub sql_do {
my ($sql) = @_;
# Check to ensure that the previous results were freed
$sql_results->finish()
if ($sql_results);
# Now prepare and execute the new query
# debug "Running SQL: $sql\n";
if (!$dbh->do($sql)) {
die "Unable to execute SQL: $sql: " . $dbh->errstr . "\n";
}
}
#############################################################################
sub set_default_config {
add_config_line("msg_dir", $msg_dir_default,
"Location of long messages");
add_config_line("max_short_body_length", $max_short_body_length_default,
"Max length in bytes of short body");
}
#############################################################################
sub add_config_line {
my ($key, $value, $desc) = @_;
my $sql;
my $results;
$sql = "SELECT cf_value FROM config WHERE cf_key=" . $dbh->quote($key);
$results = sql_select($sql);
# If we didn't find it, add it
if ($results->rows == 0) {
$results->finish();
$sql = "INSERT INTO config VALUES (NULL, 0, " .
$dbh->quote($key) . ", " .
$dbh->quote($value) . ", ".
$dbh->quote($desc) . ")";
sql_do($sql);
$config->{$key} = $value;
debug "Added default config: $key = $value\n";
}
# If we did find it, save the found value
else {
my $ref = $results->fetchrow_arrayref;
$config->{$key} = @$ref[0];
$results->finish();
debug "Found config: $key = $config->{$key}\n";
}
}
#############################################################################
#
# Check that the user is in the db
#
sub check_user_in_db {
my ($name, $passwd, $uid, $gid,
$quota, $comment, $gcos, $dir, $shell, $expire) = getpwuid($<);
debug "Username: $name\n";
$maildb_username = $name;
# Look and see if the username is in the db
my $results = sql_select("SELECT u_id FROM users WHERE u_username=" .
$dbh->quote($name));
my $found = $results->rows();
# Add if if it's not
if ($found == 0) {
$results->finish();
sql_do("INSERT INTO users VALUES (NULL, " .
$dbh->quote($name) . ", " . $dbh->quote($gcos) . ")");
debug "Added user to maildb\n";
$maildb_uid = $dbh->{'mysql_insertid'};
} elsif ($found == 1) {
debug "User already in maildb\n";
while (my $ref = $results->fetchrow_arrayref) {
$maildb_uid = @$ref[0];
}
$results->finish();
} else {
die "Problem! User in DB multiple times!\n";
}
debug "User has maildb UID: $maildb_uid\n";
# All done
endpwent();
}
#############################################################################
#
# Make sure the special "INBOX" category exists
#
sub make_inbox_cat {
# See if it already exists
my $results = sql_select("SELECT ca_id FROM cats WHERE ca_fullname='INBOX' AND ca_u_id=$maildb_uid");
my $found = $results->rows();
# If it doesn't create it
if ($found == 0) {
$results->finish();
sql_do("INSERT INTO cats VALUES (NULL, $maildb_uid, 'INBOX', 'INBOX', 'INBOX, root of all other categories', NULL)");
$inbox_cat_id = $dbh->{'mysql_insertid'};
debug "Created INBOX\n";
} elsif ($found == 1) {
my $ref = $results->fetchrow_arrayref;
$inbox_cat_id = @$ref[0];
debug "Found INBOX category already in database\n";
} else {
die "Problem! INBOX in DB multiple times!\n";
}
}
#############################################################################
sub mkdir_msg_dir {
return if (-d $config->{msg_dir});
mkpath([$config->{msg_dir}], 0, 0777);
if (! -d $config->{msg_dir}) {
die "Could not make message dir: $config->{msg_dir}\n";
}
}
#############################################################################
#
# Read in the folders
#
sub import_folders {
my $mgr = Mail::Box::Manager->new;
debug "Reading in folders...\n";
foreach my $argv (@ARGV) {
print "- Importing folder: $argv\n";
my $folder = $mgr->open(folder => $argv);
print " Read " . $folder->name . " / " .
$folder->messages . " messages\n";
# Put all categories into the database
connect_to_db();
make_cat($argv);
# Iterate over all the messages, insertting them into the database
my $count = 1;
print "Importing message: ";
STDOUT->autoflush(1);
foreach my $msg ($folder->messages) {
# Skip UW internal mbox messages
next
if $msg->subject eq
"DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA";
# Otherwise, import it
import_message($msg, 0);
print "$count ";
++$count;
++$total_imported_messages;
}
print "\n";
# All done with this folder
$folder->close();
close_db();
++$total_imported_folders;
}
$mgr->close();
}
#############################################################################
#
# Import a single message; invoked from multiple places, including
# recusrively. Creates entry in the msg_ids table and then imports
# the header, the body, and then finally makes an entry in the
# msg_owners table to complet the import.
#
sub import_message {
my ($msg, $parent_id) = @_;
debug "=============================================================\n";
my Mail::Message::Head $head = $msg->head;
my Mail::Message::Body $body = $msg->body;
# --- Create an entry in the messages table for this message ---
# This is the message ID for all the other SQL inserts to
# cross-reference.
my $sql = "INSERT INTO messages VALUES (NULL, $maildb_uid, NULL, 0)";
sql_do($sql);
my $msg_id = $dbh->{'mysql_insertid'};
# --- Import the quick search data ---
import_quick_search($msg, $msg_id, $parent_id);
# --- Process the header ---
# Note that attachment_id of 0 means the main message
import_header($head, $msg_id, 0);
# --- Process the body ---
# Note that attachment_id of 0 means the main message
my $has_children = import_body($msg, $body, $msg_id, 0);
# --- Put this message in a category ---
$sql = "INSERT DELAYED INTO msg_cats VALUES (NULL, $msg_id, $cat_id, $empty, $empty)";
sql_do($sql);
# Update the messages table to set the final flags on this
# message, and make it visible to all other clients.
my $flag_val = $FLAG_VALID +
($has_children ? $FLAG_HAS_CHILDREN : 0);
my $flags = $msg->labels;
debug Dumper($flags);
$flag_val += $FLAG_DELETED if ($msg->isDeleted);
$flag_val += $FLAG_DRAFT if ($flags->{draft});
$flag_val += $FLAG_FLAGGED if ($flags->{flagged});
$flag_val += $FLAG_NEW if ($flags->{new});
$flag_val += $FLAG_REPLIED if ($flags->{replied});
$flag_val += $FLAG_SEEN if ($flags->{seen});
# printf("Flag value: %x\n", $flag_val);
$sql = "UPDATE messages SET msg_flags=$flag_val WHERE msg_id=$msg_id";
sql_do($sql);
++$total_imported_messages_incl_embedded;
}
#############################################################################
sub import_quick_search {
my ($msg, $msg_id, $parent_id) = @_;
# Snarf some special header lines that Mail::Box knows about
my $data;
my Mail::Message::Head $head = $msg->head;
foreach my $addr ($msg->to) {
if ($data->{to}) {
$data->{to} .= ", " . $addr->format;
} else {
$data->{to} = $addr->format;
}
}
foreach my $addr ($msg->cc) {
if ($data->{cc}) {
$data->{cc} .= ", " . $addr->format;
} else {
$data->{cc} = $addr->format;
}
}
foreach my $addr ($msg->bcc) {
if ($data->{bcc}) {
$data->{bcc} .= ", " . $addr->format;
} else {
$data->{cc} = $addr->format;
}
}
foreach my $addr ($msg->from) {
if ($data->{from}) {
$data->{from} .= ", " . $addr->format;
} else {
$data->{from} = $addr->format;
}
}
foreach my $addr ($msg->sender) {
if ($data->{sender}) {
$data->{sender} .= ", " . $addr->format;
} else {
$data->{sender} = $addr->format;
}
}
$data->{subject} = $msg->subject;
$data->{date} = $msg->timestamp;
# Scan through all header lines, building up the rest of the
# cached information that we need. We know that this will always
# be a Mail::Message::Head::Complete because we're reading mbox
# files.
foreach my Mail::Message::Field $field ($head->orderedFields) {
my $name = $field->name();
my $body = $field->unfoldedBody();
if ($name eq "in-reply-to") {
$data->{in_reply_to} = $body;
} elsif ($name eq "reply-to") {
$data->{reply_to} = $body;
} elsif ($name eq "references") {
$data->{references} = $body;
} elsif ($name eq "message-id") {
$data->{message_id} = $body;
}
}
# We must have a message ID string from the header, but it's
# possible that we don't (don't know if this is compliant with
# RFC2822, but GNU mailman embedded messages do not have them)
if (!$data->{message_id}) {
$data->{message_id} = "<maildb-import-fake-id-" .
int(rand(9999999)) . ">";
}
# Query the mime type ID
$data->{multipart_boundary} =
find_mime_boundary($head->get("content-type"));
# Believe it or not, it seems that MySQL has a problem with
# uniqueness for non-unique text indices (!) if there are spaces
# at the end of a field. Use the neat "+?" minimal
# match/non-greedy regexp operator (see perlretut(1)).
foreach my $key (keys %$data) {
# Don't strip the prefix whitespace from the subject
if ($key =~ /subject/i) {
$data->{$key} =~ s/(.+?)[ \t]*$/$1/;
} else {
$data->{$key} =~ s/^[ \t]*(.+?)[ \t]*$/$1/;
}
}
# Build up the SQL string to add the message into the
# msg_quick_search table.
my $sql = "INSERT INTO msg_quick_search VALUES (NULL, $msg_id, ";
$sql .= $dbh->quote($data->{message_id}) . ", ";
$sql .= $dbh->quote($data->{to}) . ", ";
$sql .= $dbh->quote($data->{cc}) . ", ";
$sql .= $dbh->quote($data->{bcc}) . ", ";
$sql .= $dbh->quote($data->{subject}) . ", ";
$sql .= $dbh->quote($data->{date}) . ", ";
$sql .= $dbh->quote($data->{from}) . ", ";
$sql .= $dbh->quote($data->{sender}) . ", ";
$sql .= $dbh->quote($data->{in_reply_to}) . ", ";
$sql .= $dbh->quote($data->{reply_to}) . ", ";
$sql .= $dbh->quote($data->{references}) . ", ";
$sql .= $dbh->quote($data->{multipart_boundary}) . ")";
sql_do($sql);
}
#############################################################################
#
# Do the normal header import. This may be called by other places
# (e.g., when importing a message body part, because they have
# headers, too), so it's a subroutine by itself.
#
sub import_header {
my ($head, $msg_id, $part_id) = @_;
# Insert all the fields into msg_hdrs
my $count = 0;
foreach my Mail::Message::Field $field ($head->orderedFields) {
my $sql =
"INSERT DELAYED INTO msg_hdrs VALUES (NULL, $msg_id, $part_id, " .
$dbh->quote($field->Name) . ", " .
$dbh->quote($field->unfoldedBody) . ", $count)";
sql_do($sql);
debug "Added header line: " . $field->Name .
" $count, $part_id\n";
++$count;
}
}
#############################################################################
#
# Import a body into the database. This is potentially a recursive
# process, since a body may be nested, single, or multipart, and any
# one of those may contain another body.
#
sub import_body {
my ($msg, $body, $msg_id, $count) = @_;
my $has_children = 0;
debug "Import body: ID $msg_id, count $count\n";
# If this is a nested type, then just recruse into it
if ($body->isNested) {
debug "*** NESTED BODY\n";
import_message($body->nested, $msg_id);
$has_children = 1;
}
# If this is a multipart, import each part (including the preamble
# and epilogue) as a separate attachment
elsif ($body->isMultipart) {
debug "*** MULTIPART BODY\n";
# Preamble (header has already been imported)
debug "*** Multipart preamble\n";
$has_children += import_body($msg, $body->preamble, $msg_id, $count++)
if ($body->preamble);
# Attachments (import header lines as well)
foreach my $part ($body->parts) {
debug "*** Multipart part\n";
import_header($part->head, $msg_id, $count);
$has_children += import_body($msg, $part->body, $msg_id, $count++);
}
# Epilogue (has no header)
debug "*** Multipart epilogue\n";
$has_children += import_body($msg, $body->epilogue, $msg_id, $count++)
if ($body->epilogue);
}
# Otherwise, this is a single-part message; just import it
else {
debug "*** SIMPLE BODY\n";
import_simple_body($body, $msg_id, $count++);
}
# Return whether we have children or not
$has_children;
}
#############################################################################
#
# Import a simple body into the database
#
sub import_simple_body {
my ($body, $msg_id, $count) = @_;
# If it's short, put it in the database.
my $sql = "INSERT DELAYED INTO msg_parts VALUES (NULL, $msg_id, $count, ";
debug "Simple body size: " . $body->size . "\n";
debug "Max short body: $config->{max_short_body_length}\n";
# debug "Importing body: ". $body . "\n";
my $saved = 0;
my $quoted;
if ($body->size <= $config->{max_short_body_length}) {
$quoted = $dbh->quote($body);
if (length($quoted) <= $config->{max_short_body_length}) {
$sql .= $dbh->quote($body) . ", $empty)";
$saved = 1;
}
}
# If it's long, put it in the filesystem.
if (0 == $saved) {
my ($fh, $filename) = get_msg_filename();
$sql .= "$empty, " . $dbh->quote($filename) . ")";
print { $fh } $body;
close($fh);
}
sql_do($sql);
debug "Imported short body: ID $msg_id, count $count\n";
}
#############################################################################
#
# Make a random filename under a user's directory
#
sub get_msg_filename {
my $dir = "$config->{msg_dir}/$maildb_username";
# First, make a directory just for this user
if (! -d $dir) {
if (! mkpath([$dir], 0, 0700)) {
die "Couldn't make maildb dir: $dir";
}
}
# Now make a two-level directory structure, based on random
# letters
my $i = 0;
my ($fh, $filename);
while ($i < 10) {
my $first = random_char();
my $second = random_char();
my $destdir = "$dir/$first/$second";
if (! -d $destdir) {
if (! mkpath([$destdir], 0, 0700)) {
die "Couldn't make maildb dir: $destdir";
}
}
# Try to make a tempfile in there
($fh, $filename) = tempfile(DIR => $destdir);
last if ($fh);
# Otherwise, loop around and try a different directory;
# assumedly this one was full
++$i;
}
if ($i >= 10) {
die "Unable to make destination file for large message";
}
debug "Made message file: $filename\n";
return ($fh, $filename);
}
#############################################################################
#
# Make a random char
#
sub random_char {
my $c = int(rand(26));
if (int(rand(2)) == 1) {
return chr($c + ord('A'));
} else {
return chr($c + ord('a'));
}
}
#############################################################################
#
# Find the boundary line in the Content-type line
#
sub find_mime_boundary {
my ($ct_line) = @_;
# Look up the boundary line. If it exists, it'll be somewhere on
# the Content-Type line, and it may or may not be surrounded by
# quotes.
my $boundary = $ct_line;
if ($boundary =~ /boundary=/i) {
$boundary =~ s/^.*boundary=([^;]+).*$/$1/i;
$boundary =~ s/^[\"\'](.+)[\"\']$/$1/;
} else {
$boundary = "";
}
debug "Found MIME/multipart boundary: $boundary\n";
# All done
$boundary;
}
#############################################################################
#
# Make a database category if it does not already exist (and all of
# its parents, analogous to "mkdir -p").
#
sub make_cat {
my ($cat) = @_;
my (@parts) = split ("/", $cat);
debug "------------------------------\nmaking cat: $cat\n";
my $full;
my $parent_id = 0;
foreach my $part (@parts) {
if ($full) {
$full .= "/$part";
} else {
$full = $part;
}
debug "Part: $part\n";
# Search for that name with $parent_id and $maildb_uid
debug "Searching for category: $full\n";
my $results = sql_select("SELECT ca_id FROM cats WHERE ca_fullname=" .
$dbh->quote($full) .
" AND ca_u_id=$maildb_uid AND ca_parent=$parent_id");
# If it was found, save the ID in the parent for the next
# round
if ($results->rows == 1) {
my $ref = $results->fetchrow_arrayref;
$cat_id = $parent_id = @$ref[0];
debug "Found parent category: $part / ID $parent_id\n";
$results->finish();
}
# Otherwise, it was not found, so create it and set its parent
else {
$results->finish();
my $sql = "INSERT INTO cats VALUES (NULL, $maildb_uid, " .
$dbh->quote($part) . ", " .
$dbh->quote($full) . ", " .
$dbh->quote("import from mbox: $full") . ", ";
if ($parent_id) {
$sql .= " $parent_id)";
sql_do($sql);
debug "Insertted $part with parent ID $parent_id\n";
} else {
$sql .= " 0)";
sql_do($sql);
debug "Insertted $part with no parent ID\n";
}
# Get the ID of this newly-created cat so that it can be
# the parent next round
$cat_id = $parent_id = $dbh->{'mysql_insertid'};
}
}
debug "made cat ($cat): $full, ID $cat_id\n";
}
#############################################################################
#
# Close the db
#
sub close_db {
$dbh->disconnect();
}
1.1 maildb/libmaildb/db/mysql/doc/index_cat.pl
Index: index_cat.pl
===================================================================
#!/usr/bin/env perl
use strict;
use Data::Dumper;
use File::Basename qw/basename/;
# Use "require" because fink puts things in odd places
push(@INC, "/sw/lib/perl5/5.8.1/darwin-thread-multi-2level");
use DBI;
# Globals
my $dsn = "DBI:mysql:database=maildb;host=localhost";
my $dbh;
my $db_name = "maildb";
my $maildb_uid;
my $maildb_username;
my $cat_id;
my $config;
my $empty;
my $want_debug = 0;
my $FLAG_VALID = 0x1;
my $FLAG_HAS_CHILDREN = 0x2;
my $FLAG_DELETED = 0x4;
my $FLAG_DRAFT = 0x8;
my $FLAG_FLAGGED = 0x16;
my $FLAG_NEW = 0x32;
my $FLAG_REPLIED = 0x64;
my $FLAG_SEEN = 0x128;
# Do everything
connect_to_db();
get_user_id();
index_cat();
close_db();
exit(0);
#############################################################################
#
# debugging print
#
sub debug {
my ($str) = @_;
print $str
if ($want_debug);
}
#############################################################################
#
# Connect to the db
#
sub connect_to_db {
$dbh = DBI->connect($dsn, "maildb", "maildb");
$empty = $dbh->quote("");
}
#############################################################################
#
# Execute an SQL query and return the results
#
my $sql_results;
sub execute_sql {
my ($sql) = @_;
# Check to ensure that the previous results were freed
$sql_results->finish()
if ($sql_results);
# Now prepare and execute the new query
# debug "Running SQL: $sql\n";
$sql_results = $dbh->prepare($sql);
if (!$sql_results) {
die "Unable to prepare SQL: $sql: " . $dbh->errstr . "\n";
}
if (!$sql_results->execute) {
die "Unable to execute SQL: $sql: " . $dbh->errstr . "\n";
}
# Done. Return the handle to the new results.
$sql_results;
}
#############################################################################
#
# Get the user's ID in the maildb database
#
sub get_user_id {
my ($name, $passwd, $uid, $gid,
$quota, $comment, $gcos, $dir, $shell, $expire) = getpwuid($<);
debug "Username: $name\n";
$maildb_username = $name;
# Look and see if the username is in the db
my $results = execute_sql("SELECT u_id FROM users WHERE u_username=" .
$dbh->quote($name));
my $found = $results->rows();
# Add if if it's not
if ($found == 0) {
die "User not in database. Sorry.\n";
} elsif ($found == 1) {
debug "User already in maildb\n";
while (my $ref = $results->fetchrow_arrayref) {
$maildb_uid = @$ref[0];
}
$results->finish();
} else {
die "Problem! User in DB multiple times!\n";
}
debug "User has maildb UID: $maildb_uid\n";
# All done
endpwent();
}
#############################################################################
#
# List all the sub-categories and messages in a category
#
sub index_cat {
push(@ARGV, "")
if ($#ARGV == -1);
# First, find the requested category
foreach my $cat (@ARGV) {
my $cat_handle = find_cat($cat);
if ($cat_handle) {
list_sub_cats($cat_handle);
list_messages($cat_handle);
}
}
}
#############################################################################
#
# Find a category
#
sub find_cat {
my ($cat) = @_;
my $cat_handle;
my $sql = "SELECT ca_id, ca_fullname, ca_desc, ca_parent FROM cats WHERE ca_u_id=$maildb_uid ";
# Are we looking for a specific category?
if ($cat) {
$sql .= "and ca_fullname=" . $dbh->quote($cat);
my $results = execute_sql($sql);
if ($results->rows == 1) {
my $ref = $results->fetchrow_arrayref;
$cat_handle = {
id => @$ref[0],
fullname => @$ref[1],
desc => @$ref[2],
parent => @$ref[3],
};
} elsif ($results->rows == 0) {
die "Could not find category '$cat'";
} else {
print "Found more than one category named '$cat'!\n";
while (my $ref = $results->fetchrow_arrayref) {
print "Fullname: @$ref[1], id @$ref[0]\n";
}
die "Cannot continue\n";
}
$results->finish();
} else {
$sql .= "and ca_parent=0";
$cat_handle = {
id => 0,
fullname => "root",
desc => "Unnamed root category",
parent => 0,
};
}
# All done, to include the possibility of not finding it
$cat_handle;
}
#############################################################################
#
# List all the sub-categories off the category
#
sub list_sub_cats {
my ($cat_handle) = @_;
my $sql = "SELECT ca_id, ca_fullname, ca_desc, ca_parent FROM cats WHERE ca_u_id=$maildb_uid AND ca_parent=$cat_handle->{id}";
my $results = execute_sql($sql);
if ($results->rows > 0) {
print "Found " . $results->rows . " sub-categories\n";
while (my $ref = $results->fetchrow_arrayref) {
print "Sub-category: @$ref[1]\n --> @$ref[2]\n";
}
} else {
print "No sub-categories\n";
}
$results->finish()
if ($results);
}
#############################################################################
#
# List all the messages in the category
#
sub list_messages {
my ($cat_handle) = @_;
# msg_owners : mu_m_id -> msg_ids : m_id
# msg_hdrs : mh_m_id <- msg_ids : m_id
# msg_attach: ma_m_id <- msg_ids : m_id
#
# select * from msg_owners,msg_hdrs where msg_owners.mu_m_id=msg_hdrs.mh_m_id and mu_u_id=$maildb_uid and mu_ca_id=$cat_handle->{id}
# Count how many messages were found in this category
my $sql = "
SELECT count(*)
FROM messages, msg_cats
WHERE messages.msg_u_id = $maildb_uid
AND messages.msg_flags & $FLAG_VALID > 0
AND messages.msg_id = msg_cats.mc_msg_id
AND msg_cats.mc_ca_id = $cat_handle->{id}";
my $results = execute_sql($sql);
my $ref = $results->fetchrow_arrayref;
print "Found " . @$ref[0] . " messages\n";
$results->finish();
# Count how many message headers were found in this category, and
# get all the header lines
my $sql = "
SELECT msg_id, mh_part_id, mh_key, mh_value
FROM messages, msg_cats, msg_hdrs, msg_parts
WHERE messages.msg_u_id = $maildb_uid
AND messages.msg_flags & $FLAG_VALID > 0
AND messages.msg_id = msg_hdrs.mh_msg_id
AND messages.msg_id = msg_cats.mc_msg_id
AND messages.msg_id = msg_parts.mp_msg_id
AND msg_cats.mc_ca_id = $cat_handle->{id}
ORDER BY messages.msg_id, msg_hdrs.mh_part_id, msg_hdrs.mh_sort_order";
my $results = execute_sql($sql);
if ($results->rows > 0) {
print "Found " . $results->rows . " header lines\n";
my $prev_msg_id = -1;
my $prev_part_id = -1;
while (my $ref = $results->fetchrow_arrayref) {
my $msg_id = @$ref[0];
my $part_id = @$ref[1];
my $key = @$ref[2];
my $value = @$ref[3];
if ($prev_msg_id != $msg_id) {
print "=============================================\n";
$prev_msg_id = $msg_id;
$prev_part_id = 0;
} elsif ($prev_part_id != $part_id) {
print "---------------------------------------------\n";
}
print "$msg_id: $key: $value\n";
}
} else {
print "No messages in this category\n";
}
$results->finish()
if ($results);
}
#############################################################################
#
# Close the db
#
sub close_db {
$dbh->disconnect();
}
|
|
From: Jeff S. <jsq...@us...> - 2004-05-30 11:57:03
|
jsquyres 04/05/30 04:56:55
Modified: libmaildb/db/mysql/doc cr_maildb.sql
Log:
Overhaul of the schema to be workable in the prototype code. Comments
included make at least some of design.html inaccurate. Explanation e-mail
coming to the maildb-devel list shortly.
Revision Changes Path
1.8 +222 -120 maildb/libmaildb/db/mysql/doc/cr_maildb.sql
Index: cr_maildb.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_maildb.sql,v
retrieving revision 1.7
retrieving revision 1.8
diff -c -w -r1.7 -r1.8
*** cr_maildb.sql 30 May 2003 00:18:00 -0000 1.7
--- cr_maildb.sql 30 May 2004 11:56:54 -0000 1.8
***************
*** 1,83 ****
-- cr_db.sql - MailDB MySQL database creation
! -- Copyright (c) 2002 MailDB Team
--
-- This file is part of the MailDB software package. For license
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: cr_maildb.sql,v 1.7 2003/05/30 00:18:00 jlscott3 Exp $
-- -------------------------------------------------------
-- maildb tables
- -- common message data:
- -- hdrs, mime_types
-- user data:
-- users, cats, views
-- message data:
! -- msg_ids, msg_hdrs, msg_owners, msg_attach, msg_orig
-- logs:
-- obj_log, msg_log
-- meta:
-- config
! -- -------------------------
! -- Common Message Data
! -- -------------------------
!
! -- hdrs
! -- -> deleted 10/10/2002 in favor of de-normalizing
!
! -- drop table if exists hdrs;
! -- create table hdrs (
! -- h_id integer unsigned not null auto_increment,
! -- h_desc varchar(20),
! -- primary key (h_id)
! -- );
!
! -- mime_types
!
! drop table if exists mime_types;
! create table mime_types (
! mt_id integer unsigned not null auto_increment,
! mt_desc varchar(127),
! primary key (mt_id),
! index mt_desc_idx (mt_desc)
! );
!
!
! -- -------------------------
-- User Data
! -- -------------------------
-- users
drop table if exists users;
create table users (
u_id integer unsigned not null auto_increment,
! u_desc varchar(127),
primary key (u_id),
! index u_desc_idx (u_desc)
);
-- cats
drop table if exists cats;
create table cats (
ca_id integer unsigned not null auto_increment,
ca_u_id integer unsigned not null references users(u_id),
! ca_desc varchar(127),
ca_parent integer unsigned references cats(ca_id),
primary key (ca_id),
! index ca_u_id_idx (ca_u_id)
);
-- views
drop table if exists views;
create table views (
vw_id integer unsigned not null auto_increment,
! vw_desc varchar(127),
vw_u_id integer unsigned not null references users(u_id),
vw_query text,
primary key (vw_id),
--- 1,97 ----
-- cr_db.sql - MailDB MySQL database creation
! -- Copyright (c) 2002-2004 MailDB Team
--
-- This file is part of the MailDB software package. For license
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: cr_maildb.sql,v 1.8 2004/05/30 11:56:54 jsquyres Exp $
-- -------------------------------------------------------
-- maildb tables
-- user data:
-- users, cats, views
-- message data:
! -- messages, msg_cats, msg_hdrs, msg_parts, msg_quick_search
-- logs:
-- obj_log, msg_log
-- meta:
-- config
! --========================================================================
-- User Data
! --========================================================================
+ --------------------------------------------------------------------------
-- users
+ --
+ -- Simple list of usernames and a textual gecos (mainly for
+ -- debugging/reference). The user ID is used throughout other tables
+ -- for unique ownership identity.
+ --------------------------------------------------------------------------
drop table if exists users;
create table users (
+ -- Unique ID
u_id integer unsigned not null auto_increment,
!
! -- Username and gecos
! u_username varchar(127),
! u_gecos varchar(127),
!
! -- Indices
primary key (u_id),
! index u_username_idx (u_username)
);
+ --------------------------------------------------------------------------
-- cats
+ --
+ -- Names and unique ID's of categories, including parent pointers and
+ -- user ID's of the user who owns them.
+ --------------------------------------------------------------------------
drop table if exists cats;
create table cats (
+ -- Unique ID
ca_id integer unsigned not null auto_increment,
+
+ -- User owning this category
ca_u_id integer unsigned not null references users(u_id),
!
! -- Just the name of this category
! ca_basename varchar(255),
!
! -- The full name of this category, including all parent names,
! -- separated by "/". Makes it easy and quick to search for a full
! -- category name, rather than having to traverse all parent category
! -- names.
! ca_fullname varchar(255),
!
! -- A textual description
! ca_desc varchar(255),
!
! -- Parent category reference
ca_parent integer unsigned references cats(ca_id),
+
+ -- Indices
primary key (ca_id),
! index ca_u_id_idx (ca_u_id),
! index ca_fullname_idx (ca_fullname)
);
+ --------------------------------------------------------------------------
-- views
+ --
+ -- JMS Haven't done anything with this yet. Will hold SQL rules for
+ -- saved searches.
+ --------------------------------------------------------------------------
drop table if exists views;
create table views (
vw_id integer unsigned not null auto_increment,
! vw_desc varchar(255),
vw_u_id integer unsigned not null references users(u_id),
vw_query text,
primary key (vw_id),
***************
*** 85,188 ****
);
! -- -------------------------
-- Message Data
! -- -------------------------
! -- msg_ids
! drop table if exists msg_ids;
! create table msg_ids (
! m_id integer unsigned not null auto_increment,
! m_msg_id varchar(255) not null,
! m_to text,
! m_cc text,
! m_bcc text,
! m_subject text,
! m_date datetime,
! m_from text,
! m_in_reply_to text,
! m_sender text,
! m_reply_to text,
! m_references text,
! m_parent_id integer,
! m_vw_incl text,
! m_vw_excl text,
! primary key (m_id),
! index m_msg_id_idx (m_msg_id),
! index m_date_idx(m_date),
! index m_from_idx(m_from(255)),
! index m_to_idx (m_to(255)),
! index m_subject_idx (m_subject(255))
);
-- msg_hdrs
drop table if exists msg_hdrs;
create table msg_hdrs (
mh_id integer unsigned not null auto_increment,
! mh_m_id integer unsigned not null references msg_ids(m_id),
mh_key varchar(63) not null,
! mh_value varchar(255),
mh_sort_order integer unsigned,
primary key (mh_id),
- index mh_m_id_idx (mh_m_id),
index mh_key_idx (mh_key),
fulltext index mh_value_idx (mh_value)
);
! -- msg_owners
! drop table if exists msg_owners;
! create table msg_owners (
! mu_id integer unsigned not null auto_increment,
! mu_m_id integer unsigned not null references msg_ids(m_id),
! mu_u_id integer unsigned not null references users(u_id),
! mu_ca_id integer unsigned not null references cats(ca_id),
! -- mu_date integer unsigned not null references msg_hdrs(mh_id),
! -- mu_from integer unsigned not null references msg_hdrs(mh_id),
! -- mu_subject integer unsigned not null references msg_hdrs(mh_id),
! mu_flags integer,
! primary key (mu_id),
! index mu_m_id_idx (mu_m_id),
! index mu_u_id_idx (mu_u_id),
! index mu_ca_id_idx (mu_ca_id)
! );
!
! -- msg_attach
! -- ma_in_fs bool, \ removed
! -- ma_in_msg bool, / 5/22/03
!
! drop table if exists msg_attach;
! create table msg_attach (
! ma_id integer unsigned not null auto_increment,
! ma_m_id integer unsigned not null references msg_ids(m_id),
! ma_mt_id integer unsigned not null references mime_types(mt_id),
! ma_encode varchar(127),
! ma_body mediumtext,
! ma_path varchar(255),
! ma_sep_data varchar(255),
! ma_sort_order integer unsigned,
! primary key (ma_id),
! index ma_m_id_idx (ma_m_id),
! fulltext index ma_body_idx (ma_body)
! );
!
! -- msg_orig
!
! drop table if exists msg_orig;
! create table msg_orig (
! mo_id integer unsigned not null auto_increment,
! mo_m_id integer unsigned not null references msg_ids(m_id),
! mo_text longtext,
! primary key (mo_id),
! index mo_m_id_idx (mo_m_id)
);
! -- -------------------------
-- Logs
! -- -------------------------
drop table if exists obj_log;
create table obj_log (
--- 99,272 ----
);
! --========================================================================
-- Message Data
! --========================================================================
!
! --------------------------------------------------------------------------
! -- messages
! --
! -- Main table for finding messages. Contains a unique ID for each
! -- message (including RFC822 embedded messages), the user who owns
! -- them (should we do something so that more than one user can own a
! -- message?), the parent of the message (for RFC822 embedded
! -- messages), and a set of flags. The flags are the IMAP flags as
! -- well as two maildb-specific flags: valid (only set to true when the
! -- entire message has been populated in all the other relevant
! -- tables), and has_children (indicating that a search for parent_id
! -- of this message's ID will turn up some messages).
! --------------------------------------------------------------------------
!
! drop table if exists messages;
! create table messages (
! -- Unique ID
! msg_id integer unsigned not null auto_increment,
!
! -- Cross reference to a specific user
! msg_u_id integer unsigned not null references users(u_id),
!
! -- This message may have a parent (e.g., if it's an embedded RFC 822
! -- message)
! msg_parent_msg_id integer unsigned,
!
! -- Bit flags on this message
! msg_flags integer,
!
! -- Indices
! primary key (msg_id),
! index msg_u_id_idx (msg_u_id),
! index msg_parent_msg_id_idx (msg_parent_msg_id)
! );
!
! --------------------------------------------------------------------------
! -- msg_cats
! --
! -- Linking messages to categories.
! --------------------------------------------------------------------------
!
! drop table if exists msg_cats;
! create table msg_cats (
! -- Unique ID
! mc_id integer unsigned not null auto_increment,
! -- Cross reference to a specific message
! mc_msg_id integer unsigned not null references messages(msg_id),
! -- Cross reference to a specific category
! mc_ca_id integer unsigned not null references cats(ca_id),
! -- Special inclusion and exclusion lists
! mc_vw_incl text,
! mc_vw_excl text,
!
! -- Indices
! primary key (mc_id),
! index mc_ca_id_idx (mc_ca_id)
);
+ --------------------------------------------------------------------------
-- msg_hdrs
+ --
+ -- Mainly a listing of key=value pairs from the headers of message
+ -- parts (yes, to include attachments). No attempt at normalization
+ -- is made -- the pure key=value that was given as the message input
+ -- is saved.
+ --------------------------------------------------------------------------
drop table if exists msg_hdrs;
create table msg_hdrs (
+ -- Unique ID
mh_id integer unsigned not null auto_increment,
!
! -- Cross reference to a specific message and part
! mh_msg_id integer unsigned not null references messages(msg_id),
! mh_part_id integer unsigned not null references msg_part(mp_id),
!
! -- Header key=value lines
mh_key varchar(63) not null,
! mh_value text,
mh_sort_order integer unsigned,
+
+ -- Indices
primary key (mh_id),
index mh_key_idx (mh_key),
+ index mh_msg_id_idx (mh_msg_id),
fulltext index mh_value_idx (mh_value)
);
! --------------------------------------------------------------------------
! -- msg_parts
! --
! -- A single part of a message. This can contain a body here in the
! -- database (up to config/max_short_body_length bytes), or a filename
! -- somewhere in the filesystem indicating where the text of the body
! -- actually lives.
! --------------------------------------------------------------------------
!
! drop table if exists msg_parts;
! create table msg_parts (
! -- Unique ID
! mp_id integer unsigned not null auto_increment,
!
! -- Cross reference to a specific message
! mp_msg_id integer unsigned not null references msg_ids(msg_id),
! mp_sort_order integer unsigned,
!
! -- Text of the part or a filename
! mp_body mediumtext,
! mp_path varchar(255),
!
! -- Indices
! primary key (mp_id),
! index ma_m_id_idx (mp_msg_id),
! fulltext index mp_body_idx (mp_body)
! );
! --------------------------------------------------------------------------
! -- msg_quick_search
! --
! -- This data is mainly maintained for quick searches on "common"
! -- fields in the message header. The goal is to be able to search on
! -- any of these fields and then resolve it back to one or more maildb
! -- message IDs.
! --------------------------------------------------------------------------
!
! drop table if exists msg_quick_search;
! create table msg_quick_search (
! -- Unique ID
! mqs_id integer unsigned not null auto_increment,
!
! -- Cross referece to the maildb message ID
! mqs_msg_id integer unsigned not null references msg_ids(msg_id),
!
! -- Common fields
! mqs_msg_id_str varchar(255) not null,
! mqs_to text,
! mqs_cc text,
! mqs_bcc text,
! mqs_subject text,
! mqs_date datetime,
! mqs_from text,
! mqs_sender text,
! mqs_in_reply_to text,
! mqs_reply_to text,
! mqs_references text,
! mqs_boundary text,
!
! -- Indices
! primary key (mqs_id),
! index mqs_msg_id_idx(mqs_msg_id),
! index mqs_date_idx(mqs_date),
! index mqs_from_idx(mqs_from(255)),
! index mqs_to_idx(mqs_to(255)),
! index mqs_subject_idx(mqs_subject(255))
);
! --========================================================================
-- Logs
! --
! -- JMS Nothing has been done here yet
! --========================================================================
drop table if exists obj_log;
create table obj_log (
***************
*** 212,224 ****
index msl_ca_id_idx (msl_ca_id)
);
! -- -------------------------
-- Meta
! -- -------------------------
drop table if exists config;
create table config (
! cf_name varchar(127) not null,
! cf_value varchar(127),
! primary key (cf_name)
);
--- 296,326 ----
index msl_ca_id_idx (msl_ca_id)
);
! --========================================================================
-- Meta
! --========================================================================
!
! --------------------------------------------------------------------------
! -- config
! --
! -- Simple key=value
! --------------------------------------------------------------------------
drop table if exists config;
create table config (
! -- Unique ID
! cf_id integer unsigned not null auto_increment,
!
! -- Cross reference to a specific user
! cf_u_id integer unsigned not null references users(u_id),
!
! -- Key=value pairs
! cf_key varchar(127) not null,
! cf_value varchar(255),
! cf_desc varchar(255),
!
! -- Indices
! primary key (cf_id),
! index cf_u_id_idx (cf_u_id),
! index cf_key_idx (cf_key)
);
|
|
From: Jeff S. <jsq...@us...> - 2004-05-30 01:16:39
|
jsquyres 04/05/29 18:16:31 Modified: libmaildb/db/mysql/doc cr_db.sql Log: Minor fix Revision Changes Path 1.4 +2 -2 maildb/libmaildb/db/mysql/doc/cr_db.sql Index: cr_db.sql =================================================================== RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_db.sql,v retrieving revision 1.3 retrieving revision 1.4 diff -c -w -r1.3 -r1.4 *** cr_db.sql 21 Dec 2002 14:06:57 -0000 1.3 --- cr_db.sql 30 May 2004 01:16:31 -0000 1.4 *************** *** 5,11 **** -- information, see the LICENSE file in the top level directory of the -- MailDB source distribution. -- ! -- $Id: cr_db.sql,v 1.3 2002/12/21 14:06:57 jsquyres Exp $ -- ------------------------------------------------------- -- MailDB database creation --- 5,11 ---- -- information, see the LICENSE file in the top level directory of the -- MailDB source distribution. -- ! -- $Id: cr_db.sql,v 1.4 2004/05/30 01:16:31 jsquyres Exp $ -- ------------------------------------------------------- -- MailDB database creation *************** *** 17,21 **** drop database if exists maildb; create database maildb; ! grant all privileges on maildb.* to maildb identified by 'maildb'; --- 17,21 ---- drop database if exists maildb; create database maildb; ! grant all privileges on maildb.* to maildb@localhost identified by 'maildb'; |
|
From: Jeff S. <jsq...@us...> - 2004-05-30 01:16:02
|
jsquyres 04/05/29 18:15:55 Modified: libmaildb/db/mysql/doc README Log: Fix typo Revision Changes Path 1.4 +2 -2 maildb/libmaildb/db/mysql/doc/README Index: README =================================================================== RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/README,v retrieving revision 1.3 retrieving revision 1.4 diff -c -w -r1.3 -r1.4 *** README 21 Dec 2002 14:06:57 -0000 1.3 --- README 30 May 2004 01:15:53 -0000 1.4 *************** *** 6,12 **** # information, see the LICENSE file in the top level directory of the # MailDB source distribution. # ! # $Id: README,v 1.3 2002/12/21 14:06:57 jsquyres Exp $ # --------------------------------------------------------- 1) If new database, make sure you have a password set for root, and disallow --- 6,12 ---- # information, see the LICENSE file in the top level directory of the # MailDB source distribution. # ! # $Id: README,v 1.4 2004/05/30 01:15:53 jsquyres Exp $ # --------------------------------------------------------- 1) If new database, make sure you have a password set for root, and disallow *************** *** 18,24 **** % mysqladmin -u root reload % mysqladmin -u root password <new-password> ! % myqladmin -u root -p reload 2) Create maildb database --- 18,24 ---- % mysqladmin -u root reload % mysqladmin -u root password <new-password> ! % mysqladmin -u root -p reload 2) Create maildb database |
|
From: Jeff S. <jsq...@us...> - 2003-05-30 13:22:50
|
jsquyres 03/05/30 06:02:35
Modified: . log_accum.pl
Log:
Update scripty-foo to ignore whitespace when mailing out the diffs
Revision Changes Path
1.4 +1 -1 CVSROOT/log_accum.pl
Index: log_accum.pl
===================================================================
RCS file: /cvsroot/maildb/CVSROOT/log_accum.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -c -r1.3 -r1.4
*** log_accum.pl 27 Oct 2002 13:51:20 -0000 1.3
--- log_accum.pl 30 May 2003 13:02:34 -0000 1.4
***************
*** 273,279 ****
. "=================================\n";
}
else {
! open(DIFF, "-|") || exec 'cvs', '-Qn', 'diff', '-c',
"-r$prev_rev", "-r$rev", $file;
}
--- 273,279 ----
. "=================================\n";
}
else {
! open(DIFF, "-|") || exec 'cvs', '-Qn', 'diff', '-cw',
"-r$prev_rev", "-r$rev", $file;
}
|
|
From: Jeff S. <jsq...@os...> - 2003-05-30 13:15:14
|
On Fri, 30 May 2003, Jeff Squyres wrote:
> What were the essential changes that you made, since this diff is
> practically useless?
Here's that diff again, ignoring whitespace (I've updated the CVS
scripty-foo to ignore whitespace to avoid this problem in the future):
Index: cr_maildb.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_maildb.sql,v
retrieving revision 1.6
retrieving revision 1.7
diff -c -w -r1.6 -r1.7
*** cr_maildb.sql 22 May 2003 18:37:49 -0000 1.6
--- cr_maildb.sql 30 May 2003 00:18:00 -0000 1.7
***************
*** 5,11 ****
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: cr_maildb.sql,v 1.6 2003/05/22 18:37:49 lweissler Exp $
-- -------------------------------------------------------
-- maildb tables
--- 5,11 ----
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: cr_maildb.sql,v 1.7 2003/05/30 00:18:00 jlscott3 Exp $
-- -------------------------------------------------------
-- maildb tables
***************
*** 104,114 ****
m_from text,
m_in_reply_to text,
m_sender text,
m_parent_id integer,
m_vw_incl text,
m_vw_excl text,
primary key (m_id),
! index m_msg_id_idx (m_msg_id)
);
-- msg_hdrs
--- 104,120 ----
m_from text,
m_in_reply_to text,
m_sender text,
+ m_reply_to text,
+ m_references text,
m_parent_id integer,
m_vw_incl text,
m_vw_excl text,
primary key (m_id),
! index m_msg_id_idx (m_msg_id),
! index m_date_idx(m_date),
! index m_from_idx(m_from(255)),
! index m_to_idx (m_to(255)),
! index m_subject_idx (m_subject(255))
);
-- msg_hdrs
Index: design.html
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/design.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -c -w -r1.6 -r1.7
*** design.html 22 May 2003 18:37:49 -0000 1.6
--- design.html 30 May 2003 00:18:00 -0000 1.7
***************
*** 125,131 ****
</td>
<td valign="top">Numeric message record identifier (m_id)<br>
</td>
! <td valign="top">Message id (m_msg_id)<br>
</td>
<td valign="top">n/a<br>
</td>
--- 125,132 ----
</td>
<td valign="top">Numeric message record identifier (m_id)<br>
</td>
! <td valign="top">Message id (m_msg_id)<br>Date (m_date)<br>
! From (m_from)<br>To (m_to)<br>Subject (m_subject)
</td>
<td valign="top">n/a<br>
</td>
***************
*** 378,384 ****
</td>
<td valign="top"><br>
</td>
! <td valign="top"><br>
</td>
<td valign="top">To header line contents<br>
</td>
--- 379,385 ----
</td>
<td valign="top"><br>
</td>
! <td valign="top">X<br>
</td>
<td valign="top">To header line contents<br>
</td>
***************
*** 414,420 ****
</td>
<td valign="top"><br>
</td>
! <td valign="top"><br>
</td>
<td valign="top">Subject header line contents<br>
</td>
--- 415,421 ----
</td>
<td valign="top"><br>
</td>
! <td valign="top">X<br>
</td>
<td valign="top">Subject header line contents<br>
</td>
***************
*** 422,432 ****
<tr>
<td valign="top">m_date<br>
</td>
! <td valign="top">text<br>
</td>
<td valign="top"><br>
</td>
! <td valign="top"><br>
</td>
<td valign="top">Date header line contents<br>
</td>
--- 423,433 ----
<tr>
<td valign="top">m_date<br>
</td>
! <td valign="top">datetime<br>
</td>
<td valign="top"><br>
</td>
! <td valign="top">X<br>
</td>
<td valign="top">Date header line contents<br>
</td>
***************
*** 438,444 ****
</td>
<td valign="top"><br>
</td>
! <td valign="top"><br>
</td>
<td valign="top">From header line contents<br>
</td>
--- 439,445 ----
</td>
<td valign="top"><br>
</td>
! <td valign="top">X<br>
</td>
<td valign="top">From header line contents<br>
</td>
***************
*** 468,473 ****
--- 469,498 ----
</td>
</tr>
<tr>
+ <td valign="top">m_reply_to<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">Reply-To header line contents<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">m_references<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">References header line contents<br>
+ </td>
+ </tr>
+ <tr>
<td valign="top">m_parent_id<br>
</td>
<td valign="top">integer<br>
***************
*** 793,799 ****
</p>
<p>...where (U) = unsigned, and L = length of text string. </p>
<p></p>
! <hr><i>Last update: 17 October 2002 by <a href="mailto:li...@av...">Liza
! Weissler</a></i><a href="mailto:li...@av..."> </a><br>
</body>
</html>
--- 818,824 ----
</p>
<p>...where (U) = unsigned, and L = length of text string. </p>
<p></p>
! <hr><i>Last update: 22 May 2003 by <a href="mailto:jls...@do...">James
! Scott</a></i><br>
</body>
</html>
--
{+} Jeff Squyres
{+} jsq...@os...
{+} Research Associate, Open Systems Lab, Indiana University
{+} http://www.osl.iu.edu/
|
|
From: James S. <jl...@do...> - 2003-05-30 13:06:35
|
Jeff Squyres wrote: > James -- > > Heh -- gotta love editing on Unix vs. MS. :-) Crap...next time I'll use Emacs. cvs diff -w should give you the diff without whitespace. > What were the essential changes that you made, since this diff is > practically useless? Whaddaya mean "practically"? :-) Per the log message, I added the following to msg_ids: m_reply_to text, m_references text, index m_date_idx(m_date), index m_from_idx(m_from(255)), index m_to_idx (m_to(255)), index m_subject_idx (m_subject(255)) Plus the associated documentation. I think I fixed a typo in the html somewhere, but I don't remember what it was. I limited the indices on the text fields to the first 255 chars due to performance concerns. That's fairly easy to tweak as we go forward. JLS > > > On Thu, 29 May 2003, James Scott wrote: > > >>jlscott3 03/05/29 17:18:01 >> >> Modified: libmaildb/db/mysql/doc cr_maildb.sql design.html >> Log: >> Added m_reply_to and m_references cols and indices on m_date, m_from, >> m_to and m_subject to msg_ids >> >>Revision Changes Path >>1.7 +224 -218 maildb/libmaildb/db/mysql/doc/cr_maildb.sql >> >>Index: cr_maildb.sql >>=================================================================== >>RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_maildb.sql,v >>retrieving revision 1.6 >>retrieving revision 1.7 >>diff -c -r1.6 -r1.7 >>*** cr_maildb.sql 22 May 2003 18:37:49 -0000 1.6 >>--- cr_maildb.sql 30 May 2003 00:18:00 -0000 1.7 >>*************** >>*** 1,218 **** >>! -- cr_db.sql - MailDB MySQL database creation >>! -- Copyright (c) 2002 MailDB Team >>! -- >>! -- This file is part of the MailDB software package. For license >>! -- information, see the LICENSE file in the top level directory of the >>! -- MailDB source distribution. >>! -- >>! -- $Id: cr_maildb.sql,v 1.6 2003/05/22 18:37:49 lweissler Exp $ >>! -- ------------------------------------------------------- >>! >>! -- maildb tables >>! >>! -- common message data: >>! -- hdrs, mime_types >>! -- user data: >>! -- users, cats, views >>! -- message data: >>! -- msg_ids, msg_hdrs, msg_owners, msg_attach, msg_orig >>! -- logs: >>! -- obj_log, msg_log >>! -- meta: >>! -- config >>! >>! -- ------------------------- >>! -- Common Message Data >>! -- ------------------------- >>! >>! -- hdrs >>! -- -> deleted 10/10/2002 in favor of de-normalizing >>! >>! -- drop table if exists hdrs; >>! -- create table hdrs ( >>! -- h_id integer unsigned not null auto_increment, >>! -- h_desc varchar(20), >>! -- primary key (h_id) >>! -- ); >>! >>! -- mime_types >>! >>! drop table if exists mime_types; >>! create table mime_types ( >>! mt_id integer unsigned not null auto_increment, >>! mt_desc varchar(127), >>! primary key (mt_id), >>! index mt_desc_idx (mt_desc) >>! ); >>! >>! >>! -- ------------------------- >>! -- User Data >>! -- ------------------------- >>! >>! -- users >>! >>! drop table if exists users; >>! create table users ( >>! u_id integer unsigned not null auto_increment, >>! u_desc varchar(127), >>! primary key (u_id), >>! index u_desc_idx (u_desc) >>! ); >>! >>! -- cats >>! >>! drop table if exists cats; >>! create table cats ( >>! ca_id integer unsigned not null auto_increment, >>! ca_u_id integer unsigned not null references users(u_id), >>! ca_desc varchar(127), >>! ca_parent integer unsigned references cats(ca_id), >>! primary key (ca_id), >>! index ca_u_id_idx (ca_u_id) >>! ); >>! >>! -- views >>! >>! drop table if exists views; >>! create table views ( >>! vw_id integer unsigned not null auto_increment, >>! vw_desc varchar(127), >>! vw_u_id integer unsigned not null references users(u_id), >>! vw_query text, >>! primary key (vw_id), >>! index vw_u_id_idx (vw_u_id) >>! ); >>! >>! >>! -- ------------------------- >>! -- Message Data >>! -- ------------------------- >>! >>! -- msg_ids >>! >>! drop table if exists msg_ids; >>! >>! create table msg_ids ( >>! m_id integer unsigned not null auto_increment, >>! m_msg_id varchar(255) not null, >>! m_to text, >>! m_cc text, >>! m_bcc text, >>! m_subject text, >>! m_date datetime, >>! m_from text, >>! m_in_reply_to text, >>! m_sender text, >>! m_parent_id integer, >>! m_vw_incl text, >>! m_vw_excl text, >>! primary key (m_id), >>! index m_msg_id_idx (m_msg_id) >>! ); >>! >>! -- msg_hdrs >>! >>! drop table if exists msg_hdrs; >>! create table msg_hdrs ( >>! mh_id integer unsigned not null auto_increment, >>! mh_m_id integer unsigned not null references msg_ids(m_id), >>! mh_key varchar(63) not null, >>! mh_value varchar(255), >>! mh_sort_order integer unsigned, >>! primary key (mh_id), >>! index mh_m_id_idx (mh_m_id), >>! index mh_key_idx (mh_key), >>! fulltext index mh_value_idx (mh_value) >>! ); >>! >>! -- msg_owners >>! >>! drop table if exists msg_owners; >>! create table msg_owners ( >>! mu_id integer unsigned not null auto_increment, >>! mu_m_id integer unsigned not null references msg_ids(m_id), >>! mu_u_id integer unsigned not null references users(u_id), >>! mu_ca_id integer unsigned not null references cats(ca_id), >>! -- mu_date integer unsigned not null references msg_hdrs(mh_id), >>! -- mu_from integer unsigned not null references msg_hdrs(mh_id), >>! -- mu_subject integer unsigned not null references msg_hdrs(mh_id), >>! mu_flags integer, >>! primary key (mu_id), >>! index mu_m_id_idx (mu_m_id), >>! index mu_u_id_idx (mu_u_id), >>! index mu_ca_id_idx (mu_ca_id) >>! ); >>! >>! -- msg_attach >>! -- ma_in_fs bool, \ removed >>! -- ma_in_msg bool, / 5/22/03 >>! >>! drop table if exists msg_attach; >>! create table msg_attach ( >>! ma_id integer unsigned not null auto_increment, >>! ma_m_id integer unsigned not null references msg_ids(m_id), >>! ma_mt_id integer unsigned not null references mime_types(mt_id), >>! ma_encode varchar(127), >>! ma_body mediumtext, >>! ma_path varchar(255), >>! ma_sep_data varchar(255), >>! ma_sort_order integer unsigned, >>! primary key (ma_id), >>! index ma_m_id_idx (ma_m_id), >>! fulltext index ma_body_idx (ma_body) >>! ); >>! >>! -- msg_orig >>! >>! drop table if exists msg_orig; >>! create table msg_orig ( >>! mo_id integer unsigned not null auto_increment, >>! mo_m_id integer unsigned not null references msg_ids(m_id), >>! mo_text longtext, >>! primary key (mo_id), >>! index mo_m_id_idx (mo_m_id) >>! ); >>! >>! -- ------------------------- >>! -- Logs >>! -- ------------------------- >>! >>! drop table if exists obj_log; >>! create table obj_log ( >>! obj_id integer unsigned not null auto_increment, >>! obj_type varchar(15), >>! obj_type_id integer unsigned not null, >>! obj_desc varchar(127), >>! obj_action char(1), >>! obj_datetime timestamp, >>! primary key (obj_id), >>! index obj_type_idx (obj_type), >>! index obj_type_id_idx (obj_type_id), >>! index obj_desc_idx (obj_desc) >>! ); >>! >>! drop table if exists msg_log; >>! create table msg_log ( >>! msl_id integer unsigned not null auto_increment, >>! msl_m_id integer unsigned not null, >>! msl_u_id integer unsigned not null, >>! msl_ca_id integer unsigned not null, >>! msl_action char(1), >>! msl_datetime timestamp, >>! primary key (msl_id), >>! index msl_m_id_idx (msl_m_id), >>! index msl_u_id_idx (msl_u_id), >>! index msl_ca_id_idx (msl_ca_id) >>! ); >>! >>! -- ------------------------- >>! -- Meta >>! -- ------------------------- >>! >>! drop table if exists config; >>! create table config ( >>! cf_name varchar(127) not null, >>! cf_value varchar(127), >>! primary key (cf_name) >>! ); >>--- 1,224 ---- >>! -- cr_db.sql - MailDB MySQL database creation >>! -- Copyright (c) 2002 MailDB Team >>! -- >>! -- This file is part of the MailDB software package. For license >>! -- information, see the LICENSE file in the top level directory of the >>! -- MailDB source distribution. >>! -- >>! -- $Id: cr_maildb.sql,v 1.7 2003/05/30 00:18:00 jlscott3 Exp $ >>! -- ------------------------------------------------------- >>! >>! -- maildb tables >>! >>! -- common message data: >>! -- hdrs, mime_types >>! -- user data: >>! -- users, cats, views >>! -- message data: >>! -- msg_ids, msg_hdrs, msg_owners, msg_attach, msg_orig >>! -- logs: >>! -- obj_log, msg_log >>! -- meta: >>! -- config >>! >>! -- ------------------------- >>! -- Common Message Data >>! -- ------------------------- >>! >>! -- hdrs >>! -- -> deleted 10/10/2002 in favor of de-normalizing >>! >>! -- drop table if exists hdrs; >>! -- create table hdrs ( >>! -- h_id integer unsigned not null auto_increment, >>! -- h_desc varchar(20), >>! -- primary key (h_id) >>! -- ); >>! >>! -- mime_types >>! >>! drop table if exists mime_types; >>! create table mime_types ( >>! mt_id integer unsigned not null auto_increment, >>! mt_desc varchar(127), >>! primary key (mt_id), >>! index mt_desc_idx (mt_desc) >>! ); >>! >>! >>! -- ------------------------- >>! -- User Data >>! -- ------------------------- >>! >>! -- users >>! >>! drop table if exists users; >>! create table users ( >>! u_id integer unsigned not null auto_increment, >>! u_desc varchar(127), >>! primary key (u_id), >>! index u_desc_idx (u_desc) >>! ); >>! >>! -- cats >>! >>! drop table if exists cats; >>! create table cats ( >>! ca_id integer unsigned not null auto_increment, >>! ca_u_id integer unsigned not null references users(u_id), >>! ca_desc varchar(127), >>! ca_parent integer unsigned references cats(ca_id), >>! primary key (ca_id), >>! index ca_u_id_idx (ca_u_id) >>! ); >>! >>! -- views >>! >>! drop table if exists views; >>! create table views ( >>! vw_id integer unsigned not null auto_increment, >>! vw_desc varchar(127), >>! vw_u_id integer unsigned not null references users(u_id), >>! vw_query text, >>! primary key (vw_id), >>! index vw_u_id_idx (vw_u_id) >>! ); >>! >>! >>! -- ------------------------- >>! -- Message Data >>! -- ------------------------- >>! >>! -- msg_ids >>! >>! drop table if exists msg_ids; >>! >>! create table msg_ids ( >>! m_id integer unsigned not null auto_increment, >>! m_msg_id varchar(255) not null, >>! m_to text, >>! m_cc text, >>! m_bcc text, >>! m_subject text, >>! m_date datetime, >>! m_from text, >>! m_in_reply_to text, >>! m_sender text, >>! m_reply_to text, >>! m_references text, >>! m_parent_id integer, >>! m_vw_incl text, >>! m_vw_excl text, >>! primary key (m_id), >>! index m_msg_id_idx (m_msg_id), >>! index m_date_idx(m_date), >>! index m_from_idx(m_from(255)), >>! index m_to_idx (m_to(255)), >>! index m_subject_idx (m_subject(255)) >>! ); >>! >>! -- msg_hdrs >>! >>! drop table if exists msg_hdrs; >>! create table msg_hdrs ( >>! mh_id integer unsigned not null auto_increment, >>! mh_m_id integer unsigned not null references msg_ids(m_id), >>! mh_key varchar(63) not null, >>! mh_value varchar(255), >>! mh_sort_order integer unsigned, >>! primary key (mh_id), >>! index mh_m_id_idx (mh_m_id), >>! index mh_key_idx (mh_key), >>! fulltext index mh_value_idx (mh_value) >>! ); >>! >>! -- msg_owners >>! >>! drop table if exists msg_owners; >>! create table msg_owners ( >>! mu_id integer unsigned not null auto_increment, >>! mu_m_id integer unsigned not null references msg_ids(m_id), >>! mu_u_id integer unsigned not null references users(u_id), >>! mu_ca_id integer unsigned not null references cats(ca_id), >>! -- mu_date integer unsigned not null references msg_hdrs(mh_id), >>! -- mu_from integer unsigned not null references msg_hdrs(mh_id), >>! -- mu_subject integer unsigned not null references msg_hdrs(mh_id), >>! mu_flags integer, >>! primary key (mu_id), >>! index mu_m_id_idx (mu_m_id), >>! index mu_u_id_idx (mu_u_id), >>! index mu_ca_id_idx (mu_ca_id) >>! ); >>! >>! -- msg_attach >>! -- ma_in_fs bool, \ removed >>! -- ma_in_msg bool, / 5/22/03 >>! >>! drop table if exists msg_attach; >>! create table msg_attach ( >>! ma_id integer unsigned not null auto_increment, >>! ma_m_id integer unsigned not null references msg_ids(m_id), >>! ma_mt_id integer unsigned not null references mime_types(mt_id), >>! ma_encode varchar(127), >>! ma_body mediumtext, >>! ma_path varchar(255), >>! ma_sep_data varchar(255), >>! ma_sort_order integer unsigned, >>! primary key (ma_id), >>! index ma_m_id_idx (ma_m_id), >>! fulltext index ma_body_idx (ma_body) >>! ); >>! >>! -- msg_orig >>! >>! drop table if exists msg_orig; >>! create table msg_orig ( >>! mo_id integer unsigned not null auto_increment, >>! mo_m_id integer unsigned not null references msg_ids(m_id), >>! mo_text longtext, >>! primary key (mo_id), >>! index mo_m_id_idx (mo_m_id) >>! ); >>! >>! -- ------------------------- >>! -- Logs >>! -- ------------------------- >>! >>! drop table if exists obj_log; >>! create table obj_log ( >>! obj_id integer unsigned not null auto_increment, >>! obj_type varchar(15), >>! obj_type_id integer unsigned not null, >>! obj_desc varchar(127), >>! obj_action char(1), >>! obj_datetime timestamp, >>! primary key (obj_id), >>! index obj_type_idx (obj_type), >>! index obj_type_id_idx (obj_type_id), >>! index obj_desc_idx (obj_desc) >>! ); >>! >>! drop table if exists msg_log; >>! create table msg_log ( >>! msl_id integer unsigned not null auto_increment, >>! msl_m_id integer unsigned not null, >>! msl_u_id integer unsigned not null, >>! msl_ca_id integer unsigned not null, >>! msl_action char(1), >>! msl_datetime timestamp, >>! primary key (msl_id), >>! index msl_m_id_idx (msl_m_id), >>! index msl_u_id_idx (msl_u_id), >>! index msl_ca_id_idx (msl_ca_id) >>! ); >>! >>! -- ------------------------- >>! -- Meta >>! -- ------------------------- >>! >>! drop table if exists config; >>! create table config ( >>! cf_name varchar(127) not null, >>! cf_value varchar(127), >>! primary key (cf_name) >>! ); >> >> >> >>1.7 +824 -799 maildb/libmaildb/db/mysql/doc/design.html >> >>Index: design.html >>=================================================================== >>RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/design.html,v >>retrieving revision 1.6 >>retrieving revision 1.7 >>diff -c -r1.6 -r1.7 >>*** design.html 22 May 2003 18:37:49 -0000 1.6 >>--- design.html 30 May 2003 00:18:00 -0000 1.7 >>*************** >>*** 1,799 **** >>! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> >>! <html> >>! <head> >>! <!-- saved from url=(0189)http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1 --> >>! <meta http-equiv="Content-Type" >>! content="text/html; charset=windows-1252"> >>! <meta content="MSHTML 5.50.4611.1300" name="GENERATOR"> >>! <title>MailDB Design</title> >>! </head> >>! <body> >>! <h1>MailDB Database Design</h1> >>! <p><a href="#intro">Introduction</a><br> >>! <a href="#tables">Table Descriptions</a><br> >>! <a href="#issues">Open Questions/Issues</a><br> >>! <a href="#details">Table Details</a><br> >>! <a href="#storage">MySQL Storage Notes</a><br> >>! </p> >>! <p></p> >>! <hr><a name="intro"></a> >>! <h2>Introduction</h2> >>! <p>This document describes the proposed design for the MailDB database. This >>! design is a work-in-progress and is subject to change; outstanding questions/issues >>! are listed below in <a >>! href="http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1#issues">Open >>! Questions/Issues</a>. </p> >>! <p>This initial design assumes use of MySQL as the backend RDBMS. The design >>! is generally normalized, the notable exception being message >>! header tags (left of the colon) in the individual header records (which >>! are stored in the msg_hdrs table). In this case the benefits of normalizing >>! the data seemed to be outweighed by the slight increase in complexity of >>! queries. [Note: I'm a bit on the fence on this one...decision not final. >>! :-) -- lyw] </p> >>! <p>Table summary descriptions are provided in the following section. A detailed >>! description of table columns, datatypes, and a brief description/use of columns >>! is in <a href="#details">Table Details</a>, below. The full SQL for table >>! creation may be found in accompanying file <a href="cr_maildb.sql">cr_maildb.sql</a>, >>! and sample queries are provided in accompanying file <a >>! href="queries.sql">queries.sql</a>. </p> >>! <hr><a name="tables"></a> >>! <h2>Table Descriptions</h2> >>! <p>There are four basic categories of tables: data common to all messages, >>! user meta data, message data, and logs. </p> >>! <p> >>! <table border="1"> >>! <tbody> >>! <tr> >>! <th colspan="6">Common message data</th> >>! </tr> >>! <tr> >>! <th>Table</th> >>! <th>Description</th> >>! <th>Primary key</th> >>! <th>Add'l Indexes</th> >>! <th>References</th> >>! <th>Referenced by</th> >>! </tr> >>! <tr> >>! <td valign="top">mime_types</td> >>! <td valign="top">Normalized table of mime_type definitions.</td> >>! <td valign="top">Mime type numeric identifier (mt_id)</td> >>! <td valign="top">Mime type (mt_desc)</td> >>! <td valign="top">n/a</td> >>! <td valign="top">msg_attach</td> >>! </tr> >>! <tr> >>! <th colspan="6">User meta data</th> >>! </tr> >>! <tr> >>! <th>Table</th> >>! <th>Description</th> >>! <th>Primary key</th> >>! <th>Add'l Indexes</th> >>! <th>References</th> >>! <th>Referenced by</th> >>! </tr> >>! <tr> >>! <td valign="top">users</td> >>! <td valign="top">Normalized table of MailDB users.</td> >>! <td valign="top">User numeric identifier (u_id)</td> >>! <td valign="top">User name (u_desc)</td> >>! <td valign="top">n/a</td> >>! <td valign="top">cats<br> >>! views<br> >>! msg_owners</td> >>! </tr> >>! <tr> >>! <td valign="top">cats</td> >>! <td valign="top">Message categories (i.e. "folders") created by users, >>! to which messages are assigned. Categories may be [multiply] nested, >>! and messages may assigned to multiple categories.</td> >>! <td valign="top">Category numeric identifier (ca_id)</td> >>! <td valign="top">Category owner (ca_u_id)</td> >>! <td valign="top">n/a</td> >>! <td valign="top">msg_owners</td> >>! </tr> >>! <tr> >>! </tr> >>! <tr> >>! <td valign="top">views</td> >>! <td valign="top">User views of messages...specifically, defined search >>! criteria and the SQL required to execute the searches.</td> >>! <td valign="top">View numeric identifier (vw_id)</td> >>! <td valign="top">View owner (vw_u_id)</td> >>! <td valign="top">users</td> >>! <td valign="top">n/a</td> >>! </tr> >>! <tr> >>! <th colspan="6">Message data</th> >>! </tr> >>! <tr> >>! <th>Table</th> >>! <th>Description</th> >>! <th>Primary key</th> >>! <th>Add'l Indexes</th> >>! <th>References</th> >>! <th>Referenced by</th> >>! </tr> >>! <tr> >>! <td valign="top">msg_ids<br> >>! </td> >>! <td valign="top">Semi-normalized table of message ids. Also contains >>! "well-known" message headers -- including to, cc, bcc, subject, date, >>! from, in-reply-to, sender. (Note all header lines are also stored in >>! msg_hdrs.)<br> >>! </td> >>! <td valign="top">Numeric message record identifier (m_id)<br> >>! </td> >>! <td valign="top">Message id (m_msg_id)<br> >>! </td> >>! <td valign="top">n/a<br> >>! </td> >>! <td valign="top">msg_hdrs, msg_owners, msg_attach, msg_log<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">msg_hdrs</td> >>! <td valign="top">Message header information for a given message. Message >>! header sort order is maintained. Multiple records will exist for each >>! message, one per unique header line. </td> >>! <td valign="top">Numeric message header record identifier (mh_id)</td> >>! <td valign="top">Normalized message id (mh_m_id), header key (mh_key), >>! header value (mh_value) [fulltext index]</td> >>! <td valign="top">n/a</td> >>! <td valign="top">msg_owners</td> >>! </tr> >>! <tr> >>! <td valign="top">msg_owners</td> >>! <td valign="top">Records describing user instances (category filing) >>! of specific messages. Users may assign messages to one or more categories, >>! thus multiple records may exist in the table for a given message & >>! user. Includes references into msg_hdrs table for faster retrieval >>! of message date, sender, subject for category "scans".</td> >>! <td valign="top">Message instance numeric identifier (mu_id).</td> >>! <td valign="top">Normalized message id (mu_m_id), user (mu_u_id), category >>! (mu_ca_id)</td> >>! <td valign="top">users, cats, msg_hdrs</td> >>! <td valign="top">n/a</td> >>! </tr> >>! <tr> >>! <td valign="top">msg_attach</td> >>! <td valign="top">Attachments to a given message. Message "body" not in >>! an attachment is treated within the database as attachment 0. Attachment >>! sort order is maintained. Records include mime type, file encoding, >>! multi-part separator data, flag for attachment storage (0 = internal, >>! in the database; 1 = external, in the filesystem).</td> >>! <td valign="top">Message attachment numeric identifier (ma_id).</td> >>! <td valign="top">Normalized message id (ma_m_id), body (ma_body) [fulltext >>! index]</td> >>! <td valign="top">mime_types</td> >>! <td valign="top">n/a</td> >>! </tr> >>! <tr> >>! <th colspan="6">Logging</th> >>! </tr> >>! <tr> >>! <th>Table</th> >>! <th>Description</th> >>! <th>Primary key</th> >>! <th>Add'l Indexes</th> >>! <th>References</th> >>! <th>Referenced by</th> >>! </tr> >>! <tr> >>! <td valign="top">obj_log</td> >>! <td valign="top">History of actions on meta objects - namely, create, >>! update, delete of users, categories, views, mime_types. To be maintained >>! via trigger (to be defined).</td> >>! <td valign="top">Numeric log record identifier (obj_id)</td> >>! <td valign="top">Object type (obj_type), object identifier (obj_type_id), >>! object description (obj_desc)</td> >>! <td valign="top">n/a</td> >>! <td valign="top">n/a</td> >>! </tr> >>! <tr> >>! <td valign="top">msg_log</td> >>! <td valign="top">History of message activity - user adds, deletes from >>! categories. To be maintained via trigger (to be defined).</td> >>! <td valign="top">Numeric log record identifier (msl_id).</td> >>! <td valign="top">Normalized message id (msl_m_id), user (msl_u_id), category >>! (msl_ca_id)</td> >>! <td valign="top">n/a</td> >>! <td valign="top">n/a</td> >>! </tr> >>! </tbody> >>! </table> >>! </p> >>! <hr><a name="issues"></a> >>! <h2>Open Questions/Issues</h2> >>! <ol> >>! <li>Design issues >>! <ol type="a"> >>! <li>Review all field sizing, especially msg_id and record identifiers. >>! </li> >>! <li>Should header info be normalized? Not done so above. </li> >>! <li>Should users or mime_types be de-normalized? </li> >>! </ol> >>! </li> >>! <li>MySQL specifics >>! <ol type="a"> >>! <li>Triggers for maintaining log (history) tables. <b>Update: No trigger >>! or stored procedure support in MySQL. Estimate is that these items will >>! be included in version 5.0. Current stable MySQL is 3.23.x and 4.x is now >>! available.</b> </li> >>! <li>Check MySQL behavior when auto_incremented column "rolls over". >>! </li> >>! <li>Review MySQL regex pattern matching. </li> >>! <li>Note vanilla MySQL has no true foreign key constraints. You can >>! define the foreign keys (foo integer references bar(foo)) but they aren't >>! enforced. </li> >>! </ol> >>! </li> >>! <li>Message questions >>! <ol type="a"> >>! <li>Multi-part separator data format? </li> >>! <li>Which header line is used for message threading? Should it be included >>! in msg_owners table for quick category scanning? </li> >>! </ol> >>! </li> >>! <li>Miscellaneous >>! <ol type="a"> >>! <li>Construct and test sample queries... </li> >>! </ol> >>! </li> >>! </ol> >>! <hr><a name="details"></a> >>! <h2>Table Details</h2> >>! <table border="1"> >>! <tbody> >>! <tr> >>! <th>Table</th> >>! <th>Column</th> >>! <th>Datatype</th> >>! <th>Primary Key</th> >>! <th>Indexed</th> >>! <th>Description</th> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="2">mime_types</td> >>! <td>mt_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for mime_type record</td> >>! </tr> >>! <tr> >>! <td>mt_desc</td> >>! <td>varchar(127)</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Message body/attachment MIME type</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="2">users</td> >>! <td>u_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for user record</td> >>! </tr> >>! <tr> >>! <td>u_desc</td> >>! <td>varchar(127)</td> >>! <td>?</td> >>! <td>X</td> >>! <td>User description (login/reference name, e.g. 'weissler' or >>! 'li...@av...'</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="4">cats</td> >>! <td>ca_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for category record</td> >>! </tr> >>! <tr> >>! <td>ca_u_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>User owning this category. References users(u_id).</td> >>! </tr> >>! <tr> >>! <td>ca_desc</td> >>! <td>varchar(127)</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Category name, e.g. "Inbox", "Deleted", "Cycling"...</td> >>! </tr> >>! <tr> >>! <td>ca_parent</td> >>! <td>integer unsigned</td> >>! <td>?</td> >>! <td>?</td> >>! <td>"Parent" category, allowing nesting of categories. Top-level >>! categories have null parents. References cats(ca_id).</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="4">views</td> >>! <td>vw_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for view record</td> >>! </tr> >>! <tr> >>! <td>vw_desc</td> >>! <td>varchar(127)</td> >>! <td>?</td> >>! <td>?</td> >>! <td>View name, e.g. "Messages from Robert"</td> >>! </tr> >>! <tr> >>! <td>vw_u_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>User owning view. References users(u_id).</td> >>! </tr> >>! <tr> >>! <td>vw_query</td> >>! <td>text</td> >>! <td>?</td> >>! <td>?</td> >>! <td>SQL required to retrieve messages meeting user's search criteria</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="13">msg_ids<br> >>! </td> >>! <td valign="top">m_id<br> >>! </td> >>! <td valign="top">integer unsigned not null auto_increment<br> >>! </td> >>! <td valign="top">X<br> >>! </td> >>! <td valign="top">X<br> >>! </td> >>! <td valign="top">Unique identifier for message id (using less storage >>! than the string message_id's in messages)<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_msg_id<br> >>! </td> >>! <td valign="top">varchar(255)<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">X<br> >>! </td> >>! <td valign="top">Message identifier (assigned by MTA)<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_to<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">To header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_cc<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">CC header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_bcc<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">BCC header line contents (outgoing msgs only)<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_subject<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">Subject header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_date<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">Date header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_from<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">From header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_in_reply_to<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">In-Reply-To header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_sender<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">Sender header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_parent_id<br> >>! </td> >>! <td valign="top">integer<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">If attachment, m_id of parent message<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_vw_incl<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">Specify views in which to include this message<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_vw_excl<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">Specify views from which to exclude this message<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="5">msg_hdrs</td> >>! <td>mh_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for message header record</td> >>! </tr> >>! <tr> >>! <td>mh_m_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Message identifier</td> >>! </tr> >>! <tr> >>! <td>mh_key</td> >>! <td>varchar(63)</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Header tag - e.g. "To", "From", "Subject"...anything left of colon >>! (:) on header line. </td> >>! </tr> >>! <tr> >>! <td>mh_value</td> >>! <td>varchar(255)</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Header value - anything right of colon (:) on header line. Fulltext >>! index.</td> >>! </tr> >>! <tr> >>! <td>mh_sort_order</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Header sequence number.</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="5">msg_owners</td> >>! <td>mu_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for message instance record.</td> >>! </tr> >>! <tr> >>! <td>mu_m_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Message identifier.</td> >>! </tr> >>! <tr> >>! <td>mu_u_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>User owning a copy of the message.</td> >>! </tr> >>! <tr> >>! <td>mu_ca_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Category to which the user assigned the message.</td> >>! </tr> >>! <tr> >>! <td>mu_flags</td> >>! <td>integer unsigned</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Bit flags for the message.</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="8">msg_attach</td> >>! <td>ma_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for message attachment record.</td> >>! </tr> >>! <tr> >>! <td>ma_m_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Message identifier.</td> >>! </tr> >>! <tr> >>! <td>ma_mt_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Foreign key ref to mime_types(mt_id)</td> >>! </tr> >>! <tr> >>! <td>ma_encode</td> >>! <td>varchar(127)</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Attachment encoding</td> >>! </tr> >>! <tr> >>! <td>ma_body</td> >>! <td>mediumtext</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Attachment body (for attachments stored within the database). Fulltext >>! index.</td> >>! </tr> >>! <tr> >>! <td>ma_path</td> >>! <td>varchar(255)</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Full pathname to attachment (for attachments stored in the filesystem).</td> >>! </tr> >>! <tr> >>! <td>ma_sep_data</td> >>! <td>varchar(255)</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Multi-part separator data.</td> >>! </tr> >>! <tr> >>! <td>ma_sort_order</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Attachment sequence number.</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="6">obj_log</td> >>! <td>obj_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for object log record.</td> >>! </tr> >>! <tr> >>! <td>obj_type</td> >>! <td>varchar(15)</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Type of object - e.g. user, view, cat, mime_type</td> >>! </tr> >>! <tr> >>! <td>obj_type_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Object identifier; if obj_type = user, obj_type_id corresponds to >>! users(u_id), obj_type = cat, obj_type_id corresponds to cats(ca_id), >>! etc.</td> >>! </tr> >>! <tr> >>! <td>obj_desc</td> >>! <td>varchar(127)</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Object description (username, viewname, category name...)</td> >>! </tr> >>! <tr> >>! <td>obj_action</td> >>! <td>char(1)</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Action taken on this object. Values include C (create), U (update), >>! D (delete).</td> >>! </tr> >>! <tr> >>! <td>obj_datetime</td> >>! <td>timestamp(14)</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Timestamp of object action.</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="6">msg_log</td> >>! <td>msl_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for message log record.</td> >>! </tr> >>! <tr> >>! <td>msl_m_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Message identifier.</td> >>! </tr> >>! <tr> >>! <td>msl_u_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>User owning instance of the specified message.</td> >>! </tr> >>! <tr> >>! <td>msl_ca_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Category to which the user assigned the message.</td> >>! </tr> >>! <tr> >>! <td>msl_action</td> >>! <td>char(1)</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Action taken on this message. Values include C (create), U (update), >>! D (delete).</td> >>! </tr> >>! <tr> >>! <td>msl_datetime</td> >>! <td>timestamp(14)</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Timestamp of message action.</td> >>! </tr> >>! </tbody> >>! </table> >>! <p></p> >>! <hr><a name="storage"></a> >>! <h2>MySQL Storage Notes</h2> >>! <p> >>! <table border="1"> >>! <tbody> >>! <tr> >>! <th>Datatype</th> >>! <th>Max</th> >>! <th>Storage</th> >>! </tr> >>! <tr> >>! <td>varchar</td> >>! <td>255</td> >>! <td>L+1</td> >>! </tr> >>! <tr> >>! <td>tinytext</td> >>! <td>255</td> >>! <td>L+1</td> >>! </tr> >>! <tr> >>! <td>text</td> >>! <td>64k</td> >>! <td>L+2</td> >>! </tr> >>! <tr> >>! <td>mediumtext</td> >>! <td>16m</td> >>! <td>L+3</td> >>! </tr> >>! <tr> >>! <td>longtext</td> >>! <td>4g</td> >>! <td>L+4</td> >>! </tr> >>! <tr> >>! <td>tinyint (U)</td> >>! <td>255</td> >>! <td>1</td> >>! </tr> >>! <tr> >>! <td>smallint (U)</td> >>! <td>65535</td> >>! <td>2</td> >>! </tr> >>! <tr> >>! <td>mediumint (U)</td> >>! <td>16777215</td> >>! <td>3</td> >>! </tr> >>! <tr> >>! <td>integer (U)</td> >>! <td>4294967295</td> >>! <td>4</td> >>! </tr> >>! <tr> >>! <td>timestamp</td> >>! <td>YYYYMMDDHHMISS</td> >>! <td>4</td> >>! </tr> >>! </tbody> >>! </table> >>! </p> >>! <p>...where (U) = unsigned, and L = length of text string. </p> >>! <p></p> >>! <hr><i>Last update: 17 October 2002 by <a href="mailto:li...@av...">Liza >>! Weissler</a></i><a href="mailto:li...@av..."> </a><br> >>! </body> >>! </html> >>--- 1,824 ---- >>! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> >>! <html> >>! <head> >>! <!-- saved from url=(0189)http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1 --> >>! <meta http-equiv="Content-Type" >>! content="text/html; charset=windows-1252"> >>! <meta content="MSHTML 5.50.4611.1300" name="GENERATOR"> >>! <title>MailDB Design</title> >>! </head> >>! <body> >>! <h1>MailDB Database Design</h1> >>! <p><a href="#intro">Introduction</a><br> >>! <a href="#tables">Table Descriptions</a><br> >>! <a href="#issues">Open Questions/Issues</a><br> >>! <a href="#details">Table Details</a><br> >>! <a href="#storage">MySQL Storage Notes</a><br> >>! </p> >>! <p></p> >>! <hr><a name="intro"></a> >>! <h2>Introduction</h2> >>! <p>This document describes the proposed design for the MailDB database. This >>! design is a work-in-progress and is subject to change; outstanding questions/issues >>! are listed below in <a >>! href="http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1#issues">Open >>! Questions/Issues</a>. </p> >>! <p>This initial design assumes use of MySQL as the backend RDBMS. The design >>! is generally normalized, the notable exception being message >>! header tags (left of the colon) in the individual header records (which >>! are stored in the msg_hdrs table). In this case the benefits of normalizing >>! the data seemed to be outweighed by the slight increase in complexity of >>! queries. [Note: I'm a bit on the fence on this one...decision not final. >>! :-) -- lyw] </p> >>! <p>Table summary descriptions are provided in the following section. A detailed >>! description of table columns, datatypes, and a brief description/use of columns >>! is in <a href="#details">Table Details</a>, below. The full SQL for table >>! creation may be found in accompanying file <a href="cr_maildb.sql">cr_maildb.sql</a>, >>! and sample queries are provided in accompanying file <a >>! href="queries.sql">queries.sql</a>. </p> >>! <hr><a name="tables"></a> >>! <h2>Table Descriptions</h2> >>! <p>There are four basic categories of tables: data common to all messages, >>! user meta data, message data, and logs. </p> >>! <p> >>! <table border="1"> >>! <tbody> >>! <tr> >>! <th colspan="6">Common message data</th> >>! </tr> >>! <tr> >>! <th>Table</th> >>! <th>Description</th> >>! <th>Primary key</th> >>! <th>Add'l Indexes</th> >>! <th>References</th> >>! <th>Referenced by</th> >>! </tr> >>! <tr> >>! <td valign="top">mime_types</td> >>! <td valign="top">Normalized table of mime_type definitions.</td> >>! <td valign="top">Mime type numeric identifier (mt_id)</td> >>! <td valign="top">Mime type (mt_desc)</td> >>! <td valign="top">n/a</td> >>! <td valign="top">msg_attach</td> >>! </tr> >>! <tr> >>! <th colspan="6">User meta data</th> >>! </tr> >>! <tr> >>! <th>Table</th> >>! <th>Description</th> >>! <th>Primary key</th> >>! <th>Add'l Indexes</th> >>! <th>References</th> >>! <th>Referenced by</th> >>! </tr> >>! <tr> >>! <td valign="top">users</td> >>! <td valign="top">Normalized table of MailDB users.</td> >>! <td valign="top">User numeric identifier (u_id)</td> >>! <td valign="top">User name (u_desc)</td> >>! <td valign="top">n/a</td> >>! <td valign="top">cats<br> >>! views<br> >>! msg_owners</td> >>! </tr> >>! <tr> >>! <td valign="top">cats</td> >>! <td valign="top">Message categories (i.e. "folders") created by users, >>! to which messages are assigned. Categories may be [multiply] nested, >>! and messages may assigned to multiple categories.</td> >>! <td valign="top">Category numeric identifier (ca_id)</td> >>! <td valign="top">Category owner (ca_u_id)</td> >>! <td valign="top">n/a</td> >>! <td valign="top">msg_owners</td> >>! </tr> >>! <tr> >>! </tr> >>! <tr> >>! <td valign="top">views</td> >>! <td valign="top">User views of messages...specifically, defined search >>! criteria and the SQL required to execute the searches.</td> >>! <td valign="top">View numeric identifier (vw_id)</td> >>! <td valign="top">View owner (vw_u_id)</td> >>! <td valign="top">users</td> >>! <td valign="top">n/a</td> >>! </tr> >>! <tr> >>! <th colspan="6">Message data</th> >>! </tr> >>! <tr> >>! <th>Table</th> >>! <th>Description</th> >>! <th>Primary key</th> >>! <th>Add'l Indexes</th> >>! <th>References</th> >>! <th>Referenced by</th> >>! </tr> >>! <tr> >>! <td valign="top">msg_ids<br> >>! </td> >>! <td valign="top">Semi-normalized table of message ids. Also contains >>! "well-known" message headers -- including to, cc, bcc, subject, date, >>! from, in-reply-to, sender. (Note all header lines are also stored in >>! msg_hdrs.)<br> >>! </td> >>! <td valign="top">Numeric message record identifier (m_id)<br> >>! </td> >>! <td valign="top">Message id (m_msg_id)<br>Date (m_date)<br> >>! From (m_from)<br>To (m_to)<br>Subject (m_subject) >>! </td> >>! <td valign="top">n/a<br> >>! </td> >>! <td valign="top">msg_hdrs, msg_owners, msg_attach, msg_log<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">msg_hdrs</td> >>! <td valign="top">Message header information for a given message. Message >>! header sort order is maintained. Multiple records will exist for each >>! message, one per unique header line. </td> >>! <td valign="top">Numeric message header record identifier (mh_id)</td> >>! <td valign="top">Normalized message id (mh_m_id), header key (mh_key), >>! header value (mh_value) [fulltext index]</td> >>! <td valign="top">n/a</td> >>! <td valign="top">msg_owners</td> >>! </tr> >>! <tr> >>! <td valign="top">msg_owners</td> >>! <td valign="top">Records describing user instances (category filing) >>! of specific messages. Users may assign messages to one or more categories, >>! thus multiple records may exist in the table for a given message & >>! user. Includes references into msg_hdrs table for faster retrieval >>! of message date, sender, subject for category "scans".</td> >>! <td valign="top">Message instance numeric identifier (mu_id).</td> >>! <td valign="top">Normalized message id (mu_m_id), user (mu_u_id), category >>! (mu_ca_id)</td> >>! <td valign="top">users, cats, msg_hdrs</td> >>! <td valign="top">n/a</td> >>! </tr> >>! <tr> >>! <td valign="top">msg_attach</td> >>! <td valign="top">Attachments to a given message. Message "body" not in >>! an attachment is treated within the database as attachment 0. Attachment >>! sort order is maintained. Records include mime type, file encoding, >>! multi-part separator data, flag for attachment storage (0 = internal, >>! in the database; 1 = external, in the filesystem).</td> >>! <td valign="top">Message attachment numeric identifier (ma_id).</td> >>! <td valign="top">Normalized message id (ma_m_id), body (ma_body) [fulltext >>! index]</td> >>! <td valign="top">mime_types</td> >>! <td valign="top">n/a</td> >>! </tr> >>! <tr> >>! <th colspan="6">Logging</th> >>! </tr> >>! <tr> >>! <th>Table</th> >>! <th>Description</th> >>! <th>Primary key</th> >>! <th>Add'l Indexes</th> >>! <th>References</th> >>! <th>Referenced by</th> >>! </tr> >>! <tr> >>! <td valign="top">obj_log</td> >>! <td valign="top">History of actions on meta objects - namely, create, >>! update, delete of users, categories, views, mime_types. To be maintained >>! via trigger (to be defined).</td> >>! <td valign="top">Numeric log record identifier (obj_id)</td> >>! <td valign="top">Object type (obj_type), object identifier (obj_type_id), >>! object description (obj_desc)</td> >>! <td valign="top">n/a</td> >>! <td valign="top">n/a</td> >>! </tr> >>! <tr> >>! <td valign="top">msg_log</td> >>! <td valign="top">History of message activity - user adds, deletes from >>! categories. To be maintained via trigger (to be defined).</td> >>! <td valign="top">Numeric log record identifier (msl_id).</td> >>! <td valign="top">Normalized message id (msl_m_id), user (msl_u_id), category >>! (msl_ca_id)</td> >>! <td valign="top">n/a</td> >>! <td valign="top">n/a</td> >>! </tr> >>! </tbody> >>! </table> >>! </p> >>! <hr><a name="issues"></a> >>! <h2>Open Questions/Issues</h2> >>! <ol> >>! <li>Design issues >>! <ol type="a"> >>! <li>Review all field sizing, especially msg_id and record identifiers. >>! </li> >>! <li>Should header info be normalized? Not done so above. </li> >>! <li>Should users or mime_types be de-normalized? </li> >>! </ol> >>! </li> >>! <li>MySQL specifics >>! <ol type="a"> >>! <li>Triggers for maintaining log (history) tables. <b>Update: No trigger >>! or stored procedure support in MySQL. Estimate is that these items will >>! be included in version 5.0. Current stable MySQL is 3.23.x and 4.x is now >>! available.</b> </li> >>! <li>Check MySQL behavior when auto_incremented column "rolls over". >>! </li> >>! <li>Review MySQL regex pattern matching. </li> >>! <li>Note vanilla MySQL has no true foreign key constraints. You can >>! define the foreign keys (foo integer references bar(foo)) but they aren't >>! enforced. </li> >>! </ol> >>! </li> >>! <li>Message questions >>! <ol type="a"> >>! <li>Multi-part separator data format? </li> >>! <li>Which header line is used for message threading? Should it be included >>! in msg_owners table for quick category scanning? </li> >>! </ol> >>! </li> >>! <li>Miscellaneous >>! <ol type="a"> >>! <li>Construct and test sample queries... </li> >>! </ol> >>! </li> >>! </ol> >>! <hr><a name="details"></a> >>! <h2>Table Details</h2> >>! <table border="1"> >>! <tbody> >>! <tr> >>! <th>Table</th> >>! <th>Column</th> >>! <th>Datatype</th> >>! <th>Primary Key</th> >>! <th>Indexed</th> >>! <th>Description</th> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="2">mime_types</td> >>! <td>mt_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for mime_type record</td> >>! </tr> >>! <tr> >>! <td>mt_desc</td> >>! <td>varchar(127)</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Message body/attachment MIME type</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="2">users</td> >>! <td>u_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for user record</td> >>! </tr> >>! <tr> >>! <td>u_desc</td> >>! <td>varchar(127)</td> >>! <td>?</td> >>! <td>X</td> >>! <td>User description (login/reference name, e.g. 'weissler' or >>! 'li...@av...'</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="4">cats</td> >>! <td>ca_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for category record</td> >>! </tr> >>! <tr> >>! <td>ca_u_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>User owning this category. References users(u_id).</td> >>! </tr> >>! <tr> >>! <td>ca_desc</td> >>! <td>varchar(127)</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Category name, e.g. "Inbox", "Deleted", "Cycling"...</td> >>! </tr> >>! <tr> >>! <td>ca_parent</td> >>! <td>integer unsigned</td> >>! <td>?</td> >>! <td>?</td> >>! <td>"Parent" category, allowing nesting of categories. Top-level >>! categories have null parents. References cats(ca_id).</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="4">views</td> >>! <td>vw_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for view record</td> >>! </tr> >>! <tr> >>! <td>vw_desc</td> >>! <td>varchar(127)</td> >>! <td>?</td> >>! <td>?</td> >>! <td>View name, e.g. "Messages from Robert"</td> >>! </tr> >>! <tr> >>! <td>vw_u_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>User owning view. References users(u_id).</td> >>! </tr> >>! <tr> >>! <td>vw_query</td> >>! <td>text</td> >>! <td>?</td> >>! <td>?</td> >>! <td>SQL required to retrieve messages meeting user's search criteria</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="13">msg_ids<br> >>! </td> >>! <td valign="top">m_id<br> >>! </td> >>! <td valign="top">integer unsigned not null auto_increment<br> >>! </td> >>! <td valign="top">X<br> >>! </td> >>! <td valign="top">X<br> >>! </td> >>! <td valign="top">Unique identifier for message id (using less storage >>! than the string message_id's in messages)<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_msg_id<br> >>! </td> >>! <td valign="top">varchar(255)<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">X<br> >>! </td> >>! <td valign="top">Message identifier (assigned by MTA)<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_to<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">X<br> >>! </td> >>! <td valign="top">To header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_cc<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">CC header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_bcc<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">BCC header line contents (outgoing msgs only)<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_subject<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">X<br> >>! </td> >>! <td valign="top">Subject header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_date<br> >>! </td> >>! <td valign="top">datetime<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">X<br> >>! </td> >>! <td valign="top">Date header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_from<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">X<br> >>! </td> >>! <td valign="top">From header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_in_reply_to<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">In-Reply-To header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_sender<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">Sender header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_reply_to<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">Reply-To header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_references<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">References header line contents<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_parent_id<br> >>! </td> >>! <td valign="top">integer<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">If attachment, m_id of parent message<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_vw_incl<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">Specify views in which to include this message<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top">m_vw_excl<br> >>! </td> >>! <td valign="top">text<br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top"><br> >>! </td> >>! <td valign="top">Specify views from which to exclude this message<br> >>! </td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="5">msg_hdrs</td> >>! <td>mh_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for message header record</td> >>! </tr> >>! <tr> >>! <td>mh_m_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Message identifier</td> >>! </tr> >>! <tr> >>! <td>mh_key</td> >>! <td>varchar(63)</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Header tag - e.g. "To", "From", "Subject"...anything left of colon >>! (:) on header line. </td> >>! </tr> >>! <tr> >>! <td>mh_value</td> >>! <td>varchar(255)</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Header value - anything right of colon (:) on header line. Fulltext >>! index.</td> >>! </tr> >>! <tr> >>! <td>mh_sort_order</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Header sequence number.</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="5">msg_owners</td> >>! <td>mu_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for message instance record.</td> >>! </tr> >>! <tr> >>! <td>mu_m_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Message identifier.</td> >>! </tr> >>! <tr> >>! <td>mu_u_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>User owning a copy of the message.</td> >>! </tr> >>! <tr> >>! <td>mu_ca_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Category to which the user assigned the message.</td> >>! </tr> >>! <tr> >>! <td>mu_flags</td> >>! <td>integer unsigned</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Bit flags for the message.</td> >>! </tr> >>! <tr> >>! <td valign="top" rowspan="8">msg_attach</td> >>! <td>ma_id</td> >>! <td>integer unsigned not null auto_increment</td> >>! <td>X</td> >>! <td>X</td> >>! <td>Unique identifier for message attachment record.</td> >>! </tr> >>! <tr> >>! <td>ma_m_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>X</td> >>! <td>Message identifier.</td> >>! </tr> >>! <tr> >>! <td>ma_mt_id</td> >>! <td>integer unsigned not null</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Foreign key ref to mime_types(mt_id)</td> >>! </tr> >>! <tr> >>! <td>ma_encode</td> >>! <td>varchar(127)</td> >>! <td>?</td> >>! <td>?</td> >>! <td>Attachment encoding</td> >>! </tr> >>! <tr> >>! <td>ma_body</td> >>! <td>mediu... [truncated message content] |
|
From: Jeff S. <jsq...@os...> - 2003-05-30 12:49:55
|
James -- Heh -- gotta love editing on Unix vs. MS. :-) What were the essential changes that you made, since this diff is practically useless? On Thu, 29 May 2003, James Scott wrote: > jlscott3 03/05/29 17:18:01 > > Modified: libmaildb/db/mysql/doc cr_maildb.sql design.html > Log: > Added m_reply_to and m_references cols and indices on m_date, m_from, > m_to and m_subject to msg_ids > > Revision Changes Path > 1.7 +224 -218 maildb/libmaildb/db/mysql/doc/cr_maildb.sql > > Index: cr_maildb.sql > =================================================================== > RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_maildb.sql,v > retrieving revision 1.6 > retrieving revision 1.7 > diff -c -r1.6 -r1.7 > *** cr_maildb.sql 22 May 2003 18:37:49 -0000 1.6 > --- cr_maildb.sql 30 May 2003 00:18:00 -0000 1.7 > *************** > *** 1,218 **** > ! -- cr_db.sql - MailDB MySQL database creation > ! -- Copyright (c) 2002 MailDB Team > ! -- > ! -- This file is part of the MailDB software package. For license > ! -- information, see the LICENSE file in the top level directory of the > ! -- MailDB source distribution. > ! -- > ! -- $Id: cr_maildb.sql,v 1.6 2003/05/22 18:37:49 lweissler Exp $ > ! -- ------------------------------------------------------- > ! > ! -- maildb tables > ! > ! -- common message data: > ! -- hdrs, mime_types > ! -- user data: > ! -- users, cats, views > ! -- message data: > ! -- msg_ids, msg_hdrs, msg_owners, msg_attach, msg_orig > ! -- logs: > ! -- obj_log, msg_log > ! -- meta: > ! -- config > ! > ! -- ------------------------- > ! -- Common Message Data > ! -- ------------------------- > ! > ! -- hdrs > ! -- -> deleted 10/10/2002 in favor of de-normalizing > ! > ! -- drop table if exists hdrs; > ! -- create table hdrs ( > ! -- h_id integer unsigned not null auto_increment, > ! -- h_desc varchar(20), > ! -- primary key (h_id) > ! -- ); > ! > ! -- mime_types > ! > ! drop table if exists mime_types; > ! create table mime_types ( > ! mt_id integer unsigned not null auto_increment, > ! mt_desc varchar(127), > ! primary key (mt_id), > ! index mt_desc_idx (mt_desc) > ! ); > ! > ! > ! -- ------------------------- > ! -- User Data > ! -- ------------------------- > ! > ! -- users > ! > ! drop table if exists users; > ! create table users ( > ! u_id integer unsigned not null auto_increment, > ! u_desc varchar(127), > ! primary key (u_id), > ! index u_desc_idx (u_desc) > ! ); > ! > ! -- cats > ! > ! drop table if exists cats; > ! create table cats ( > ! ca_id integer unsigned not null auto_increment, > ! ca_u_id integer unsigned not null references users(u_id), > ! ca_desc varchar(127), > ! ca_parent integer unsigned references cats(ca_id), > ! primary key (ca_id), > ! index ca_u_id_idx (ca_u_id) > ! ); > ! > ! -- views > ! > ! drop table if exists views; > ! create table views ( > ! vw_id integer unsigned not null auto_increment, > ! vw_desc varchar(127), > ! vw_u_id integer unsigned not null references users(u_id), > ! vw_query text, > ! primary key (vw_id), > ! index vw_u_id_idx (vw_u_id) > ! ); > ! > ! > ! -- ------------------------- > ! -- Message Data > ! -- ------------------------- > ! > ! -- msg_ids > ! > ! drop table if exists msg_ids; > ! > ! create table msg_ids ( > ! m_id integer unsigned not null auto_increment, > ! m_msg_id varchar(255) not null, > ! m_to text, > ! m_cc text, > ! m_bcc text, > ! m_subject text, > ! m_date datetime, > ! m_from text, > ! m_in_reply_to text, > ! m_sender text, > ! m_parent_id integer, > ! m_vw_incl text, > ! m_vw_excl text, > ! primary key (m_id), > ! index m_msg_id_idx (m_msg_id) > ! ); > ! > ! -- msg_hdrs > ! > ! drop table if exists msg_hdrs; > ! create table msg_hdrs ( > ! mh_id integer unsigned not null auto_increment, > ! mh_m_id integer unsigned not null references msg_ids(m_id), > ! mh_key varchar(63) not null, > ! mh_value varchar(255), > ! mh_sort_order integer unsigned, > ! primary key (mh_id), > ! index mh_m_id_idx (mh_m_id), > ! index mh_key_idx (mh_key), > ! fulltext index mh_value_idx (mh_value) > ! ); > ! > ! -- msg_owners > ! > ! drop table if exists msg_owners; > ! create table msg_owners ( > ! mu_id integer unsigned not null auto_increment, > ! mu_m_id integer unsigned not null references msg_ids(m_id), > ! mu_u_id integer unsigned not null references users(u_id), > ! mu_ca_id integer unsigned not null references cats(ca_id), > ! -- mu_date integer unsigned not null references msg_hdrs(mh_id), > ! -- mu_from integer unsigned not null references msg_hdrs(mh_id), > ! -- mu_subject integer unsigned not null references msg_hdrs(mh_id), > ! mu_flags integer, > ! primary key (mu_id), > ! index mu_m_id_idx (mu_m_id), > ! index mu_u_id_idx (mu_u_id), > ! index mu_ca_id_idx (mu_ca_id) > ! ); > ! > ! -- msg_attach > ! -- ma_in_fs bool, \ removed > ! -- ma_in_msg bool, / 5/22/03 > ! > ! drop table if exists msg_attach; > ! create table msg_attach ( > ! ma_id integer unsigned not null auto_increment, > ! ma_m_id integer unsigned not null references msg_ids(m_id), > ! ma_mt_id integer unsigned not null references mime_types(mt_id), > ! ma_encode varchar(127), > ! ma_body mediumtext, > ! ma_path varchar(255), > ! ma_sep_data varchar(255), > ! ma_sort_order integer unsigned, > ! primary key (ma_id), > ! index ma_m_id_idx (ma_m_id), > ! fulltext index ma_body_idx (ma_body) > ! ); > ! > ! -- msg_orig > ! > ! drop table if exists msg_orig; > ! create table msg_orig ( > ! mo_id integer unsigned not null auto_increment, > ! mo_m_id integer unsigned not null references msg_ids(m_id), > ! mo_text longtext, > ! primary key (mo_id), > ! index mo_m_id_idx (mo_m_id) > ! ); > ! > ! -- ------------------------- > ! -- Logs > ! -- ------------------------- > ! > ! drop table if exists obj_log; > ! create table obj_log ( > ! obj_id integer unsigned not null auto_increment, > ! obj_type varchar(15), > ! obj_type_id integer unsigned not null, > ! obj_desc varchar(127), > ! obj_action char(1), > ! obj_datetime timestamp, > ! primary key (obj_id), > ! index obj_type_idx (obj_type), > ! index obj_type_id_idx (obj_type_id), > ! index obj_desc_idx (obj_desc) > ! ); > ! > ! drop table if exists msg_log; > ! create table msg_log ( > ! msl_id integer unsigned not null auto_increment, > ! msl_m_id integer unsigned not null, > ! msl_u_id integer unsigned not null, > ! msl_ca_id integer unsigned not null, > ! msl_action char(1), > ! msl_datetime timestamp, > ! primary key (msl_id), > ! index msl_m_id_idx (msl_m_id), > ! index msl_u_id_idx (msl_u_id), > ! index msl_ca_id_idx (msl_ca_id) > ! ); > ! > ! -- ------------------------- > ! -- Meta > ! -- ------------------------- > ! > ! drop table if exists config; > ! create table config ( > ! cf_name varchar(127) not null, > ! cf_value varchar(127), > ! primary key (cf_name) > ! ); > --- 1,224 ---- > ! -- cr_db.sql - MailDB MySQL database creation > ! -- Copyright (c) 2002 MailDB Team > ! -- > ! -- This file is part of the MailDB software package. For license > ! -- information, see the LICENSE file in the top level directory of the > ! -- MailDB source distribution. > ! -- > ! -- $Id: cr_maildb.sql,v 1.7 2003/05/30 00:18:00 jlscott3 Exp $ > ! -- ------------------------------------------------------- > ! > ! -- maildb tables > ! > ! -- common message data: > ! -- hdrs, mime_types > ! -- user data: > ! -- users, cats, views > ! -- message data: > ! -- msg_ids, msg_hdrs, msg_owners, msg_attach, msg_orig > ! -- logs: > ! -- obj_log, msg_log > ! -- meta: > ! -- config > ! > ! -- ------------------------- > ! -- Common Message Data > ! -- ------------------------- > ! > ! -- hdrs > ! -- -> deleted 10/10/2002 in favor of de-normalizing > ! > ! -- drop table if exists hdrs; > ! -- create table hdrs ( > ! -- h_id integer unsigned not null auto_increment, > ! -- h_desc varchar(20), > ! -- primary key (h_id) > ! -- ); > ! > ! -- mime_types > ! > ! drop table if exists mime_types; > ! create table mime_types ( > ! mt_id integer unsigned not null auto_increment, > ! mt_desc varchar(127), > ! primary key (mt_id), > ! index mt_desc_idx (mt_desc) > ! ); > ! > ! > ! -- ------------------------- > ! -- User Data > ! -- ------------------------- > ! > ! -- users > ! > ! drop table if exists users; > ! create table users ( > ! u_id integer unsigned not null auto_increment, > ! u_desc varchar(127), > ! primary key (u_id), > ! index u_desc_idx (u_desc) > ! ); > ! > ! -- cats > ! > ! drop table if exists cats; > ! create table cats ( > ! ca_id integer unsigned not null auto_increment, > ! ca_u_id integer unsigned not null references users(u_id), > ! ca_desc varchar(127), > ! ca_parent integer unsigned references cats(ca_id), > ! primary key (ca_id), > ! index ca_u_id_idx (ca_u_id) > ! ); > ! > ! -- views > ! > ! drop table if exists views; > ! create table views ( > ! vw_id integer unsigned not null auto_increment, > ! vw_desc varchar(127), > ! vw_u_id integer unsigned not null references users(u_id), > ! vw_query text, > ! primary key (vw_id), > ! index vw_u_id_idx (vw_u_id) > ! ); > ! > ! > ! -- ------------------------- > ! -- Message Data > ! -- ------------------------- > ! > ! -- msg_ids > ! > ! drop table if exists msg_ids; > ! > ! create table msg_ids ( > ! m_id integer unsigned not null auto_increment, > ! m_msg_id varchar(255) not null, > ! m_to text, > ! m_cc text, > ! m_bcc text, > ! m_subject text, > ! m_date datetime, > ! m_from text, > ! m_in_reply_to text, > ! m_sender text, > ! m_reply_to text, > ! m_references text, > ! m_parent_id integer, > ! m_vw_incl text, > ! m_vw_excl text, > ! primary key (m_id), > ! index m_msg_id_idx (m_msg_id), > ! index m_date_idx(m_date), > ! index m_from_idx(m_from(255)), > ! index m_to_idx (m_to(255)), > ! index m_subject_idx (m_subject(255)) > ! ); > ! > ! -- msg_hdrs > ! > ! drop table if exists msg_hdrs; > ! create table msg_hdrs ( > ! mh_id integer unsigned not null auto_increment, > ! mh_m_id integer unsigned not null references msg_ids(m_id), > ! mh_key varchar(63) not null, > ! mh_value varchar(255), > ! mh_sort_order integer unsigned, > ! primary key (mh_id), > ! index mh_m_id_idx (mh_m_id), > ! index mh_key_idx (mh_key), > ! fulltext index mh_value_idx (mh_value) > ! ); > ! > ! -- msg_owners > ! > ! drop table if exists msg_owners; > ! create table msg_owners ( > ! mu_id integer unsigned not null auto_increment, > ! mu_m_id integer unsigned not null references msg_ids(m_id), > ! mu_u_id integer unsigned not null references users(u_id), > ! mu_ca_id integer unsigned not null references cats(ca_id), > ! -- mu_date integer unsigned not null references msg_hdrs(mh_id), > ! -- mu_from integer unsigned not null references msg_hdrs(mh_id), > ! -- mu_subject integer unsigned not null references msg_hdrs(mh_id), > ! mu_flags integer, > ! primary key (mu_id), > ! index mu_m_id_idx (mu_m_id), > ! index mu_u_id_idx (mu_u_id), > ! index mu_ca_id_idx (mu_ca_id) > ! ); > ! > ! -- msg_attach > ! -- ma_in_fs bool, \ removed > ! -- ma_in_msg bool, / 5/22/03 > ! > ! drop table if exists msg_attach; > ! create table msg_attach ( > ! ma_id integer unsigned not null auto_increment, > ! ma_m_id integer unsigned not null references msg_ids(m_id), > ! ma_mt_id integer unsigned not null references mime_types(mt_id), > ! ma_encode varchar(127), > ! ma_body mediumtext, > ! ma_path varchar(255), > ! ma_sep_data varchar(255), > ! ma_sort_order integer unsigned, > ! primary key (ma_id), > ! index ma_m_id_idx (ma_m_id), > ! fulltext index ma_body_idx (ma_body) > ! ); > ! > ! -- msg_orig > ! > ! drop table if exists msg_orig; > ! create table msg_orig ( > ! mo_id integer unsigned not null auto_increment, > ! mo_m_id integer unsigned not null references msg_ids(m_id), > ! mo_text longtext, > ! primary key (mo_id), > ! index mo_m_id_idx (mo_m_id) > ! ); > ! > ! -- ------------------------- > ! -- Logs > ! -- ------------------------- > ! > ! drop table if exists obj_log; > ! create table obj_log ( > ! obj_id integer unsigned not null auto_increment, > ! obj_type varchar(15), > ! obj_type_id integer unsigned not null, > ! obj_desc varchar(127), > ! obj_action char(1), > ! obj_datetime timestamp, > ! primary key (obj_id), > ! index obj_type_idx (obj_type), > ! index obj_type_id_idx (obj_type_id), > ! index obj_desc_idx (obj_desc) > ! ); > ! > ! drop table if exists msg_log; > ! create table msg_log ( > ! msl_id integer unsigned not null auto_increment, > ! msl_m_id integer unsigned not null, > ! msl_u_id integer unsigned not null, > ! msl_ca_id integer unsigned not null, > ! msl_action char(1), > ! msl_datetime timestamp, > ! primary key (msl_id), > ! index msl_m_id_idx (msl_m_id), > ! index msl_u_id_idx (msl_u_id), > ! index msl_ca_id_idx (msl_ca_id) > ! ); > ! > ! -- ------------------------- > ! -- Meta > ! -- ------------------------- > ! > ! drop table if exists config; > ! create table config ( > ! cf_name varchar(127) not null, > ! cf_value varchar(127), > ! primary key (cf_name) > ! ); > > > > 1.7 +824 -799 maildb/libmaildb/db/mysql/doc/design.html > > Index: design.html > =================================================================== > RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/design.html,v > retrieving revision 1.6 > retrieving revision 1.7 > diff -c -r1.6 -r1.7 > *** design.html 22 May 2003 18:37:49 -0000 1.6 > --- design.html 30 May 2003 00:18:00 -0000 1.7 > *************** > *** 1,799 **** > ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> > ! <html> > ! <head> > ! <!-- saved from url=(0189)http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1 --> > ! <meta http-equiv="Content-Type" > ! content="text/html; charset=windows-1252"> > ! <meta content="MSHTML 5.50.4611.1300" name="GENERATOR"> > ! <title>MailDB Design</title> > ! </head> > ! <body> > ! <h1>MailDB Database Design</h1> > ! <p><a href="#intro">Introduction</a><br> > ! <a href="#tables">Table Descriptions</a><br> > ! <a href="#issues">Open Questions/Issues</a><br> > ! <a href="#details">Table Details</a><br> > ! <a href="#storage">MySQL Storage Notes</a><br> > ! </p> > ! <p></p> > ! <hr><a name="intro"></a> > ! <h2>Introduction</h2> > ! <p>This document describes the proposed design for the MailDB database. This > ! design is a work-in-progress and is subject to change; outstanding questions/issues > ! are listed below in <a > ! href="http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1#issues">Open > ! Questions/Issues</a>. </p> > ! <p>This initial design assumes use of MySQL as the backend RDBMS. The design > ! is generally normalized, the notable exception being message > ! header tags (left of the colon) in the individual header records (which > ! are stored in the msg_hdrs table). In this case the benefits of normalizing > ! the data seemed to be outweighed by the slight increase in complexity of > ! queries. [Note: I'm a bit on the fence on this one...decision not final. > ! :-) -- lyw] </p> > ! <p>Table summary descriptions are provided in the following section. A detailed > ! description of table columns, datatypes, and a brief description/use of columns > ! is in <a href="#details">Table Details</a>, below. The full SQL for table > ! creation may be found in accompanying file <a href="cr_maildb.sql">cr_maildb.sql</a>, > ! and sample queries are provided in accompanying file <a > ! href="queries.sql">queries.sql</a>. </p> > ! <hr><a name="tables"></a> > ! <h2>Table Descriptions</h2> > ! <p>There are four basic categories of tables: data common to all messages, > ! user meta data, message data, and logs. </p> > ! <p> > ! <table border="1"> > ! <tbody> > ! <tr> > ! <th colspan="6">Common message data</th> > ! </tr> > ! <tr> > ! <th>Table</th> > ! <th>Description</th> > ! <th>Primary key</th> > ! <th>Add'l Indexes</th> > ! <th>References</th> > ! <th>Referenced by</th> > ! </tr> > ! <tr> > ! <td valign="top">mime_types</td> > ! <td valign="top">Normalized table of mime_type definitions.</td> > ! <td valign="top">Mime type numeric identifier (mt_id)</td> > ! <td valign="top">Mime type (mt_desc)</td> > ! <td valign="top">n/a</td> > ! <td valign="top">msg_attach</td> > ! </tr> > ! <tr> > ! <th colspan="6">User meta data</th> > ! </tr> > ! <tr> > ! <th>Table</th> > ! <th>Description</th> > ! <th>Primary key</th> > ! <th>Add'l Indexes</th> > ! <th>References</th> > ! <th>Referenced by</th> > ! </tr> > ! <tr> > ! <td valign="top">users</td> > ! <td valign="top">Normalized table of MailDB users.</td> > ! <td valign="top">User numeric identifier (u_id)</td> > ! <td valign="top">User name (u_desc)</td> > ! <td valign="top">n/a</td> > ! <td valign="top">cats<br> > ! views<br> > ! msg_owners</td> > ! </tr> > ! <tr> > ! <td valign="top">cats</td> > ! <td valign="top">Message categories (i.e. "folders") created by users, > ! to which messages are assigned. Categories may be [multiply] nested, > ! and messages may assigned to multiple categories.</td> > ! <td valign="top">Category numeric identifier (ca_id)</td> > ! <td valign="top">Category owner (ca_u_id)</td> > ! <td valign="top">n/a</td> > ! <td valign="top">msg_owners</td> > ! </tr> > ! <tr> > ! </tr> > ! <tr> > ! <td valign="top">views</td> > ! <td valign="top">User views of messages...specifically, defined search > ! criteria and the SQL required to execute the searches.</td> > ! <td valign="top">View numeric identifier (vw_id)</td> > ! <td valign="top">View owner (vw_u_id)</td> > ! <td valign="top">users</td> > ! <td valign="top">n/a</td> > ! </tr> > ! <tr> > ! <th colspan="6">Message data</th> > ! </tr> > ! <tr> > ! <th>Table</th> > ! <th>Description</th> > ! <th>Primary key</th> > ! <th>Add'l Indexes</th> > ! <th>References</th> > ! <th>Referenced by</th> > ! </tr> > ! <tr> > ! <td valign="top">msg_ids<br> > ! </td> > ! <td valign="top">Semi-normalized table of message ids. Also contains > ! "well-known" message headers -- including to, cc, bcc, subject, date, > ! from, in-reply-to, sender. (Note all header lines are also stored in > ! msg_hdrs.)<br> > ! </td> > ! <td valign="top">Numeric message record identifier (m_id)<br> > ! </td> > ! <td valign="top">Message id (m_msg_id)<br> > ! </td> > ! <td valign="top">n/a<br> > ! </td> > ! <td valign="top">msg_hdrs, msg_owners, msg_attach, msg_log<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">msg_hdrs</td> > ! <td valign="top">Message header information for a given message. Message > ! header sort order is maintained. Multiple records will exist for each > ! message, one per unique header line. </td> > ! <td valign="top">Numeric message header record identifier (mh_id)</td> > ! <td valign="top">Normalized message id (mh_m_id), header key (mh_key), > ! header value (mh_value) [fulltext index]</td> > ! <td valign="top">n/a</td> > ! <td valign="top">msg_owners</td> > ! </tr> > ! <tr> > ! <td valign="top">msg_owners</td> > ! <td valign="top">Records describing user instances (category filing) > ! of specific messages. Users may assign messages to one or more categories, > ! thus multiple records may exist in the table for a given message & > ! user. Includes references into msg_hdrs table for faster retrieval > ! of message date, sender, subject for category "scans".</td> > ! <td valign="top">Message instance numeric identifier (mu_id).</td> > ! <td valign="top">Normalized message id (mu_m_id), user (mu_u_id), category > ! (mu_ca_id)</td> > ! <td valign="top">users, cats, msg_hdrs</td> > ! <td valign="top">n/a</td> > ! </tr> > ! <tr> > ! <td valign="top">msg_attach</td> > ! <td valign="top">Attachments to a given message. Message "body" not in > ! an attachment is treated within the database as attachment 0. Attachment > ! sort order is maintained. Records include mime type, file encoding, > ! multi-part separator data, flag for attachment storage (0 = internal, > ! in the database; 1 = external, in the filesystem).</td> > ! <td valign="top">Message attachment numeric identifier (ma_id).</td> > ! <td valign="top">Normalized message id (ma_m_id), body (ma_body) [fulltext > ! index]</td> > ! <td valign="top">mime_types</td> > ! <td valign="top">n/a</td> > ! </tr> > ! <tr> > ! <th colspan="6">Logging</th> > ! </tr> > ! <tr> > ! <th>Table</th> > ! <th>Description</th> > ! <th>Primary key</th> > ! <th>Add'l Indexes</th> > ! <th>References</th> > ! <th>Referenced by</th> > ! </tr> > ! <tr> > ! <td valign="top">obj_log</td> > ! <td valign="top">History of actions on meta objects - namely, create, > ! update, delete of users, categories, views, mime_types. To be maintained > ! via trigger (to be defined).</td> > ! <td valign="top">Numeric log record identifier (obj_id)</td> > ! <td valign="top">Object type (obj_type), object identifier (obj_type_id), > ! object description (obj_desc)</td> > ! <td valign="top">n/a</td> > ! <td valign="top">n/a</td> > ! </tr> > ! <tr> > ! <td valign="top">msg_log</td> > ! <td valign="top">History of message activity - user adds, deletes from > ! categories. To be maintained via trigger (to be defined).</td> > ! <td valign="top">Numeric log record identifier (msl_id).</td> > ! <td valign="top">Normalized message id (msl_m_id), user (msl_u_id), category > ! (msl_ca_id)</td> > ! <td valign="top">n/a</td> > ! <td valign="top">n/a</td> > ! </tr> > ! </tbody> > ! </table> > ! </p> > ! <hr><a name="issues"></a> > ! <h2>Open Questions/Issues</h2> > ! <ol> > ! <li>Design issues > ! <ol type="a"> > ! <li>Review all field sizing, especially msg_id and record identifiers. > ! </li> > ! <li>Should header info be normalized? Not done so above. </li> > ! <li>Should users or mime_types be de-normalized? </li> > ! </ol> > ! </li> > ! <li>MySQL specifics > ! <ol type="a"> > ! <li>Triggers for maintaining log (history) tables. <b>Update: No trigger > ! or stored procedure support in MySQL. Estimate is that these items will > ! be included in version 5.0. Current stable MySQL is 3.23.x and 4.x is now > ! available.</b> </li> > ! <li>Check MySQL behavior when auto_incremented column "rolls over". > ! </li> > ! <li>Review MySQL regex pattern matching. </li> > ! <li>Note vanilla MySQL has no true foreign key constraints. You can > ! define the foreign keys (foo integer references bar(foo)) but they aren't > ! enforced. </li> > ! </ol> > ! </li> > ! <li>Message questions > ! <ol type="a"> > ! <li>Multi-part separator data format? </li> > ! <li>Which header line is used for message threading? Should it be included > ! in msg_owners table for quick category scanning? </li> > ! </ol> > ! </li> > ! <li>Miscellaneous > ! <ol type="a"> > ! <li>Construct and test sample queries... </li> > ! </ol> > ! </li> > ! </ol> > ! <hr><a name="details"></a> > ! <h2>Table Details</h2> > ! <table border="1"> > ! <tbody> > ! <tr> > ! <th>Table</th> > ! <th>Column</th> > ! <th>Datatype</th> > ! <th>Primary Key</th> > ! <th>Indexed</th> > ! <th>Description</th> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="2">mime_types</td> > ! <td>mt_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for mime_type record</td> > ! </tr> > ! <tr> > ! <td>mt_desc</td> > ! <td>varchar(127)</td> > ! <td> </td> > ! <td>X</td> > ! <td>Message body/attachment MIME type</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="2">users</td> > ! <td>u_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for user record</td> > ! </tr> > ! <tr> > ! <td>u_desc</td> > ! <td>varchar(127)</td> > ! <td> </td> > ! <td>X</td> > ! <td>User description (login/reference name, e.g. 'weissler' or > ! 'li...@av...'</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="4">cats</td> > ! <td>ca_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for category record</td> > ! </tr> > ! <tr> > ! <td>ca_u_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>User owning this category. References users(u_id).</td> > ! </tr> > ! <tr> > ! <td>ca_desc</td> > ! <td>varchar(127)</td> > ! <td> </td> > ! <td> </td> > ! <td>Category name, e.g. "Inbox", "Deleted", "Cycling"...</td> > ! </tr> > ! <tr> > ! <td>ca_parent</td> > ! <td>integer unsigned</td> > ! <td> </td> > ! <td> </td> > ! <td>"Parent" category, allowing nesting of categories. Top-level > ! categories have null parents. References cats(ca_id).</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="4">views</td> > ! <td>vw_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for view record</td> > ! </tr> > ! <tr> > ! <td>vw_desc</td> > ! <td>varchar(127)</td> > ! <td> </td> > ! <td> </td> > ! <td>View name, e.g. "Messages from Robert"</td> > ! </tr> > ! <tr> > ! <td>vw_u_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>User owning view. References users(u_id).</td> > ! </tr> > ! <tr> > ! <td>vw_query</td> > ! <td>text</td> > ! <td> </td> > ! <td> </td> > ! <td>SQL required to retrieve messages meeting user's search criteria</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="13">msg_ids<br> > ! </td> > ! <td valign="top">m_id<br> > ! </td> > ! <td valign="top">integer unsigned not null auto_increment<br> > ! </td> > ! <td valign="top">X<br> > ! </td> > ! <td valign="top">X<br> > ! </td> > ! <td valign="top">Unique identifier for message id (using less storage > ! than the string message_id's in messages)<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_msg_id<br> > ! </td> > ! <td valign="top">varchar(255)<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">X<br> > ! </td> > ! <td valign="top">Message identifier (assigned by MTA)<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_to<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">To header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_cc<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">CC header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_bcc<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">BCC header line contents (outgoing msgs only)<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_subject<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">Subject header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_date<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">Date header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_from<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">From header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_in_reply_to<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">In-Reply-To header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_sender<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">Sender header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_parent_id<br> > ! </td> > ! <td valign="top">integer<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">If attachment, m_id of parent message<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_vw_incl<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">Specify views in which to include this message<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_vw_excl<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">Specify views from which to exclude this message<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="5">msg_hdrs</td> > ! <td>mh_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for message header record</td> > ! </tr> > ! <tr> > ! <td>mh_m_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>Message identifier</td> > ! </tr> > ! <tr> > ! <td>mh_key</td> > ! <td>varchar(63)</td> > ! <td> </td> > ! <td>X</td> > ! <td>Header tag - e.g. "To", "From", "Subject"...anything left of colon > ! (:) on header line. </td> > ! </tr> > ! <tr> > ! <td>mh_value</td> > ! <td>varchar(255)</td> > ! <td> </td> > ! <td>X</td> > ! <td>Header value - anything right of colon (:) on header line. Fulltext > ! index.</td> > ! </tr> > ! <tr> > ! <td>mh_sort_order</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td> </td> > ! <td>Header sequence number.</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="5">msg_owners</td> > ! <td>mu_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for message instance record.</td> > ! </tr> > ! <tr> > ! <td>mu_m_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>Message identifier.</td> > ! </tr> > ! <tr> > ! <td>mu_u_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>User owning a copy of the message.</td> > ! </tr> > ! <tr> > ! <td>mu_ca_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>Category to which the user assigned the message.</td> > ! </tr> > ! <tr> > ! <td>mu_flags</td> > ! <td>integer unsigned</td> > ! <td> </td> > ! <td> </td> > ! <td>Bit flags for the message.</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="8">msg_attach</td> > ! <td>ma_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for message attachment record.</td> > ! </tr> > ! <tr> > ! <td>ma_m_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>Message identifier.</td> > ! </tr> > ! <tr> > ! <td>ma_mt_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td> </td> > ! <td>Foreign key ref to mime_types(mt_id)</td> > ! </tr> > ! <tr> > ! <td>ma_encode</td> > ! <td>varchar(127)</td> > ! <td> </td> > ! <td> </td> > ! <td>Attachment encoding</td> > ! </tr> > ! <tr> > ! <td>ma_body</td> > ! <td>mediumtext</td> > ! <td> </td> > ! <td>X</td> > ! <td>Attachment body (for attachments stored within the database). Fulltext > ! index.</td> > ! </tr> > ! <tr> > ! <td>ma_path</td> > ! <td>varchar(255)</td> > ! <td> </td> > ! <td> </td> > ! <td>Full pathname to attachment (for attachments stored in the filesystem).</td> > ! </tr> > ! <tr> > ! <td>ma_sep_data</td> > ! <td>varchar(255)</td> > ! <td> </td> > ! <td> </td> > ! <td>Multi-part separator data.</td> > ! </tr> > ! <tr> > ! <td>ma_sort_order</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td> </td> > ! <td>Attachment sequence number.</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="6">obj_log</td> > ! <td>obj_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for object log record.</td> > ! </tr> > ! <tr> > ! <td>obj_type</td> > ! <td>varchar(15)</td> > ! <td> </td> > ! <td>X</td> > ! <td>Type of object - e.g. user, view, cat, mime_type</td> > ! </tr> > ! <tr> > ! <td>obj_type_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>Object identifier; if obj_type = user, obj_type_id corresponds to > ! users(u_id), obj_type = cat, obj_type_id corresponds to cats(ca_id), > ! etc.</td> > ! </tr> > ! <tr> > ! <td>obj_desc</td> > ! <td>varchar(127)</td> > ! <td> </td> > ! <td>X</td> > ! <td>Object description (username, viewname, category name...)</td> > ! </tr> > ! <tr> > ! <td>obj_action</td> > ! <td>char(1)</td> > ! <td> </td> > ! <td> </td> > ! <td>Action taken on this object. Values include C (create), U (update), > ! D (delete).</td> > ! </tr> > ! <tr> > ! <td>obj_datetime</td> > ! <td>timestamp(14)</td> > ! <td> </td> > ! <td> </td> > ! <td>Timestamp of object action.</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="6">msg_log</td> > ! <td>msl_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for message log record.</td> > ! </tr> > ! <tr> > ! <td>msl_m_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>Message identifier.</td> > ! </tr> > ! <tr> > ! <td>msl_u_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>User owning instance of the specified message.</td> > ! </tr> > ! <tr> > ! <td>msl_ca_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>Category to which the user assigned the message.</td> > ! </tr> > ! <tr> > ! <td>msl_action</td> > ! <td>char(1)</td> > ! <td> </td> > ! <td>X</td> > ! <td>Action taken on this message. Values include C (create), U (update), > ! D (delete).</td> > ! </tr> > ! <tr> > ! <td>msl_datetime</td> > ! <td>timestamp(14)</td> > ! <td> </td> > ! <td> </td> > ! <td>Timestamp of message action.</td> > ! </tr> > ! </tbody> > ! </table> > ! <p></p> > ! <hr><a name="storage"></a> > ! <h2>MySQL Storage Notes</h2> > ! <p> > ! <table border="1"> > ! <tbody> > ! <tr> > ! <th>Datatype</th> > ! <th>Max</th> > ! <th>Storage</th> > ! </tr> > ! <tr> > ! <td>varchar</td> > ! <td>255</td> > ! <td>L+1</td> > ! </tr> > ! <tr> > ! <td>tinytext</td> > ! <td>255</td> > ! <td>L+1</td> > ! </tr> > ! <tr> > ! <td>text</td> > ! <td>64k</td> > ! <td>L+2</td> > ! </tr> > ! <tr> > ! <td>mediumtext</td> > ! <td>16m</td> > ! <td>L+3</td> > ! </tr> > ! <tr> > ! <td>longtext</td> > ! <td>4g</td> > ! <td>L+4</td> > ! </tr> > ! <tr> > ! <td>tinyint (U)</td> > ! <td>255</td> > ! <td>1</td> > ! </tr> > ! <tr> > ! <td>smallint (U)</td> > ! <td>65535</td> > ! <td>2</td> > ! </tr> > ! <tr> > ! <td>mediumint (U)</td> > ! <td>16777215</td> > ! <td>3</td> > ! </tr> > ! <tr> > ! <td>integer (U)</td> > ! <td>4294967295</td> > ! <td>4</td> > ! </tr> > ! <tr> > ! <td>timestamp</td> > ! <td>YYYYMMDDHHMISS</td> > ! <td>4</td> > ! </tr> > ! </tbody> > ! </table> > ! </p> > ! <p>...where (U) = unsigned, and L = length of text string. </p> > ! <p></p> > ! <hr><i>Last update: 17 October 2002 by <a href="mailto:li...@av...">Liza > ! Weissler</a></i><a href="mailto:li...@av..."> </a><br> > ! </body> > ! </html> > --- 1,824 ---- > ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> > ! <html> > ! <head> > ! <!-- saved from url=(0189)http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1 --> > ! <meta http-equiv="Content-Type" > ! content="text/html; charset=windows-1252"> > ! <meta content="MSHTML 5.50.4611.1300" name="GENERATOR"> > ! <title>MailDB Design</title> > ! </head> > ! <body> > ! <h1>MailDB Database Design</h1> > ! <p><a href="#intro">Introduction</a><br> > ! <a href="#tables">Table Descriptions</a><br> > ! <a href="#issues">Open Questions/Issues</a><br> > ! <a href="#details">Table Details</a><br> > ! <a href="#storage">MySQL Storage Notes</a><br> > ! </p> > ! <p></p> > ! <hr><a name="intro"></a> > ! <h2>Introduction</h2> > ! <p>This document describes the proposed design for the MailDB database. This > ! design is a work-in-progress and is subject to change; outstanding questions/issues > ! are listed below in <a > ! href="http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1#issues">Open > ! Questions/Issues</a>. </p> > ! <p>This initial design assumes use of MySQL as the backend RDBMS. The design > ! is generally normalized, the notable exception being message > ! header tags (left of the colon) in the individual header records (which > ! are stored in the msg_hdrs table). In this case the benefits of normalizing > ! the data seemed to be outweighed by the slight increase in complexity of > ! queries. [Note: I'm a bit on the fence on this one...decision not final. > ! :-) -- lyw] </p> > ! <p>Table summary descriptions are provided in the following section. A detailed > ! description of table columns, datatypes, and a brief description/use of columns > ! is in <a href="#details">Table Details</a>, below. The full SQL for table > ! creation may be found in accompanying file <a href="cr_maildb.sql">cr_maildb.sql</a>, > ! and sample queries are provided in accompanying file <a > ! href="queries.sql">queries.sql</a>. </p> > ! <hr><a name="tables"></a> > ! <h2>Table Descriptions</h2> > ! <p>There are four basic categories of tables: data common to all messages, > ! user meta data, message data, and logs. </p> > ! <p> > ! <table border="1"> > ! <tbody> > ! <tr> > ! <th colspan="6">Common message data</th> > ! </tr> > ! <tr> > ! <th>Table</th> > ! <th>Description</th> > ! <th>Primary key</th> > ! <th>Add'l Indexes</th> > ! <th>References</th> > ! <th>Referenced by</th> > ! </tr> > ! <tr> > ! <td valign="top">mime_types</td> > ! <td valign="top">Normalized table of mime_type definitions.</td> > ! <td valign="top">Mime type numeric identifier (mt_id)</td> > ! <td valign="top">Mime type (mt_desc)</td> > ! <td valign="top">n/a</td> > ! <td valign="top">msg_attach</td> > ! </tr> > ! <tr> > ! <th colspan="6">User meta data</th> > ! </tr> > ! <tr> > ! <th>Table</th> > ! <th>Description</th> > ! <th>Primary key</th> > ! <th>Add'l Indexes</th> > ! <th>References</th> > ! <th>Referenced by</th> > ! </tr> > ! <tr> > ! <td valign="top">users</td> > ! <td valign="top">Normalized table of MailDB users.</td> > ! <td valign="top">User numeric identifier (u_id)</td> > ! <td valign="top">User name (u_desc)</td> > ! <td valign="top">n/a</td> > ! <td valign="top">cats<br> > ! views<br> > ! msg_owners</td> > ! </tr> > ! <tr> > ! <td valign="top">cats</td> > ! <td valign="top">Message categories (i.e. "folders") created by users, > ! to which messages are assigned. Categories may be [multiply] nested, > ! and messages may assigned to multiple categories.</td> > ! <td valign="top">Category numeric identifier (ca_id)</td> > ! <td valign="top">Category owner (ca_u_id)</td> > ! <td valign="top">n/a</td> > ! <td valign="top">msg_owners</td> > ! </tr> > ! <tr> > ! </tr> > ! <tr> > ! <td valign="top">views</td> > ! <td valign="top">User views of messages...specifically, defined search > ! criteria and the SQL required to execute the searches.</td> > ! <td valign="top">View numeric identifier (vw_id)</td> > ! <td valign="top">View owner (vw_u_id)</td> > ! <td valign="top">users</td> > ! <td valign="top">n/a</td> > ! </tr> > ! <tr> > ! <th colspan="6">Message data</th> > ! </tr> > ! <tr> > ! <th>Table</th> > ! <th>Description</th> > ! <th>Primary key</th> > ! <th>Add'l Indexes</th> > ! <th>References</th> > ! <th>Referenced by</th> > ! </tr> > ! <tr> > ! <td valign="top">msg_ids<br> > ! </td> > ! <td valign="top">Semi-normalized table of message ids. Also contains > ! "well-known" message headers -- including to, cc, bcc, subject, date, > ! from, in-reply-to, sender. (Note all header lines are also stored in > ! msg_hdrs.)<br> > ! </td> > ! <td valign="top">Numeric message record identifier (m_id)<br> > ! </td> > ! <td valign="top">Message id (m_msg_id)<br>Date (m_date)<br> > ! From (m_from)<br>To (m_to)<br>Subject (m_subject) > ! </td> > ! <td valign="top">n/a<br> > ! </td> > ! <td valign="top">msg_hdrs, msg_owners, msg_attach, msg_log<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">msg_hdrs</td> > ! <td valign="top">Message header information for a given message. Message > ! header sort order is maintained. Multiple records will exist for each > ! message, one per unique header line. </td> > ! <td valign="top">Numeric message header record identifier (mh_id)</td> > ! <td valign="top">Normalized message id (mh_m_id), header key (mh_key), > ! header value (mh_value) [fulltext index]</td> > ! <td valign="top">n/a</td> > ! <td valign="top">msg_owners</td> > ! </tr> > ! <tr> > ! <td valign="top">msg_owners</td> > ! <td valign="top">Records describing user instances (category filing) > ! of specific messages. Users may assign messages to one or more categories, > ! thus multiple records may exist in the table for a given message & > ! user. Includes references into msg_hdrs table for faster retrieval > ! of message date, sender, subject for category "scans".</td> > ! <td valign="top">Message instance numeric identifier (mu_id).</td> > ! <td valign="top">Normalized message id (mu_m_id), user (mu_u_id), category > ! (mu_ca_id)</td> > ! <td valign="top">users, cats, msg_hdrs</td> > ! <td valign="top">n/a</td> > ! </tr> > ! <tr> > ! <td valign="top">msg_attach</td> > ! <td valign="top">Attachments to a given message. Message "body" not in > ! an attachment is treated within the database as attachment 0. Attachment > ! sort order is maintained. Records include mime type, file encoding, > ! multi-part separator data, flag for attachment storage (0 = internal, > ! in the database; 1 = external, in the filesystem).</td> > ! <td valign="top">Message attachment numeric identifier (ma_id).</td> > ! <td valign="top">Normalized message id (ma_m_id), body (ma_body) [fulltext > ! index]</td> > ! <td valign="top">mime_types</td> > ! <td valign="top">n/a</td> > ! </tr> > ! <tr> > ! <th colspan="6">Logging</th> > ! </tr> > ! <tr> > ! <th>Table</th> > ! <th>Description</th> > ! <th>Primary key</th> > ! <th>Add'l Indexes</th> > ! <th>References</th> > ! <th>Referenced by</th> > ! </tr> > ! <tr> > ! <td valign="top">obj_log</td> > ! <td valign="top">History of actions on meta objects - namely, create, > ! update, delete of users, categories, views, mime_types. To be maintained > ! via trigger (to be defined).</td> > ! <td valign="top">Numeric log record identifier (obj_id)</td> > ! <td valign="top">Object type (obj_type), object identifier (obj_type_id), > ! object description (obj_desc)</td> > ! <td valign="top">n/a</td> > ! <td valign="top">n/a</td> > ! </tr> > ! <tr> > ! <td valign="top">msg_log</td> > ! <td valign="top">History of message activity - user adds, deletes from > ! categories. To be maintained via trigger (to be defined).</td> > ! <td valign="top">Numeric log record identifier (msl_id).</td> > ! <td valign="top">Normalized message id (msl_m_id), user (msl_u_id), category > ! (msl_ca_id)</td> > ! <td valign="top">n/a</td> > ! <td valign="top">n/a</td> > ! </tr> > ! </tbody> > ! </table> > ! </p> > ! <hr><a name="issues"></a> > ! <h2>Open Questions/Issues</h2> > ! <ol> > ! <li>Design issues > ! <ol type="a"> > ! <li>Review all field sizing, especially msg_id and record identifiers. > ! </li> > ! <li>Should header info be normalized? Not done so above. </li> > ! <li>Should users or mime_types be de-normalized? </li> > ! </ol> > ! </li> > ! <li>MySQL specifics > ! <ol type="a"> > ! <li>Triggers for maintaining log (history) tables. <b>Update: No trigger > ! or stored procedure support in MySQL. Estimate is that these items will > ! be included in version 5.0. Current stable MySQL is 3.23.x and 4.x is now > ! available.</b> </li> > ! <li>Check MySQL behavior when auto_incremented column "rolls over". > ! </li> > ! <li>Review MySQL regex pattern matching. </li> > ! <li>Note vanilla MySQL has no true foreign key constraints. You can > ! define the foreign keys (foo integer references bar(foo)) but they aren't > ! enforced. </li> > ! </ol> > ! </li> > ! <li>Message questions > ! <ol type="a"> > ! <li>Multi-part separator data format? </li> > ! <li>Which header line is used for message threading? Should it be included > ! in msg_owners table for quick category scanning? </li> > ! </ol> > ! </li> > ! <li>Miscellaneous > ! <ol type="a"> > ! <li>Construct and test sample queries... </li> > ! </ol> > ! </li> > ! </ol> > ! <hr><a name="details"></a> > ! <h2>Table Details</h2> > ! <table border="1"> > ! <tbody> > ! <tr> > ! <th>Table</th> > ! <th>Column</th> > ! <th>Datatype</th> > ! <th>Primary Key</th> > ! <th>Indexed</th> > ! <th>Description</th> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="2">mime_types</td> > ! <td>mt_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for mime_type record</td> > ! </tr> > ! <tr> > ! <td>mt_desc</td> > ! <td>varchar(127)</td> > ! <td> </td> > ! <td>X</td> > ! <td>Message body/attachment MIME type</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="2">users</td> > ! <td>u_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for user record</td> > ! </tr> > ! <tr> > ! <td>u_desc</td> > ! <td>varchar(127)</td> > ! <td> </td> > ! <td>X</td> > ! <td>User description (login/reference name, e.g. 'weissler' or > ! 'li...@av...'</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="4">cats</td> > ! <td>ca_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for category record</td> > ! </tr> > ! <tr> > ! <td>ca_u_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>User owning this category. References users(u_id).</td> > ! </tr> > ! <tr> > ! <td>ca_desc</td> > ! <td>varchar(127)</td> > ! <td> </td> > ! <td> </td> > ! <td>Category name, e.g. "Inbox", "Deleted", "Cycling"...</td> > ! </tr> > ! <tr> > ! <td>ca_parent</td> > ! <td>integer unsigned</td> > ! <td> </td> > ! <td> </td> > ! <td>"Parent" category, allowing nesting of categories. Top-level > ! categories have null parents. References cats(ca_id).</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="4">views</td> > ! <td>vw_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for view record</td> > ! </tr> > ! <tr> > ! <td>vw_desc</td> > ! <td>varchar(127)</td> > ! <td> </td> > ! <td> </td> > ! <td>View name, e.g. "Messages from Robert"</td> > ! </tr> > ! <tr> > ! <td>vw_u_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>User owning view. References users(u_id).</td> > ! </tr> > ! <tr> > ! <td>vw_query</td> > ! <td>text</td> > ! <td> </td> > ! <td> </td> > ! <td>SQL required to retrieve messages meeting user's search criteria</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="13">msg_ids<br> > ! </td> > ! <td valign="top">m_id<br> > ! </td> > ! <td valign="top">integer unsigned not null auto_increment<br> > ! </td> > ! <td valign="top">X<br> > ! </td> > ! <td valign="top">X<br> > ! </td> > ! <td valign="top">Unique identifier for message id (using less storage > ! than the string message_id's in messages)<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_msg_id<br> > ! </td> > ! <td valign="top">varchar(255)<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">X<br> > ! </td> > ! <td valign="top">Message identifier (assigned by MTA)<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_to<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">X<br> > ! </td> > ! <td valign="top">To header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_cc<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">CC header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_bcc<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">BCC header line contents (outgoing msgs only)<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_subject<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">X<br> > ! </td> > ! <td valign="top">Subject header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_date<br> > ! </td> > ! <td valign="top">datetime<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">X<br> > ! </td> > ! <td valign="top">Date header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_from<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">X<br> > ! </td> > ! <td valign="top">From header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_in_reply_to<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">In-Reply-To header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_sender<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">Sender header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_reply_to<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">Reply-To header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_references<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">References header line contents<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_parent_id<br> > ! </td> > ! <td valign="top">integer<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">If attachment, m_id of parent message<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_vw_incl<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">Specify views in which to include this message<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top">m_vw_excl<br> > ! </td> > ! <td valign="top">text<br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top"><br> > ! </td> > ! <td valign="top">Specify views from which to exclude this message<br> > ! </td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="5">msg_hdrs</td> > ! <td>mh_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for message header record</td> > ! </tr> > ! <tr> > ! <td>mh_m_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>Message identifier</td> > ! </tr> > ! <tr> > ! <td>mh_key</td> > ! <td>varchar(63)</td> > ! <td> </td> > ! <td>X</td> > ! <td>Header tag - e.g. "To", "From", "Subject"...anything left of colon > ! (:) on header line. </td> > ! </tr> > ! <tr> > ! <td>mh_value</td> > ! <td>varchar(255)</td> > ! <td> </td> > ! <td>X</td> > ! <td>Header value - anything right of colon (:) on header line. Fulltext > ! index.</td> > ! </tr> > ! <tr> > ! <td>mh_sort_order</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td> </td> > ! <td>Header sequence number.</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="5">msg_owners</td> > ! <td>mu_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for message instance record.</td> > ! </tr> > ! <tr> > ! <td>mu_m_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>Message identifier.</td> > ! </tr> > ! <tr> > ! <td>mu_u_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>User owning a copy of the message.</td> > ! </tr> > ! <tr> > ! <td>mu_ca_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>Category to which the user assigned the message.</td> > ! </tr> > ! <tr> > ! <td>mu_flags</td> > ! <td>integer unsigned</td> > ! <td> </td> > ! <td> </td> > ! <td>Bit flags for the message.</td> > ! </tr> > ! <tr> > ! <td valign="top" rowspan="8">msg_attach</td> > ! <td>ma_id</td> > ! <td>integer unsigned not null auto_increment</td> > ! <td>X</td> > ! <td>X</td> > ! <td>Unique identifier for message attachment record.</td> > ! </tr> > ! <tr> > ! <td>ma_m_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td>X</td> > ! <td>Message identifier.</td> > ! </tr> > ! <tr> > ! <td>ma_mt_id</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td> </td> > ! <td>Foreign key ref to mime_types(mt_id)</td> > ! </tr> > ! <tr> > ! <td>ma_encode</td> > ! <td>varchar(127)</td> > ! <td> </td> > ! <td> </td> > ! <td>Attachment encoding</td> > ! </tr> > ! <tr> > ! <td>ma_body</td> > ! <td>mediumtext</td> > ! <td> </td> > ! <td>X</td> > ! <td>Attachment body (for attachments stored within the database). Fulltext > ! index.</td> > ! </tr> > ! <tr> > ! <td>ma_path</td> > ! <td>varchar(255)</td> > ! <td> </td> > ! <td> </td> > ! <td>Full pathname to attachment (for attachments stored in the filesystem).</td> > ! </tr> > ! <tr> > ! <td>ma_sep_data</td> > ! <td>varchar(255)</td> > ! <td> </td> > ! <td> </td> > ! <td>Multi-part separator data.</td> > ! </tr> > ! <tr> > ! <td>ma_sort_order</td> > ! <td>integer unsigned not null</td> > ! <td> </td> > ! <td> </td> > ! <td>Att... [truncated message content] |
|
From: James S. <jls...@us...> - 2003-05-30 00:18:14
|
jlscott3 03/05/29 17:18:01 Modified: libmaildb/db/mysql/doc cr_maildb.sql design.html Log: Added m_reply_to and m_references cols and indices on m_date, m_from, m_to and m_subject to msg_ids Revision Changes Path 1.7 +224 -218 maildb/libmaildb/db/mysql/doc/cr_maildb.sql Index: cr_maildb.sql =================================================================== RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_maildb.sql,v retrieving revision 1.6 retrieving revision 1.7 diff -c -r1.6 -r1.7 *** cr_maildb.sql 22 May 2003 18:37:49 -0000 1.6 --- cr_maildb.sql 30 May 2003 00:18:00 -0000 1.7 *************** *** 1,218 **** ! -- cr_db.sql - MailDB MySQL database creation ! -- Copyright (c) 2002 MailDB Team ! -- ! -- This file is part of the MailDB software package. For license ! -- information, see the LICENSE file in the top level directory of the ! -- MailDB source distribution. ! -- ! -- $Id: cr_maildb.sql,v 1.6 2003/05/22 18:37:49 lweissler Exp $ ! -- ------------------------------------------------------- ! ! -- maildb tables ! ! -- common message data: ! -- hdrs, mime_types ! -- user data: ! -- users, cats, views ! -- message data: ! -- msg_ids, msg_hdrs, msg_owners, msg_attach, msg_orig ! -- logs: ! -- obj_log, msg_log ! -- meta: ! -- config ! ! -- ------------------------- ! -- Common Message Data ! -- ------------------------- ! ! -- hdrs ! -- -> deleted 10/10/2002 in favor of de-normalizing ! ! -- drop table if exists hdrs; ! -- create table hdrs ( ! -- h_id integer unsigned not null auto_increment, ! -- h_desc varchar(20), ! -- primary key (h_id) ! -- ); ! ! -- mime_types ! ! drop table if exists mime_types; ! create table mime_types ( ! mt_id integer unsigned not null auto_increment, ! mt_desc varchar(127), ! primary key (mt_id), ! index mt_desc_idx (mt_desc) ! ); ! ! ! -- ------------------------- ! -- User Data ! -- ------------------------- ! ! -- users ! ! drop table if exists users; ! create table users ( ! u_id integer unsigned not null auto_increment, ! u_desc varchar(127), ! primary key (u_id), ! index u_desc_idx (u_desc) ! ); ! ! -- cats ! ! drop table if exists cats; ! create table cats ( ! ca_id integer unsigned not null auto_increment, ! ca_u_id integer unsigned not null references users(u_id), ! ca_desc varchar(127), ! ca_parent integer unsigned references cats(ca_id), ! primary key (ca_id), ! index ca_u_id_idx (ca_u_id) ! ); ! ! -- views ! ! drop table if exists views; ! create table views ( ! vw_id integer unsigned not null auto_increment, ! vw_desc varchar(127), ! vw_u_id integer unsigned not null references users(u_id), ! vw_query text, ! primary key (vw_id), ! index vw_u_id_idx (vw_u_id) ! ); ! ! ! -- ------------------------- ! -- Message Data ! -- ------------------------- ! ! -- msg_ids ! ! drop table if exists msg_ids; ! ! create table msg_ids ( ! m_id integer unsigned not null auto_increment, ! m_msg_id varchar(255) not null, ! m_to text, ! m_cc text, ! m_bcc text, ! m_subject text, ! m_date datetime, ! m_from text, ! m_in_reply_to text, ! m_sender text, ! m_parent_id integer, ! m_vw_incl text, ! m_vw_excl text, ! primary key (m_id), ! index m_msg_id_idx (m_msg_id) ! ); ! ! -- msg_hdrs ! ! drop table if exists msg_hdrs; ! create table msg_hdrs ( ! mh_id integer unsigned not null auto_increment, ! mh_m_id integer unsigned not null references msg_ids(m_id), ! mh_key varchar(63) not null, ! mh_value varchar(255), ! mh_sort_order integer unsigned, ! primary key (mh_id), ! index mh_m_id_idx (mh_m_id), ! index mh_key_idx (mh_key), ! fulltext index mh_value_idx (mh_value) ! ); ! ! -- msg_owners ! ! drop table if exists msg_owners; ! create table msg_owners ( ! mu_id integer unsigned not null auto_increment, ! mu_m_id integer unsigned not null references msg_ids(m_id), ! mu_u_id integer unsigned not null references users(u_id), ! mu_ca_id integer unsigned not null references cats(ca_id), ! -- mu_date integer unsigned not null references msg_hdrs(mh_id), ! -- mu_from integer unsigned not null references msg_hdrs(mh_id), ! -- mu_subject integer unsigned not null references msg_hdrs(mh_id), ! mu_flags integer, ! primary key (mu_id), ! index mu_m_id_idx (mu_m_id), ! index mu_u_id_idx (mu_u_id), ! index mu_ca_id_idx (mu_ca_id) ! ); ! ! -- msg_attach ! -- ma_in_fs bool, \ removed ! -- ma_in_msg bool, / 5/22/03 ! ! drop table if exists msg_attach; ! create table msg_attach ( ! ma_id integer unsigned not null auto_increment, ! ma_m_id integer unsigned not null references msg_ids(m_id), ! ma_mt_id integer unsigned not null references mime_types(mt_id), ! ma_encode varchar(127), ! ma_body mediumtext, ! ma_path varchar(255), ! ma_sep_data varchar(255), ! ma_sort_order integer unsigned, ! primary key (ma_id), ! index ma_m_id_idx (ma_m_id), ! fulltext index ma_body_idx (ma_body) ! ); ! ! -- msg_orig ! ! drop table if exists msg_orig; ! create table msg_orig ( ! mo_id integer unsigned not null auto_increment, ! mo_m_id integer unsigned not null references msg_ids(m_id), ! mo_text longtext, ! primary key (mo_id), ! index mo_m_id_idx (mo_m_id) ! ); ! ! -- ------------------------- ! -- Logs ! -- ------------------------- ! ! drop table if exists obj_log; ! create table obj_log ( ! obj_id integer unsigned not null auto_increment, ! obj_type varchar(15), ! obj_type_id integer unsigned not null, ! obj_desc varchar(127), ! obj_action char(1), ! obj_datetime timestamp, ! primary key (obj_id), ! index obj_type_idx (obj_type), ! index obj_type_id_idx (obj_type_id), ! index obj_desc_idx (obj_desc) ! ); ! ! drop table if exists msg_log; ! create table msg_log ( ! msl_id integer unsigned not null auto_increment, ! msl_m_id integer unsigned not null, ! msl_u_id integer unsigned not null, ! msl_ca_id integer unsigned not null, ! msl_action char(1), ! msl_datetime timestamp, ! primary key (msl_id), ! index msl_m_id_idx (msl_m_id), ! index msl_u_id_idx (msl_u_id), ! index msl_ca_id_idx (msl_ca_id) ! ); ! ! -- ------------------------- ! -- Meta ! -- ------------------------- ! ! drop table if exists config; ! create table config ( ! cf_name varchar(127) not null, ! cf_value varchar(127), ! primary key (cf_name) ! ); --- 1,224 ---- ! -- cr_db.sql - MailDB MySQL database creation ! -- Copyright (c) 2002 MailDB Team ! -- ! -- This file is part of the MailDB software package. For license ! -- information, see the LICENSE file in the top level directory of the ! -- MailDB source distribution. ! -- ! -- $Id: cr_maildb.sql,v 1.7 2003/05/30 00:18:00 jlscott3 Exp $ ! -- ------------------------------------------------------- ! ! -- maildb tables ! ! -- common message data: ! -- hdrs, mime_types ! -- user data: ! -- users, cats, views ! -- message data: ! -- msg_ids, msg_hdrs, msg_owners, msg_attach, msg_orig ! -- logs: ! -- obj_log, msg_log ! -- meta: ! -- config ! ! -- ------------------------- ! -- Common Message Data ! -- ------------------------- ! ! -- hdrs ! -- -> deleted 10/10/2002 in favor of de-normalizing ! ! -- drop table if exists hdrs; ! -- create table hdrs ( ! -- h_id integer unsigned not null auto_increment, ! -- h_desc varchar(20), ! -- primary key (h_id) ! -- ); ! ! -- mime_types ! ! drop table if exists mime_types; ! create table mime_types ( ! mt_id integer unsigned not null auto_increment, ! mt_desc varchar(127), ! primary key (mt_id), ! index mt_desc_idx (mt_desc) ! ); ! ! ! -- ------------------------- ! -- User Data ! -- ------------------------- ! ! -- users ! ! drop table if exists users; ! create table users ( ! u_id integer unsigned not null auto_increment, ! u_desc varchar(127), ! primary key (u_id), ! index u_desc_idx (u_desc) ! ); ! ! -- cats ! ! drop table if exists cats; ! create table cats ( ! ca_id integer unsigned not null auto_increment, ! ca_u_id integer unsigned not null references users(u_id), ! ca_desc varchar(127), ! ca_parent integer unsigned references cats(ca_id), ! primary key (ca_id), ! index ca_u_id_idx (ca_u_id) ! ); ! ! -- views ! ! drop table if exists views; ! create table views ( ! vw_id integer unsigned not null auto_increment, ! vw_desc varchar(127), ! vw_u_id integer unsigned not null references users(u_id), ! vw_query text, ! primary key (vw_id), ! index vw_u_id_idx (vw_u_id) ! ); ! ! ! -- ------------------------- ! -- Message Data ! -- ------------------------- ! ! -- msg_ids ! ! drop table if exists msg_ids; ! ! create table msg_ids ( ! m_id integer unsigned not null auto_increment, ! m_msg_id varchar(255) not null, ! m_to text, ! m_cc text, ! m_bcc text, ! m_subject text, ! m_date datetime, ! m_from text, ! m_in_reply_to text, ! m_sender text, ! m_reply_to text, ! m_references text, ! m_parent_id integer, ! m_vw_incl text, ! m_vw_excl text, ! primary key (m_id), ! index m_msg_id_idx (m_msg_id), ! index m_date_idx(m_date), ! index m_from_idx(m_from(255)), ! index m_to_idx (m_to(255)), ! index m_subject_idx (m_subject(255)) ! ); ! ! -- msg_hdrs ! ! drop table if exists msg_hdrs; ! create table msg_hdrs ( ! mh_id integer unsigned not null auto_increment, ! mh_m_id integer unsigned not null references msg_ids(m_id), ! mh_key varchar(63) not null, ! mh_value varchar(255), ! mh_sort_order integer unsigned, ! primary key (mh_id), ! index mh_m_id_idx (mh_m_id), ! index mh_key_idx (mh_key), ! fulltext index mh_value_idx (mh_value) ! ); ! ! -- msg_owners ! ! drop table if exists msg_owners; ! create table msg_owners ( ! mu_id integer unsigned not null auto_increment, ! mu_m_id integer unsigned not null references msg_ids(m_id), ! mu_u_id integer unsigned not null references users(u_id), ! mu_ca_id integer unsigned not null references cats(ca_id), ! -- mu_date integer unsigned not null references msg_hdrs(mh_id), ! -- mu_from integer unsigned not null references msg_hdrs(mh_id), ! -- mu_subject integer unsigned not null references msg_hdrs(mh_id), ! mu_flags integer, ! primary key (mu_id), ! index mu_m_id_idx (mu_m_id), ! index mu_u_id_idx (mu_u_id), ! index mu_ca_id_idx (mu_ca_id) ! ); ! ! -- msg_attach ! -- ma_in_fs bool, \ removed ! -- ma_in_msg bool, / 5/22/03 ! ! drop table if exists msg_attach; ! create table msg_attach ( ! ma_id integer unsigned not null auto_increment, ! ma_m_id integer unsigned not null references msg_ids(m_id), ! ma_mt_id integer unsigned not null references mime_types(mt_id), ! ma_encode varchar(127), ! ma_body mediumtext, ! ma_path varchar(255), ! ma_sep_data varchar(255), ! ma_sort_order integer unsigned, ! primary key (ma_id), ! index ma_m_id_idx (ma_m_id), ! fulltext index ma_body_idx (ma_body) ! ); ! ! -- msg_orig ! ! drop table if exists msg_orig; ! create table msg_orig ( ! mo_id integer unsigned not null auto_increment, ! mo_m_id integer unsigned not null references msg_ids(m_id), ! mo_text longtext, ! primary key (mo_id), ! index mo_m_id_idx (mo_m_id) ! ); ! ! -- ------------------------- ! -- Logs ! -- ------------------------- ! ! drop table if exists obj_log; ! create table obj_log ( ! obj_id integer unsigned not null auto_increment, ! obj_type varchar(15), ! obj_type_id integer unsigned not null, ! obj_desc varchar(127), ! obj_action char(1), ! obj_datetime timestamp, ! primary key (obj_id), ! index obj_type_idx (obj_type), ! index obj_type_id_idx (obj_type_id), ! index obj_desc_idx (obj_desc) ! ); ! ! drop table if exists msg_log; ! create table msg_log ( ! msl_id integer unsigned not null auto_increment, ! msl_m_id integer unsigned not null, ! msl_u_id integer unsigned not null, ! msl_ca_id integer unsigned not null, ! msl_action char(1), ! msl_datetime timestamp, ! primary key (msl_id), ! index msl_m_id_idx (msl_m_id), ! index msl_u_id_idx (msl_u_id), ! index msl_ca_id_idx (msl_ca_id) ! ); ! ! -- ------------------------- ! -- Meta ! -- ------------------------- ! ! drop table if exists config; ! create table config ( ! cf_name varchar(127) not null, ! cf_value varchar(127), ! primary key (cf_name) ! ); 1.7 +824 -799 maildb/libmaildb/db/mysql/doc/design.html Index: design.html =================================================================== RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/design.html,v retrieving revision 1.6 retrieving revision 1.7 diff -c -r1.6 -r1.7 *** design.html 22 May 2003 18:37:49 -0000 1.6 --- design.html 30 May 2003 00:18:00 -0000 1.7 *************** *** 1,799 **** ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ! <html> ! <head> ! <!-- saved from url=(0189)http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1 --> ! <meta http-equiv="Content-Type" ! content="text/html; charset=windows-1252"> ! <meta content="MSHTML 5.50.4611.1300" name="GENERATOR"> ! <title>MailDB Design</title> ! </head> ! <body> ! <h1>MailDB Database Design</h1> ! <p><a href="#intro">Introduction</a><br> ! <a href="#tables">Table Descriptions</a><br> ! <a href="#issues">Open Questions/Issues</a><br> ! <a href="#details">Table Details</a><br> ! <a href="#storage">MySQL Storage Notes</a><br> ! </p> ! <p></p> ! <hr><a name="intro"></a> ! <h2>Introduction</h2> ! <p>This document describes the proposed design for the MailDB database. This ! design is a work-in-progress and is subject to change; outstanding questions/issues ! are listed below in <a ! href="http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1#issues">Open ! Questions/Issues</a>. </p> ! <p>This initial design assumes use of MySQL as the backend RDBMS. The design ! is generally normalized, the notable exception being message ! header tags (left of the colon) in the individual header records (which ! are stored in the msg_hdrs table). In this case the benefits of normalizing ! the data seemed to be outweighed by the slight increase in complexity of ! queries. [Note: I'm a bit on the fence on this one...decision not final. ! :-) -- lyw] </p> ! <p>Table summary descriptions are provided in the following section. A detailed ! description of table columns, datatypes, and a brief description/use of columns ! is in <a href="#details">Table Details</a>, below. The full SQL for table ! creation may be found in accompanying file <a href="cr_maildb.sql">cr_maildb.sql</a>, ! and sample queries are provided in accompanying file <a ! href="queries.sql">queries.sql</a>. </p> ! <hr><a name="tables"></a> ! <h2>Table Descriptions</h2> ! <p>There are four basic categories of tables: data common to all messages, ! user meta data, message data, and logs. </p> ! <p> ! <table border="1"> ! <tbody> ! <tr> ! <th colspan="6">Common message data</th> ! </tr> ! <tr> ! <th>Table</th> ! <th>Description</th> ! <th>Primary key</th> ! <th>Add'l Indexes</th> ! <th>References</th> ! <th>Referenced by</th> ! </tr> ! <tr> ! <td valign="top">mime_types</td> ! <td valign="top">Normalized table of mime_type definitions.</td> ! <td valign="top">Mime type numeric identifier (mt_id)</td> ! <td valign="top">Mime type (mt_desc)</td> ! <td valign="top">n/a</td> ! <td valign="top">msg_attach</td> ! </tr> ! <tr> ! <th colspan="6">User meta data</th> ! </tr> ! <tr> ! <th>Table</th> ! <th>Description</th> ! <th>Primary key</th> ! <th>Add'l Indexes</th> ! <th>References</th> ! <th>Referenced by</th> ! </tr> ! <tr> ! <td valign="top">users</td> ! <td valign="top">Normalized table of MailDB users.</td> ! <td valign="top">User numeric identifier (u_id)</td> ! <td valign="top">User name (u_desc)</td> ! <td valign="top">n/a</td> ! <td valign="top">cats<br> ! views<br> ! msg_owners</td> ! </tr> ! <tr> ! <td valign="top">cats</td> ! <td valign="top">Message categories (i.e. "folders") created by users, ! to which messages are assigned. Categories may be [multiply] nested, ! and messages may assigned to multiple categories.</td> ! <td valign="top">Category numeric identifier (ca_id)</td> ! <td valign="top">Category owner (ca_u_id)</td> ! <td valign="top">n/a</td> ! <td valign="top">msg_owners</td> ! </tr> ! <tr> ! </tr> ! <tr> ! <td valign="top">views</td> ! <td valign="top">User views of messages...specifically, defined search ! criteria and the SQL required to execute the searches.</td> ! <td valign="top">View numeric identifier (vw_id)</td> ! <td valign="top">View owner (vw_u_id)</td> ! <td valign="top">users</td> ! <td valign="top">n/a</td> ! </tr> ! <tr> ! <th colspan="6">Message data</th> ! </tr> ! <tr> ! <th>Table</th> ! <th>Description</th> ! <th>Primary key</th> ! <th>Add'l Indexes</th> ! <th>References</th> ! <th>Referenced by</th> ! </tr> ! <tr> ! <td valign="top">msg_ids<br> ! </td> ! <td valign="top">Semi-normalized table of message ids. Also contains ! "well-known" message headers -- including to, cc, bcc, subject, date, ! from, in-reply-to, sender. (Note all header lines are also stored in ! msg_hdrs.)<br> ! </td> ! <td valign="top">Numeric message record identifier (m_id)<br> ! </td> ! <td valign="top">Message id (m_msg_id)<br> ! </td> ! <td valign="top">n/a<br> ! </td> ! <td valign="top">msg_hdrs, msg_owners, msg_attach, msg_log<br> ! </td> ! </tr> ! <tr> ! <td valign="top">msg_hdrs</td> ! <td valign="top">Message header information for a given message. Message ! header sort order is maintained. Multiple records will exist for each ! message, one per unique header line. </td> ! <td valign="top">Numeric message header record identifier (mh_id)</td> ! <td valign="top">Normalized message id (mh_m_id), header key (mh_key), ! header value (mh_value) [fulltext index]</td> ! <td valign="top">n/a</td> ! <td valign="top">msg_owners</td> ! </tr> ! <tr> ! <td valign="top">msg_owners</td> ! <td valign="top">Records describing user instances (category filing) ! of specific messages. Users may assign messages to one or more categories, ! thus multiple records may exist in the table for a given message & ! user. Includes references into msg_hdrs table for faster retrieval ! of message date, sender, subject for category "scans".</td> ! <td valign="top">Message instance numeric identifier (mu_id).</td> ! <td valign="top">Normalized message id (mu_m_id), user (mu_u_id), category ! (mu_ca_id)</td> ! <td valign="top">users, cats, msg_hdrs</td> ! <td valign="top">n/a</td> ! </tr> ! <tr> ! <td valign="top">msg_attach</td> ! <td valign="top">Attachments to a given message. Message "body" not in ! an attachment is treated within the database as attachment 0. Attachment ! sort order is maintained. Records include mime type, file encoding, ! multi-part separator data, flag for attachment storage (0 = internal, ! in the database; 1 = external, in the filesystem).</td> ! <td valign="top">Message attachment numeric identifier (ma_id).</td> ! <td valign="top">Normalized message id (ma_m_id), body (ma_body) [fulltext ! index]</td> ! <td valign="top">mime_types</td> ! <td valign="top">n/a</td> ! </tr> ! <tr> ! <th colspan="6">Logging</th> ! </tr> ! <tr> ! <th>Table</th> ! <th>Description</th> ! <th>Primary key</th> ! <th>Add'l Indexes</th> ! <th>References</th> ! <th>Referenced by</th> ! </tr> ! <tr> ! <td valign="top">obj_log</td> ! <td valign="top">History of actions on meta objects - namely, create, ! update, delete of users, categories, views, mime_types. To be maintained ! via trigger (to be defined).</td> ! <td valign="top">Numeric log record identifier (obj_id)</td> ! <td valign="top">Object type (obj_type), object identifier (obj_type_id), ! object description (obj_desc)</td> ! <td valign="top">n/a</td> ! <td valign="top">n/a</td> ! </tr> ! <tr> ! <td valign="top">msg_log</td> ! <td valign="top">History of message activity - user adds, deletes from ! categories. To be maintained via trigger (to be defined).</td> ! <td valign="top">Numeric log record identifier (msl_id).</td> ! <td valign="top">Normalized message id (msl_m_id), user (msl_u_id), category ! (msl_ca_id)</td> ! <td valign="top">n/a</td> ! <td valign="top">n/a</td> ! </tr> ! </tbody> ! </table> ! </p> ! <hr><a name="issues"></a> ! <h2>Open Questions/Issues</h2> ! <ol> ! <li>Design issues ! <ol type="a"> ! <li>Review all field sizing, especially msg_id and record identifiers. ! </li> ! <li>Should header info be normalized? Not done so above. </li> ! <li>Should users or mime_types be de-normalized? </li> ! </ol> ! </li> ! <li>MySQL specifics ! <ol type="a"> ! <li>Triggers for maintaining log (history) tables. <b>Update: No trigger ! or stored procedure support in MySQL. Estimate is that these items will ! be included in version 5.0. Current stable MySQL is 3.23.x and 4.x is now ! available.</b> </li> ! <li>Check MySQL behavior when auto_incremented column "rolls over". ! </li> ! <li>Review MySQL regex pattern matching. </li> ! <li>Note vanilla MySQL has no true foreign key constraints. You can ! define the foreign keys (foo integer references bar(foo)) but they aren't ! enforced. </li> ! </ol> ! </li> ! <li>Message questions ! <ol type="a"> ! <li>Multi-part separator data format? </li> ! <li>Which header line is used for message threading? Should it be included ! in msg_owners table for quick category scanning? </li> ! </ol> ! </li> ! <li>Miscellaneous ! <ol type="a"> ! <li>Construct and test sample queries... </li> ! </ol> ! </li> ! </ol> ! <hr><a name="details"></a> ! <h2>Table Details</h2> ! <table border="1"> ! <tbody> ! <tr> ! <th>Table</th> ! <th>Column</th> ! <th>Datatype</th> ! <th>Primary Key</th> ! <th>Indexed</th> ! <th>Description</th> ! </tr> ! <tr> ! <td valign="top" rowspan="2">mime_types</td> ! <td>mt_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for mime_type record</td> ! </tr> ! <tr> ! <td>mt_desc</td> ! <td>varchar(127)</td> ! <td> </td> ! <td>X</td> ! <td>Message body/attachment MIME type</td> ! </tr> ! <tr> ! <td valign="top" rowspan="2">users</td> ! <td>u_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for user record</td> ! </tr> ! <tr> ! <td>u_desc</td> ! <td>varchar(127)</td> ! <td> </td> ! <td>X</td> ! <td>User description (login/reference name, e.g. 'weissler' or ! 'li...@av...'</td> ! </tr> ! <tr> ! <td valign="top" rowspan="4">cats</td> ! <td>ca_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for category record</td> ! </tr> ! <tr> ! <td>ca_u_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>User owning this category. References users(u_id).</td> ! </tr> ! <tr> ! <td>ca_desc</td> ! <td>varchar(127)</td> ! <td> </td> ! <td> </td> ! <td>Category name, e.g. "Inbox", "Deleted", "Cycling"...</td> ! </tr> ! <tr> ! <td>ca_parent</td> ! <td>integer unsigned</td> ! <td> </td> ! <td> </td> ! <td>"Parent" category, allowing nesting of categories. Top-level ! categories have null parents. References cats(ca_id).</td> ! </tr> ! <tr> ! <td valign="top" rowspan="4">views</td> ! <td>vw_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for view record</td> ! </tr> ! <tr> ! <td>vw_desc</td> ! <td>varchar(127)</td> ! <td> </td> ! <td> </td> ! <td>View name, e.g. "Messages from Robert"</td> ! </tr> ! <tr> ! <td>vw_u_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>User owning view. References users(u_id).</td> ! </tr> ! <tr> ! <td>vw_query</td> ! <td>text</td> ! <td> </td> ! <td> </td> ! <td>SQL required to retrieve messages meeting user's search criteria</td> ! </tr> ! <tr> ! <td valign="top" rowspan="13">msg_ids<br> ! </td> ! <td valign="top">m_id<br> ! </td> ! <td valign="top">integer unsigned not null auto_increment<br> ! </td> ! <td valign="top">X<br> ! </td> ! <td valign="top">X<br> ! </td> ! <td valign="top">Unique identifier for message id (using less storage ! than the string message_id's in messages)<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_msg_id<br> ! </td> ! <td valign="top">varchar(255)<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">X<br> ! </td> ! <td valign="top">Message identifier (assigned by MTA)<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_to<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">To header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_cc<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">CC header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_bcc<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">BCC header line contents (outgoing msgs only)<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_subject<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">Subject header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_date<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">Date header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_from<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">From header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_in_reply_to<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">In-Reply-To header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_sender<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">Sender header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_parent_id<br> ! </td> ! <td valign="top">integer<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">If attachment, m_id of parent message<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_vw_incl<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">Specify views in which to include this message<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_vw_excl<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">Specify views from which to exclude this message<br> ! </td> ! </tr> ! <tr> ! <td valign="top" rowspan="5">msg_hdrs</td> ! <td>mh_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for message header record</td> ! </tr> ! <tr> ! <td>mh_m_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Message identifier</td> ! </tr> ! <tr> ! <td>mh_key</td> ! <td>varchar(63)</td> ! <td> </td> ! <td>X</td> ! <td>Header tag - e.g. "To", "From", "Subject"...anything left of colon ! (:) on header line. </td> ! </tr> ! <tr> ! <td>mh_value</td> ! <td>varchar(255)</td> ! <td> </td> ! <td>X</td> ! <td>Header value - anything right of colon (:) on header line. Fulltext ! index.</td> ! </tr> ! <tr> ! <td>mh_sort_order</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td> </td> ! <td>Header sequence number.</td> ! </tr> ! <tr> ! <td valign="top" rowspan="5">msg_owners</td> ! <td>mu_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for message instance record.</td> ! </tr> ! <tr> ! <td>mu_m_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Message identifier.</td> ! </tr> ! <tr> ! <td>mu_u_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>User owning a copy of the message.</td> ! </tr> ! <tr> ! <td>mu_ca_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Category to which the user assigned the message.</td> ! </tr> ! <tr> ! <td>mu_flags</td> ! <td>integer unsigned</td> ! <td> </td> ! <td> </td> ! <td>Bit flags for the message.</td> ! </tr> ! <tr> ! <td valign="top" rowspan="8">msg_attach</td> ! <td>ma_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for message attachment record.</td> ! </tr> ! <tr> ! <td>ma_m_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Message identifier.</td> ! </tr> ! <tr> ! <td>ma_mt_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td> </td> ! <td>Foreign key ref to mime_types(mt_id)</td> ! </tr> ! <tr> ! <td>ma_encode</td> ! <td>varchar(127)</td> ! <td> </td> ! <td> </td> ! <td>Attachment encoding</td> ! </tr> ! <tr> ! <td>ma_body</td> ! <td>mediumtext</td> ! <td> </td> ! <td>X</td> ! <td>Attachment body (for attachments stored within the database). Fulltext ! index.</td> ! </tr> ! <tr> ! <td>ma_path</td> ! <td>varchar(255)</td> ! <td> </td> ! <td> </td> ! <td>Full pathname to attachment (for attachments stored in the filesystem).</td> ! </tr> ! <tr> ! <td>ma_sep_data</td> ! <td>varchar(255)</td> ! <td> </td> ! <td> </td> ! <td>Multi-part separator data.</td> ! </tr> ! <tr> ! <td>ma_sort_order</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td> </td> ! <td>Attachment sequence number.</td> ! </tr> ! <tr> ! <td valign="top" rowspan="6">obj_log</td> ! <td>obj_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for object log record.</td> ! </tr> ! <tr> ! <td>obj_type</td> ! <td>varchar(15)</td> ! <td> </td> ! <td>X</td> ! <td>Type of object - e.g. user, view, cat, mime_type</td> ! </tr> ! <tr> ! <td>obj_type_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Object identifier; if obj_type = user, obj_type_id corresponds to ! users(u_id), obj_type = cat, obj_type_id corresponds to cats(ca_id), ! etc.</td> ! </tr> ! <tr> ! <td>obj_desc</td> ! <td>varchar(127)</td> ! <td> </td> ! <td>X</td> ! <td>Object description (username, viewname, category name...)</td> ! </tr> ! <tr> ! <td>obj_action</td> ! <td>char(1)</td> ! <td> </td> ! <td> </td> ! <td>Action taken on this object. Values include C (create), U (update), ! D (delete).</td> ! </tr> ! <tr> ! <td>obj_datetime</td> ! <td>timestamp(14)</td> ! <td> </td> ! <td> </td> ! <td>Timestamp of object action.</td> ! </tr> ! <tr> ! <td valign="top" rowspan="6">msg_log</td> ! <td>msl_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for message log record.</td> ! </tr> ! <tr> ! <td>msl_m_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Message identifier.</td> ! </tr> ! <tr> ! <td>msl_u_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>User owning instance of the specified message.</td> ! </tr> ! <tr> ! <td>msl_ca_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Category to which the user assigned the message.</td> ! </tr> ! <tr> ! <td>msl_action</td> ! <td>char(1)</td> ! <td> </td> ! <td>X</td> ! <td>Action taken on this message. Values include C (create), U (update), ! D (delete).</td> ! </tr> ! <tr> ! <td>msl_datetime</td> ! <td>timestamp(14)</td> ! <td> </td> ! <td> </td> ! <td>Timestamp of message action.</td> ! </tr> ! </tbody> ! </table> ! <p></p> ! <hr><a name="storage"></a> ! <h2>MySQL Storage Notes</h2> ! <p> ! <table border="1"> ! <tbody> ! <tr> ! <th>Datatype</th> ! <th>Max</th> ! <th>Storage</th> ! </tr> ! <tr> ! <td>varchar</td> ! <td>255</td> ! <td>L+1</td> ! </tr> ! <tr> ! <td>tinytext</td> ! <td>255</td> ! <td>L+1</td> ! </tr> ! <tr> ! <td>text</td> ! <td>64k</td> ! <td>L+2</td> ! </tr> ! <tr> ! <td>mediumtext</td> ! <td>16m</td> ! <td>L+3</td> ! </tr> ! <tr> ! <td>longtext</td> ! <td>4g</td> ! <td>L+4</td> ! </tr> ! <tr> ! <td>tinyint (U)</td> ! <td>255</td> ! <td>1</td> ! </tr> ! <tr> ! <td>smallint (U)</td> ! <td>65535</td> ! <td>2</td> ! </tr> ! <tr> ! <td>mediumint (U)</td> ! <td>16777215</td> ! <td>3</td> ! </tr> ! <tr> ! <td>integer (U)</td> ! <td>4294967295</td> ! <td>4</td> ! </tr> ! <tr> ! <td>timestamp</td> ! <td>YYYYMMDDHHMISS</td> ! <td>4</td> ! </tr> ! </tbody> ! </table> ! </p> ! <p>...where (U) = unsigned, and L = length of text string. </p> ! <p></p> ! <hr><i>Last update: 17 October 2002 by <a href="mailto:li...@av...">Liza ! Weissler</a></i><a href="mailto:li...@av..."> </a><br> ! </body> ! </html> --- 1,824 ---- ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ! <html> ! <head> ! <!-- saved from url=(0189)http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1 --> ! <meta http-equiv="Content-Type" ! content="text/html; charset=windows-1252"> ! <meta content="MSHTML 5.50.4611.1300" name="GENERATOR"> ! <title>MailDB Design</title> ! </head> ! <body> ! <h1>MailDB Database Design</h1> ! <p><a href="#intro">Introduction</a><br> ! <a href="#tables">Table Descriptions</a><br> ! <a href="#issues">Open Questions/Issues</a><br> ! <a href="#details">Table Details</a><br> ! <a href="#storage">MySQL Storage Notes</a><br> ! </p> ! <p></p> ! <hr><a name="intro"></a> ! <h2>Introduction</h2> ! <p>This document describes the proposed design for the MailDB database. This ! design is a work-in-progress and is subject to change; outstanding questions/issues ! are listed below in <a ! href="http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1#issues">Open ! Questions/Issues</a>. </p> ! <p>This initial design assumes use of MySQL as the backend RDBMS. The design ! is generally normalized, the notable exception being message ! header tags (left of the colon) in the individual header records (which ! are stored in the msg_hdrs table). In this case the benefits of normalizing ! the data seemed to be outweighed by the slight increase in complexity of ! queries. [Note: I'm a bit on the fence on this one...decision not final. ! :-) -- lyw] </p> ! <p>Table summary descriptions are provided in the following section. A detailed ! description of table columns, datatypes, and a brief description/use of columns ! is in <a href="#details">Table Details</a>, below. The full SQL for table ! creation may be found in accompanying file <a href="cr_maildb.sql">cr_maildb.sql</a>, ! and sample queries are provided in accompanying file <a ! href="queries.sql">queries.sql</a>. </p> ! <hr><a name="tables"></a> ! <h2>Table Descriptions</h2> ! <p>There are four basic categories of tables: data common to all messages, ! user meta data, message data, and logs. </p> ! <p> ! <table border="1"> ! <tbody> ! <tr> ! <th colspan="6">Common message data</th> ! </tr> ! <tr> ! <th>Table</th> ! <th>Description</th> ! <th>Primary key</th> ! <th>Add'l Indexes</th> ! <th>References</th> ! <th>Referenced by</th> ! </tr> ! <tr> ! <td valign="top">mime_types</td> ! <td valign="top">Normalized table of mime_type definitions.</td> ! <td valign="top">Mime type numeric identifier (mt_id)</td> ! <td valign="top">Mime type (mt_desc)</td> ! <td valign="top">n/a</td> ! <td valign="top">msg_attach</td> ! </tr> ! <tr> ! <th colspan="6">User meta data</th> ! </tr> ! <tr> ! <th>Table</th> ! <th>Description</th> ! <th>Primary key</th> ! <th>Add'l Indexes</th> ! <th>References</th> ! <th>Referenced by</th> ! </tr> ! <tr> ! <td valign="top">users</td> ! <td valign="top">Normalized table of MailDB users.</td> ! <td valign="top">User numeric identifier (u_id)</td> ! <td valign="top">User name (u_desc)</td> ! <td valign="top">n/a</td> ! <td valign="top">cats<br> ! views<br> ! msg_owners</td> ! </tr> ! <tr> ! <td valign="top">cats</td> ! <td valign="top">Message categories (i.e. "folders") created by users, ! to which messages are assigned. Categories may be [multiply] nested, ! and messages may assigned to multiple categories.</td> ! <td valign="top">Category numeric identifier (ca_id)</td> ! <td valign="top">Category owner (ca_u_id)</td> ! <td valign="top">n/a</td> ! <td valign="top">msg_owners</td> ! </tr> ! <tr> ! </tr> ! <tr> ! <td valign="top">views</td> ! <td valign="top">User views of messages...specifically, defined search ! criteria and the SQL required to execute the searches.</td> ! <td valign="top">View numeric identifier (vw_id)</td> ! <td valign="top">View owner (vw_u_id)</td> ! <td valign="top">users</td> ! <td valign="top">n/a</td> ! </tr> ! <tr> ! <th colspan="6">Message data</th> ! </tr> ! <tr> ! <th>Table</th> ! <th>Description</th> ! <th>Primary key</th> ! <th>Add'l Indexes</th> ! <th>References</th> ! <th>Referenced by</th> ! </tr> ! <tr> ! <td valign="top">msg_ids<br> ! </td> ! <td valign="top">Semi-normalized table of message ids. Also contains ! "well-known" message headers -- including to, cc, bcc, subject, date, ! from, in-reply-to, sender. (Note all header lines are also stored in ! msg_hdrs.)<br> ! </td> ! <td valign="top">Numeric message record identifier (m_id)<br> ! </td> ! <td valign="top">Message id (m_msg_id)<br>Date (m_date)<br> ! From (m_from)<br>To (m_to)<br>Subject (m_subject) ! </td> ! <td valign="top">n/a<br> ! </td> ! <td valign="top">msg_hdrs, msg_owners, msg_attach, msg_log<br> ! </td> ! </tr> ! <tr> ! <td valign="top">msg_hdrs</td> ! <td valign="top">Message header information for a given message. Message ! header sort order is maintained. Multiple records will exist for each ! message, one per unique header line. </td> ! <td valign="top">Numeric message header record identifier (mh_id)</td> ! <td valign="top">Normalized message id (mh_m_id), header key (mh_key), ! header value (mh_value) [fulltext index]</td> ! <td valign="top">n/a</td> ! <td valign="top">msg_owners</td> ! </tr> ! <tr> ! <td valign="top">msg_owners</td> ! <td valign="top">Records describing user instances (category filing) ! of specific messages. Users may assign messages to one or more categories, ! thus multiple records may exist in the table for a given message & ! user. Includes references into msg_hdrs table for faster retrieval ! of message date, sender, subject for category "scans".</td> ! <td valign="top">Message instance numeric identifier (mu_id).</td> ! <td valign="top">Normalized message id (mu_m_id), user (mu_u_id), category ! (mu_ca_id)</td> ! <td valign="top">users, cats, msg_hdrs</td> ! <td valign="top">n/a</td> ! </tr> ! <tr> ! <td valign="top">msg_attach</td> ! <td valign="top">Attachments to a given message. Message "body" not in ! an attachment is treated within the database as attachment 0. Attachment ! sort order is maintained. Records include mime type, file encoding, ! multi-part separator data, flag for attachment storage (0 = internal, ! in the database; 1 = external, in the filesystem).</td> ! <td valign="top">Message attachment numeric identifier (ma_id).</td> ! <td valign="top">Normalized message id (ma_m_id), body (ma_body) [fulltext ! index]</td> ! <td valign="top">mime_types</td> ! <td valign="top">n/a</td> ! </tr> ! <tr> ! <th colspan="6">Logging</th> ! </tr> ! <tr> ! <th>Table</th> ! <th>Description</th> ! <th>Primary key</th> ! <th>Add'l Indexes</th> ! <th>References</th> ! <th>Referenced by</th> ! </tr> ! <tr> ! <td valign="top">obj_log</td> ! <td valign="top">History of actions on meta objects - namely, create, ! update, delete of users, categories, views, mime_types. To be maintained ! via trigger (to be defined).</td> ! <td valign="top">Numeric log record identifier (obj_id)</td> ! <td valign="top">Object type (obj_type), object identifier (obj_type_id), ! object description (obj_desc)</td> ! <td valign="top">n/a</td> ! <td valign="top">n/a</td> ! </tr> ! <tr> ! <td valign="top">msg_log</td> ! <td valign="top">History of message activity - user adds, deletes from ! categories. To be maintained via trigger (to be defined).</td> ! <td valign="top">Numeric log record identifier (msl_id).</td> ! <td valign="top">Normalized message id (msl_m_id), user (msl_u_id), category ! (msl_ca_id)</td> ! <td valign="top">n/a</td> ! <td valign="top">n/a</td> ! </tr> ! </tbody> ! </table> ! </p> ! <hr><a name="issues"></a> ! <h2>Open Questions/Issues</h2> ! <ol> ! <li>Design issues ! <ol type="a"> ! <li>Review all field sizing, especially msg_id and record identifiers. ! </li> ! <li>Should header info be normalized? Not done so above. </li> ! <li>Should users or mime_types be de-normalized? </li> ! </ol> ! </li> ! <li>MySQL specifics ! <ol type="a"> ! <li>Triggers for maintaining log (history) tables. <b>Update: No trigger ! or stored procedure support in MySQL. Estimate is that these items will ! be included in version 5.0. Current stable MySQL is 3.23.x and 4.x is now ! available.</b> </li> ! <li>Check MySQL behavior when auto_incremented column "rolls over". ! </li> ! <li>Review MySQL regex pattern matching. </li> ! <li>Note vanilla MySQL has no true foreign key constraints. You can ! define the foreign keys (foo integer references bar(foo)) but they aren't ! enforced. </li> ! </ol> ! </li> ! <li>Message questions ! <ol type="a"> ! <li>Multi-part separator data format? </li> ! <li>Which header line is used for message threading? Should it be included ! in msg_owners table for quick category scanning? </li> ! </ol> ! </li> ! <li>Miscellaneous ! <ol type="a"> ! <li>Construct and test sample queries... </li> ! </ol> ! </li> ! </ol> ! <hr><a name="details"></a> ! <h2>Table Details</h2> ! <table border="1"> ! <tbody> ! <tr> ! <th>Table</th> ! <th>Column</th> ! <th>Datatype</th> ! <th>Primary Key</th> ! <th>Indexed</th> ! <th>Description</th> ! </tr> ! <tr> ! <td valign="top" rowspan="2">mime_types</td> ! <td>mt_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for mime_type record</td> ! </tr> ! <tr> ! <td>mt_desc</td> ! <td>varchar(127)</td> ! <td> </td> ! <td>X</td> ! <td>Message body/attachment MIME type</td> ! </tr> ! <tr> ! <td valign="top" rowspan="2">users</td> ! <td>u_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for user record</td> ! </tr> ! <tr> ! <td>u_desc</td> ! <td>varchar(127)</td> ! <td> </td> ! <td>X</td> ! <td>User description (login/reference name, e.g. 'weissler' or ! 'li...@av...'</td> ! </tr> ! <tr> ! <td valign="top" rowspan="4">cats</td> ! <td>ca_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for category record</td> ! </tr> ! <tr> ! <td>ca_u_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>User owning this category. References users(u_id).</td> ! </tr> ! <tr> ! <td>ca_desc</td> ! <td>varchar(127)</td> ! <td> </td> ! <td> </td> ! <td>Category name, e.g. "Inbox", "Deleted", "Cycling"...</td> ! </tr> ! <tr> ! <td>ca_parent</td> ! <td>integer unsigned</td> ! <td> </td> ! <td> </td> ! <td>"Parent" category, allowing nesting of categories. Top-level ! categories have null parents. References cats(ca_id).</td> ! </tr> ! <tr> ! <td valign="top" rowspan="4">views</td> ! <td>vw_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for view record</td> ! </tr> ! <tr> ! <td>vw_desc</td> ! <td>varchar(127)</td> ! <td> </td> ! <td> </td> ! <td>View name, e.g. "Messages from Robert"</td> ! </tr> ! <tr> ! <td>vw_u_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>User owning view. References users(u_id).</td> ! </tr> ! <tr> ! <td>vw_query</td> ! <td>text</td> ! <td> </td> ! <td> </td> ! <td>SQL required to retrieve messages meeting user's search criteria</td> ! </tr> ! <tr> ! <td valign="top" rowspan="13">msg_ids<br> ! </td> ! <td valign="top">m_id<br> ! </td> ! <td valign="top">integer unsigned not null auto_increment<br> ! </td> ! <td valign="top">X<br> ! </td> ! <td valign="top">X<br> ! </td> ! <td valign="top">Unique identifier for message id (using less storage ! than the string message_id's in messages)<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_msg_id<br> ! </td> ! <td valign="top">varchar(255)<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">X<br> ! </td> ! <td valign="top">Message identifier (assigned by MTA)<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_to<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">X<br> ! </td> ! <td valign="top">To header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_cc<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">CC header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_bcc<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">BCC header line contents (outgoing msgs only)<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_subject<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">X<br> ! </td> ! <td valign="top">Subject header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_date<br> ! </td> ! <td valign="top">datetime<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">X<br> ! </td> ! <td valign="top">Date header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_from<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">X<br> ! </td> ! <td valign="top">From header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_in_reply_to<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">In-Reply-To header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_sender<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">Sender header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_reply_to<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">Reply-To header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_references<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">References header line contents<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_parent_id<br> ! </td> ! <td valign="top">integer<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">If attachment, m_id of parent message<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_vw_incl<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">Specify views in which to include this message<br> ! </td> ! </tr> ! <tr> ! <td valign="top">m_vw_excl<br> ! </td> ! <td valign="top">text<br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top"><br> ! </td> ! <td valign="top">Specify views from which to exclude this message<br> ! </td> ! </tr> ! <tr> ! <td valign="top" rowspan="5">msg_hdrs</td> ! <td>mh_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for message header record</td> ! </tr> ! <tr> ! <td>mh_m_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Message identifier</td> ! </tr> ! <tr> ! <td>mh_key</td> ! <td>varchar(63)</td> ! <td> </td> ! <td>X</td> ! <td>Header tag - e.g. "To", "From", "Subject"...anything left of colon ! (:) on header line. </td> ! </tr> ! <tr> ! <td>mh_value</td> ! <td>varchar(255)</td> ! <td> </td> ! <td>X</td> ! <td>Header value - anything right of colon (:) on header line. Fulltext ! index.</td> ! </tr> ! <tr> ! <td>mh_sort_order</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td> </td> ! <td>Header sequence number.</td> ! </tr> ! <tr> ! <td valign="top" rowspan="5">msg_owners</td> ! <td>mu_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for message instance record.</td> ! </tr> ! <tr> ! <td>mu_m_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Message identifier.</td> ! </tr> ! <tr> ! <td>mu_u_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>User owning a copy of the message.</td> ! </tr> ! <tr> ! <td>mu_ca_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Category to which the user assigned the message.</td> ! </tr> ! <tr> ! <td>mu_flags</td> ! <td>integer unsigned</td> ! <td> </td> ! <td> </td> ! <td>Bit flags for the message.</td> ! </tr> ! <tr> ! <td valign="top" rowspan="8">msg_attach</td> ! <td>ma_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for message attachment record.</td> ! </tr> ! <tr> ! <td>ma_m_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Message identifier.</td> ! </tr> ! <tr> ! <td>ma_mt_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td> </td> ! <td>Foreign key ref to mime_types(mt_id)</td> ! </tr> ! <tr> ! <td>ma_encode</td> ! <td>varchar(127)</td> ! <td> </td> ! <td> </td> ! <td>Attachment encoding</td> ! </tr> ! <tr> ! <td>ma_body</td> ! <td>mediumtext</td> ! <td> </td> ! <td>X</td> ! <td>Attachment body (for attachments stored within the database). Fulltext ! index.</td> ! </tr> ! <tr> ! <td>ma_path</td> ! <td>varchar(255)</td> ! <td> </td> ! <td> </td> ! <td>Full pathname to attachment (for attachments stored in the filesystem).</td> ! </tr> ! <tr> ! <td>ma_sep_data</td> ! <td>varchar(255)</td> ! <td> </td> ! <td> </td> ! <td>Multi-part separator data.</td> ! </tr> ! <tr> ! <td>ma_sort_order</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td> </td> ! <td>Attachment sequence number.</td> ! </tr> ! <tr> ! <td valign="top" rowspan="6">obj_log</td> ! <td>obj_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for object log record.</td> ! </tr> ! <tr> ! <td>obj_type</td> ! <td>varchar(15)</td> ! <td> </td> ! <td>X</td> ! <td>Type of object - e.g. user, view, cat, mime_type</td> ! </tr> ! <tr> ! <td>obj_type_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Object identifier; if obj_type = user, obj_type_id corresponds to ! users(u_id), obj_type = cat, obj_type_id corresponds to cats(ca_id), ! etc.</td> ! </tr> ! <tr> ! <td>obj_desc</td> ! <td>varchar(127)</td> ! <td> </td> ! <td>X</td> ! <td>Object description (username, viewname, category name...)</td> ! </tr> ! <tr> ! <td>obj_action</td> ! <td>char(1)</td> ! <td> </td> ! <td> </td> ! <td>Action taken on this object. Values include C (create), U (update), ! D (delete).</td> ! </tr> ! <tr> ! <td>obj_datetime</td> ! <td>timestamp(14)</td> ! <td> </td> ! <td> </td> ! <td>Timestamp of object action.</td> ! </tr> ! <tr> ! <td valign="top" rowspan="6">msg_log</td> ! <td>msl_id</td> ! <td>integer unsigned not null auto_increment</td> ! <td>X</td> ! <td>X</td> ! <td>Unique identifier for message log record.</td> ! </tr> ! <tr> ! <td>msl_m_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Message identifier.</td> ! </tr> ! <tr> ! <td>msl_u_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>User owning instance of the specified message.</td> ! </tr> ! <tr> ! <td>msl_ca_id</td> ! <td>integer unsigned not null</td> ! <td> </td> ! <td>X</td> ! <td>Category to which the user assigned the message.</td> ! </tr> ! <tr> ! <td>msl_action</td> ! <td>char(1)</td> ! <td> </td> ! <td>X</td> ! <td>Action taken on this message. Values include C (create), U (update), ! D (delete).</td> ! </tr> ! <tr> ! <td>msl_datetime</td> ! <td>timestamp(14)</td> ! <td> </td> ! <td> </td> ! <td>Timestamp of message action.</td> ! </tr> ! </tbody> ! </table> ! <p></p> ! <hr><a name="storage"></a> ! <h2>MySQL Storage Notes</h2> ! <p> ! <table border="1"> ! <tbody> ! <tr> ! <th>Datatype</th> ! <th>Max</th> ! <th>Storage</th> ! </tr> ! <tr> ! <td>varchar</td> ! <td>255</td> ! <td>L+1</td> ! </tr> ! <tr> ! <td>tinytext</td> ! <td>255</td> ! <td>L+1</td> ! </tr> ! <tr> ! <td>text</td> ! <td>64k</td> ! <td>L+2</td> ! </tr> ! <tr... [truncated message content] |
|
From: Liza W. <lwe...@us...> - 2003-05-22 18:31:55
|
lweissler 03/05/22 11:31:55
Modified: libmaildb/db/mysql/doc cr_maildb.sql design.html message.sql
test.sql
Log:
Add common header fields to msg_ids, as well as parent_id field. msg_owners loses date, from, subject fields. msg_attach loses ma_in_fs, ma_in_msg fields.
Revision Changes Path
1.5 +29 -9 maildb/libmaildb/db/mysql/doc/cr_maildb.sql
Index: cr_maildb.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_maildb.sql,v
retrieving revision 1.4
retrieving revision 1.5
diff -c -r1.4 -r1.5
*** cr_maildb.sql 21 May 2003 21:04:19 -0000 1.4
--- cr_maildb.sql 22 May 2003 18:31:54 -0000 1.5
***************
*** 5,11 ****
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: cr_maildb.sql,v 1.4 2003/05/21 21:04:19 lweissler Exp $
-- -------------------------------------------------------
-- maildb tables
--- 5,11 ----
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: cr_maildb.sql,v 1.5 2003/05/22 18:31:54 lweissler Exp $
-- -------------------------------------------------------
-- maildb tables
***************
*** 15,21 ****
-- user data:
-- users, cats, views
-- message data:
! -- msg_ids, msg_hdrs, msg_owners, msg_attach
-- logs:
-- obj_log, msg_log
-- meta:
--- 15,21 ----
-- user data:
-- users, cats, views
-- message data:
! -- msg_ids, msg_hdrs, msg_owners, msg_attach, msg_orig
-- logs:
-- obj_log, msg_log
-- meta:
***************
*** 96,101 ****
--- 96,110 ----
create table msg_ids (
m_id integer unsigned not null auto_increment,
m_msg_id varchar(255) not null,
+ m_to text,
+ m_cc text,
+ m_bcc text,
+ m_subject text,
+ m_date datetime,
+ m_from text,
+ m_in_reply_to text,
+ m_sender text,
+ m_parent_id integer unsigned,
m_vw_incl text,
m_vw_excl text,
primary key (m_id),
***************
*** 122,133 ****
drop table if exists msg_owners;
create table msg_owners (
mu_id integer unsigned not null auto_increment,
! mu_m_id integer unsigned not null not null references msg_ids(m_id),
mu_u_id integer unsigned not null references users(u_id),
mu_ca_id integer unsigned not null references cats(ca_id),
! mu_date integer unsigned not null references msg_hdrs(mh_id),
! mu_from integer unsigned not null references msg_hdrs(mh_id),
! mu_subject integer unsigned not null references msg_hdrs(mh_id),
mu_flags integer,
primary key (mu_id),
index mu_m_id_idx (mu_m_id),
--- 131,142 ----
drop table if exists msg_owners;
create table msg_owners (
mu_id integer unsigned not null auto_increment,
! mu_m_id integer unsigned not null references msg_ids(m_id),
mu_u_id integer unsigned not null references users(u_id),
mu_ca_id integer unsigned not null references cats(ca_id),
! -- mu_date integer unsigned not null references msg_hdrs(mh_id),
! -- mu_from integer unsigned not null references msg_hdrs(mh_id),
! -- mu_subject integer unsigned not null references msg_hdrs(mh_id),
mu_flags integer,
primary key (mu_id),
index mu_m_id_idx (mu_m_id),
***************
*** 136,150 ****
);
-- msg_attach
drop table if exists msg_attach;
create table msg_attach (
ma_id integer unsigned not null auto_increment,
! ma_m_id integer unsigned not null not null references msg_ids(m_id),
ma_mt_id integer unsigned not null references mime_types(mt_id),
ma_encode varchar(127),
- ma_in_fs bool,
- ma_in_msg bool,
ma_body mediumtext,
ma_path varchar(255),
ma_sep_data varchar(255),
--- 145,159 ----
);
-- msg_attach
+ -- ma_in_fs bool, \ removed
+ -- ma_in_msg bool, / 5/22/03
drop table if exists msg_attach;
create table msg_attach (
ma_id integer unsigned not null auto_increment,
! ma_m_id integer unsigned not null references msg_ids(m_id),
ma_mt_id integer unsigned not null references mime_types(mt_id),
ma_encode varchar(127),
ma_body mediumtext,
ma_path varchar(255),
ma_sep_data varchar(255),
***************
*** 152,157 ****
--- 161,177 ----
primary key (ma_id),
index ma_m_id_idx (ma_m_id),
fulltext index ma_body_idx (ma_body)
+ );
+
+ -- msg_orig
+
+ drop table if exists msg_orig;
+ create table msg_orig (
+ mo_id integer unsigned not null auto_increment,
+ mo_m_id integer unsigned not null references msg_ids(m_id),
+ mo_text longtext,
+ primary key (mo_id),
+ index mo_m_id_idx (mo_m_id)
);
-- -------------------------
1.5 +118 -47 maildb/libmaildb/db/mysql/doc/design.html
Index: design.html
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/design.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -c -r1.4 -r1.5
*** design.html 21 May 2003 21:04:19 -0000 1.4
--- design.html 22 May 2003 18:31:54 -0000 1.5
***************
*** 118,124 ****
<tr>
<td valign="top">msg_ids<br>
</td>
! <td valign="top">Normalized table of message ids.<br>
</td>
<td valign="top">Numeric message record identifier (m_id)<br>
</td>
--- 118,127 ----
<tr>
<td valign="top">msg_ids<br>
</td>
! <td valign="top">Semi-normalized table of message ids. Also contains
! "well-known" message headers -- including to, cc, bcc, subject, date,
! from, in-reply-to, sender. (Note all header lines are also stored in
! msg_hdrs.)<br>
</td>
<td valign="top">Numeric message record identifier (m_id)<br>
</td>
***************
*** 210,218 ****
</li>
<li>Should header info be normalized? Not done so above. </li>
<li>Should users or mime_types be de-normalized? </li>
- <li>Size threshold for determining whether attachment is stored in
- the database or as external file? (Need to know here only for reasonable
- sizing of the ma_body field in msg_attach.) </li>
</ol>
</li>
<li>MySQL specifics
--- 213,218 ----
***************
*** 345,351 ****
<td>SQL required to retrieve messages meeting user's search criteria</td>
</tr>
<tr>
! <td valign="top" rowspan="2">msg_ids<br>
</td>
<td valign="top">m_id<br>
</td>
--- 345,351 ----
<td>SQL required to retrieve messages meeting user's search criteria</td>
</tr>
<tr>
! <td valign="top" rowspan="13">msg_ids<br>
</td>
<td valign="top">m_id<br>
</td>
***************
*** 372,386 ****
</td>
</tr>
<tr>
<td valign="top">m_vw_incl<br>
</td>
<td valign="top">text<br>
</td>
<td valign="top"><br>
</td>
! <td valign="top">X<br>
</td>
! <td valign="to">Specify views in which to include this message<br>
</td>
</tr>
<tr>
--- 372,494 ----
</td>
</tr>
<tr>
+ <td valign="top">m_to<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">To header line contents<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">m_cc<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">CC header line contents<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">m_bcc<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">BCC header line contents (outgoing msgs only)<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">m_subject<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">Subject header line contents<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">m_date<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">Date header line contents<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">m_from<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">From header line contents<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">m_in_reply_to<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">In-Reply-To header line contents<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">m_sender<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">Sender header line contents<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">m_parent_id<br>
+ </td>
+ <td valign="top">integer unsigned<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">If attachment, m_id of parent message<br>
+ </td>
+ </tr>
+ <tr>
<td valign="top">m_vw_incl<br>
</td>
<td valign="top">text<br>
</td>
<td valign="top"><br>
</td>
! <td valign="top"><br>
</td>
! <td valign="top">Specify views in which to include this message<br>
</td>
</tr>
<tr>
***************
*** 390,396 ****
</td>
<td valign="top"><br>
</td>
! <td valign="top">X<br>
</td>
<td valign="top">Specify views from which to exclude this message<br>
</td>
--- 498,504 ----
</td>
<td valign="top"><br>
</td>
! <td valign="top"><br>
</td>
<td valign="top">Specify views from which to exclude this message<br>
</td>
***************
*** 434,440 ****
<td>Header sequence number.</td>
</tr>
<tr>
! <td valign="top" rowspan="8">msg_owners</td>
<td>mu_id</td>
<td>integer unsigned not null auto_increment</td>
<td>X</td>
--- 542,548 ----
<td>Header sequence number.</td>
</tr>
<tr>
! <td valign="top" rowspan="5">msg_owners</td>
<td>mu_id</td>
<td>integer unsigned not null auto_increment</td>
<td>X</td>
***************
*** 463,489 ****
<td>Category to which the user assigned the message.</td>
</tr>
<tr>
- <td>mu_date</td>
- <td>integer unsigned not null</td>
- <td> </td>
- <td> </td>
- <td>Foreign key ref to corresponding "Date" header in msg_hdrs.</td>
- </tr>
- <tr>
- <td>mu_from</td>
- <td>integer unsigned not null</td>
- <td> </td>
- <td> </td>
- <td>Foreign key ref to corresponding "From" header in msg_hdrs.</td>
- </tr>
- <tr>
- <td>mu_subject</td>
- <td>integer unsigned not null</td>
- <td> </td>
- <td> </td>
- <td>Foreign key ref to corresponding "Subject" header in msg_hdrs.</td>
- </tr>
- <tr>
<td>mu_flags</td>
<td>integer unsigned</td>
<td> </td>
--- 571,576 ----
***************
*** 491,497 ****
<td>Bit flags for the message.</td>
</tr>
<tr>
! <td valign="top" rowspan="9">msg_attach</td>
<td>ma_id</td>
<td>integer unsigned not null auto_increment</td>
<td>X</td>
--- 578,584 ----
<td>Bit flags for the message.</td>
</tr>
<tr>
! <td valign="top" rowspan="8">msg_attach</td>
<td>ma_id</td>
<td>integer unsigned not null auto_increment</td>
<td>X</td>
***************
*** 518,539 ****
<td> </td>
<td> </td>
<td>Attachment encoding</td>
- </tr>
- <tr>
- <td>ma_in_fs</td>
- <td>boolean</td>
- <td> </td>
- <td> </td>
- <td>Denotes whether attachment is stored within the database (0) or
- externally in the filesystem (1).</td>
- </tr>
- <tr>
- <td>ma_in_msg</td>
- <td>boolean</td>
- <td> </td>
- <td> </td>
- <td>Denotes whether attachment is stored within the database as
- a message. This being true assumes ma_in_fs is TRUE.</td>
</tr>
<tr>
<td>ma_body</td>
--- 605,610 ----
1.5 +15 -5 maildb/libmaildb/db/mysql/doc/message.sql
Index: message.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/message.sql,v
retrieving revision 1.4
retrieving revision 1.5
diff -c -r1.4 -r1.5
*** message.sql 21 May 2003 21:04:19 -0000 1.4
--- message.sql 22 May 2003 18:31:54 -0000 1.5
***************
*** 5,11 ****
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: message.sql,v 1.4 2003/05/21 21:04:19 lweissler Exp $
-- -------------------------------------------------------
delete from config where cf_name is not null;
--- 5,11 ----
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: message.sql,v 1.5 2003/05/22 18:31:54 lweissler Exp $
-- -------------------------------------------------------
delete from config where cf_name is not null;
***************
*** 17,23 ****
insert into config values ('fs_path', '/home/lyw/maildb/foo');
insert into config values ('max_msg_size', '99999999');
! insert into msg_ids values (NULL, '<001801c27523$aa5d46a0$af270444@CX434770b>',NULL,NULL);
insert into msg_hdrs values (NULL, 1,
'From', 'lyu...@co... Wed Oct 16 10:53:33 2002', 0);
--- 17,35 ----
insert into config values ('fs_path', '/home/lyw/maildb/foo');
insert into config values ('max_msg_size', '99999999');
! insert into msg_ids values (NULL,
! '<001801c27523$aa5d46a0$af270444@CX434770b>',
! '"Liza Weissler" <li...@av...>',
! NULL,
! NULL,
! 'estee lauder',
! 'Wed, 16 Oct 2002 07:52:36 -0700',
! '"Luci Ursich" <lyu...@co...>',
! NULL,
! NULL,
! NULL,
! NULL,
! NULL);
insert into msg_hdrs values (NULL, 1,
'From', 'lyu...@co... Wed Oct 16 10:53:33 2002', 0);
***************
*** 67,78 ****
1,
1,
'',
- 0,
- 0,
'The blush is called Blush All Day, Natural Cheek Color..I have one that\nis 04 Pink Cloud and one that is 01 Potpourri..one is older than the\nother and I remember a discontinued color... both are like an orangey\npink...a salmon type color...I don''t want pink, pink... it is a blue\nrectangular case about 1 3/4 inches by 3.5 inches...powder with a brush.\n\nThere is also tube of stuff call Spotlight Skin Tone Perfecter... I like\nthat...\nL',
'',
'',
0);
! insert into msg_owners values (NULL, 1, 1, 1, 10, 7, 9, NULL);
--- 79,88 ----
1,
1,
'',
'The blush is called Blush All Day, Natural Cheek Color..I have one that\nis 04 Pink Cloud and one that is 01 Potpourri..one is older than the\nother and I remember a discontinued color... both are like an orangey\npink...a salmon type color...I don''t want pink, pink... it is a blue\nrectangular case about 1 3/4 inches by 3.5 inches...powder with a brush.\n\nThere is also tube of stuff call Spotlight Skin Tone Perfecter... I like\nthat...\nL',
'',
'',
0);
! insert into msg_owners values (NULL, 1, 1, 1, NULL);
1.4 +8 -10 maildb/libmaildb/db/mysql/doc/test.sql
Index: test.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/test.sql,v
retrieving revision 1.3
retrieving revision 1.4
diff -c -r1.3 -r1.4
*** test.sql 21 Dec 2002 14:06:57 -0000 1.3
--- test.sql 22 May 2003 18:31:54 -0000 1.4
***************
*** 5,11 ****
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: test.sql,v 1.3 2002/12/21 14:06:57 jsquyres Exp $
-- -------------------------------------------------------
-- -------------------------
--- 5,11 ----
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: test.sql,v 1.4 2003/05/22 18:31:54 lweissler Exp $
-- -------------------------------------------------------
-- -------------------------
***************
*** 35,41 ****
;
SELECT ma_m_id, m_msg_id, mt_desc, ma_encode, ma_body, ma_path,
! ma_sep_data, ma_in_fs, ma_sort_order
FROM msg_attach, mime_types, msg_ids
WHERE ma_m_id = 1
AND m_id = ma_m_id
--- 35,41 ----
;
SELECT ma_m_id, m_msg_id, mt_desc, ma_encode, ma_body, ma_path,
! ma_sep_data, ma_sort_order
FROM msg_attach, mime_types, msg_ids
WHERE ma_m_id = 1
AND m_id = ma_m_id
***************
*** 47,61 ****
-- Basically same as category scan except drop the mu_ca_id check
-- and add in check of mu_from.
! SELECT mu_m_id, a.mh_value as date, b.mh_value as hfrom,
! c.mh_value as subject, mu_flags
! FROM msg_owners, msg_hdrs a, msg_hdrs b, msg_hdrs c
WHERE mu_u_id = 1
! AND mu_date = a.mh_id
! AND mu_from = b.mh_id
! AND mu_subject = c.mh_id
! AND b.mh_value like '%lyursich%'
! ORDER BY a.mh_value
;
-- Count messages in a category
--- 47,59 ----
-- Basically same as category scan except drop the mu_ca_id check
-- and add in check of mu_from.
! -- SELECT mu_m_id, a.mh_value as date, b.mh_value as hfrom,
! -- c.mh_value as subject, mu_flags
! SELECT mu_m_id, m_date, m_from, m_subject
! FROM msg_owners, msg_ids
WHERE mu_u_id = 1
! AND mu_m_id = m_id
! AND m_from like '%lyursich%'
;
-- Count messages in a category
|
|
From: Liza W. <lwe...@us...> - 2003-05-21 21:04:20
|
lweissler 03/05/21 14:04:19
Modified: libmaildb/db/mysql/doc cr_maildb.sql design.html message.sql
Log:
Added m_vw_incl, mv_vw_excl fields to msg_ids table, to be used to
indicate views that a message should be included in/excluded from.
Revision Changes Path
1.4 +3 -1 maildb/libmaildb/db/mysql/doc/cr_maildb.sql
Index: cr_maildb.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_maildb.sql,v
retrieving revision 1.3
retrieving revision 1.4
diff -c -r1.3 -r1.4
*** cr_maildb.sql 21 Dec 2002 14:06:57 -0000 1.3
--- cr_maildb.sql 21 May 2003 21:04:19 -0000 1.4
***************
*** 5,11 ****
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: cr_maildb.sql,v 1.3 2002/12/21 14:06:57 jsquyres Exp $
-- -------------------------------------------------------
-- maildb tables
--- 5,11 ----
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: cr_maildb.sql,v 1.4 2003/05/21 21:04:19 lweissler Exp $
-- -------------------------------------------------------
-- maildb tables
***************
*** 96,101 ****
--- 96,103 ----
create table msg_ids (
m_id integer unsigned not null auto_increment,
m_msg_id varchar(255) not null,
+ m_vw_incl text,
+ m_vw_excl text,
primary key (m_id),
index m_msg_id_idx (m_msg_id)
);
1.4 +24 -0 maildb/libmaildb/db/mysql/doc/design.html
Index: design.html
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/design.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -c -r1.3 -r1.4
*** design.html 21 Dec 2002 14:06:57 -0000 1.3
--- design.html 21 May 2003 21:04:19 -0000 1.4
***************
*** 372,377 ****
--- 372,401 ----
</td>
</tr>
<tr>
+ <td valign="top">m_vw_incl<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">X<br>
+ </td>
+ <td valign="to">Specify views in which to include this message<br>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">m_vw_excl<br>
+ </td>
+ <td valign="top">text<br>
+ </td>
+ <td valign="top"><br>
+ </td>
+ <td valign="top">X<br>
+ </td>
+ <td valign="top">Specify views from which to exclude this message<br>
+ </td>
+ </tr>
+ <tr>
<td valign="top" rowspan="5">msg_hdrs</td>
<td>mh_id</td>
<td>integer unsigned not null auto_increment</td>
1.4 +2 -2 maildb/libmaildb/db/mysql/doc/message.sql
Index: message.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/message.sql,v
retrieving revision 1.3
retrieving revision 1.4
diff -c -r1.3 -r1.4
*** message.sql 21 Dec 2002 14:06:57 -0000 1.3
--- message.sql 21 May 2003 21:04:19 -0000 1.4
***************
*** 5,11 ****
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: message.sql,v 1.3 2002/12/21 14:06:57 jsquyres Exp $
-- -------------------------------------------------------
delete from config where cf_name is not null;
--- 5,11 ----
-- information, see the LICENSE file in the top level directory of the
-- MailDB source distribution.
--
! -- $Id: message.sql,v 1.4 2003/05/21 21:04:19 lweissler Exp $
-- -------------------------------------------------------
delete from config where cf_name is not null;
***************
*** 17,23 ****
insert into config values ('fs_path', '/home/lyw/maildb/foo');
insert into config values ('max_msg_size', '99999999');
! insert into msg_ids values (NULL, '<001801c27523$aa5d46a0$af270444@CX434770b>');
insert into msg_hdrs values (NULL, 1,
'From', 'lyu...@co... Wed Oct 16 10:53:33 2002', 0);
--- 17,23 ----
insert into config values ('fs_path', '/home/lyw/maildb/foo');
insert into config values ('max_msg_size', '99999999');
! insert into msg_ids values (NULL, '<001801c27523$aa5d46a0$af270444@CX434770b>',NULL,NULL);
insert into msg_hdrs values (NULL, 1,
'From', 'lyu...@co... Wed Oct 16 10:53:33 2002', 0);
|
|
From: Jeff S. <jsq...@us...> - 2002-12-21 14:07:00
|
jsquyres 02/12/21 06:06:58
Modified: libmaildb/db/mysql/doc README cr_db.sql cr_maildb.sql
design.html message.sql mime.sql queries.sql
test.sql users.sql
Log:
Next revision of the MySQL stuff from Liza
Revision Changes Path
1.3 +33 -36 maildb/libmaildb/db/mysql/doc/README
Index: README
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/README,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** README 5 Nov 2002 23:15:46 -0000 1.2
--- README 21 Dec 2002 14:06:57 -0000 1.3
***************
*** 1,36 ****
! # README
! #
! # Copyright (c) 2002 MailDB Team
! #
! # This file is part of the MailDB software package. For license
! # information, see the LICENSE file in the top level directory of the
! # MailDB source distribution.
! #
! # $Id: README,v 1.2 2002/11/05 23:15:46 lweissler Exp $
! # ---------------------------------------------------------
!
! 1) If new database, make sure you have a password set for root, and disallow
! local access without a password. This should do it...
!
! % mysql mysql
! > delete from user where host='localhost' and user='';
! > quit
!
! % mysqladmin -u root reload
! % mysqladmin -u root password <new-password>
! % mysqladmin -u root -p reload
!
! 2) Create maildb database
!
! - Edit cr_db.sql to set an appropriate password for the
! - maildb user (don't use the default...)
!
! % mysql -u root -p mysql < cr_db.sql /* provide root pw */
! % mysql -u maildb -p maildb < cr_maildb.sql /* provide maildb pw */
!
! 3) Populate with some sample data
! % mysql -u maildb -p maildb
! > source mime.sql
! > source users.sql
! > source message.sql
!
--- 1,33 ----
! # README
! #
! # Copyright (c) 2002 MailDB Team
! #
! # This file is part of the MailDB software package. For license
! # information, see the LICENSE file in the top level directory of the
! # MailDB source distribution.
! #
! # $Id: README,v 1.3 2002/12/21 14:06:57 jsquyres Exp $
! # ---------------------------------------------------------
!
! 1) If new database, make sure you have a password set for root, and disallow
! local access without a password. This should do it...
!
! % mysql mysql
! > delete from user where host='localhost' and user='';
! > quit
!
! % mysqladmin -u root reload
! % mysqladmin -u root password <new-password>
! % myqladmin -u root -p reload
!
! 2) Create maildb database
!
! % mysql -u root -p mysql < cr_db.sql /* provide root pw */
! % mysql -u maildb -p maildb < cr_maildb.sql /* provide maildb pw */
!
! 3) Populate with some sample data
! % mysql -u maildb -p maildb
! > source mime.sql
! > source users.sql
! > source message.sql
!
1.3 +21 -22 maildb/libmaildb/db/mysql/doc/cr_db.sql
Index: cr_db.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_db.sql,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** cr_db.sql 5 Nov 2002 23:15:47 -0000 1.2
--- cr_db.sql 21 Dec 2002 14:06:57 -0000 1.3
***************
*** 1,22 ****
! -- cr_db.sql - MailDB MySQL database creation
! -- Copyright (c) 2002 MailDB Team
! --
! -- This file is part of the MailDB software package. For license
! -- information, see the LICENSE file in the top level directory of the
! -- MailDB source distribution.
! --
! -- $Id: cr_db.sql,v 1.2 2002/11/05 23:15:47 lweissler Exp $
! -- -------------------------------------------------------
!
! -- Edit the 'grant' line below to set a good password for the
! -- maildb user
!
! -- Run this as:
! -- mysql --user=root -p mysql < cr_db.sql
! -- then:
! -- mysql --user=maildb -p maildb < cr_maildb.sql
!
! drop database if exists maildb;
! create database maildb;
! grant all privileges on maildb.* to maildb identified by 'maildb';
!
--- 1,21 ----
! -- cr_db.sql - MailDB MySQL database creation
! -- Copyright (c) 2002 MailDB Team
! --
! -- This file is part of the MailDB software package. For license
! -- information, see the LICENSE file in the top level directory of the
! -- MailDB source distribution.
! --
! -- $Id: cr_db.sql,v 1.3 2002/12/21 14:06:57 jsquyres Exp $
! -- -------------------------------------------------------
!
! -- MailDB database creation
! -- 10/18/2002 lyw
! -- run this as:
! -- mysql --user root -p mysql < cr_db.sql
! -- then:
! -- mysql --user=maildb -p maildb < cr_maildb.sql
!
! drop database if exists maildb;
! create database maildb;
! grant all privileges on maildb.* to maildb identified by 'maildb';
!
1.3 +196 -181 maildb/libmaildb/db/mysql/doc/cr_maildb.sql
Index: cr_maildb.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_maildb.sql,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** cr_maildb.sql 5 Nov 2002 23:15:47 -0000 1.2
--- cr_maildb.sql 21 Dec 2002 14:06:57 -0000 1.3
***************
*** 1,181 ****
! -- cr_maildb.sql - MailDB MySQL database table creation
! -- Copyright (c) 2002 MailDB Team
! --
! -- This file is part of the MailDB software package. For license
! -- information, see the LICENSE file in the top level directory of the
! -- MailDB source distribution.
! --
! -- $Id: cr_maildb.sql,v 1.2 2002/11/05 23:15:47 lweissler Exp $
! -- -------------------------------------------------------
! -- Create maildb tables
!
! -- common message data:
! -- hdrs, mime_types
! -- user data:
! -- users, cats, views
! -- message data:
! -- msg_ids, msg_hdrs, msg_users, msg_attach
! -- logs:
! -- obj_log, msg_log
!
! -- -------------------------
! -- Common Message Data
! -- -------------------------
!
! -- hdrs
! -- -> deleted 10/10/2002 in favor of de-normalizing
!
! -- drop table if exists hdrs;
! -- create table hdrs (
! -- h_id smallint unsigned not null auto_increment,
! -- h_desc varchar(20),
! -- primary key (h_id)
! -- );
!
! -- mime_types
!
! drop table if exists mime_types;
! create table mime_types (
! mt_id smallint unsigned not null auto_increment,
! mt_desc varchar(127),
! primary key (mt_id),
! index mt_desc_idx (mt_desc)
! );
!
!
! -- -------------------------
! -- User Data
! -- -------------------------
!
! -- users
!
! drop table if exists users;
! create table users (
! u_id smallint unsigned not null auto_increment,
! u_desc varchar(127),
! primary key (u_id),
! index u_desc_idx (u_desc)
! );
!
! -- cats
!
! drop table if exists cats;
! create table cats (
! ca_id mediumint unsigned not null auto_increment,
! ca_u_id smallint unsigned not null references users(u_id),
! ca_desc varchar(127),
! ca_parent mediumint unsigned references cats(ca_id),
! primary key (ca_id),
! index ca_u_id_idx (ca_u_id)
! );
!
! -- views
!
! drop table if exists views;
! create table views (
! vw_id mediumint unsigned not null auto_increment,
! vw_desc varchar(127),
! vw_u_id smallint unsigned not null references users(u_id),
! vw_query text,
! primary key (vw_id),
! index vw_u_id_idx (vw_u_id)
! );
!
!
! -- -------------------------
! -- Message Data
! -- -------------------------
!
! -- msg_ids
!
! drop table if exists msg_ids;
!
! create table msg_ids (
! m_id mediumint unsigned not null auto_increment,
! m_msg_id varchar(255) not null,
! primary key (m_id),
! index m_msg_id_idx (m_msg_id)
! );
!
! -- msg_hdrs
!
! drop table if exists msg_hdrs;
! create table msg_hdrs (
! mh_id mediumint unsigned not null auto_increment,
! mh_m_id mediumint unsigned not null references msg_ids(m_id),
! mh_key varchar(63) not null,
! mh_value varchar(255),
! mh_sort_order smallint unsigned,
! primary key (mh_id),
! index mh_m_id_idx (mh_m_id),
! index mh_key_idx (mh_key),
! fulltext index mh_value_idx (mh_value)
! );
!
! -- msg_users
!
! drop table if exists msg_users;
! create table msg_users (
! mu_id mediumint unsigned not null auto_increment,
! mu_m_id mediumint unsigned not null not null references msg_ids(m_id),
! mu_u_id smallint unsigned not null references users(u_id),
! mu_ca_id mediumint unsigned not null references cats(ca_id),
! mu_date mediumint unsigned not null references msg_hdrs(mh_id),
! mu_from mediumint unsigned not null references msg_hdrs(mh_id),
! mu_subject mediumint unsigned not null references msg_hdrs(mh_id),
! mu_flags tinyint,
! primary key (mu_id),
! index mu_m_id_idx (mu_m_id),
! index mu_u_id_idx (mu_u_id),
! index mu_ca_id_idx (mu_ca_id)
! );
!
! -- msg_attach
!
! drop table if exists msg_attach;
! create table msg_attach (
! ma_id mediumint unsigned not null auto_increment,
! ma_m_id mediumint unsigned not null not null references msg_ids(m_id),
! ma_mt_id smallint unsigned not null references mime_types(mt_id),
! ma_encode varchar(127),
! ma_storage bool,
! ma_body mediumtext,
! ma_path varchar(255),
! ma_sep_data varchar(255),
! ma_sort_order smallint unsigned,
! primary key (ma_id),
! index ma_m_id_idx (ma_m_id),
! fulltext index ma_body_idx (ma_body)
! );
!
! -- -------------------------
! -- Logs
! -- -------------------------
!
! drop table if exists obj_log;
! create table obj_log (
! obj_id mediumint unsigned not null auto_increment,
! obj_type varchar(15),
! obj_type_id mediumint unsigned not null,
! obj_desc varchar(127),
! obj_action char(1),
! obj_datetime timestamp,
! primary key (obj_id),
! index obj_type_idx (obj_type),
! index obj_type_id_idx (obj_type_id),
! index obj_desc_idx (obj_desc)
! );
!
! drop table if exists msg_log;
! create table msg_log (
! msl_id mediumint unsigned not null auto_increment,
! msl_m_id mediumint unsigned not null,
! msl_u_id mediumint unsigned not null,
! msl_ca_id mediumint unsigned not null,
! msl_action char(1),
! msl_datetime timestamp,
! primary key (msl_id),
! index msl_m_id_idx (msl_m_id),
! index msl_u_id_idx (msl_u_id),
! index msl_ca_id_idx (msl_ca_id)
! );
--- 1,196 ----
! -- cr_db.sql - MailDB MySQL database creation
! -- Copyright (c) 2002 MailDB Team
! --
! -- This file is part of the MailDB software package. For license
! -- information, see the LICENSE file in the top level directory of the
! -- MailDB source distribution.
! --
! -- $Id: cr_maildb.sql,v 1.3 2002/12/21 14:06:57 jsquyres Exp $
! -- -------------------------------------------------------
!
! -- maildb tables
!
! -- common message data:
! -- hdrs, mime_types
! -- user data:
! -- users, cats, views
! -- message data:
! -- msg_ids, msg_hdrs, msg_owners, msg_attach
! -- logs:
! -- obj_log, msg_log
! -- meta:
! -- config
!
! -- -------------------------
! -- Common Message Data
! -- -------------------------
!
! -- hdrs
! -- -> deleted 10/10/2002 in favor of de-normalizing
!
! -- drop table if exists hdrs;
! -- create table hdrs (
! -- h_id integer unsigned not null auto_increment,
! -- h_desc varchar(20),
! -- primary key (h_id)
! -- );
!
! -- mime_types
!
! drop table if exists mime_types;
! create table mime_types (
! mt_id integer unsigned not null auto_increment,
! mt_desc varchar(127),
! primary key (mt_id),
! index mt_desc_idx (mt_desc)
! );
!
!
! -- -------------------------
! -- User Data
! -- -------------------------
!
! -- users
!
! drop table if exists users;
! create table users (
! u_id integer unsigned not null auto_increment,
! u_desc varchar(127),
! primary key (u_id),
! index u_desc_idx (u_desc)
! );
!
! -- cats
!
! drop table if exists cats;
! create table cats (
! ca_id integer unsigned not null auto_increment,
! ca_u_id integer unsigned not null references users(u_id),
! ca_desc varchar(127),
! ca_parent integer unsigned references cats(ca_id),
! primary key (ca_id),
! index ca_u_id_idx (ca_u_id)
! );
!
! -- views
!
! drop table if exists views;
! create table views (
! vw_id integer unsigned not null auto_increment,
! vw_desc varchar(127),
! vw_u_id integer unsigned not null references users(u_id),
! vw_query text,
! primary key (vw_id),
! index vw_u_id_idx (vw_u_id)
! );
!
!
! -- -------------------------
! -- Message Data
! -- -------------------------
!
! -- msg_ids
!
! drop table if exists msg_ids;
!
! create table msg_ids (
! m_id integer unsigned not null auto_increment,
! m_msg_id varchar(255) not null,
! primary key (m_id),
! index m_msg_id_idx (m_msg_id)
! );
!
! -- msg_hdrs
!
! drop table if exists msg_hdrs;
! create table msg_hdrs (
! mh_id integer unsigned not null auto_increment,
! mh_m_id integer unsigned not null references msg_ids(m_id),
! mh_key varchar(63) not null,
! mh_value varchar(255),
! mh_sort_order integer unsigned,
! primary key (mh_id),
! index mh_m_id_idx (mh_m_id),
! index mh_key_idx (mh_key),
! fulltext index mh_value_idx (mh_value)
! );
!
! -- msg_owners
!
! drop table if exists msg_owners;
! create table msg_owners (
! mu_id integer unsigned not null auto_increment,
! mu_m_id integer unsigned not null not null references msg_ids(m_id),
! mu_u_id integer unsigned not null references users(u_id),
! mu_ca_id integer unsigned not null references cats(ca_id),
! mu_date integer unsigned not null references msg_hdrs(mh_id),
! mu_from integer unsigned not null references msg_hdrs(mh_id),
! mu_subject integer unsigned not null references msg_hdrs(mh_id),
! mu_flags integer,
! primary key (mu_id),
! index mu_m_id_idx (mu_m_id),
! index mu_u_id_idx (mu_u_id),
! index mu_ca_id_idx (mu_ca_id)
! );
!
! -- msg_attach
!
! drop table if exists msg_attach;
! create table msg_attach (
! ma_id integer unsigned not null auto_increment,
! ma_m_id integer unsigned not null not null references msg_ids(m_id),
! ma_mt_id integer unsigned not null references mime_types(mt_id),
! ma_encode varchar(127),
! ma_in_fs bool,
! ma_in_msg bool,
! ma_body mediumtext,
! ma_path varchar(255),
! ma_sep_data varchar(255),
! ma_sort_order integer unsigned,
! primary key (ma_id),
! index ma_m_id_idx (ma_m_id),
! fulltext index ma_body_idx (ma_body)
! );
!
! -- -------------------------
! -- Logs
! -- -------------------------
!
! drop table if exists obj_log;
! create table obj_log (
! obj_id integer unsigned not null auto_increment,
! obj_type varchar(15),
! obj_type_id integer unsigned not null,
! obj_desc varchar(127),
! obj_action char(1),
! obj_datetime timestamp,
! primary key (obj_id),
! index obj_type_idx (obj_type),
! index obj_type_id_idx (obj_type_id),
! index obj_desc_idx (obj_desc)
! );
!
! drop table if exists msg_log;
! create table msg_log (
! msl_id integer unsigned not null auto_increment,
! msl_m_id integer unsigned not null,
! msl_u_id integer unsigned not null,
! msl_ca_id integer unsigned not null,
! msl_action char(1),
! msl_datetime timestamp,
! primary key (msl_id),
! index msl_m_id_idx (msl_m_id),
! index msl_u_id_idx (msl_u_id),
! index msl_ca_id_idx (msl_ca_id)
! );
!
! -- -------------------------
! -- Meta
! -- -------------------------
!
! drop table if exists config;
! create table config (
! cf_name varchar(127) not null,
! cf_value varchar(127),
! primary key (cf_name)
! );
1.3 +704 -702 maildb/libmaildb/db/mysql/doc/design.html
Index: design.html
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/design.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** design.html 5 Nov 2002 23:15:47 -0000 1.2
--- design.html 21 Dec 2002 14:06:57 -0000 1.3
***************
*** 1,702 ****
! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
! <html>
! <head>
! <!-- saved from url=(0189)http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1 -->
! <meta http-equiv="Content-Type"
! content="text/html; charset=windows-1252">
! <meta content="MSHTML 5.50.4611.1300" name="GENERATOR">
! <title>MailDB Design</title>
! </head>
! <body>
! <h1>MailDB Database Design</h1>
! <p><a href="#intro">Introduction</a><br>
! <a href="#tables">Table Descriptions</a><br>
! <a href="#issues">Open Questions/Issues</a><br>
! <a href="#details">Table Details</a><br>
! <a href="#storage">MySQL Storage Notes</a><br>
! </p>
! <p>
! Copyright © 2002 MailDB Team
! <p>This file is part of the MailDB software package. For license
! information, see the LICENSE file in the top level directory of the
! MailDB source distribution.
! <p><i>$Id: design.html,v 1.2 2002/11/05 23:15:47 lweissler Exp $</i></p.
! <p></p>
! <hr><a name="intro"></a>
! <h2>Introduction</h2>
! <p>This document describes the proposed design for the MailDB database. This
! design is a work-in-progress and is subject to change; outstanding questions/issues
! are listed below in <a
! href="http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1#issues">Open
! Questions/Issues</a>. </p>
! <p>This initial design assumes use of MySQL as the backend RDBMS. The design
! is generally normalized, the notable exception being message
! header tags (left of the colon) in the individual header records (which
! are stored in the msg_hdrs table). In this case the benefits of normalizing
! the data seemed to be outweighed by the slight increase in complexity of
! queries. [Note: I'm a bit on the fence on this one...decision not final.
! :-) -- lyw] </p>
! <p>Table summary descriptions are provided in the following section. A detailed
! description of table columns, datatypes, and a brief description/use of columns
! is in <a href="#details">Table Details</a>, below. The full SQL for table
! creation may be found in accompanying file <a href="cr_maildb.sql">cr_maildb.sql</a>,
! and sample queries are provided in accompanying file <a
! href="queries.sql">queries.sql</a>. </p>
! <hr><a name="tables"></a>
! <h2>Table Descriptions</h2>
! <p>There are four basic categories of tables: data common to all messages,
! user meta data, message data, and logs. </p>
! <p>
! <table border="1">
! <tbody>
! <tr>
! <th colspan="6">Common message data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">mime_types</td>
! <td valign="top">Normalized table of mime_type definitions.</td>
! <td valign="top">Mime type numeric identifier (mt_id)</td>
! <td valign="top">Mime type (mt_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_attach</td>
! </tr>
! <tr>
! <th colspan="6">User meta data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">users</td>
! <td valign="top">Normalized table of MailDB users.</td>
! <td valign="top">User numeric identifier (u_id)</td>
! <td valign="top">User name (u_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">cats<br>
! views<br>
! msg_users</td>
! </tr>
! <tr>
! <td valign="top">cats</td>
! <td valign="top">Message categories (i.e. "folders") created by users,
! to which messages are assigned. Categories may be [multiply] nested,
! and messages may assigned to multiple categories.</td>
! <td valign="top">Category numeric identifier (ca_id)</td>
! <td valign="top">Category owner (ca_u_id)</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_users</td>
! </tr>
! <tr>
! </tr>
! <tr>
! <td valign="top">views</td>
! <td valign="top">User views of messages...specifically, defined search
! criteria and the SQL required to execute the searches.</td>
! <td valign="top">View numeric identifier (vw_id)</td>
! <td valign="top">View owner (vw_u_id)</td>
! <td valign="top">users</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <th colspan="6">Message data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">msg_ids<br>
! </td>
! <td valign="top">Normalized table of message ids.<br>
! </td>
! <td valign="top">Numeric message record identifier (m_id)<br>
! </td>
! <td valign="top">Message id (m_msg_id)<br>
! </td>
! <td valign="top">n/a<br>
! </td>
! <td valign="top">msg_hdrs, msg_users, msg_attach, msg_log<br>
! </td>
! </tr>
! <tr>
! <td valign="top">msg_hdrs</td>
! <td valign="top">Message header information for a given message. Message
! header sort order is maintained. Multiple records will exist for each
! message, one per unique header line. </td>
! <td valign="top">Numeric message header record identifier (mh_id)</td>
! <td valign="top">Normalized message id (mh_m_id), header key (mh_key),
! header value (mh_value) [fulltext index]</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_users</td>
! </tr>
! <tr>
! <td valign="top">msg_users</td>
! <td valign="top">Records describing user instances (category filing)
! of specific messages. Users may assign messages to one or more categories,
! thus multiple records may exist in the table for a given message &
! user. Includes references into msg_hdrs table for faster retrieval
! of message date, sender, subject for category "scans".</td>
! <td valign="top">Message instance numeric identifier (mu_id).</td>
! <td valign="top">Normalized message id (mu_m_id), user (mu_u_id), category
! (mu_ca_id)</td>
! <td valign="top">users, cats, msg_hdrs</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <td valign="top">msg_attach</td>
! <td valign="top">Attachments to a given message. Message "body" not in
! an attachment is treated within the database as attachment 0. Attachment
! sort order is maintained. Records include mime type, file encoding,
! multi-part separator data, flag for attachment storage (0 = internal,
! in the database; 1 = external, in the filesystem).</td>
! <td valign="top">Message attachment numeric identifier (ma_id).</td>
! <td valign="top">Normalized message id (ma_m_id), body (ma_body) [fulltext
! index]</td>
! <td valign="top">mime_types</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <th colspan="6">Logging</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">obj_log</td>
! <td valign="top">History of actions on meta objects - namely, create,
! update, delete of users, categories, views, mime_types. To be maintained
! via trigger (to be defined).</td>
! <td valign="top">Numeric log record identifier (obj_id)</td>
! <td valign="top">Object type (obj_type), object identifier (obj_type_id),
! object description (obj_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <td valign="top">msg_log</td>
! <td valign="top">History of message activity - user adds, deletes from
! categories. To be maintained via trigger (to be defined).</td>
! <td valign="top">Numeric log record identifier (msl_id).</td>
! <td valign="top">Normalized message id (msl_m_id), user (msl_u_id), category
! (msl_ca_id)</td>
! <td valign="top">n/a</td>
! <td valign="top">n/a</td>
! </tr>
! </tbody>
! </table>
! </p>
! <hr><a name="issues"></a>
! <h2>Open Questions/Issues</h2>
! <ol>
! <li>Design issues
! <ol type="a">
! <li>Review all field sizing, especially msg_id and record identifiers.
! </li>
! <li>Should header info be normalized? Not done so above. </li>
! <li>Should users or mime_types be de-normalized? </li>
! <li>Size threshold for determining whether attachment is stored in
! the database or as external file? (Need to know here only for reasonable
! sizing of the ma_body field in msg_attach.) </li>
! </ol>
! </li>
! <li>MySQL specifics
! <ol type="a">
! <li>Triggers for maintaining log (history) tables. <b>Update: No trigger
! or stored procedure support in MySQL. Estimate is that these items will
! be included in version 5.0. Current stable MySQL is 3.23.x and 4.x is now
! available.</b> </li>
! <li>Check MySQL behavior when auto_incremented column "rolls over".
! </li>
! <li>Review MySQL regex pattern matching. </li>
! <li>Note vanilla MySQL has no true foreign key constraints. You can
! define the foreign keys (foo integer references bar(foo)) but they aren't
! enforced. </li>
! </ol>
! </li>
! <li>Message questions
! <ol type="a">
! <li>Multi-part separator data format? </li>
! <li>Which header line is used for message threading? Should it be included
! in msg_users table for quick category scanning? </li>
! </ol>
! </li>
! <li>Miscellaneous
! <ol type="a">
! <li>Construct and test sample queries... </li>
! </ol>
! </li>
! </ol>
! <hr><a name="details"></a>
! <h2>Table Details</h2>
! <table border="1">
! <tbody>
! <tr>
! <th>Table</th>
! <th>Column</th>
! <th>Datatype</th>
! <th>Primary Key</th>
! <th>Indexed</th>
! <th>Description</th>
! </tr>
! <tr>
! <td valign="top" rowspan="2">mime_types</td>
! <td>mt_id</td>
! <td>smallint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for mime_type record</td>
! </tr>
! <tr>
! <td>mt_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>Message body/attachment MIME type</td>
! </tr>
! <tr>
! <td valign="top" rowspan="2">users</td>
! <td>u_id</td>
! <td>smallint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for user record</td>
! </tr>
! <tr>
! <td>u_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>User description (login/reference name, e.g. 'weissler' or
! 'li...@av...'</td>
! </tr>
! <tr>
! <td valign="top" rowspan="4">cats</td>
! <td>ca_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for category record</td>
! </tr>
! <tr>
! <td>ca_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning this category. References users(u_id).</td>
! </tr>
! <tr>
! <td>ca_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>Category name, e.g. "Inbox", "Deleted", "Cycling"...</td>
! </tr>
! <tr>
! <td>ca_parent</td>
! <td>mediumint unsigned</td>
! <td> </td>
! <td> </td>
! <td>"Parent" category, allowing nesting of categories. Top-level
! categories have null parents. References cats(ca_id).</td>
! </tr>
! <tr>
! <td valign="top" rowspan="4">views</td>
! <td>vw_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for view record</td>
! </tr>
! <tr>
! <td>vw_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>View name, e.g. "Messages from Robert"</td>
! </tr>
! <tr>
! <td>vw_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning view. References users(u_id).</td>
! </tr>
! <tr>
! <td>vw_query</td>
! <td>text</td>
! <td> </td>
! <td> </td>
! <td>SQL required to retrieve messages meeting user's search criteria</td>
! </tr>
! <tr>
! <td valign="top" rowspan="2">msg_ids<br>
! </td>
! <td valign="top">m_id<br>
! </td>
! <td valign="top">mediumint unsigned not null auto_increment<br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">Unique identifier for message id (using less storage
! than the string message_id's in messages)<br>
! </td>
! </tr>
! <tr>
! <td valign="top">m_msg_id<br>
! </td>
! <td valign="top">varchar(255)<br>
! </td>
! <td valign="top"><br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">Message identifier (assigned by MTA)<br>
! </td>
! </tr>
! <tr>
! <td valign="top" rowspan="5">msg_hdrs</td>
! <td>mh_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message header record</td>
! </tr>
! <tr>
! <td>mh_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier</td>
! </tr>
! <tr>
! <td>mh_key</td>
! <td>varchar(63)</td>
! <td> </td>
! <td>X</td>
! <td>Header tag - e.g. "To", "From", "Subject"...anything left of colon
! (:) on header line. </td>
! </tr>
! <tr>
! <td>mh_value</td>
! <td>varchar(255)</td>
! <td> </td>
! <td>X</td>
! <td>Header value - anything right of colon (:) on header line. Fulltext
! index.</td>
! </tr>
! <tr>
! <td>mh_sort_order</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Header sequence number.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="8">msg_users</td>
! <td>mu_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message instance record.</td>
! </tr>
! <tr>
! <td>mu_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>mu_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning a copy of the message.</td>
! </tr>
! <tr>
! <td>mu_ca_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Category to which the user assigned the message.</td>
! </tr>
! <tr>
! <td>mu_date</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "Date" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_from</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "From" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_subject</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "Subject" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_flags</td>
! <td>tinyint unsigned</td>
! <td> </td>
! <td> </td>
! <td>Bit flags for the message.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="9">msg_attach</td>
! <td>ma_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message attachment record.</td>
! </tr>
! <tr>
! <td>ma_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>ma_mt_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to mime_types(mt_id)</td>
! </tr>
! <tr>
! <td>ma_encode</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>Attachment encoding</td>
! </tr>
! <tr>
! <td>ma_storage</td>
! <td>boolean</td>
! <td> </td>
! <td> </td>
! <td>Denotes whether attachment is stored within the database (0) or
! externally in the filesystem (1).</td>
! </tr>
! <tr>
! <td>ma_body</td>
! <td>mediumtext</td>
! <td> </td>
! <td>X</td>
! <td>Attachment body (for attachments stored within the database). Fulltext
! index.</td>
! </tr>
! <tr>
! <td>ma_path</td>
! <td>varchar(255)</td>
! <td> </td>
! <td> </td>
! <td>Full pathname to attachment (for attachments stored in the filesystem).</td>
! </tr>
! <tr>
! <td>ma_sep_data</td>
! <td>varchar(255)</td>
! <td> </td>
! <td> </td>
! <td>Multi-part separator data.</td>
! </tr>
! <tr>
! <td>ma_sort_order</td>
! <td>tinyint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Attachment sequence number.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="6">obj_log</td>
! <td>obj_id</td>
! <td>int unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for object log record.</td>
! </tr>
! <tr>
! <td>obj_type</td>
! <td>varchar(15)</td>
! <td> </td>
! <td>X</td>
! <td>Type of object - e.g. user, view, cat, mime_type</td>
! </tr>
! <tr>
! <td>obj_type_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Object identifier; if obj_type = user, obj_type_id corresponds to
! users(u_id), obj_type = cat, obj_type_id corresponds to cats(ca_id),
! etc.</td>
! </tr>
! <tr>
! <td>obj_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>Object description (username, viewname, category name...)</td>
! </tr>
! <tr>
! <td>obj_action</td>
! <td>char(1)</td>
! <td> </td>
! <td> </td>
! <td>Action taken on this object. Values include C (create), U (update),
! D (delete).</td>
! </tr>
! <tr>
! <td>obj_datetime</td>
! <td>timestamp(14)</td>
! <td> </td>
! <td> </td>
! <td>Timestamp of object action.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="6">msg_log</td>
! <td>msl_id</td>
! <td>int unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message log record.</td>
! </tr>
! <tr>
! <td>msl_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>msl_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning instance of the specified message.</td>
! </tr>
! <tr>
! <td>msl_ca_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Category to which the user assigned the message.</td>
! </tr>
! <tr>
! <td>msl_action</td>
! <td>char(1)</td>
! <td> </td>
! <td>X</td>
! <td>Action taken on this message. Values include C (create), U (update),
! D (delete).</td>
! </tr>
! <tr>
! <td>msl_datetime</td>
! <td>timestamp(14)</td>
! <td> </td>
! <td> </td>
! <td>Timestamp of message action.</td>
! </tr>
! </tbody>
! </table>
! <p></p>
! <hr><a name="storage"></a>
! <h2>MySQL Storage Notes</h2>
! <p>
! <table border="1">
! <tbody>
! <tr>
! <th>Datatype</th>
! <th>Max</th>
! <th>Storage</th>
! </tr>
! <tr>
! <td>varchar</td>
! <td>255</td>
! <td>L+1</td>
! </tr>
! <tr>
! <td>tinytext</td>
! <td>255</td>
! <td>L+1</td>
! </tr>
! <tr>
! <td>text</td>
! <td>64k</td>
! <td>L+2</td>
! </tr>
! <tr>
! <td>mediumtext</td>
! <td>16m</td>
! <td>L+3</td>
! </tr>
! <tr>
! <td>longtext</td>
! <td>4g</td>
! <td>L+4</td>
! </tr>
! <tr>
! <td>tinyint (U)</td>
! <td>255</td>
! <td>1</td>
! </tr>
! <tr>
! <td>smallint (U)</td>
! <td>65535</td>
! <td>2</td>
! </tr>
! <tr>
! <td>mediumint (U)</td>
! <td>16777215</td>
! <td>3</td>
! </tr>
! <tr>
! <td>int (U)</td>
! <td>4294967295</td>
! <td>4</td>
! </tr>
! <tr>
! <td>timestamp</td>
! <td>YYYYMMDDHHMISS</td>
! <td>4</td>
! </tr>
! </tbody>
! </table>
! </p>
! <p>...where (U) = unsigned, and L = length of text string. </p>
! <p></p>
! <hr><i>Last update: 17 October 2002 by <a href="mailto:li...@av...">Liza
! Weissler</a></i><a href="mailto:li...@av..."> </a><br>
! </body>
! </html>
--- 1,704 ----
! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
! <html>
! <head>
! <!-- saved from url=(0189)http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1 -->
! <meta http-equiv="Content-Type"
! content="text/html; charset=windows-1252">
! <meta content="MSHTML 5.50.4611.1300" name="GENERATOR">
! <title>MailDB Design</title>
! </head>
! <body>
! <h1>MailDB Database Design</h1>
! <p><a href="#intro">Introduction</a><br>
! <a href="#tables">Table Descriptions</a><br>
! <a href="#issues">Open Questions/Issues</a><br>
! <a href="#details">Table Details</a><br>
! <a href="#storage">MySQL Storage Notes</a><br>
! </p>
! <p></p>
! <hr><a name="intro"></a>
! <h2>Introduction</h2>
! <p>This document describes the proposed design for the MailDB database. This
! design is a work-in-progress and is subject to change; outstanding questions/issues
! are listed below in <a
! href="http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1#issues">Open
! Questions/Issues</a>. </p>
! <p>This initial design assumes use of MySQL as the backend RDBMS. The design
! is generally normalized, the notable exception being message
! header tags (left of the colon) in the individual header records (which
! are stored in the msg_hdrs table). In this case the benefits of normalizing
! the data seemed to be outweighed by the slight increase in complexity of
! queries. [Note: I'm a bit on the fence on this one...decision not final.
! :-) -- lyw] </p>
! <p>Table summary descriptions are provided in the following section. A detailed
! description of table columns, datatypes, and a brief description/use of columns
! is in <a href="#details">Table Details</a>, below. The full SQL for table
! creation may be found in accompanying file <a href="cr_maildb.sql">cr_maildb.sql</a>,
! and sample queries are provided in accompanying file <a
! href="queries.sql">queries.sql</a>. </p>
! <hr><a name="tables"></a>
! <h2>Table Descriptions</h2>
! <p>There are four basic categories of tables: data common to all messages,
! user meta data, message data, and logs. </p>
! <p>
! <table border="1">
! <tbody>
! <tr>
! <th colspan="6">Common message data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">mime_types</td>
! <td valign="top">Normalized table of mime_type definitions.</td>
! <td valign="top">Mime type numeric identifier (mt_id)</td>
! <td valign="top">Mime type (mt_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_attach</td>
! </tr>
! <tr>
! <th colspan="6">User meta data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">users</td>
! <td valign="top">Normalized table of MailDB users.</td>
! <td valign="top">User numeric identifier (u_id)</td>
! <td valign="top">User name (u_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">cats<br>
! views<br>
! msg_owners</td>
! </tr>
! <tr>
! <td valign="top">cats</td>
! <td valign="top">Message categories (i.e. "folders") created by users,
! to which messages are assigned. Categories may be [multiply] nested,
! and messages may assigned to multiple categories.</td>
! <td valign="top">Category numeric identifier (ca_id)</td>
! <td valign="top">Category owner (ca_u_id)</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_owners</td>
! </tr>
! <tr>
! </tr>
! <tr>
! <td valign="top">views</td>
! <td valign="top">User views of messages...specifically, defined search
! criteria and the SQL required to execute the searches.</td>
! <td valign="top">View numeric identifier (vw_id)</td>
! <td valign="top">View owner (vw_u_id)</td>
! <td valign="top">users</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <th colspan="6">Message data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">msg_ids<br>
! </td>
! <td valign="top">Normalized table of message ids.<br>
! </td>
! <td valign="top">Numeric message record identifier (m_id)<br>
! </td>
! <td valign="top">Message id (m_msg_id)<br>
! </td>
! <td valign="top">n/a<br>
! </td>
! <td valign="top">msg_hdrs, msg_owners, msg_attach, msg_log<br>
! </td>
! </tr>
! <tr>
! <td valign="top">msg_hdrs</td>
! <td valign="top">Message header information for a given message. Message
! header sort order is maintained. Multiple records will exist for each
! message, one per unique header line. </td>
! <td valign="top">Numeric message header record identifier (mh_id)</td>
! <td valign="top">Normalized message id (mh_m_id), header key (mh_key),
! header value (mh_value) [fulltext index]</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_owners</td>
! </tr>
! <tr>
! <td valign="top">msg_owners</td>
! <td valign="top">Records describing user instances (category filing)
! of specific messages. Users may assign messages to one or more categories,
! thus multiple records may exist in the table for a given message &
! user. Includes references into msg_hdrs table for faster retrieval
! of message date, sender, subject for category "scans".</td>
! <td valign="top">Message instance numeric identifier (mu_id).</td>
! <td valign="top">Normalized message id (mu_m_id), user (mu_u_id), category
! (mu_ca_id)</td>
! <td valign="top">users, cats, msg_hdrs</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <td valign="top">msg_attach</td>
! <td valign="top">Attachments to a given message. Message "body" not in
! an attachment is treated within the database as attachment 0. Attachment
! sort order is maintained. Records include mime type, file encoding,
! multi-part separator data, flag for attachment storage (0 = internal,
! in the database; 1 = external, in the filesystem).</td>
! <td valign="top">Message attachment numeric identifier (ma_id).</td>
! <td valign="top">Normalized message id (ma_m_id), body (ma_body) [fulltext
! index]</td>
! <td valign="top">mime_types</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <th colspan="6">Logging</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">obj_log</td>
! <td valign="top">History of actions on meta objects - namely, create,
! update, delete of users, categories, views, mime_types. To be maintained
! via trigger (to be defined).</td>
! <td valign="top">Numeric log record identifier (obj_id)</td>
! <td valign="top">Object type (obj_type), object identifier (obj_type_id),
! object description (obj_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <td valign="top">msg_log</td>
! <td valign="top">History of message activity - user adds, deletes from
! categories. To be maintained via trigger (to be defined).</td>
! <td valign="top">Numeric log record identifier (msl_id).</td>
! <td valign="top">Normalized message id (msl_m_id), user (msl_u_id), category
! (msl_ca_id)</td>
! <td valign="top">n/a</td>
! <td valign="top">n/a</td>
! </tr>
! </tbody>
! </table>
! </p>
! <hr><a name="issues"></a>
! <h2>Open Questions/Issues</h2>
! <ol>
! <li>Design issues
! <ol type="a">
! <li>Review all field sizing, especially msg_id and record identifiers.
! </li>
! <li>Should header info be normalized? Not done so above. </li>
! <li>Should users or mime_types be de-normalized? </li>
! <li>Size threshold for determining whether attachment is stored in
! the database or as external file? (Need to know here only for reasonable
! sizing of the ma_body field in msg_attach.) </li>
! </ol>
! </li>
! <li>MySQL specifics
! <ol type="a">
! <li>Triggers for maintaining log (history) tables. <b>Update: No trigger
! or stored procedure support in MySQL. Estimate is that these items will
! be included in version 5.0. Current stable MySQL is 3.23.x and 4.x is now
! available.</b> </li>
! <li>Check MySQL behavior when auto_incremented column "rolls over".
! </li>
! <li>Review MySQL regex pattern matching. </li>
! <li>Note vanilla MySQL has no true foreign key constraints. You can
! define the foreign keys (foo integer references bar(foo)) but they aren't
! enforced. </li>
! </ol>
! </li>
! <li>Message questions
! <ol type="a">
! <li>Multi-part separator data format? </li>
! <li>Which header line is used for message threading? Should it be included
! in msg_owners table for quick category scanning? </li>
! </ol>
! </li>
! <li>Miscellaneous
! <ol type="a">
! <li>Construct and test sample queries... </li>
! </ol>
! </li>
! </ol>
! <hr><a name="details"></a>
! <h2>Table Details</h2>
! <table border="1">
! <tbody>
! <tr>
! <th>Table</th>
! <th>Column</th>
! <th>Datatype</th>
! <th>Primary Key</th>
! <th>Indexed</th>
! <th>Description</th>
! </tr>
! <tr>
! <td valign="top" rowspan="2">mime_types</td>
! <td>mt_id</td>
! <td>integer unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for mime_type record</td>
! </tr>
! <tr>
! <td>mt_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>Message body/attachment MIME type</td>
! </tr>
! <tr>
! <td valign="top" rowspan="2">users</td>
! <td>u_id</td>
! <td>integer unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for user record</td>
! </tr>
! <tr>
! <td>u_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>User description (login/reference name, e.g. 'weissler' or
! 'li...@av...'</td>
! </tr>
! <tr>
! <td valign="top" rowspan="4">cats</td>
! <td>ca_id</td>
! <td>integer unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for category record</td>
! </tr>
! <tr>
! <td>ca_u_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning this category. References users(u_id).</td>
! </tr>
! <tr>
! <td>ca_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>Category name, e.g. "Inbox", "Deleted", "Cycling"...</td>
! </tr>
! <tr>
! <td>ca_parent</td>
! <td>integer unsigned</td>
! <td> </td>
! <td> </td>
! <td>"Parent" category, allowing nesting of categories. Top-level
! categories have null parents. References cats(ca_id).</td>
! </tr>
! <tr>
! <td valign="top" rowspan="4">views</td>
! <td>vw_id</td>
! <td>integer unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for view record</td>
! </tr>
! <tr>
! <td>vw_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>View name, e.g. "Messages from Robert"</td>
! </tr>
! <tr>
! <td>vw_u_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning view. References users(u_id).</td>
! </tr>
! <tr>
! <td>vw_query</td>
! <td>text</td>
! <td> </td>
! <td> </td>
! <td>SQL required to retrieve messages meeting user's search criteria</td>
! </tr>
! <tr>
! <td valign="top" rowspan="2">msg_ids<br>
! </td>
! <td valign="top">m_id<br>
! </td>
! <td valign="top">integer unsigned not null auto_increment<br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">Unique identifier for message id (using less storage
! than the string message_id's in messages)<br>
! </td>
! </tr>
! <tr>
! <td valign="top">m_msg_id<br>
! </td>
! <td valign="top">varchar(255)<br>
! </td>
! <td valign="top"><br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">Message identifier (assigned by MTA)<br>
! </td>
! </tr>
! <tr>
! <td valign="top" rowspan="5">msg_hdrs</td>
! <td>mh_id</td>
! <td>integer unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message header record</td>
! </tr>
! <tr>
! <td>mh_m_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier</td>
! </tr>
! <tr>
! <td>mh_key</td>
! <td>varchar(63)</td>
! <td> </td>
! <td>X</td>
! <td>Header tag - e.g. "To", "From", "Subject"...anything left of colon
! (:) on header line. </td>
! </tr>
! <tr>
! <td>mh_value</td>
! <td>varchar(255)</td>
! <td> </td>
! <td>X</td>
! <td>Header value - anything right of colon (:) on header line. Fulltext
! index.</td>
! </tr>
! <tr>
! <td>mh_sort_order</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Header sequence number.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="8">msg_owners</td>
! <td>mu_id</td>
! <td>integer unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message instance record.</td>
! </tr>
! <tr>
! <td>mu_m_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>mu_u_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning a copy of the message.</td>
! </tr>
! <tr>
! <td>mu_ca_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Category to which the user assigned the message.</td>
! </tr>
! <tr>
! <td>mu_date</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "Date" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_from</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "From" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_subject</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "Subject" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_flags</td>
! <td>integer unsigned</td>
! <td> </td>
! <td> </td>
! <td>Bit flags for the message.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="9">msg_attach</td>
! <td>ma_id</td>
! <td>integer unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message attachment record.</td>
! </tr>
! <tr>
! <td>ma_m_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>ma_mt_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to mime_types(mt_id)</td>
! </tr>
! <tr>
! <td>ma_encode</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>Attachment encoding</td>
! </tr>
! <tr>
! <td>ma_in_fs</td>
! <td>boolean</td>
! <td> </td>
! <td> </td>
! <td>Denotes whether attachment is stored within the database (0) or
! externally in the filesystem (1).</td>
! </tr>
! <tr>
! <td>ma_in_msg</td>
! <td>boolean</td>
! <td> </td>
! <td> </td>
! <td>Denotes whether attachment is stored within the database as
! a message. This being true assumes ma_in_fs is TRUE.</td>
! </tr>
! <tr>
! <td>ma_body</td>
! <td>mediumtext</td>
! <td> </td>
! <td>X</td>
! <td>Attachment body (for attachments stored within the database). Fulltext
! index.</td>
! </tr>
! <tr>
! <td>ma_path</td>
! <td>varchar(255)</td>
! <td> </td>
! <td> </td>
! <td>Full pathname to attachment (for attachments stored in the filesystem).</td>
! </tr>
! <tr>
! <td>ma_sep_data</td>
! <td>varchar(255)</td>
! <td> </td>
! <td> </td>
! <td>Multi-part separator data.</td>
! </tr>
! <tr>
! <td>ma_sort_order</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Attachment sequence number.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="6">obj_log</td>
! <td>obj_id</td>
! <td>integer unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for object log record.</td>
! </tr>
! <tr>
! <td>obj_type</td>
! <td>varchar(15)</td>
! <td> </td>
! <td>X</td>
! <td>Type of object - e.g. user, view, cat, mime_type</td>
! </tr>
! <tr>
! <td>obj_type_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Object identifier; if obj_type = user, obj_type_id corresponds to
! users(u_id), obj_type = cat, obj_type_id corresponds to cats(ca_id),
! etc.</td>
! </tr>
! <tr>
! <td>obj_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>Object description (username, viewname, category name...)</td>
! </tr>
! <tr>
! <td>obj_action</td>
! <td>char(1)</td>
! <td> </td>
! <td> </td>
! <td>Action taken on this object. Values include C (create), U (update),
! D (delete).</td>
! </tr>
! <tr>
! <td>obj_datetime</td>
! <td>timestamp(14)</td>
! <td> </td>
! <td> </td>
! <td>Timestamp of object action.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="6">msg_log</td>
! <td>msl_id</td>
! <td>integer unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message log record.</td>
! </tr>
! <tr>
! <td>msl_m_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>msl_u_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning instance of the specified message.</td>
! </tr>
! <tr>
! <td>msl_ca_id</td>
! <td>integer unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Category to which the user assigned the message.</td>
! </tr>
! <tr>
! <td>msl_action</td>
! <td>char(1)</td>
! <td> </td>
! <td>X</td>
! <td>Action taken on this message. Values include C (create), U (update),
! D (delete).</td>
! </tr>
! <tr>
! <td>msl_datetime</td>
! <td>timestamp(14)</td>
! <td> </td>
! <td> </td>
! <td>Timestamp of message action.</td>
! </tr>
! </tbody>
! </table>
! <p></p>
! <hr><a name="storage"></a>
! <h2>MySQL Storage Notes</h2>
! <p>
! <table border="1">
! <tbody>
! <tr>
! <th>Datatype</th>
! <th>Max</th>
! <th>Storage</th>
! </tr>
! <tr>
! <td>varchar</td>
! <td>255</td>
! <td>L+1</td>
! </tr>
! <tr>
! <td>tinytext</td>
! <td>255</td>
! <td>L+1</td>
! </tr>
! <tr>
! <td>text</td>
! <td>64k</td>
! <td>L+2</td>
! </tr>
! <tr>
! <td>mediumtext</td>
! <td>16m</td>
! <td>L+3</td>
! </tr>
! <tr>
! <td>longtext</td>
! <td>4g</td>
! <td>L+4</td>
! </tr>
! <tr>
! <td>tinyint (U)</td>
! <td>255</td>
! <td>1</td>
! </tr>
! <tr>
! <td>smallint (U)</td>
! <td>65535</td>
! <td>2</td>
! </tr>
! <tr>
! <td>mediumint (U)</td>
! <td>16777215</td>
! <td>3</td>
! </tr>
! <tr>
! <td>integer (U)</td>
! <td>4294967295</td>
! <td>4</td>
! </tr>
! <tr>
! <td>timestamp</td>
! <td>YYYYMMDDHHMISS</td>
! <td>4</td>
! </tr>
! </tbody>
! </table>
! </p>
! <p>...where (U) = unsigned, and L = length of text string. </p>
! <p></p>
! <hr><i>Last update: 17 October 2002 by <a href="mailto:li...@av...">Liza
! Weissler</a></i><a href="mailto:li...@av..."> </a><br>
! </body>
! </html>
1.3 +78 -72 maildb/libmaildb/db/mysql/doc/message.sql
Index: message.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/message.sql,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** message.sql 5 Nov 2002 23:15:47 -0000 1.2
--- message.sql 21 Dec 2002 14:06:57 -0000 1.3
***************
*** 1,72 ****
! -- message.sql - insert dummy message into MailDB tables
! -- Copyright (c) 2002 MailDB Team
! --
! -- This file is part of the MailDB software package. For license
! -- information, see the LICENSE file in the top level directory of the
! -- MailDB source distribution.
! --
! -- $Id: message.sql,v 1.2 2002/11/05 23:15:47 lweissler Exp $
! -- -------------------------------------------------------
!
! delete from msg_ids where m_id < 10;
! delete from msg_hdrs where mh_id < 100;
! delete from msg_attach where ma_id < 100;
!
! insert into msg_ids values (NULL, '<001801c27523$aa5d46a0$...
[truncated message content] |
|
From: Liza W. <lwe...@us...> - 2002-11-05 23:15:49
|
lweissler 02/11/05 15:15:48
Modified: libmaildb/db/mysql/doc README cr_db.sql cr_maildb.sql
design.html message.sql mime.sql queries.sql
test.sql users.sql
Log:
Added copyright notice to MySQL database files.
Revision Changes Path
1.2 +36 -22 maildb/libmaildb/db/mysql/doc/README
Index: README
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/README,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** README 30 Oct 2002 02:51:46 -0000 1.1
--- README 5 Nov 2002 23:15:46 -0000 1.2
***************
*** 1,22 ****
! 1) If new database, make sure you have a password set for root, and disallow
! local access without a password. This should do it...
!
! % mysql mysql
! > delete from user where host='localhost' and user='';
! > quit
!
! % mysqladmin -u root reload
! % mysqladmin -u root password <new-password>
! % myqladmin -u root -p reload
!
! 2) Create maildb database
!
! % mysql -u root -p mysql < cr_db.sql /* provide root pw */
! % mysql -u maildb -p maildb < cr_maildb.sql /* provide maildb pw */
!
! 3) Populate with some sample data
! % mysql -u maildb -p maildb
! > source mime.sql
! > source users.sql
! > source message.sql
!
--- 1,36 ----
! # README
! #
! # Copyright (c) 2002 MailDB Team
! #
! # This file is part of the MailDB software package. For license
! # information, see the LICENSE file in the top level directory of the
! # MailDB source distribution.
! #
! # $Id: README,v 1.2 2002/11/05 23:15:46 lweissler Exp $
! # ---------------------------------------------------------
!
! 1) If new database, make sure you have a password set for root, and disallow
! local access without a password. This should do it...
!
! % mysql mysql
! > delete from user where host='localhost' and user='';
! > quit
!
! % mysqladmin -u root reload
! % mysqladmin -u root password <new-password>
! % mysqladmin -u root -p reload
!
! 2) Create maildb database
!
! - Edit cr_db.sql to set an appropriate password for the
! - maildb user (don't use the default...)
!
! % mysql -u root -p mysql < cr_db.sql /* provide root pw */
! % mysql -u maildb -p maildb < cr_maildb.sql /* provide maildb pw */
!
! 3) Populate with some sample data
! % mysql -u maildb -p maildb
! > source mime.sql
! > source users.sql
! > source message.sql
!
1.2 +22 -11 maildb/libmaildb/db/mysql/doc/cr_db.sql
Index: cr_db.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_db.sql,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** cr_db.sql 30 Oct 2002 02:51:46 -0000 1.1
--- cr_db.sql 5 Nov 2002 23:15:47 -0000 1.2
***************
*** 1,11 ****
! -- MailDB database creation
! -- 10/18/2002 lyw
! -- run this as:
! -- mysql --user root -p mysql < cr_db.sql
! -- then:
! -- mysql --user=maildb -p maildb < cr_maildb.sql
!
! drop database if exists maildb;
! create database maildb;
! grant all privileges on maildb.* to maildb identified by 'maildb';
!
--- 1,22 ----
! -- cr_db.sql - MailDB MySQL database creation
! -- Copyright (c) 2002 MailDB Team
! --
! -- This file is part of the MailDB software package. For license
! -- information, see the LICENSE file in the top level directory of the
! -- MailDB source distribution.
! --
! -- $Id: cr_db.sql,v 1.2 2002/11/05 23:15:47 lweissler Exp $
! -- -------------------------------------------------------
!
! -- Edit the 'grant' line below to set a good password for the
! -- maildb user
!
! -- Run this as:
! -- mysql --user=root -p mysql < cr_db.sql
! -- then:
! -- mysql --user=maildb -p maildb < cr_maildb.sql
!
! drop database if exists maildb;
! create database maildb;
! grant all privileges on maildb.* to maildb identified by 'maildb';
!
1.2 +181 -172 maildb/libmaildb/db/mysql/doc/cr_maildb.sql
Index: cr_maildb.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/cr_maildb.sql,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** cr_maildb.sql 30 Oct 2002 02:51:46 -0000 1.1
--- cr_maildb.sql 5 Nov 2002 23:15:47 -0000 1.2
***************
*** 1,172 ****
! -- maildb tables
!
! -- common message data:
! -- hdrs, mime_types
! -- user data:
! -- users, cats, views
! -- message data:
! -- msg_ids, msg_hdrs, msg_users, msg_attach
! -- logs:
! -- obj_log, msg_log
!
! -- -------------------------
! -- Common Message Data
! -- -------------------------
!
! -- hdrs
! -- -> deleted 10/10/2002 in favor of de-normalizing
!
! -- drop table if exists hdrs;
! -- create table hdrs (
! -- h_id smallint unsigned not null auto_increment,
! -- h_desc varchar(20),
! -- primary key (h_id)
! -- );
!
! -- mime_types
!
! drop table if exists mime_types;
! create table mime_types (
! mt_id smallint unsigned not null auto_increment,
! mt_desc varchar(127),
! primary key (mt_id),
! index mt_desc_idx (mt_desc)
! );
!
!
! -- -------------------------
! -- User Data
! -- -------------------------
!
! -- users
!
! drop table if exists users;
! create table users (
! u_id smallint unsigned not null auto_increment,
! u_desc varchar(127),
! primary key (u_id),
! index u_desc_idx (u_desc)
! );
!
! -- cats
!
! drop table if exists cats;
! create table cats (
! ca_id mediumint unsigned not null auto_increment,
! ca_u_id smallint unsigned not null references users(u_id),
! ca_desc varchar(127),
! ca_parent mediumint unsigned references cats(ca_id),
! primary key (ca_id),
! index ca_u_id_idx (ca_u_id)
! );
!
! -- views
!
! drop table if exists views;
! create table views (
! vw_id mediumint unsigned not null auto_increment,
! vw_desc varchar(127),
! vw_u_id smallint unsigned not null references users(u_id),
! vw_query text,
! primary key (vw_id),
! index vw_u_id_idx (vw_u_id)
! );
!
!
! -- -------------------------
! -- Message Data
! -- -------------------------
!
! -- msg_ids
!
! drop table if exists msg_ids;
!
! create table msg_ids (
! m_id mediumint unsigned not null auto_increment,
! m_msg_id varchar(255) not null,
! primary key (m_id),
! index m_msg_id_idx (m_msg_id)
! );
!
! -- msg_hdrs
!
! drop table if exists msg_hdrs;
! create table msg_hdrs (
! mh_id mediumint unsigned not null auto_increment,
! mh_m_id mediumint unsigned not null references msg_ids(m_id),
! mh_key varchar(63) not null,
! mh_value varchar(255),
! mh_sort_order smallint unsigned,
! primary key (mh_id),
! index mh_m_id_idx (mh_m_id),
! index mh_key_idx (mh_key),
! fulltext index mh_value_idx (mh_value)
! );
!
! -- msg_users
!
! drop table if exists msg_users;
! create table msg_users (
! mu_id mediumint unsigned not null auto_increment,
! mu_m_id mediumint unsigned not null not null references msg_ids(m_id),
! mu_u_id smallint unsigned not null references users(u_id),
! mu_ca_id mediumint unsigned not null references cats(ca_id),
! mu_date mediumint unsigned not null references msg_hdrs(mh_id),
! mu_from mediumint unsigned not null references msg_hdrs(mh_id),
! mu_subject mediumint unsigned not null references msg_hdrs(mh_id),
! mu_flags tinyint,
! primary key (mu_id),
! index mu_m_id_idx (mu_m_id),
! index mu_u_id_idx (mu_u_id),
! index mu_ca_id_idx (mu_ca_id)
! );
!
! -- msg_attach
!
! drop table if exists msg_attach;
! create table msg_attach (
! ma_id mediumint unsigned not null auto_increment,
! ma_m_id mediumint unsigned not null not null references msg_ids(m_id),
! ma_mt_id smallint unsigned not null references mime_types(mt_id),
! ma_encode varchar(127),
! ma_storage bool,
! ma_body mediumtext,
! ma_path varchar(255),
! ma_sep_data varchar(255),
! ma_sort_order smallint unsigned,
! primary key (ma_id),
! index ma_m_id_idx (ma_m_id),
! fulltext index ma_body_idx (ma_body)
! );
!
! -- -------------------------
! -- Logs
! -- -------------------------
!
! drop table if exists obj_log;
! create table obj_log (
! obj_id mediumint unsigned not null auto_increment,
! obj_type varchar(15),
! obj_type_id mediumint unsigned not null,
! obj_desc varchar(127),
! obj_action char(1),
! obj_datetime timestamp,
! primary key (obj_id),
! index obj_type_idx (obj_type),
! index obj_type_id_idx (obj_type_id),
! index obj_desc_idx (obj_desc)
! );
!
! drop table if exists msg_log;
! create table msg_log (
! msl_id mediumint unsigned not null auto_increment,
! msl_m_id mediumint unsigned not null,
! msl_u_id mediumint unsigned not null,
! msl_ca_id mediumint unsigned not null,
! msl_action char(1),
! msl_datetime timestamp,
! primary key (msl_id),
! index msl_m_id_idx (msl_m_id),
! index msl_u_id_idx (msl_u_id),
! index msl_ca_id_idx (msl_ca_id)
! );
--- 1,181 ----
! -- cr_maildb.sql - MailDB MySQL database table creation
! -- Copyright (c) 2002 MailDB Team
! --
! -- This file is part of the MailDB software package. For license
! -- information, see the LICENSE file in the top level directory of the
! -- MailDB source distribution.
! --
! -- $Id: cr_maildb.sql,v 1.2 2002/11/05 23:15:47 lweissler Exp $
! -- -------------------------------------------------------
! -- Create maildb tables
!
! -- common message data:
! -- hdrs, mime_types
! -- user data:
! -- users, cats, views
! -- message data:
! -- msg_ids, msg_hdrs, msg_users, msg_attach
! -- logs:
! -- obj_log, msg_log
!
! -- -------------------------
! -- Common Message Data
! -- -------------------------
!
! -- hdrs
! -- -> deleted 10/10/2002 in favor of de-normalizing
!
! -- drop table if exists hdrs;
! -- create table hdrs (
! -- h_id smallint unsigned not null auto_increment,
! -- h_desc varchar(20),
! -- primary key (h_id)
! -- );
!
! -- mime_types
!
! drop table if exists mime_types;
! create table mime_types (
! mt_id smallint unsigned not null auto_increment,
! mt_desc varchar(127),
! primary key (mt_id),
! index mt_desc_idx (mt_desc)
! );
!
!
! -- -------------------------
! -- User Data
! -- -------------------------
!
! -- users
!
! drop table if exists users;
! create table users (
! u_id smallint unsigned not null auto_increment,
! u_desc varchar(127),
! primary key (u_id),
! index u_desc_idx (u_desc)
! );
!
! -- cats
!
! drop table if exists cats;
! create table cats (
! ca_id mediumint unsigned not null auto_increment,
! ca_u_id smallint unsigned not null references users(u_id),
! ca_desc varchar(127),
! ca_parent mediumint unsigned references cats(ca_id),
! primary key (ca_id),
! index ca_u_id_idx (ca_u_id)
! );
!
! -- views
!
! drop table if exists views;
! create table views (
! vw_id mediumint unsigned not null auto_increment,
! vw_desc varchar(127),
! vw_u_id smallint unsigned not null references users(u_id),
! vw_query text,
! primary key (vw_id),
! index vw_u_id_idx (vw_u_id)
! );
!
!
! -- -------------------------
! -- Message Data
! -- -------------------------
!
! -- msg_ids
!
! drop table if exists msg_ids;
!
! create table msg_ids (
! m_id mediumint unsigned not null auto_increment,
! m_msg_id varchar(255) not null,
! primary key (m_id),
! index m_msg_id_idx (m_msg_id)
! );
!
! -- msg_hdrs
!
! drop table if exists msg_hdrs;
! create table msg_hdrs (
! mh_id mediumint unsigned not null auto_increment,
! mh_m_id mediumint unsigned not null references msg_ids(m_id),
! mh_key varchar(63) not null,
! mh_value varchar(255),
! mh_sort_order smallint unsigned,
! primary key (mh_id),
! index mh_m_id_idx (mh_m_id),
! index mh_key_idx (mh_key),
! fulltext index mh_value_idx (mh_value)
! );
!
! -- msg_users
!
! drop table if exists msg_users;
! create table msg_users (
! mu_id mediumint unsigned not null auto_increment,
! mu_m_id mediumint unsigned not null not null references msg_ids(m_id),
! mu_u_id smallint unsigned not null references users(u_id),
! mu_ca_id mediumint unsigned not null references cats(ca_id),
! mu_date mediumint unsigned not null references msg_hdrs(mh_id),
! mu_from mediumint unsigned not null references msg_hdrs(mh_id),
! mu_subject mediumint unsigned not null references msg_hdrs(mh_id),
! mu_flags tinyint,
! primary key (mu_id),
! index mu_m_id_idx (mu_m_id),
! index mu_u_id_idx (mu_u_id),
! index mu_ca_id_idx (mu_ca_id)
! );
!
! -- msg_attach
!
! drop table if exists msg_attach;
! create table msg_attach (
! ma_id mediumint unsigned not null auto_increment,
! ma_m_id mediumint unsigned not null not null references msg_ids(m_id),
! ma_mt_id smallint unsigned not null references mime_types(mt_id),
! ma_encode varchar(127),
! ma_storage bool,
! ma_body mediumtext,
! ma_path varchar(255),
! ma_sep_data varchar(255),
! ma_sort_order smallint unsigned,
! primary key (ma_id),
! index ma_m_id_idx (ma_m_id),
! fulltext index ma_body_idx (ma_body)
! );
!
! -- -------------------------
! -- Logs
! -- -------------------------
!
! drop table if exists obj_log;
! create table obj_log (
! obj_id mediumint unsigned not null auto_increment,
! obj_type varchar(15),
! obj_type_id mediumint unsigned not null,
! obj_desc varchar(127),
! obj_action char(1),
! obj_datetime timestamp,
! primary key (obj_id),
! index obj_type_idx (obj_type),
! index obj_type_id_idx (obj_type_id),
! index obj_desc_idx (obj_desc)
! );
!
! drop table if exists msg_log;
! create table msg_log (
! msl_id mediumint unsigned not null auto_increment,
! msl_m_id mediumint unsigned not null,
! msl_u_id mediumint unsigned not null,
! msl_ca_id mediumint unsigned not null,
! msl_action char(1),
! msl_datetime timestamp,
! primary key (msl_id),
! index msl_m_id_idx (msl_m_id),
! index msl_u_id_idx (msl_u_id),
! index msl_ca_id_idx (msl_ca_id)
! );
1.2 +702 -696 maildb/libmaildb/db/mysql/doc/design.html
Index: design.html
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/design.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** design.html 30 Oct 2002 12:30:40 -0000 1.1
--- design.html 5 Nov 2002 23:15:47 -0000 1.2
***************
*** 1,696 ****
! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
! <html>
! <head>
! <!-- saved from url=(0189)http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1 -->
! <meta http-equiv="Content-Type"
! content="text/html; charset=windows-1252">
! <meta content="MSHTML 5.50.4611.1300" name="GENERATOR">
! <title>MailDB Design</title>
! </head>
! <body>
! <h1>MailDB Database Design</h1>
! <p><a href="#intro">Introduction</a><br>
! <a href="#tables">Table Descriptions</a><br>
! <a href="#issues">Open Questions/Issues</a><br>
! <a href="#details">Table Details</a><br>
! <a href="#storage">MySQL Storage Notes</a><br>
! </p>
! <p></p>
! <hr><a name="intro"></a>
! <h2>Introduction</h2>
! <p>This document describes the proposed design for the MailDB database. This
! design is a work-in-progress and is subject to change; outstanding questions/issues
! are listed below in <a
! href="http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1#issues">Open
! Questions/Issues</a>. </p>
! <p>This initial design assumes use of MySQL as the backend RDBMS. The design
! is generally normalized, the notable exception being message
! header tags (left of the colon) in the individual header records (which
! are stored in the msg_hdrs table). In this case the benefits of normalizing
! the data seemed to be outweighed by the slight increase in complexity of
! queries. [Note: I'm a bit on the fence on this one...decision not final.
! :-) -- lyw] </p>
! <p>Table summary descriptions are provided in the following section. A detailed
! description of table columns, datatypes, and a brief description/use of columns
! is in <a href="#details">Table Details</a>, below. The full SQL for table
! creation may be found in accompanying file <a href="cr_maildb.sql">cr_maildb.sql</a>,
! and sample queries are provided in accompanying file <a
! href="queries.sql">queries.sql</a>. </p>
! <hr><a name="tables"></a>
! <h2>Table Descriptions</h2>
! <p>There are four basic categories of tables: data common to all messages,
! user meta data, message data, and logs. </p>
! <p>
! <table border="1">
! <tbody>
! <tr>
! <th colspan="6">Common message data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">mime_types</td>
! <td valign="top">Normalized table of mime_type definitions.</td>
! <td valign="top">Mime type numeric identifier (mt_id)</td>
! <td valign="top">Mime type (mt_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_attach</td>
! </tr>
! <tr>
! <th colspan="6">User meta data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">users</td>
! <td valign="top">Normalized table of MailDB users.</td>
! <td valign="top">User numeric identifier (u_id)</td>
! <td valign="top">User name (u_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">cats<br>
! views<br>
! msg_users</td>
! </tr>
! <tr>
! <td valign="top">cats</td>
! <td valign="top">Message categories (i.e. "folders") created by users,
! to which messages are assigned. Categories may be [multiply] nested,
! and messages may assigned to multiple categories.</td>
! <td valign="top">Category numeric identifier (ca_id)</td>
! <td valign="top">Category owner (ca_u_id)</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_users</td>
! </tr>
! <tr>
! </tr>
! <tr>
! <td valign="top">views</td>
! <td valign="top">User views of messages...specifically, defined search
! criteria and the SQL required to execute the searches.</td>
! <td valign="top">View numeric identifier (vw_id)</td>
! <td valign="top">View owner (vw_u_id)</td>
! <td valign="top">users</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <th colspan="6">Message data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">msg_ids<br>
! </td>
! <td valign="top">Normalized table of message ids.<br>
! </td>
! <td valign="top">Numeric message record identifier (m_id)<br>
! </td>
! <td valign="top">Message id (m_msg_id)<br>
! </td>
! <td valign="top">n/a<br>
! </td>
! <td valign="top">msg_hdrs, msg_users, msg_attach, msg_log<br>
! </td>
! </tr>
! <tr>
! <td valign="top">msg_hdrs</td>
! <td valign="top">Message header information for a given message. Message
! header sort order is maintained. Multiple records will exist for each
! message, one per unique header line. </td>
! <td valign="top">Numeric message header record identifier (mh_id)</td>
! <td valign="top">Normalized message id (mh_m_id), header key (mh_key),
! header value (mh_value) [fulltext index]</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_users</td>
! </tr>
! <tr>
! <td valign="top">msg_users</td>
! <td valign="top">Records describing user instances (category filing)
! of specific messages. Users may assign messages to one or more categories,
! thus multiple records may exist in the table for a given message &
! user. Includes references into msg_hdrs table for faster retrieval
! of message date, sender, subject for category "scans".</td>
! <td valign="top">Message instance numeric identifier (mu_id).</td>
! <td valign="top">Normalized message id (mu_m_id), user (mu_u_id), category
! (mu_ca_id)</td>
! <td valign="top">users, cats, msg_hdrs</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <td valign="top">msg_attach</td>
! <td valign="top">Attachments to a given message. Message "body" not in
! an attachment is treated within the database as attachment 0. Attachment
! sort order is maintained. Records include mime type, file encoding,
! multi-part separator data, flag for attachment storage (0 = internal,
! in the database; 1 = external, in the filesystem).</td>
! <td valign="top">Message attachment numeric identifier (ma_id).</td>
! <td valign="top">Normalized message id (ma_m_id), body (ma_body) [fulltext
! index]</td>
! <td valign="top">mime_types</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <th colspan="6">Logging</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">obj_log</td>
! <td valign="top">History of actions on meta objects - namely, create,
! update, delete of users, categories, views, mime_types. To be maintained
! via trigger (to be defined).</td>
! <td valign="top">Numeric log record identifier (obj_id)</td>
! <td valign="top">Object type (obj_type), object identifier (obj_type_id),
! object description (obj_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <td valign="top">msg_log</td>
! <td valign="top">History of message activity - user adds, deletes from
! categories. To be maintained via trigger (to be defined).</td>
! <td valign="top">Numeric log record identifier (msl_id).</td>
! <td valign="top">Normalized message id (msl_m_id), user (msl_u_id), category
! (msl_ca_id)</td>
! <td valign="top">n/a</td>
! <td valign="top">n/a</td>
! </tr>
! </tbody>
! </table>
! </p>
! <hr><a name="issues"></a>
! <h2>Open Questions/Issues</h2>
! <ol>
! <li>Design issues
! <ol type="a">
! <li>Review all field sizing, especially msg_id and record identifiers.
! </li>
! <li>Should header info be normalized? Not done so above. </li>
! <li>Should users or mime_types be de-normalized? </li>
! <li>Size threshold for determining whether attachment is stored in
! the database or as external file? (Need to know here only for reasonable
! sizing of the ma_body field in msg_attach.) </li>
! </ol>
! </li>
! <li>MySQL specifics
! <ol type="a">
! <li>Triggers for maintaining log (history) tables. <b>Update: No trigger
! or stored procedure support in MySQL. Estimate is that these items will
! be included in version 5.0. Current stable MySQL is 3.23.x and 4.x is now
! available.</b> </li>
! <li>Check MySQL behavior when auto_incremented column "rolls over".
! </li>
! <li>Review MySQL regex pattern matching. </li>
! <li>Note vanilla MySQL has no true foreign key constraints. You can
! define the foreign keys (foo integer references bar(foo)) but they aren't
! enforced. </li>
! </ol>
! </li>
! <li>Message questions
! <ol type="a">
! <li>Multi-part separator data format? </li>
! <li>Which header line is used for message threading? Should it be included
! in msg_users table for quick category scanning? </li>
! </ol>
! </li>
! <li>Miscellaneous
! <ol type="a">
! <li>Construct and test sample queries... </li>
! </ol>
! </li>
! </ol>
! <hr><a name="details"></a>
! <h2>Table Details</h2>
! <table border="1">
! <tbody>
! <tr>
! <th>Table</th>
! <th>Column</th>
! <th>Datatype</th>
! <th>Primary Key</th>
! <th>Indexed</th>
! <th>Description</th>
! </tr>
! <tr>
! <td valign="top" rowspan="2">mime_types</td>
! <td>mt_id</td>
! <td>smallint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for mime_type record</td>
! </tr>
! <tr>
! <td>mt_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>Message body/attachment MIME type</td>
! </tr>
! <tr>
! <td valign="top" rowspan="2">users</td>
! <td>u_id</td>
! <td>smallint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for user record</td>
! </tr>
! <tr>
! <td>u_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>User description (login/reference name, e.g. 'weissler' or
! 'li...@av...'</td>
! </tr>
! <tr>
! <td valign="top" rowspan="4">cats</td>
! <td>ca_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for category record</td>
! </tr>
! <tr>
! <td>ca_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning this category. References users(u_id).</td>
! </tr>
! <tr>
! <td>ca_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>Category name, e.g. "Inbox", "Deleted", "Cycling"...</td>
! </tr>
! <tr>
! <td>ca_parent</td>
! <td>mediumint unsigned</td>
! <td> </td>
! <td> </td>
! <td>"Parent" category, allowing nesting of categories. Top-level
! categories have null parents. References cats(ca_id).</td>
! </tr>
! <tr>
! <td valign="top" rowspan="4">views</td>
! <td>vw_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for view record</td>
! </tr>
! <tr>
! <td>vw_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>View name, e.g. "Messages from Robert"</td>
! </tr>
! <tr>
! <td>vw_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning view. References users(u_id).</td>
! </tr>
! <tr>
! <td>vw_query</td>
! <td>text</td>
! <td> </td>
! <td> </td>
! <td>SQL required to retrieve messages meeting user's search criteria</td>
! </tr>
! <tr>
! <td valign="top" rowspan="2">msg_ids<br>
! </td>
! <td valign="top">m_id<br>
! </td>
! <td valign="top">mediumint unsigned not null auto_increment<br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">Unique identifier for message id (using less storage
! than the string message_id's in messages)<br>
! </td>
! </tr>
! <tr>
! <td valign="top">m_msg_id<br>
! </td>
! <td valign="top">varchar(255)<br>
! </td>
! <td valign="top"><br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">Message identifier (assigned by MTA)<br>
! </td>
! </tr>
! <tr>
! <td valign="top" rowspan="5">msg_hdrs</td>
! <td>mh_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message header record</td>
! </tr>
! <tr>
! <td>mh_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier</td>
! </tr>
! <tr>
! <td>mh_key</td>
! <td>varchar(63)</td>
! <td> </td>
! <td>X</td>
! <td>Header tag - e.g. "To", "From", "Subject"...anything left of colon
! (:) on header line. </td>
! </tr>
! <tr>
! <td>mh_value</td>
! <td>varchar(255)</td>
! <td> </td>
! <td>X</td>
! <td>Header value - anything right of colon (:) on header line. Fulltext
! index.</td>
! </tr>
! <tr>
! <td>mh_sort_order</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Header sequence number.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="8">msg_users</td>
! <td>mu_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message instance record.</td>
! </tr>
! <tr>
! <td>mu_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>mu_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning a copy of the message.</td>
! </tr>
! <tr>
! <td>mu_ca_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Category to which the user assigned the message.</td>
! </tr>
! <tr>
! <td>mu_date</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "Date" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_from</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "From" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_subject</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "Subject" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_flags</td>
! <td>tinyint unsigned</td>
! <td> </td>
! <td> </td>
! <td>Bit flags for the message.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="9">msg_attach</td>
! <td>ma_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message attachment record.</td>
! </tr>
! <tr>
! <td>ma_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>ma_mt_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to mime_types(mt_id)</td>
! </tr>
! <tr>
! <td>ma_encode</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>Attachment encoding</td>
! </tr>
! <tr>
! <td>ma_storage</td>
! <td>boolean</td>
! <td> </td>
! <td> </td>
! <td>Denotes whether attachment is stored within the database (0) or
! externally in the filesystem (1).</td>
! </tr>
! <tr>
! <td>ma_body</td>
! <td>mediumtext</td>
! <td> </td>
! <td>X</td>
! <td>Attachment body (for attachments stored within the database). Fulltext
! index.</td>
! </tr>
! <tr>
! <td>ma_path</td>
! <td>varchar(255)</td>
! <td> </td>
! <td> </td>
! <td>Full pathname to attachment (for attachments stored in the filesystem).</td>
! </tr>
! <tr>
! <td>ma_sep_data</td>
! <td>varchar(255)</td>
! <td> </td>
! <td> </td>
! <td>Multi-part separator data.</td>
! </tr>
! <tr>
! <td>ma_sort_order</td>
! <td>tinyint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Attachment sequence number.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="6">obj_log</td>
! <td>obj_id</td>
! <td>int unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for object log record.</td>
! </tr>
! <tr>
! <td>obj_type</td>
! <td>varchar(15)</td>
! <td> </td>
! <td>X</td>
! <td>Type of object - e.g. user, view, cat, mime_type</td>
! </tr>
! <tr>
! <td>obj_type_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Object identifier; if obj_type = user, obj_type_id corresponds to
! users(u_id), obj_type = cat, obj_type_id corresponds to cats(ca_id),
! etc.</td>
! </tr>
! <tr>
! <td>obj_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>Object description (username, viewname, category name...)</td>
! </tr>
! <tr>
! <td>obj_action</td>
! <td>char(1)</td>
! <td> </td>
! <td> </td>
! <td>Action taken on this object. Values include C (create), U (update),
! D (delete).</td>
! </tr>
! <tr>
! <td>obj_datetime</td>
! <td>timestamp(14)</td>
! <td> </td>
! <td> </td>
! <td>Timestamp of object action.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="6">msg_log</td>
! <td>msl_id</td>
! <td>int unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message log record.</td>
! </tr>
! <tr>
! <td>msl_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>msl_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning instance of the specified message.</td>
! </tr>
! <tr>
! <td>msl_ca_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Category to which the user assigned the message.</td>
! </tr>
! <tr>
! <td>msl_action</td>
! <td>char(1)</td>
! <td> </td>
! <td>X</td>
! <td>Action taken on this message. Values include C (create), U (update),
! D (delete).</td>
! </tr>
! <tr>
! <td>msl_datetime</td>
! <td>timestamp(14)</td>
! <td> </td>
! <td> </td>
! <td>Timestamp of message action.</td>
! </tr>
! </tbody>
! </table>
! <p></p>
! <hr><a name="storage"></a>
! <h2>MySQL Storage Notes</h2>
! <p>
! <table border="1">
! <tbody>
! <tr>
! <th>Datatype</th>
! <th>Max</th>
! <th>Storage</th>
! </tr>
! <tr>
! <td>varchar</td>
! <td>255</td>
! <td>L+1</td>
! </tr>
! <tr>
! <td>tinytext</td>
! <td>255</td>
! <td>L+1</td>
! </tr>
! <tr>
! <td>text</td>
! <td>64k</td>
! <td>L+2</td>
! </tr>
! <tr>
! <td>mediumtext</td>
! <td>16m</td>
! <td>L+3</td>
! </tr>
! <tr>
! <td>longtext</td>
! <td>4g</td>
! <td>L+4</td>
! </tr>
! <tr>
! <td>tinyint (U)</td>
! <td>255</td>
! <td>1</td>
! </tr>
! <tr>
! <td>smallint (U)</td>
! <td>65535</td>
! <td>2</td>
! </tr>
! <tr>
! <td>mediumint (U)</td>
! <td>16777215</td>
! <td>3</td>
! </tr>
! <tr>
! <td>int (U)</td>
! <td>4294967295</td>
! <td>4</td>
! </tr>
! <tr>
! <td>timestamp</td>
! <td>YYYYMMDDHHMISS</td>
! <td>4</td>
! </tr>
! </tbody>
! </table>
! </p>
! <p>...where (U) = unsigned, and L = length of text string. </p>
! <p></p>
! <hr><i>Last update: 17 October 2002 by <a href="mailto:li...@av...">Liza
! Weissler</a></i><a href="mailto:li...@av..."> </a><br>
! </body>
! </html>
--- 1,702 ----
! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
! <html>
! <head>
! <!-- saved from url=(0189)http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1 -->
! <meta http-equiv="Content-Type"
! content="text/html; charset=windows-1252">
! <meta content="MSHTML 5.50.4611.1300" name="GENERATOR">
! <title>MailDB Design</title>
! </head>
! <body>
! <h1>MailDB Database Design</h1>
! <p><a href="#intro">Introduction</a><br>
! <a href="#tables">Table Descriptions</a><br>
! <a href="#issues">Open Questions/Issues</a><br>
! <a href="#details">Table Details</a><br>
! <a href="#storage">MySQL Storage Notes</a><br>
! </p>
! <p>
! Copyright © 2002 MailDB Team
! <p>This file is part of the MailDB software package. For license
! information, see the LICENSE file in the top level directory of the
! MailDB source distribution.
! <p><i>$Id: design.html,v 1.2 2002/11/05 23:15:47 lweissler Exp $</i></p.
! <p></p>
! <hr><a name="intro"></a>
! <h2>Introduction</h2>
! <p>This document describes the proposed design for the MailDB database. This
! design is a work-in-progress and is subject to change; outstanding questions/issues
! are listed below in <a
! href="http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1#issues">Open
! Questions/Issues</a>. </p>
! <p>This initial design assumes use of MySQL as the backend RDBMS. The design
! is generally normalized, the notable exception being message
! header tags (left of the colon) in the individual header records (which
! are stored in the msg_hdrs table). In this case the benefits of normalizing
! the data seemed to be outweighed by the slight increase in complexity of
! queries. [Note: I'm a bit on the fence on this one...decision not final.
! :-) -- lyw] </p>
! <p>Table summary descriptions are provided in the following section. A detailed
! description of table columns, datatypes, and a brief description/use of columns
! is in <a href="#details">Table Details</a>, below. The full SQL for table
! creation may be found in accompanying file <a href="cr_maildb.sql">cr_maildb.sql</a>,
! and sample queries are provided in accompanying file <a
! href="queries.sql">queries.sql</a>. </p>
! <hr><a name="tables"></a>
! <h2>Table Descriptions</h2>
! <p>There are four basic categories of tables: data common to all messages,
! user meta data, message data, and logs. </p>
! <p>
! <table border="1">
! <tbody>
! <tr>
! <th colspan="6">Common message data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">mime_types</td>
! <td valign="top">Normalized table of mime_type definitions.</td>
! <td valign="top">Mime type numeric identifier (mt_id)</td>
! <td valign="top">Mime type (mt_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_attach</td>
! </tr>
! <tr>
! <th colspan="6">User meta data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">users</td>
! <td valign="top">Normalized table of MailDB users.</td>
! <td valign="top">User numeric identifier (u_id)</td>
! <td valign="top">User name (u_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">cats<br>
! views<br>
! msg_users</td>
! </tr>
! <tr>
! <td valign="top">cats</td>
! <td valign="top">Message categories (i.e. "folders") created by users,
! to which messages are assigned. Categories may be [multiply] nested,
! and messages may assigned to multiple categories.</td>
! <td valign="top">Category numeric identifier (ca_id)</td>
! <td valign="top">Category owner (ca_u_id)</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_users</td>
! </tr>
! <tr>
! </tr>
! <tr>
! <td valign="top">views</td>
! <td valign="top">User views of messages...specifically, defined search
! criteria and the SQL required to execute the searches.</td>
! <td valign="top">View numeric identifier (vw_id)</td>
! <td valign="top">View owner (vw_u_id)</td>
! <td valign="top">users</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <th colspan="6">Message data</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">msg_ids<br>
! </td>
! <td valign="top">Normalized table of message ids.<br>
! </td>
! <td valign="top">Numeric message record identifier (m_id)<br>
! </td>
! <td valign="top">Message id (m_msg_id)<br>
! </td>
! <td valign="top">n/a<br>
! </td>
! <td valign="top">msg_hdrs, msg_users, msg_attach, msg_log<br>
! </td>
! </tr>
! <tr>
! <td valign="top">msg_hdrs</td>
! <td valign="top">Message header information for a given message. Message
! header sort order is maintained. Multiple records will exist for each
! message, one per unique header line. </td>
! <td valign="top">Numeric message header record identifier (mh_id)</td>
! <td valign="top">Normalized message id (mh_m_id), header key (mh_key),
! header value (mh_value) [fulltext index]</td>
! <td valign="top">n/a</td>
! <td valign="top">msg_users</td>
! </tr>
! <tr>
! <td valign="top">msg_users</td>
! <td valign="top">Records describing user instances (category filing)
! of specific messages. Users may assign messages to one or more categories,
! thus multiple records may exist in the table for a given message &
! user. Includes references into msg_hdrs table for faster retrieval
! of message date, sender, subject for category "scans".</td>
! <td valign="top">Message instance numeric identifier (mu_id).</td>
! <td valign="top">Normalized message id (mu_m_id), user (mu_u_id), category
! (mu_ca_id)</td>
! <td valign="top">users, cats, msg_hdrs</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <td valign="top">msg_attach</td>
! <td valign="top">Attachments to a given message. Message "body" not in
! an attachment is treated within the database as attachment 0. Attachment
! sort order is maintained. Records include mime type, file encoding,
! multi-part separator data, flag for attachment storage (0 = internal,
! in the database; 1 = external, in the filesystem).</td>
! <td valign="top">Message attachment numeric identifier (ma_id).</td>
! <td valign="top">Normalized message id (ma_m_id), body (ma_body) [fulltext
! index]</td>
! <td valign="top">mime_types</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <th colspan="6">Logging</th>
! </tr>
! <tr>
! <th>Table</th>
! <th>Description</th>
! <th>Primary key</th>
! <th>Add'l Indexes</th>
! <th>References</th>
! <th>Referenced by</th>
! </tr>
! <tr>
! <td valign="top">obj_log</td>
! <td valign="top">History of actions on meta objects - namely, create,
! update, delete of users, categories, views, mime_types. To be maintained
! via trigger (to be defined).</td>
! <td valign="top">Numeric log record identifier (obj_id)</td>
! <td valign="top">Object type (obj_type), object identifier (obj_type_id),
! object description (obj_desc)</td>
! <td valign="top">n/a</td>
! <td valign="top">n/a</td>
! </tr>
! <tr>
! <td valign="top">msg_log</td>
! <td valign="top">History of message activity - user adds, deletes from
! categories. To be maintained via trigger (to be defined).</td>
! <td valign="top">Numeric log record identifier (msl_id).</td>
! <td valign="top">Normalized message id (msl_m_id), user (msl_u_id), category
! (msl_ca_id)</td>
! <td valign="top">n/a</td>
! <td valign="top">n/a</td>
! </tr>
! </tbody>
! </table>
! </p>
! <hr><a name="issues"></a>
! <h2>Open Questions/Issues</h2>
! <ol>
! <li>Design issues
! <ol type="a">
! <li>Review all field sizing, especially msg_id and record identifiers.
! </li>
! <li>Should header info be normalized? Not done so above. </li>
! <li>Should users or mime_types be de-normalized? </li>
! <li>Size threshold for determining whether attachment is stored in
! the database or as external file? (Need to know here only for reasonable
! sizing of the ma_body field in msg_attach.) </li>
! </ol>
! </li>
! <li>MySQL specifics
! <ol type="a">
! <li>Triggers for maintaining log (history) tables. <b>Update: No trigger
! or stored procedure support in MySQL. Estimate is that these items will
! be included in version 5.0. Current stable MySQL is 3.23.x and 4.x is now
! available.</b> </li>
! <li>Check MySQL behavior when auto_incremented column "rolls over".
! </li>
! <li>Review MySQL regex pattern matching. </li>
! <li>Note vanilla MySQL has no true foreign key constraints. You can
! define the foreign keys (foo integer references bar(foo)) but they aren't
! enforced. </li>
! </ol>
! </li>
! <li>Message questions
! <ol type="a">
! <li>Multi-part separator data format? </li>
! <li>Which header line is used for message threading? Should it be included
! in msg_users table for quick category scanning? </li>
! </ol>
! </li>
! <li>Miscellaneous
! <ol type="a">
! <li>Construct and test sample queries... </li>
! </ol>
! </li>
! </ol>
! <hr><a name="details"></a>
! <h2>Table Details</h2>
! <table border="1">
! <tbody>
! <tr>
! <th>Table</th>
! <th>Column</th>
! <th>Datatype</th>
! <th>Primary Key</th>
! <th>Indexed</th>
! <th>Description</th>
! </tr>
! <tr>
! <td valign="top" rowspan="2">mime_types</td>
! <td>mt_id</td>
! <td>smallint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for mime_type record</td>
! </tr>
! <tr>
! <td>mt_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>Message body/attachment MIME type</td>
! </tr>
! <tr>
! <td valign="top" rowspan="2">users</td>
! <td>u_id</td>
! <td>smallint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for user record</td>
! </tr>
! <tr>
! <td>u_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>User description (login/reference name, e.g. 'weissler' or
! 'li...@av...'</td>
! </tr>
! <tr>
! <td valign="top" rowspan="4">cats</td>
! <td>ca_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for category record</td>
! </tr>
! <tr>
! <td>ca_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning this category. References users(u_id).</td>
! </tr>
! <tr>
! <td>ca_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>Category name, e.g. "Inbox", "Deleted", "Cycling"...</td>
! </tr>
! <tr>
! <td>ca_parent</td>
! <td>mediumint unsigned</td>
! <td> </td>
! <td> </td>
! <td>"Parent" category, allowing nesting of categories. Top-level
! categories have null parents. References cats(ca_id).</td>
! </tr>
! <tr>
! <td valign="top" rowspan="4">views</td>
! <td>vw_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for view record</td>
! </tr>
! <tr>
! <td>vw_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>View name, e.g. "Messages from Robert"</td>
! </tr>
! <tr>
! <td>vw_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning view. References users(u_id).</td>
! </tr>
! <tr>
! <td>vw_query</td>
! <td>text</td>
! <td> </td>
! <td> </td>
! <td>SQL required to retrieve messages meeting user's search criteria</td>
! </tr>
! <tr>
! <td valign="top" rowspan="2">msg_ids<br>
! </td>
! <td valign="top">m_id<br>
! </td>
! <td valign="top">mediumint unsigned not null auto_increment<br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">Unique identifier for message id (using less storage
! than the string message_id's in messages)<br>
! </td>
! </tr>
! <tr>
! <td valign="top">m_msg_id<br>
! </td>
! <td valign="top">varchar(255)<br>
! </td>
! <td valign="top"><br>
! </td>
! <td valign="top">X<br>
! </td>
! <td valign="top">Message identifier (assigned by MTA)<br>
! </td>
! </tr>
! <tr>
! <td valign="top" rowspan="5">msg_hdrs</td>
! <td>mh_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message header record</td>
! </tr>
! <tr>
! <td>mh_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier</td>
! </tr>
! <tr>
! <td>mh_key</td>
! <td>varchar(63)</td>
! <td> </td>
! <td>X</td>
! <td>Header tag - e.g. "To", "From", "Subject"...anything left of colon
! (:) on header line. </td>
! </tr>
! <tr>
! <td>mh_value</td>
! <td>varchar(255)</td>
! <td> </td>
! <td>X</td>
! <td>Header value - anything right of colon (:) on header line. Fulltext
! index.</td>
! </tr>
! <tr>
! <td>mh_sort_order</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Header sequence number.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="8">msg_users</td>
! <td>mu_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message instance record.</td>
! </tr>
! <tr>
! <td>mu_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>mu_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning a copy of the message.</td>
! </tr>
! <tr>
! <td>mu_ca_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Category to which the user assigned the message.</td>
! </tr>
! <tr>
! <td>mu_date</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "Date" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_from</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "From" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_subject</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to corresponding "Subject" header in msg_hdrs.</td>
! </tr>
! <tr>
! <td>mu_flags</td>
! <td>tinyint unsigned</td>
! <td> </td>
! <td> </td>
! <td>Bit flags for the message.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="9">msg_attach</td>
! <td>ma_id</td>
! <td>mediumint unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message attachment record.</td>
! </tr>
! <tr>
! <td>ma_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>ma_mt_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Foreign key ref to mime_types(mt_id)</td>
! </tr>
! <tr>
! <td>ma_encode</td>
! <td>varchar(127)</td>
! <td> </td>
! <td> </td>
! <td>Attachment encoding</td>
! </tr>
! <tr>
! <td>ma_storage</td>
! <td>boolean</td>
! <td> </td>
! <td> </td>
! <td>Denotes whether attachment is stored within the database (0) or
! externally in the filesystem (1).</td>
! </tr>
! <tr>
! <td>ma_body</td>
! <td>mediumtext</td>
! <td> </td>
! <td>X</td>
! <td>Attachment body (for attachments stored within the database). Fulltext
! index.</td>
! </tr>
! <tr>
! <td>ma_path</td>
! <td>varchar(255)</td>
! <td> </td>
! <td> </td>
! <td>Full pathname to attachment (for attachments stored in the filesystem).</td>
! </tr>
! <tr>
! <td>ma_sep_data</td>
! <td>varchar(255)</td>
! <td> </td>
! <td> </td>
! <td>Multi-part separator data.</td>
! </tr>
! <tr>
! <td>ma_sort_order</td>
! <td>tinyint unsigned not null</td>
! <td> </td>
! <td> </td>
! <td>Attachment sequence number.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="6">obj_log</td>
! <td>obj_id</td>
! <td>int unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for object log record.</td>
! </tr>
! <tr>
! <td>obj_type</td>
! <td>varchar(15)</td>
! <td> </td>
! <td>X</td>
! <td>Type of object - e.g. user, view, cat, mime_type</td>
! </tr>
! <tr>
! <td>obj_type_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Object identifier; if obj_type = user, obj_type_id corresponds to
! users(u_id), obj_type = cat, obj_type_id corresponds to cats(ca_id),
! etc.</td>
! </tr>
! <tr>
! <td>obj_desc</td>
! <td>varchar(127)</td>
! <td> </td>
! <td>X</td>
! <td>Object description (username, viewname, category name...)</td>
! </tr>
! <tr>
! <td>obj_action</td>
! <td>char(1)</td>
! <td> </td>
! <td> </td>
! <td>Action taken on this object. Values include C (create), U (update),
! D (delete).</td>
! </tr>
! <tr>
! <td>obj_datetime</td>
! <td>timestamp(14)</td>
! <td> </td>
! <td> </td>
! <td>Timestamp of object action.</td>
! </tr>
! <tr>
! <td valign="top" rowspan="6">msg_log</td>
! <td>msl_id</td>
! <td>int unsigned not null auto_increment</td>
! <td>X</td>
! <td>X</td>
! <td>Unique identifier for message log record.</td>
! </tr>
! <tr>
! <td>msl_m_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Message identifier.</td>
! </tr>
! <tr>
! <td>msl_u_id</td>
! <td>smallint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>User owning instance of the specified message.</td>
! </tr>
! <tr>
! <td>msl_ca_id</td>
! <td>mediumint unsigned not null</td>
! <td> </td>
! <td>X</td>
! <td>Category to which the user assigned the message.</td>
! </tr>
! <tr>
! <td>msl_action</td>
! <td>char(1)</td>
! <td> </td>
! <td>X</td>
! <td>Action taken on this message. Values include C (create), U (update),
! D (delete).</td>
! </tr>
! <tr>
! <td>msl_datetime</td>
! <td>timestamp(14)</td>
! <td> </td>
! <td> </td>
! <td>Timestamp of message action.</td>
! </tr>
! </tbody>
! </table>
! <p></p>
! <hr><a name="storage"></a>
! <h2>MySQL Storage Notes</h2>
! <p>
! <table border="1">
! <tbody>
! <tr>
! <th>Datatype</th>
! <th>Max</th>
! <th>Storage</th>
! </tr>
! <tr>
! <td>varchar</td>
! <td>255</td>
! <td>L+1</td>
! </tr>
! <tr>
! <td>tinytext</td>
! <td>255</td>
! <td>L+1</td>
! </tr>
! <tr>
! <td>text</td>
! <td>64k</td>
! <td>L+2</td>
! </tr>
! <tr>
! <td>mediumtext</td>
! <td>16m</td>
! <td>L+3</td>
! </tr>
! <tr>
! <td>longtext</td>
! <td>4g</td>
! <td>L+4</td>
! </tr>
! <tr>
! <td>tinyint (U)</td>
! <td>255</td>
! <td>1</td>
! </tr>
! <tr>
! <td>smallint (U)</td>
! <td>65535</td>
! <td>2</td>
! </tr>
! <tr>
! <td>mediumint (U)</td>
! <td>16777215</td>
! <td>3</td>
! </tr>
! <tr>
! <td>int (U)</td>
! <td>4294967295</td>
! <td>4</td>
! </tr>
! <tr>
! <td>timestamp</td>
! <td>YYYYMMDDHHMISS</td>
! <td>4</td>
! </tr>
! </tbody>
! </table>
! </p>
! <p>...where (U) = unsigned, and L = length of text string. </p>
! <p></p>
! <hr><i>Last update: 17 October 2002 by <a href="mailto:li...@av...">Liza
! Weissler</a></i><a href="mailto:li...@av..."> </a><br>
! </body>
! </html>
1.2 +72 -62 maildb/libmaildb/db/mysql/doc/message.sql
Index: message.sql
===================================================================
RCS file: /cvsroot/maildb/maildb/libmaildb/db/mysql/doc/message.sql,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** message.sql 30 Oct 2002 02:51:46 -0000 1.1
--- message.sql 5 Nov 2002 23:15:47 -0000 1.2
***************
*** 1,62 ****
! delete from msg_ids where m_id < 10;
! delete from msg_hdrs where mh_id < 100;
! delete from msg_attach where ma_id < 100;
!
! insert into msg_ids values (NULL, '<001801c27523$aa5d46a0$af270444@CX434770b>');
!
! insert into msg_hdrs values (NULL, 1,
! 'From', 'lyu...@co... Wed Oct 16 10:53:33 2002', 0);
! insert into msg_hdrs values (NULL, 1,
! 'Return-path', '<lyu...@co...>', 1);
! insert into msg_hdrs values (NULL, 1,
! 'Envelope-to', 'li...@av...', 2);
! insert into msg_hdrs values (NULL, 1,
! 'Delivery-date', 'Wed, 16 Oct 2002 10:53:33 -0400', 3);
! insert into msg_hdrs values (NULL, 1,
! 'Received', 'from fed1mtao02.cox.net ([68.6.19.243])
! by server627.peel3.com with esmtp (Exim 3.36 #1)
! id 181pYD-0007jN-00
! for li...@av...; Wed, 16 Oct 2002 10:53:33 -0400', 4);
! insert into msg_hdrs values (NULL, 1,
! 'Received', 'from CX434770b ([68.4.39.175]) by fed1mtao02.cox.net
! (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with SMTP
! id <20021016145235.TLKB25985.fed1mtao02.cox.net@CX434770b>
! for <li...@av...>; Wed, 16 Oct 2002 10:52:35 -0400', 5);
! insert into msg_hdrs values (NULL, 1,
! 'Message-ID', 1, 6);
! insert into msg_hdrs values (NULL, 1,
! 'From', '"Luci Ursich" <lyu...@co...>', 7);
! insert into msg_hdrs values (NULL, 1,
! 'To', '"Liza Weissler" <li...@av...>', 8);
! insert into msg_hdrs values (NULL, 1,
! 'Subject', 'estee lauder', 9);
! insert into msg_hdrs values (NULL, 1,
! 'Date', 'Wed, 16 Oct 2002 07:52:36 -0700', 10);
! insert into msg_hdrs values (NULL, 1,
! 'MIME-Version', '1.0', 11);
! insert into msg_hdrs values (NULL, 1,
! 'Content-Type', 'multipart/alternative;
! boundary="----=_NextPart_000_0015_01C274E8.FDE8EAD0"', 12);
! insert into msg_hdrs values (NULL, 1,
! 'X-Priority', '3', 13);
! insert into msg_hdrs values (NULL, 1,
! 'X-MSMail-Priority', 'Normal', 14);
! insert into msg_hdrs values (NULL, 1,
! 'X-Mailer', 'Microsoft Outlook Express 6.00.2720.3000', 15);
! insert into msg_hdrs values (NULL, 1,
! 'X-Mi...
[truncated message content] |
|
From: Jeff S. <jsq...@us...> - 2002-10-30 13:29:06
|
jsquyres 02/10/30 05:29:05 Modified: libmaildb/common Makefile.am Log: Make the copyrights be "MailDB Team" with a top-level AUTHORS file, not "Jeff Squyres". Much simpler that way. Revision Changes Path 1.2 +2 -2 maildb/libmaildb/common/Makefile.am Index: Makefile.am =================================================================== RCS file: /cvsroot/maildb/maildb/libmaildb/common/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** Makefile.am 30 Oct 2002 12:31:00 -0000 1.1 --- Makefile.am 30 Oct 2002 13:29:05 -0000 1.2 *************** *** 1,12 **** # -*- makefile -*- # ! # Copyright (c) 2002 Jeff Squyres # # This file is part of the MailDB software package. For license # information, see the LICENSE file in the top level directory of the # MailDB source distribution. # ! # $Id: Makefile.am,v 1.1 2002/10/30 12:31:00 jsquyres Exp $ # # Nobody here yet but us chickens... --- 1,12 ---- # -*- makefile -*- # ! # Copyright (c) 2002 MailDB Team # # This file is part of the MailDB software package. For license # information, see the LICENSE file in the top level directory of the # MailDB source distribution. # ! # $Id: Makefile.am,v 1.2 2002/10/30 13:29:05 jsquyres Exp $ # # Nobody here yet but us chickens... |
|
From: Jeff S. <jsq...@us...> - 2002-10-30 13:29:06
|
jsquyres 02/10/30 05:29:05 Modified: libmaildb/db Makefile.am Log: Make the copyrights be "MailDB Team" with a top-level AUTHORS file, not "Jeff Squyres". Much simpler that way. Revision Changes Path 1.2 +2 -2 maildb/libmaildb/db/Makefile.am Index: Makefile.am =================================================================== RCS file: /cvsroot/maildb/maildb/libmaildb/db/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** Makefile.am 30 Oct 2002 12:31:01 -0000 1.1 --- Makefile.am 30 Oct 2002 13:29:05 -0000 1.2 *************** *** 1,12 **** # -*- makefile -*- # ! # Copyright (c) 2002 Jeff Squyres # # This file is part of the MailDB software package. For license # information, see the LICENSE file in the top level directory of the # MailDB source distribution. # ! # $Id: Makefile.am,v 1.1 2002/10/30 12:31:01 jsquyres Exp $ # # Nobody here yet but us chickens... --- 1,12 ---- # -*- makefile -*- # ! # Copyright (c) 2002 MailDB Team # # This file is part of the MailDB software package. For license # information, see the LICENSE file in the top level directory of the # MailDB source distribution. # ! # $Id: Makefile.am,v 1.2 2002/10/30 13:29:05 jsquyres Exp $ # # Nobody here yet but us chickens... |
|
From: Jeff S. <jsq...@us...> - 2002-10-30 13:29:06
|
jsquyres 02/10/30 05:29:05 Modified: libmaildb Makefile.am Log: Make the copyrights be "MailDB Team" with a top-level AUTHORS file, not "Jeff Squyres". Much simpler that way. Revision Changes Path 1.2 +2 -2 maildb/libmaildb/Makefile.am Index: Makefile.am =================================================================== RCS file: /cvsroot/maildb/maildb/libmaildb/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** Makefile.am 30 Oct 2002 12:31:00 -0000 1.1 --- Makefile.am 30 Oct 2002 13:29:05 -0000 1.2 *************** *** 1,12 **** # -*- makefile -*- # ! # Copyright (c) 2002 Jeff Squyres # # This file is part of the MailDB software package. For license # information, see the LICENSE file in the top level directory of the # MailDB source distribution. # ! # $Id: Makefile.am,v 1.1 2002/10/30 12:31:00 jsquyres Exp $ # SUBDIRS = db common --- 1,12 ---- # -*- makefile -*- # ! # Copyright (c) 2002 MailDB Team # # This file is part of the MailDB software package. For license # information, see the LICENSE file in the top level directory of the # MailDB source distribution. # ! # $Id: Makefile.am,v 1.2 2002/10/30 13:29:05 jsquyres Exp $ # SUBDIRS = db common |
|
From: Jeff S. <jsq...@us...> - 2002-10-30 13:29:05
|
jsquyres 02/10/30 05:29:05
Modified: dist Makefile.am get_maildb_version maildb_functions.m4
maildb_get_version.m4
Log:
Make the copyrights be "MailDB Team" with a top-level AUTHORS file,
not "Jeff Squyres". Much simpler that way.
Revision Changes Path
1.2 +2 -2 maildb/dist/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /cvsroot/maildb/maildb/dist/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** Makefile.am 30 Oct 2002 12:31:00 -0000 1.1
--- Makefile.am 30 Oct 2002 13:29:05 -0000 1.2
***************
*** 1,12 ****
# -*- makefile -*-
#
! # Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
! # $Id: Makefile.am,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
EXTRA_DIST = \
--- 1,12 ----
# -*- makefile -*-
#
! # Copyright (c) 2002 MailDB Team
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
! # $Id: Makefile.am,v 1.2 2002/10/30 13:29:05 jsquyres Exp $
#
EXTRA_DIST = \
1.2 +2 -2 maildb/dist/get_maildb_version
Index: get_maildb_version
===================================================================
RCS file: /cvsroot/maildb/maildb/dist/get_maildb_version,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** get_maildb_version 30 Oct 2002 12:31:00 -0000 1.1
--- get_maildb_version 30 Oct 2002 13:29:05 -0000 1.2
***************
*** 1,12 ****
#!/bin/sh
#
! # Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
! # $Id: get_maildb_version,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
# Since we do this in multiple places, it's worth putting in a
# separate shell script. Very primitive script to get the version
--- 1,12 ----
#!/bin/sh
#
! # Copyright (c) 2002 MailDB Team
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
! # $Id: get_maildb_version,v 1.2 2002/10/30 13:29:05 jsquyres Exp $
#
# Since we do this in multiple places, it's worth putting in a
# separate shell script. Very primitive script to get the version
1.2 +2 -2 maildb/dist/maildb_functions.m4
Index: maildb_functions.m4
===================================================================
RCS file: /cvsroot/maildb/maildb/dist/maildb_functions.m4,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** maildb_functions.m4 30 Oct 2002 12:31:00 -0000 1.1
--- maildb_functions.m4 30 Oct 2002 13:29:05 -0000 1.2
***************
*** 1,12 ****
dnl -*- shell-script -*-
dnl
! dnl Copyright (c) 2002 Jeff Squyres
dnl
dnl This file is part of the MailDB software package. For license
dnl information, see the LICENSE file in the top level directory of the
dnl MailDB source distribution.
dnl
! dnl $Id: maildb_functions.m4,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
dnl
AC_DEFUN(MAILDB_CONFIGURE_SETUP,[
--- 1,12 ----
dnl -*- shell-script -*-
dnl
! dnl Copyright (c) 2002 MailDB Team
dnl
dnl This file is part of the MailDB software package. For license
dnl information, see the LICENSE file in the top level directory of the
dnl MailDB source distribution.
dnl
! dnl $Id: maildb_functions.m4,v 1.2 2002/10/30 13:29:05 jsquyres Exp $
dnl
AC_DEFUN(MAILDB_CONFIGURE_SETUP,[
1.2 +2 -2 maildb/dist/maildb_get_version.m4
Index: maildb_get_version.m4
===================================================================
RCS file: /cvsroot/maildb/maildb/dist/maildb_get_version.m4,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** maildb_get_version.m4 30 Oct 2002 12:31:00 -0000 1.1
--- maildb_get_version.m4 30 Oct 2002 13:29:05 -0000 1.2
***************
*** 1,12 ****
dnl -*- shell-script -*-
dnl
! dnl Copyright (c) 2002 Jeff Squyres
dnl
dnl This file is part of the MailDB software package. For license
dnl information, see the LICENSE file in the top level directory of the
dnl MailDB source distribution.
dnl
! dnl $Id: maildb_get_version.m4,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
dnl
define(MAILDB_GET_VERSION,[
--- 1,12 ----
dnl -*- shell-script -*-
dnl
! dnl Copyright (c) 2002 MailDB Team
dnl
dnl This file is part of the MailDB software package. For license
dnl information, see the LICENSE file in the top level directory of the
dnl MailDB source distribution.
dnl
! dnl $Id: maildb_get_version.m4,v 1.2 2002/10/30 13:29:05 jsquyres Exp $
dnl
define(MAILDB_GET_VERSION,[
|
|
From: Jeff S. <jsq...@us...> - 2002-10-30 13:29:05
|
jsquyres 02/10/30 05:29:04
Modified: . LICENSE Makefile.am acinclude.m4 autogen.sh
configure.in
Added: . AUTHORS README
Log:
Make the copyrights be "MailDB Team" with a top-level AUTHORS file,
not "Jeff Squyres". Much simpler that way.
Revision Changes Path
1.2 +2 -0 maildb/LICENSE
Index: LICENSE
===================================================================
RCS file: /cvsroot/maildb/maildb/LICENSE,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** LICENSE 30 Oct 2002 12:31:00 -0000 1.1
--- LICENSE 30 Oct 2002 13:29:04 -0000 1.2
***************
*** 1,3 ****
--- 1,5 ----
+ Copyright (c) 2002 MailDB Team
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1.2 +3 -3 maildb/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /cvsroot/maildb/maildb/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** Makefile.am 30 Oct 2002 12:31:00 -0000 1.1
--- Makefile.am 30 Oct 2002 13:29:04 -0000 1.2
***************
*** 1,17 ****
# -*- makefile -*-
#
! # Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
! # $Id: Makefile.am,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
SUBDIRS = dist libmaildb
! EXTRA_DIST = LICENSE README
#
# For making the distribution. MailDB maintainers only. It won't work
--- 1,17 ----
# -*- makefile -*-
#
! # Copyright (c) 2002 MailDB Team
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
! # $Id: Makefile.am,v 1.2 2002/10/30 13:29:04 jsquyres Exp $
#
SUBDIRS = dist libmaildb
! EXTRA_DIST = AUTHORS LICENSE README
#
# For making the distribution. MailDB maintainers only. It won't work
1.2 +2 -2 maildb/acinclude.m4
Index: acinclude.m4
===================================================================
RCS file: /cvsroot/maildb/maildb/acinclude.m4,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** acinclude.m4 30 Oct 2002 12:31:00 -0000 1.1
--- acinclude.m4 30 Oct 2002 13:29:04 -0000 1.2
***************
*** 1,12 ****
# -*- makefile -*-
#
! # Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
! # $Id: acinclude.m4,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
sinclude(dist/maildb_functions.m4)
--- 1,12 ----
# -*- makefile -*-
#
! # Copyright (c) 2002 MailDB Team
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
! # $Id: acinclude.m4,v 1.2 2002/10/30 13:29:04 jsquyres Exp $
#
sinclude(dist/maildb_functions.m4)
1.2 +2 -2 maildb/autogen.sh
Index: autogen.sh
===================================================================
RCS file: /cvsroot/maildb/maildb/autogen.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** autogen.sh 30 Oct 2002 12:31:00 -0000 1.1
--- autogen.sh 30 Oct 2002 13:29:04 -0000 1.2
***************
*** 1,8 ****
#! /bin/sh
#
! # $Id: autogen.sh,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
! # Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
--- 1,8 ----
#! /bin/sh
#
! # $Id: autogen.sh,v 1.2 2002/10/30 13:29:04 jsquyres Exp $
#
! # Copyright (c) 2002 MailDB Team
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
1.2 +3 -3 maildb/configure.in
Index: configure.in
===================================================================
RCS file: /cvsroot/maildb/maildb/configure.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** configure.in 30 Oct 2002 12:31:00 -0000 1.1
--- configure.in 30 Oct 2002 13:29:04 -0000 1.2
***************
*** 1,12 ****
# -*- shell-script -*-
#
! # Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
! # $Id: configure.in,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
############################################################################
--- 1,12 ----
# -*- shell-script -*-
#
! # Copyright (c) 2002 MailDB Team
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
! # $Id: configure.in,v 1.2 2002/10/30 13:29:04 jsquyres Exp $
#
############################################################################
***************
*** 69,75 ****
AH_TOP([/* -*- c -*-
*
! * Copyright (c) 2002 Jeff Squyres
*
* This file is part of the MailDB software package. For license
* information, see the LICENSE file in the top level directory of the
--- 69,75 ----
AH_TOP([/* -*- c -*-
*
! * Copyright (c) 2002 MailDB Team
*
* This file is part of the MailDB software package. For license
* information, see the LICENSE file in the top level directory of the
1.1 maildb/AUTHORS
Index: AUTHORS
===================================================================
Copyright (c) 2002 MailDB Team
This file is part of the MailDB software package. For license
information, see the LICENSE file in the top level directory of the
MailDB source distribution.
$Id: AUTHORS,v 1.1 2002/10/30 13:29:04 jsquyres Exp $
The developers in the MailDB project (referred to as "MailDB Team" in
all copyright notices) are:
Jeff Squyres
Liza Weissler
1.1 maildb/README
Index: README
===================================================================
Copyright (c) 2002 MailDB Team
This file is part of the MailDB software package. For license
information, see the LICENSE file in the top level directory of the
MailDB source distribution.
Blah.
To be filled in.
|
|
From: Jeff S. <jsq...@us...> - 2002-10-30 12:31:02
|
jsquyres 02/10/30 04:31:01 Added: libmaildb/common .cvsignore Makefile.am Log: First take of skeleton structure for maildb Revision Changes Path 1.1 maildb/libmaildb/common/.cvsignore Index: .cvsignore =================================================================== Makefile Makefile.in 1.1 maildb/libmaildb/common/Makefile.am Index: Makefile.am =================================================================== # -*- makefile -*- # # Copyright (c) 2002 Jeff Squyres # # This file is part of the MailDB software package. For license # information, see the LICENSE file in the top level directory of the # MailDB source distribution. # # $Id: Makefile.am,v 1.1 2002/10/30 12:31:00 jsquyres Exp $ # # Nobody here yet but us chickens... |
|
From: Jeff S. <jsq...@us...> - 2002-10-30 12:31:02
|
jsquyres 02/10/30 04:31:00
Added: dist .cvsignore Makefile.am VERSION get_maildb_version
maildb_functions.m4 maildb_get_version.m4
Log:
First take of skeleton structure for maildb
Revision Changes Path
1.1 maildb/dist/.cvsignore
Index: .cvsignore
===================================================================
Makefile
Makefile.in
config.guess
config.sub
install-sh
ltmain.sh
missing
mkinstalldirs
1.1 maildb/dist/Makefile.am
Index: Makefile.am
===================================================================
# -*- makefile -*-
#
# Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
# $Id: Makefile.am,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
EXTRA_DIST = \
get_maildb_version \
maildb_functions.m4 \
maildb_get_version.m4
1.1 maildb/dist/VERSION
Index: VERSION
===================================================================
major=0
minor=1
release=0
alpha=0
beta=1
cvs=1
1.1 maildb/dist/get_maildb_version
Index: get_maildb_version
===================================================================
#!/bin/sh
#
# Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
# $Id: get_maildb_version,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
# Since we do this in multiple places, it's worth putting in a
# separate shell script. Very primitive script to get the version
# number of LAM into a coherent variable. Can query for any of the
# individual parts of the version number, too.
#
srcfile="$1"
option="$2"
if test "$srcfile" = ""; then
option="--help"
else
LAM_MAJOR_VERSION="`cat $srcfile | grep major | cut -d= -f2`"
LAM_MINOR_VERSION="`cat $srcfile | grep minor | cut -d= -f2`"
LAM_RELEASE_VERSION="`cat $srcfile | grep release | cut -d= -f2`"
LAM_ALPHA_VERSION="`cat $srcfile | grep alpha | cut -d= -f2`"
LAM_BETA_VERSION="`cat $srcfile | grep beta | cut -d= -f2`"
LAM_CVS_VERSION="`cat $srcfile | grep cvs | cut -d= -f2`"
if test "$LAM_RELEASE_VERSION" != "0" -a "$LAM_RELEASE_VERSION" != ""; then
LAM_VERSION="$LAM_MAJOR_VERSION.$LAM_MINOR_VERSION.$LAM_RELEASE_VERSION"
else
LAM_VERSION="$LAM_MAJOR_VERSION.$LAM_MINOR_VERSION"
fi
if test "`expr $LAM_ALPHA_VERSION \> 0`" = "1"; then
LAM_VERSION="${LAM_VERSION}a$LAM_ALPHA_VERSION"
elif test "`expr $LAM_BETA_VERSION \> 0`" = "1"; then
LAM_VERSION="${LAM_VERSION}b$LAM_BETA_VERSION"
fi
if test "$LAM_CVS_VERSION" = "1"; then
LAM_VERSION="${LAM_VERSION}cvs"
elif test "`expr $LAM_CVS_VERSION \> 0`" = "1"; then
LAM_VERSION="${LAM_VERSION}cvs$LAM_CVS_VERSION"
fi
if test "$option" = ""; then
option="--full"
fi
fi
case "$option" in
--full|-v|--version)
echo $LAM_VERSION
;;
--major)
echo $LAM_MAJOR_VERSION
;;
--minor)
echo $LAM_MINOR_VERSION
;;
--release)
echo $LAM_RELEASE_VERSION
;;
--alpha)
echo $LAM_ALPHA_VERSION
;;
--beta)
echo $LAM_BETA_VERSION
;;
--cvs)
echo $LAM_CVS_VERSION
;;
-h|--help)
cat <<EOF
$0 <srcfile> [<option>]
<srcfile> - Text version file
<option> - One of:
--full - Full version number
--major - Major version number
--minor - Minor version number
--release - Release version number
--alpha - Alpha version number
--beta - Beta version nmumber
--cvs - CVS date stamp
--help - This message
EOF
esac
exit 0
1.1 maildb/dist/maildb_functions.m4
Index: maildb_functions.m4
===================================================================
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2002 Jeff Squyres
dnl
dnl This file is part of the MailDB software package. For license
dnl information, see the LICENSE file in the top level directory of the
dnl MailDB source distribution.
dnl
dnl $Id: maildb_functions.m4,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
dnl
AC_DEFUN(MAILDB_CONFIGURE_SETUP,[
# Some helper script functions. Unfortunately, we cannot use $1 kinds
# of arugments here because of the m4 substitution. So we have to set
# special variable names before invoking the function. :-\
maildb_show_title() {
cat <<EOF
============================================================================
== ${1}
============================================================================
EOF
}
maildb_show_subtitle() {
cat <<EOF
*** ${1}
EOF
}])
AC_DEFUN(MAILDB_BASIC_SETUP,[
#
# Make automake clean emacs ~ files for "make clean"
#
CLEANFILES="*~"
AC_SUBST(CLEANFILES)
#
# This is useful later
#
AC_CANONICAL_HOST
])
AC_DEFUN(MAILDB_LOG_MSG,[
# 1 is the message
# 2 is whether to put a prefix or not
if test -n "$2"; then
echo "configure:__oline__: $1" >&5
else
echo $1 >&5
fi])dnl
AC_DEFUN(MAILDB_LOG_FILE,[
# 1 is the filename
if test -n "$1" -a -f "$1"; then
cat $1 >&5
fi])dnl
AC_DEFUN(MAILDB_LOG_COMMAND,[
# 1 is the command
# 2 is actions to do if success
# 3 is actions to do if fail
echo "configure:__oline__: $1" >&5
$1 1>&5 2>&1
maildb_status=$?
MAILDB_LOG_MSG([\$? = $maildb_status], 1)
if test "$maildb_status" = "0"; then
unset maildb_status
$2
else
unset maildb_status
$3
fi])dnl
1.1 maildb/dist/maildb_get_version.m4
Index: maildb_get_version.m4
===================================================================
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2002 Jeff Squyres
dnl
dnl This file is part of the MailDB software package. For license
dnl information, see the LICENSE file in the top level directory of the
dnl MailDB source distribution.
dnl
dnl $Id: maildb_get_version.m4,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
dnl
define(MAILDB_GET_VERSION,[
gv_glv_dir="$1"
gv_ver_file="$2"
gv_prefix="$3"
# Find the get_maildb_version program
gv_prog="sh $gv_glv_dir/get_maildb_version $gv_ver_file"
dnl quote eval to suppress macro expansion with non-GNU m4
gv_run() {
[eval] ${gv_prefix}_${2}=`$gv_prog --${1}`
}
gv_run full VERSION
gv_run major MAJOR_VERSION
gv_run minor MINOR_VERSION
gv_run release RELEASE_VERSION
gv_run alpha ALPHA_VERSION
gv_run beta BETA_VERSION
gv_run cvs CVS_VERSION
# Clean up
unset gv_glv_dir gv_ver_file gv_prefix gv_prog gv_run
])
|
|
From: Jeff S. <jsq...@us...> - 2002-10-30 12:31:02
|
jsquyres 02/10/30 04:31:01 Added: libmaildb/db .cvsignore Makefile.am Log: First take of skeleton structure for maildb Revision Changes Path 1.1 maildb/libmaildb/db/.cvsignore Index: .cvsignore =================================================================== Makefile Makefile.in 1.1 maildb/libmaildb/db/Makefile.am Index: Makefile.am =================================================================== # -*- makefile -*- # # Copyright (c) 2002 Jeff Squyres # # This file is part of the MailDB software package. For license # information, see the LICENSE file in the top level directory of the # MailDB source distribution. # # $Id: Makefile.am,v 1.1 2002/10/30 12:31:01 jsquyres Exp $ # # Nobody here yet but us chickens... |
|
From: Jeff S. <jsq...@us...> - 2002-10-30 12:31:01
|
jsquyres 02/10/30 04:31:00
Added: . .cvsignore LICENSE Makefile.am acinclude.m4
autogen.sh configure.in
Log:
First take of skeleton structure for maildb
Revision Changes Path
1.1 maildb/.cvsignore
Index: .cvsignore
===================================================================
Makefile
Makefile.in
autom4te.cache
config.log
config.status
libtool
aclocal.m4
configure
1.1 maildb/LICENSE
Index: LICENSE
===================================================================
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
1.1 maildb/Makefile.am
Index: Makefile.am
===================================================================
# -*- makefile -*-
#
# Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
# $Id: Makefile.am,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
SUBDIRS = dist libmaildb
EXTRA_DIST = LICENSE README
#
# For making the distribution. MailDB maintainers only. It won't work
# for you. :-)
#
dist-hook:
csh -f dist/distscript.csh $(DESTDIR)$(distdir)
1.1 maildb/acinclude.m4
Index: acinclude.m4
===================================================================
# -*- makefile -*-
#
# Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
# $Id: acinclude.m4,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
sinclude(dist/maildb_functions.m4)
sinclude(dist/maildb_get_version.m4)
1.1 maildb/autogen.sh
Index: autogen.sh
===================================================================
#! /bin/sh
#
# $Id: autogen.sh,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
# Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
# This script is run on developer copies of MailDB -- *not*
# distribution tarballs.
#
# Some helper functions
#
#
# Subroutine to check for the existence of various standard GNU tools
#
test_for_existence() {
tfe_prog="$1"
tfe_foo="`$tfe_prog --version`"
if test "$?" != 0; then
cat <<EOF
You must have GNU autoconf, automake, and libtool installed to build
the developer's version of MailDB. You can obtain these packages
from ftp://ftp.gnu.org/gnu/.
EOF
# Stupid emacs: '
exit 1
fi
unset tfe_prog tfe_foo
}
#
# Subroutine to execite the standard GNU tools, and if they fail,
# print out a warning.
#
run_and_check() {
rac_progs="$*"
echo "$rac_progs"
eval $rac_progs
if test "$?" != 0; then
cat <<EOF
It seems that the execution of "$progs" has failed.
I am gonna abort. :-(
This may be caused by an older version of one of the required
packages. Please make sure you are using at least the following
versions:
GNU Autoconf 2.52
GNU Automake 1.5
GNU Libtool 1.4.2
EOF
exit 1
fi
unset rac_progs
}
#
# Subroutine to look for standard files in a number of common places
# (e.g., ./config.guess, config/config.guess, dist/config.guess), and
# delete it. If it's not found there, look for AC_CONFIG_AUX_DIR in
# the configure.in script and try there. If it's not there, oh well.
#
find_and_delete() {
fad_file="$1"
# Look for the file in "standard" places
if test -f $fad_file; then
rm -f $fad_file
elif test -d config/$fad_file; then
rm -f config/$fad_file
elif test -d dist/$fad_file; then
rm -f dist/$fad_file
else
# Didn't find it -- look for an AC_CONFIG_AUX_DIR line in
# configure.[in|ac]
if test -f configure.in; then
fad_cfile=configure.in
elif test -f configure.ac; then
fad_cfile=configure.ac
else
echo "--> Errr... there's no configure.in or configure.ac file!"
fi
if test -n "$fad_cfile"; then
auxdir="`grep AC_CONFIG_AUX_DIR $fad_cfile | cut -d\( -f 2 | cut -d\) -f 1`"
fi
if test -f "$auxdir/$fad_file"; then
rm -f "$auxdir/$fad_file"
fi
unset fad_cfile
fi
unset fad_file
}
#
# Subroutine to actually do the GNU tool setup in the proper order, etc.
#
run_gnu_tools() {
rgt_dir="$1"
rgt_cur_dir="`pwd`"
if test -d "$rgt_dir"; then
cd "$rgt_dir"
# See if the package doesn't want us to set it up
if test -f .maildb_no_gnu; then
cat <<EOF
*** Found .maildb_no_gnu file -- skipping GNU setup in:
*** `pwd`
EOF
elif test -f .maildb_ignore; then
cat <<EOF
*** Found .maildb_ignore file -- skipping entire tree:
*** `pwd`
EOF
elif test "$rgt_dir" != "." -a -x autogen.sh; then
cat <<EOF
*** Found custom autogen.sh file in:
*** `pwd`
EOF
./autogen.sh
else
cat <<EOF
*** Running GNU tools in directory:
*** `pwd`
EOF
# Sanity check to ensure that there's a configure.in or
# configure.ac file here
if test -f configure.in -o -f configure.ac; then
happy=1
else
echo "---> Err... there's no configure.in or configure.ac file in this directory"
echo "---> I'm confused, so I'm going to abort"
exit 1
fi
unset happy
# Find and delete the GNU helper script files
find_and_delete config.guess
find_and_delete config.sub
find_and_delete depcomp
find_and_delete install-sh
find_and_delete ltconfig
find_and_delete ltmain.sh
find_and_delete missing
find_and_delete mkinstalldirs
find_and_delete libtool
# Run the GNU tools
run_and_check aclocal
run_and_check autoheader
run_and_check autoconf
run_and_check libtoolize --automake --copy
run_and_check automake --foreign -a --copy --include-deps
fi
# Go back to the original directory
cd "$rgt_cur_dir"
fi
unset rgt_dir rgt_cur_dir
}
#
# Subroutine to run in just one directory
#
run_local() {
run_gnu_tools .
}
#
# Subroutine to run across the entire MailDB tree
#
run_global() {
# Run the config in the top-level directory
run_gnu_tools .
# Now run the config in every directory in share/ssi/*/* that has
# a configure.in or configure.ac script
for db in libmaildb/db/*; do
if test -d "$db"; then
if test -f "$db/configure.in" -o -f "$db/configure.ac"; then
run_gnu_tools "$db"
fi
fi
done
unset db
}
##########################################################################
# Main
##########################################################################
# Check the command line to see if we should run the whole shebang, or
# just in this current directory.
want_local=0
for arg in $*; do
case $arg in
-l) want_local=1 ;;
*) ;;
esac
done
# Are we in the right directory? We must be in the top-level MailDB
# directory.
if test "$want_local" = "0"; then
if test -f dist/VERSION -a -f configure.in ; then
bad=0
else
cat <<EOF
You must run this script from the top-level MailDB directory.
EOF
exit 1
fi
fi
test_for_existence autoconf
test_for_existence automake
test_for_existence libtool
# Now do the run
if test "$want_local" = "1"; then
run_local
else
run_global
fi
# All done
exit 0
1.1 maildb/configure.in
Index: configure.in
===================================================================
# -*- shell-script -*-
#
# Copyright (c) 2002 Jeff Squyres
#
# This file is part of the MailDB software package. For license
# information, see the LICENSE file in the top level directory of the
# MailDB source distribution.
#
# $Id: configure.in,v 1.1 2002/10/30 12:31:00 jsquyres Exp $
#
############################################################################
# Initialization, version number, and other random setup/init stuff
############################################################################
# Init autoconf
AC_INIT(./LICENSE)
AC_PREREQ(2.52)
AC_CONFIG_AUX_DIR(./dist)
# Get the version of MailDB that we are installing
MAILDB_GET_VERSION($srcdir/dist, $srcdir/dist/VERSION, MAILDB)
AC_DEFINE_UNQUOTED(MAILDB_MAJOR_VERSION, $MAILDB_MAJOR_VERSION,
[Major MAILDB version])
AC_DEFINE_UNQUOTED(MAILDB_MINOR_VERSION, $MAILDB_MINOR_VERSION,
[Minor MAILDB version])
AC_DEFINE_UNQUOTED(MAILDB_RELEASE_VERSION, $MAILDB_RELEASE_VERSION,
[Release MAILDB version])
AC_DEFINE_UNQUOTED(MAILDB_ALPHA_VERSION, $MAILDB_ALPHA_VERSION,
[Alpha MAILDB version])
AC_DEFINE_UNQUOTED(MAILDB_BETA_VERSION, $MAILDB_BETA_VERSION,
[Beta MAILDB version])
AC_DEFINE_UNQUOTED(MAILDB_CVS_VERSION, $MAILDB_CVS_VERSION,
[CVS MAILDB version])
AC_DEFINE_UNQUOTED(MAILDB_VERSION, "$MAILDB_VERSION",
[Overall MAILDB version number])
# Need to also AC_SUBST these for share/include/patchlevel.h and
# share/include/mpif.h
AC_SUBST(MAILDB_MAJOR_VERSION)
AC_SUBST(MAILDB_MINOR_VERSION)
AC_SUBST(MAILDB_RELEASE_VERSION)
AC_SUBST(MAILDB_ALPHA_VERSION)
AC_SUBST(MAILDB_BETA_VERSION)
AC_SUBST(MAILDB_CVS_VERSION)
AC_SUBST(MAILDB_VERSION)
#
# Start it up
#
MAILDB_CONFIGURE_SETUP
maildb_show_title "Configuring MailDB version $MAILDB_VERSION"
maildb_show_subtitle "Initialization, setup"
#
# Init automake
# The third argument to AM_INIT_AUTOMAKE surpresses the PACKAGE and
# VERSION macors
#
AM_INIT_AUTOMAKE(maildb, $MAILDB_VERSION, 'no')
# Setup the top of the share/include/maildb_config.h file
AH_TOP([/* -*- c -*-
*
* Copyright (c) 2002 Jeff Squyres
*
* This file is part of the MailDB software package. For license
* information, see the LICENSE file in the top level directory of the
* MailDB source distribution.
*
* Function: - OS, CPU and compiler dependent configuration
*/
#ifndef _MAILDB_CONFIG_H
#define _MAILDB_CONFIG_H
])
AH_BOTTOM([#endif /* _MAILDB_CONFIG_H */])
#
# This is useful later
#
MAILDB_BASIC_SETUP
############################################################################
# libtool magic
############################################################################
maildb_show_subtitle "GNU libtool setup"
AM_PROG_LIBTOOL
############################################################################
# Party on
############################################################################
maildb_show_subtitle "Final output"
AM_CONFIG_HEADER([libmaildb/common/maildb_config.h])
AC_CONFIG_FILES([
Makefile
dist/Makefile
libmaildb/Makefile
libmaildb/common/Makefile
libmaildb/db/Makefile
])
AC_OUTPUT
|
|
From: Jeff S. <jsq...@us...> - 2002-10-30 12:31:01
|
jsquyres 02/10/30 04:31:00 Added: libmaildb .cvsignore Makefile.am Log: First take of skeleton structure for maildb Revision Changes Path 1.1 maildb/libmaildb/.cvsignore Index: .cvsignore =================================================================== Makefile Makefile.in 1.1 maildb/libmaildb/Makefile.am Index: Makefile.am =================================================================== # -*- makefile -*- # # Copyright (c) 2002 Jeff Squyres # # This file is part of the MailDB software package. For license # information, see the LICENSE file in the top level directory of the # MailDB source distribution. # # $Id: Makefile.am,v 1.1 2002/10/30 12:31:00 jsquyres Exp $ # SUBDIRS = db common |
|
From: Jeff S. <jsq...@us...> - 2002-10-30 12:30:41
|
jsquyres 02/10/30 04:30:40 Added: libmaildb/db/mysql/doc design.html Log: Forgot to add this file Revision Changes Path 1.1 maildb/libmaildb/db/mysql/doc/design.html Index: design.html =================================================================== <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <!-- saved from url=(0189)http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1 --> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta content="MSHTML 5.50.4611.1300" name="GENERATOR"> <title>MailDB Design</title> </head> <body> <h1>MailDB Database Design</h1> <p><a href="#intro">Introduction</a><br> <a href="#tables">Table Descriptions</a><br> <a href="#issues">Open Questions/Issues</a><br> <a href="#details">Table Details</a><br> <a href="#storage">MySQL Storage Notes</a><br> </p> <p></p> <hr><a name="intro"></a> <h2>Introduction</h2> <p>This document describes the proposed design for the MailDB database. This design is a work-in-progress and is subject to change; outstanding questions/issues are listed below in <a href="http://aves.org:2095/liza+aves.org/neomail.pl?action=viewattachment&sessionid=avesorg-session-0.0982186974297328&message_id=fd02e2f221c24eb3770452d3143b0894&folder=INBOX&attachment_number=1#issues">Open Questions/Issues</a>. </p> <p>This initial design assumes use of MySQL as the backend RDBMS. The design is generally normalized, the notable exception being message header tags (left of the colon) in the individual header records (which are stored in the msg_hdrs table). In this case the benefits of normalizing the data seemed to be outweighed by the slight increase in complexity of queries. [Note: I'm a bit on the fence on this one...decision not final. :-) -- lyw] </p> <p>Table summary descriptions are provided in the following section. A detailed description of table columns, datatypes, and a brief description/use of columns is in <a href="#details">Table Details</a>, below. The full SQL for table creation may be found in accompanying file <a href="cr_maildb.sql">cr_maildb.sql</a>, and sample queries are provided in accompanying file <a href="queries.sql">queries.sql</a>. </p> <hr><a name="tables"></a> <h2>Table Descriptions</h2> <p>There are four basic categories of tables: data common to all messages, user meta data, message data, and logs. </p> <p> <table border="1"> <tbody> <tr> <th colspan="6">Common message data</th> </tr> <tr> <th>Table</th> <th>Description</th> <th>Primary key</th> <th>Add'l Indexes</th> <th>References</th> <th>Referenced by</th> </tr> <tr> <td valign="top">mime_types</td> <td valign="top">Normalized table of mime_type definitions.</td> <td valign="top">Mime type numeric identifier (mt_id)</td> <td valign="top">Mime type (mt_desc)</td> <td valign="top">n/a</td> <td valign="top">msg_attach</td> </tr> <tr> <th colspan="6">User meta data</th> </tr> <tr> <th>Table</th> <th>Description</th> <th>Primary key</th> <th>Add'l Indexes</th> <th>References</th> <th>Referenced by</th> </tr> <tr> <td valign="top">users</td> <td valign="top">Normalized table of MailDB users.</td> <td valign="top">User numeric identifier (u_id)</td> <td valign="top">User name (u_desc)</td> <td valign="top">n/a</td> <td valign="top">cats<br> views<br> msg_users</td> </tr> <tr> <td valign="top">cats</td> <td valign="top">Message categories (i.e. "folders") created by users, to which messages are assigned. Categories may be [multiply] nested, and messages may assigned to multiple categories.</td> <td valign="top">Category numeric identifier (ca_id)</td> <td valign="top">Category owner (ca_u_id)</td> <td valign="top">n/a</td> <td valign="top">msg_users</td> </tr> <tr> </tr> <tr> <td valign="top">views</td> <td valign="top">User views of messages...specifically, defined search criteria and the SQL required to execute the searches.</td> <td valign="top">View numeric identifier (vw_id)</td> <td valign="top">View owner (vw_u_id)</td> <td valign="top">users</td> <td valign="top">n/a</td> </tr> <tr> <th colspan="6">Message data</th> </tr> <tr> <th>Table</th> <th>Description</th> <th>Primary key</th> <th>Add'l Indexes</th> <th>References</th> <th>Referenced by</th> </tr> <tr> <td valign="top">msg_ids<br> </td> <td valign="top">Normalized table of message ids.<br> </td> <td valign="top">Numeric message record identifier (m_id)<br> </td> <td valign="top">Message id (m_msg_id)<br> </td> <td valign="top">n/a<br> </td> <td valign="top">msg_hdrs, msg_users, msg_attach, msg_log<br> </td> </tr> <tr> <td valign="top">msg_hdrs</td> <td valign="top">Message header information for a given message. Message header sort order is maintained. Multiple records will exist for each message, one per unique header line. </td> <td valign="top">Numeric message header record identifier (mh_id)</td> <td valign="top">Normalized message id (mh_m_id), header key (mh_key), header value (mh_value) [fulltext index]</td> <td valign="top">n/a</td> <td valign="top">msg_users</td> </tr> <tr> <td valign="top">msg_users</td> <td valign="top">Records describing user instances (category filing) of specific messages. Users may assign messages to one or more categories, thus multiple records may exist in the table for a given message & user. Includes references into msg_hdrs table for faster retrieval of message date, sender, subject for category "scans".</td> <td valign="top">Message instance numeric identifier (mu_id).</td> <td valign="top">Normalized message id (mu_m_id), user (mu_u_id), category (mu_ca_id)</td> <td valign="top">users, cats, msg_hdrs</td> <td valign="top">n/a</td> </tr> <tr> <td valign="top">msg_attach</td> <td valign="top">Attachments to a given message. Message "body" not in an attachment is treated within the database as attachment 0. Attachment sort order is maintained. Records include mime type, file encoding, multi-part separator data, flag for attachment storage (0 = internal, in the database; 1 = external, in the filesystem).</td> <td valign="top">Message attachment numeric identifier (ma_id).</td> <td valign="top">Normalized message id (ma_m_id), body (ma_body) [fulltext index]</td> <td valign="top">mime_types</td> <td valign="top">n/a</td> </tr> <tr> <th colspan="6">Logging</th> </tr> <tr> <th>Table</th> <th>Description</th> <th>Primary key</th> <th>Add'l Indexes</th> <th>References</th> <th>Referenced by</th> </tr> <tr> <td valign="top">obj_log</td> <td valign="top">History of actions on meta objects - namely, create, update, delete of users, categories, views, mime_types. To be maintained via trigger (to be defined).</td> <td valign="top">Numeric log record identifier (obj_id)</td> <td valign="top">Object type (obj_type), object identifier (obj_type_id), object description (obj_desc)</td> <td valign="top">n/a</td> <td valign="top">n/a</td> </tr> <tr> <td valign="top">msg_log</td> <td valign="top">History of message activity - user adds, deletes from categories. To be maintained via trigger (to be defined).</td> <td valign="top">Numeric log record identifier (msl_id).</td> <td valign="top">Normalized message id (msl_m_id), user (msl_u_id), category (msl_ca_id)</td> <td valign="top">n/a</td> <td valign="top">n/a</td> </tr> </tbody> </table> </p> <hr><a name="issues"></a> <h2>Open Questions/Issues</h2> <ol> <li>Design issues <ol type="a"> <li>Review all field sizing, especially msg_id and record identifiers. </li> <li>Should header info be normalized? Not done so above. </li> <li>Should users or mime_types be de-normalized? </li> <li>Size threshold for determining whether attachment is stored in the database or as external file? (Need to know here only for reasonable sizing of the ma_body field in msg_attach.) </li> </ol> </li> <li>MySQL specifics <ol type="a"> <li>Triggers for maintaining log (history) tables. <b>Update: No trigger or stored procedure support in MySQL. Estimate is that these items will be included in version 5.0. Current stable MySQL is 3.23.x and 4.x is now available.</b> </li> <li>Check MySQL behavior when auto_incremented column "rolls over". </li> <li>Review MySQL regex pattern matching. </li> <li>Note vanilla MySQL has no true foreign key constraints. You can define the foreign keys (foo integer references bar(foo)) but they aren't enforced. </li> </ol> </li> <li>Message questions <ol type="a"> <li>Multi-part separator data format? </li> <li>Which header line is used for message threading? Should it be included in msg_users table for quick category scanning? </li> </ol> </li> <li>Miscellaneous <ol type="a"> <li>Construct and test sample queries... </li> </ol> </li> </ol> <hr><a name="details"></a> <h2>Table Details</h2> <table border="1"> <tbody> <tr> <th>Table</th> <th>Column</th> <th>Datatype</th> <th>Primary Key</th> <th>Indexed</th> <th>Description</th> </tr> <tr> <td valign="top" rowspan="2">mime_types</td> <td>mt_id</td> <td>smallint unsigned not null auto_increment</td> <td>X</td> <td>X</td> <td>Unique identifier for mime_type record</td> </tr> <tr> <td>mt_desc</td> <td>varchar(127)</td> <td> </td> <td>X</td> <td>Message body/attachment MIME type</td> </tr> <tr> <td valign="top" rowspan="2">users</td> <td>u_id</td> <td>smallint unsigned not null auto_increment</td> <td>X</td> <td>X</td> <td>Unique identifier for user record</td> </tr> <tr> <td>u_desc</td> <td>varchar(127)</td> <td> </td> <td>X</td> <td>User description (login/reference name, e.g. 'weissler' or 'li...@av...'</td> </tr> <tr> <td valign="top" rowspan="4">cats</td> <td>ca_id</td> <td>mediumint unsigned not null auto_increment</td> <td>X</td> <td>X</td> <td>Unique identifier for category record</td> </tr> <tr> <td>ca_u_id</td> <td>smallint unsigned not null</td> <td> </td> <td>X</td> <td>User owning this category. References users(u_id).</td> </tr> <tr> <td>ca_desc</td> <td>varchar(127)</td> <td> </td> <td> </td> <td>Category name, e.g. "Inbox", "Deleted", "Cycling"...</td> </tr> <tr> <td>ca_parent</td> <td>mediumint unsigned</td> <td> </td> <td> </td> <td>"Parent" category, allowing nesting of categories. Top-level categories have null parents. References cats(ca_id).</td> </tr> <tr> <td valign="top" rowspan="4">views</td> <td>vw_id</td> <td>mediumint unsigned not null auto_increment</td> <td>X</td> <td>X</td> <td>Unique identifier for view record</td> </tr> <tr> <td>vw_desc</td> <td>varchar(127)</td> <td> </td> <td> </td> <td>View name, e.g. "Messages from Robert"</td> </tr> <tr> <td>vw_u_id</td> <td>smallint unsigned not null</td> <td> </td> <td>X</td> <td>User owning view. References users(u_id).</td> </tr> <tr> <td>vw_query</td> <td>text</td> <td> </td> <td> </td> <td>SQL required to retrieve messages meeting user's search criteria</td> </tr> <tr> <td valign="top" rowspan="2">msg_ids<br> </td> <td valign="top">m_id<br> </td> <td valign="top">mediumint unsigned not null auto_increment<br> </td> <td valign="top">X<br> </td> <td valign="top">X<br> </td> <td valign="top">Unique identifier for message id (using less storage than the string message_id's in messages)<br> </td> </tr> <tr> <td valign="top">m_msg_id<br> </td> <td valign="top">varchar(255)<br> </td> <td valign="top"><br> </td> <td valign="top">X<br> </td> <td valign="top">Message identifier (assigned by MTA)<br> </td> </tr> <tr> <td valign="top" rowspan="5">msg_hdrs</td> <td>mh_id</td> <td>mediumint unsigned not null auto_increment</td> <td>X</td> <td>X</td> <td>Unique identifier for message header record</td> </tr> <tr> <td>mh_m_id</td> <td>mediumint unsigned not null</td> <td> </td> <td>X</td> <td>Message identifier</td> </tr> <tr> <td>mh_key</td> <td>varchar(63)</td> <td> </td> <td>X</td> <td>Header tag - e.g. "To", "From", "Subject"...anything left of colon (:) on header line. </td> </tr> <tr> <td>mh_value</td> <td>varchar(255)</td> <td> </td> <td>X</td> <td>Header value - anything right of colon (:) on header line. Fulltext index.</td> </tr> <tr> <td>mh_sort_order</td> <td>smallint unsigned not null</td> <td> </td> <td> </td> <td>Header sequence number.</td> </tr> <tr> <td valign="top" rowspan="8">msg_users</td> <td>mu_id</td> <td>mediumint unsigned not null auto_increment</td> <td>X</td> <td>X</td> <td>Unique identifier for message instance record.</td> </tr> <tr> <td>mu_m_id</td> <td>mediumint unsigned not null</td> <td> </td> <td>X</td> <td>Message identifier.</td> </tr> <tr> <td>mu_u_id</td> <td>smallint unsigned not null</td> <td> </td> <td>X</td> <td>User owning a copy of the message.</td> </tr> <tr> <td>mu_ca_id</td> <td>mediumint unsigned not null</td> <td> </td> <td>X</td> <td>Category to which the user assigned the message.</td> </tr> <tr> <td>mu_date</td> <td>mediumint unsigned not null</td> <td> </td> <td> </td> <td>Foreign key ref to corresponding "Date" header in msg_hdrs.</td> </tr> <tr> <td>mu_from</td> <td>mediumint unsigned not null</td> <td> </td> <td> </td> <td>Foreign key ref to corresponding "From" header in msg_hdrs.</td> </tr> <tr> <td>mu_subject</td> <td>mediumint unsigned not null</td> <td> </td> <td> </td> <td>Foreign key ref to corresponding "Subject" header in msg_hdrs.</td> </tr> <tr> <td>mu_flags</td> <td>tinyint unsigned</td> <td> </td> <td> </td> <td>Bit flags for the message.</td> </tr> <tr> <td valign="top" rowspan="9">msg_attach</td> <td>ma_id</td> <td>mediumint unsigned not null auto_increment</td> <td>X</td> <td>X</td> <td>Unique identifier for message attachment record.</td> </tr> <tr> <td>ma_m_id</td> <td>mediumint unsigned not null</td> <td> </td> <td>X</td> <td>Message identifier.</td> </tr> <tr> <td>ma_mt_id</td> <td>smallint unsigned not null</td> <td> </td> <td> </td> <td>Foreign key ref to mime_types(mt_id)</td> </tr> <tr> <td>ma_encode</td> <td>varchar(127)</td> <td> </td> <td> </td> <td>Attachment encoding</td> </tr> <tr> <td>ma_storage</td> <td>boolean</td> <td> </td> <td> </td> <td>Denotes whether attachment is stored within the database (0) or externally in the filesystem (1).</td> </tr> <tr> <td>ma_body</td> <td>mediumtext</td> <td> </td> <td>X</td> <td>Attachment body (for attachments stored within the database). Fulltext index.</td> </tr> <tr> <td>ma_path</td> <td>varchar(255)</td> <td> </td> <td> </td> <td>Full pathname to attachment (for attachments stored in the filesystem).</td> </tr> <tr> <td>ma_sep_data</td> <td>varchar(255)</td> <td> </td> <td> </td> <td>Multi-part separator data.</td> </tr> <tr> <td>ma_sort_order</td> <td>tinyint unsigned not null</td> <td> </td> <td> </td> <td>Attachment sequence number.</td> </tr> <tr> <td valign="top" rowspan="6">obj_log</td> <td>obj_id</td> <td>int unsigned not null auto_increment</td> <td>X</td> <td>X</td> <td>Unique identifier for object log record.</td> </tr> <tr> <td>obj_type</td> <td>varchar(15)</td> <td> </td> <td>X</td> <td>Type of object - e.g. user, view, cat, mime_type</td> </tr> <tr> <td>obj_type_id</td> <td>mediumint unsigned not null</td> <td> </td> <td>X</td> <td>Object identifier; if obj_type = user, obj_type_id corresponds to users(u_id), obj_type = cat, obj_type_id corresponds to cats(ca_id), etc.</td> </tr> <tr> <td>obj_desc</td> <td>varchar(127)</td> <td> </td> <td>X</td> <td>Object description (username, viewname, category name...)</td> </tr> <tr> <td>obj_action</td> <td>char(1)</td> <td> </td> <td> </td> <td>Action taken on this object. Values include C (create), U (update), D (delete).</td> </tr> <tr> <td>obj_datetime</td> <td>timestamp(14)</td> <td> </td> <td> </td> <td>Timestamp of object action.</td> </tr> <tr> <td valign="top" rowspan="6">msg_log</td> <td>msl_id</td> <td>int unsigned not null auto_increment</td> <td>X</td> <td>X</td> <td>Unique identifier for message log record.</td> </tr> <tr> <td>msl_m_id</td> <td>mediumint unsigned not null</td> <td> </td> <td>X</td> <td>Message identifier.</td> </tr> <tr> <td>msl_u_id</td> <td>smallint unsigned not null</td> <td> </td> <td>X</td> <td>User owning instance of the specified message.</td> </tr> <tr> <td>msl_ca_id</td> <td>mediumint unsigned not null</td> <td> </td> <td>X</td> <td>Category to which the user assigned the message.</td> </tr> <tr> <td>msl_action</td> <td>char(1)</td> <td> </td> <td>X</td> <td>Action taken on this message. Values include C (create), U (update), D (delete).</td> </tr> <tr> <td>msl_datetime</td> <td>timestamp(14)</td> <td> </td> <td> </td> <td>Timestamp of message action.</td> </tr> </tbody> </table> <p></p> <hr><a name="storage"></a> <h2>MySQL Storage Notes</h2> <p> <table border="1"> <tbody> <tr> <th>Datatype</th> <th>Max</th> <th>Storage</th> </tr> <tr> <td>varchar</td> <td>255</td> <td>L+1</td> </tr> <tr> <td>tinytext</td> <td>255</td> <td>L+1</td> </tr> <tr> <td>text</td> <td>64k</td> <td>L+2</td> </tr> <tr> <td>mediumtext</td> <td>16m</td> <td>L+3</td> </tr> <tr> <td>longtext</td> <td>4g</td> <td>L+4</td> </tr> <tr> <td>tinyint (U)</td> <td>255</td> <td>1</td> </tr> <tr> <td>smallint (U)</td> <td>65535</td> <td>2</td> </tr> <tr> <td>mediumint (U)</td> <td>16777215</td> <td>3</td> </tr> <tr> <td>int (U)</td> <td>4294967295</td> <td>4</td> </tr> <tr> <td>timestamp</td> <td>YYYYMMDDHHMISS</td> <td>4</td> </tr> </tbody> </table> </p> <p>...where (U) = unsigned, and L = length of text string. </p> <p></p> <hr><i>Last update: 17 October 2002 by <a href="mailto:li...@av...">Liza Weissler</a></i><a href="mailto:li...@av..."> </a><br> </body> </html> |
|
From: Jeff S. <jsq...@us...> - 2002-10-30 02:51:46
|
jsquyres 02/10/29 18:51:46
Added: libmaildb/db/mysql/doc README cr_db.sql cr_maildb.sql
message.sql mime.sql queries.sql test.sql users.sql
Log:
First CVS version of mysql stuff for mysql maildb schema
Revision Changes Path
1.1 maildb/libmaildb/db/mysql/doc/README
Index: README
===================================================================
1) If new database, make sure you have a password set for root, and disallow
local access without a password. This should do it...
% mysql mysql
> delete from user where host='localhost' and user='';
> quit
% mysqladmin -u root reload
% mysqladmin -u root password <new-password>
% myqladmin -u root -p reload
2) Create maildb database
% mysql -u root -p mysql < cr_db.sql /* provide root pw */
% mysql -u maildb -p maildb < cr_maildb.sql /* provide maildb pw */
3) Populate with some sample data
% mysql -u maildb -p maildb
> source mime.sql
> source users.sql
> source message.sql
1.1 maildb/libmaildb/db/mysql/doc/cr_db.sql
Index: cr_db.sql
===================================================================
-- MailDB database creation
-- 10/18/2002 lyw
-- run this as:
-- mysql --user root -p mysql < cr_db.sql
-- then:
-- mysql --user=maildb -p maildb < cr_maildb.sql
drop database if exists maildb;
create database maildb;
grant all privileges on maildb.* to maildb identified by 'maildb';
1.1 maildb/libmaildb/db/mysql/doc/cr_maildb.sql
Index: cr_maildb.sql
===================================================================
-- maildb tables
-- common message data:
-- hdrs, mime_types
-- user data:
-- users, cats, views
-- message data:
-- msg_ids, msg_hdrs, msg_users, msg_attach
-- logs:
-- obj_log, msg_log
-- -------------------------
-- Common Message Data
-- -------------------------
-- hdrs
-- -> deleted 10/10/2002 in favor of de-normalizing
-- drop table if exists hdrs;
-- create table hdrs (
-- h_id smallint unsigned not null auto_increment,
-- h_desc varchar(20),
-- primary key (h_id)
-- );
-- mime_types
drop table if exists mime_types;
create table mime_types (
mt_id smallint unsigned not null auto_increment,
mt_desc varchar(127),
primary key (mt_id),
index mt_desc_idx (mt_desc)
);
-- -------------------------
-- User Data
-- -------------------------
-- users
drop table if exists users;
create table users (
u_id smallint unsigned not null auto_increment,
u_desc varchar(127),
primary key (u_id),
index u_desc_idx (u_desc)
);
-- cats
drop table if exists cats;
create table cats (
ca_id mediumint unsigned not null auto_increment,
ca_u_id smallint unsigned not null references users(u_id),
ca_desc varchar(127),
ca_parent mediumint unsigned references cats(ca_id),
primary key (ca_id),
index ca_u_id_idx (ca_u_id)
);
-- views
drop table if exists views;
create table views (
vw_id mediumint unsigned not null auto_increment,
vw_desc varchar(127),
vw_u_id smallint unsigned not null references users(u_id),
vw_query text,
primary key (vw_id),
index vw_u_id_idx (vw_u_id)
);
-- -------------------------
-- Message Data
-- -------------------------
-- msg_ids
drop table if exists msg_ids;
create table msg_ids (
m_id mediumint unsigned not null auto_increment,
m_msg_id varchar(255) not null,
primary key (m_id),
index m_msg_id_idx (m_msg_id)
);
-- msg_hdrs
drop table if exists msg_hdrs;
create table msg_hdrs (
mh_id mediumint unsigned not null auto_increment,
mh_m_id mediumint unsigned not null references msg_ids(m_id),
mh_key varchar(63) not null,
mh_value varchar(255),
mh_sort_order smallint unsigned,
primary key (mh_id),
index mh_m_id_idx (mh_m_id),
index mh_key_idx (mh_key),
fulltext index mh_value_idx (mh_value)
);
-- msg_users
drop table if exists msg_users;
create table msg_users (
mu_id mediumint unsigned not null auto_increment,
mu_m_id mediumint unsigned not null not null references msg_ids(m_id),
mu_u_id smallint unsigned not null references users(u_id),
mu_ca_id mediumint unsigned not null references cats(ca_id),
mu_date mediumint unsigned not null references msg_hdrs(mh_id),
mu_from mediumint unsigned not null references msg_hdrs(mh_id),
mu_subject mediumint unsigned not null references msg_hdrs(mh_id),
mu_flags tinyint,
primary key (mu_id),
index mu_m_id_idx (mu_m_id),
index mu_u_id_idx (mu_u_id),
index mu_ca_id_idx (mu_ca_id)
);
-- msg_attach
drop table if exists msg_attach;
create table msg_attach (
ma_id mediumint unsigned not null auto_increment,
ma_m_id mediumint unsigned not null not null references msg_ids(m_id),
ma_mt_id smallint unsigned not null references mime_types(mt_id),
ma_encode varchar(127),
ma_storage bool,
ma_body mediumtext,
ma_path varchar(255),
ma_sep_data varchar(255),
ma_sort_order smallint unsigned,
primary key (ma_id),
index ma_m_id_idx (ma_m_id),
fulltext index ma_body_idx (ma_body)
);
-- -------------------------
-- Logs
-- -------------------------
drop table if exists obj_log;
create table obj_log (
obj_id mediumint unsigned not null auto_increment,
obj_type varchar(15),
obj_type_id mediumint unsigned not null,
obj_desc varchar(127),
obj_action char(1),
obj_datetime timestamp,
primary key (obj_id),
index obj_type_idx (obj_type),
index obj_type_id_idx (obj_type_id),
index obj_desc_idx (obj_desc)
);
drop table if exists msg_log;
create table msg_log (
msl_id mediumint unsigned not null auto_increment,
msl_m_id mediumint unsigned not null,
msl_u_id mediumint unsigned not null,
msl_ca_id mediumint unsigned not null,
msl_action char(1),
msl_datetime timestamp,
primary key (msl_id),
index msl_m_id_idx (msl_m_id),
index msl_u_id_idx (msl_u_id),
index msl_ca_id_idx (msl_ca_id)
);
1.1 maildb/libmaildb/db/mysql/doc/message.sql
Index: message.sql
===================================================================
delete from msg_ids where m_id < 10;
delete from msg_hdrs where mh_id < 100;
delete from msg_attach where ma_id < 100;
insert into msg_ids values (NULL, '<001801c27523$aa5d46a0$af270444@CX434770b>');
insert into msg_hdrs values (NULL, 1,
'From', 'lyu...@co... Wed Oct 16 10:53:33 2002', 0);
insert into msg_hdrs values (NULL, 1,
'Return-path', '<lyu...@co...>', 1);
insert into msg_hdrs values (NULL, 1,
'Envelope-to', 'li...@av...', 2);
insert into msg_hdrs values (NULL, 1,
'Delivery-date', 'Wed, 16 Oct 2002 10:53:33 -0400', 3);
insert into msg_hdrs values (NULL, 1,
'Received', 'from fed1mtao02.cox.net ([68.6.19.243])
by server627.peel3.com with esmtp (Exim 3.36 #1)
id 181pYD-0007jN-00
for li...@av...; Wed, 16 Oct 2002 10:53:33 -0400', 4);
insert into msg_hdrs values (NULL, 1,
'Received', 'from CX434770b ([68.4.39.175]) by fed1mtao02.cox.net
(InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with SMTP
id <20021016145235.TLKB25985.fed1mtao02.cox.net@CX434770b>
for <li...@av...>; Wed, 16 Oct 2002 10:52:35 -0400', 5);
insert into msg_hdrs values (NULL, 1,
'Message-ID', 1, 6);
insert into msg_hdrs values (NULL, 1,
'From', '"Luci Ursich" <lyu...@co...>', 7);
insert into msg_hdrs values (NULL, 1,
'To', '"Liza Weissler" <li...@av...>', 8);
insert into msg_hdrs values (NULL, 1,
'Subject', 'estee lauder', 9);
insert into msg_hdrs values (NULL, 1,
'Date', 'Wed, 16 Oct 2002 07:52:36 -0700', 10);
insert into msg_hdrs values (NULL, 1,
'MIME-Version', '1.0', 11);
insert into msg_hdrs values (NULL, 1,
'Content-Type', 'multipart/alternative;
boundary="----=_NextPart_000_0015_01C274E8.FDE8EAD0"', 12);
insert into msg_hdrs values (NULL, 1,
'X-Priority', '3', 13);
insert into msg_hdrs values (NULL, 1,
'X-MSMail-Priority', 'Normal', 14);
insert into msg_hdrs values (NULL, 1,
'X-Mailer', 'Microsoft Outlook Express 6.00.2720.3000', 15);
insert into msg_hdrs values (NULL, 1,
'X-MimeOLE', 'Produced By Microsoft MimeOLE V6.00.2600.0000', 16);
insert into msg_hdrs values (NULL, 1,
'Status', 'R', 17);
insert into msg_attach values (NULL,
1,
1,
'',
0,
'The blush is called Blush All Day, Natural Cheek Color..I have one that\nis 04 Pink Cloud and one that is 01 Potpourri..one is older than the\nother and I remember a discontinued color... both are like an orangey\npink...a salmon type color...I don''t want pink, pink... it is a blue\nrectangular case about 1 3/4 inches by 3.5 inches...powder with a brush.\n\nThere is also tube of stuff call Spotlight Skin Tone Perfecter... I like\nthat...\nL',
'',
'',
0);
insert into msg_users values (NULL, 1, 1, 1, 10, 7, 9, NULL);
1.1 maildb/libmaildb/db/mysql/doc/mime.sql
Index: mime.sql
===================================================================
insert into mime_types values (NULL, 'text/plain');
insert into mime_types values (NULL, 'text/richtext');
insert into mime_types values (NULL, 'text/enriched');
insert into mime_types values (NULL, 'text/tab-separated-values');
insert into mime_types values (NULL, 'text/html');
insert into mime_types values (NULL, 'text/sgml');
insert into mime_types values (NULL, 'text/vnd.latex-z');
insert into mime_types values (NULL, 'text/vnd.fmi.flexstor');
insert into mime_types values (NULL, 'text/uri-list');
insert into mime_types values (NULL, 'text/vnd.abc');
insert into mime_types values (NULL, 'text/rfc822-headers');
insert into mime_types values (NULL, 'text/vnd.in3d.3dml');
insert into mime_types values (NULL, 'text/prs.lines.tag');
insert into mime_types values (NULL, 'text/vnd.in3d.spot');
insert into mime_types values (NULL, 'text/css');
insert into mime_types values (NULL, 'text/xml');
insert into mime_types values (NULL, 'text/xml-external-parsed-entity');
insert into mime_types values (NULL, 'text/rtf');
insert into mime_types values (NULL, 'text/directory');
insert into mime_types values (NULL, 'text/calendar');
insert into mime_types values (NULL, 'text/vnd.wap.wml');
insert into mime_types values (NULL, 'text/vnd.wap.wmlscript');
insert into mime_types values (NULL, 'text/vnd.motorola.reflex');
insert into mime_types values (NULL, 'text/vnd.fly');
insert into mime_types values (NULL, 'text/vnd.wap.sl');
insert into mime_types values (NULL, 'text/vnd.wap.si');
insert into mime_types values (NULL, 'text/t140');
insert into mime_types values (NULL, 'text/vnd.ms-mediapackage');
insert into mime_types values (NULL, 'text/vnd.IPTC.NewsML');
insert into mime_types values (NULL, 'text/vnd.IPTC.NITF');
insert into mime_types values (NULL, 'text/vnd.curl');
insert into mime_types values (NULL, 'text/vnd.DMClientScript');
insert into mime_types values (NULL, 'text/parityfec');
insert into mime_types values (NULL, 'multipart/mixed');
insert into mime_types values (NULL, 'multipart/alternative');
insert into mime_types values (NULL, 'multipart/digest');
insert into mime_types values (NULL, 'multipart/parallel');
insert into mime_types values (NULL, 'multipart/appledouble');
insert into mime_types values (NULL, 'multipart/header-set');
insert into mime_types values (NULL, 'multipart/form-data');
insert into mime_types values (NULL, 'multipart/related');
insert into mime_types values (NULL, 'multipart/report');
insert into mime_types values (NULL, 'multipart/voice-message');
insert into mime_types values (NULL, 'multipart/signed');
insert into mime_types values (NULL, 'multipart/encrypted');
insert into mime_types values (NULL, 'multipart/byteranges');
insert into mime_types values (NULL, 'message/rfc822');
insert into mime_types values (NULL, 'message/partial');
insert into mime_types values (NULL, 'message/external-body');
insert into mime_types values (NULL, 'message/news');
insert into mime_types values (NULL, 'message/http');
insert into mime_types values (NULL, 'message/delivery-status');
insert into mime_types values (NULL, 'message/disposition-notification');
insert into mime_types values (NULL, 'message/s-http');
insert into mime_types values (NULL, 'application/octet-stream');
insert into mime_types values (NULL, 'application/postscript');
insert into mime_types values (NULL, 'application/oda');
insert into mime_types values (NULL, 'application/atomicmail');
insert into mime_types values (NULL, 'application/andrew-inset');
insert into mime_types values (NULL, 'application/slate');
insert into mime_types values (NULL, 'application/wita');
insert into mime_types values (NULL, 'application/dec-dx');
insert into mime_types values (NULL, 'application/dca-rft');
insert into mime_types values (NULL, 'application/activemessage');
insert into mime_types values (NULL, 'application/rtf');
insert into mime_types values (NULL, 'application/applefile');
insert into mime_types values (NULL, 'application/mac-binhex40');
insert into mime_types values (NULL, 'application/news-message-id');
insert into mime_types values (NULL, 'application/news-transmission');
insert into mime_types values (NULL, 'application/wordperfect5.1');
insert into mime_types values (NULL, 'application/pdf');
insert into mime_types values (NULL, 'application/zip');
insert into mime_types values (NULL, 'application/macwriteii');
insert into mime_types values (NULL, 'application/msword');
insert into mime_types values (NULL, 'application/remote-printing');
insert into mime_types values (NULL, 'application/mathematica');
insert into mime_types values (NULL, 'application/cybercash');
insert into mime_types values (NULL, 'application/commonground');
insert into mime_types values (NULL, 'application/iges');
insert into mime_types values (NULL, 'application/riscos');
insert into mime_types values (NULL, 'application/eshop');
insert into mime_types values (NULL, 'application/x400-bp');
insert into mime_types values (NULL, 'application/sgml');
insert into mime_types values (NULL, 'application/cals-1840');
insert into mime_types values (NULL, 'application/pgp-encrypted');
insert into mime_types values (NULL, 'application/pgp-signature');
insert into mime_types values (NULL, 'application/pgp-keys');
insert into mime_types values (NULL, 'application/vnd.framemaker');
insert into mime_types values (NULL, 'application/vnd.mif');
insert into mime_types values (NULL, 'application/vnd.ms-excel');
insert into mime_types values (NULL, 'application/vnd.ms-powerpoint');
insert into mime_types values (NULL, 'application/vnd.ms-project');
insert into mime_types values (NULL, 'application/vnd.ms-works');
insert into mime_types values (NULL, 'application/vnd.ms-tnef');
insert into mime_types values (NULL, 'application/vnd.svd');
insert into mime_types values (NULL, 'application/vnd.music-niff');
insert into mime_types values (NULL, 'application/vnd.ms-artgalry');
insert into mime_types values (NULL, 'application/vnd.truedoc');
insert into mime_types values (NULL, 'application/vnd.koan');
insert into mime_types values (NULL, 'application/vnd.street-stream');
insert into mime_types values (NULL, 'application/vnd.fdf');
insert into mime_types values (NULL, 'application/set-payment-initiation');
insert into mime_types values (NULL, 'application/set-payment');
insert into mime_types values (NULL, 'application/set-registration-initiation');
insert into mime_types values (NULL, 'application/set-registration');
insert into mime_types values (NULL, 'application/vnd.seemail');
insert into mime_types values (NULL, 'application/vnd.businessobjects');
insert into mime_types values (NULL, 'application/vnd.meridian-slingshot');
insert into mime_types values (NULL, 'application/vnd.xara');
insert into mime_types values (NULL, 'application/sgml-open-catalog');
insert into mime_types values (NULL, 'application/vnd.rapid');
insert into mime_types values (NULL, 'application/vnd.enliven');
insert into mime_types values (NULL, 'application/vnd.japannet-registration-wakeup');
insert into mime_types values (NULL, 'application/vnd.japannet-verification-wakeup');
insert into mime_types values (NULL, 'application/vnd.japannet-payment-wakeup');
insert into mime_types values (NULL, 'application/vnd.japannet-directory-service');
insert into mime_types values (NULL, 'application/vnd.intertrust.digibox');
insert into mime_types values (NULL, 'application/vnd.intertrust.nncp');
insert into mime_types values (NULL, 'application/prs.alvestrand.titrax-sheet');
insert into mime_types values (NULL, 'application/vnd.noblenet-web');
insert into mime_types values (NULL, 'application/vnd.noblenet-sealer');
insert into mime_types values (NULL, 'application/vnd.noblenet-directory');
insert into mime_types values (NULL, 'application/prs.nprend');
insert into mime_types values (NULL, 'application/vnd.webturbo');
insert into mime_types values (NULL, 'application/hyperstudio');
insert into mime_types values (NULL, 'application/vnd.shana.informed.formtemplate');
insert into mime_types values (NULL, 'application/vnd.shana.informed.formdata');
insert into mime_types values (NULL, 'application/vnd.shana.informed.package');
insert into mime_types values (NULL, 'application/vnd.shana.informed.interchange');
insert into mime_types values (NULL, 'application/vnd.$commerce_battelle');
insert into mime_types values (NULL, 'application/vnd.osa.netdeploy');
insert into mime_types values (NULL, 'application/vnd.ibm.MiniPay');
insert into mime_types values (NULL, 'application/vnd.japannet-jpnstore-wakeup');
insert into mime_types values (NULL, 'application/vnd.japannet-setstore-wakeup');
insert into mime_types values (NULL, 'application/vnd.japannet-verification');
insert into mime_types values (NULL, 'application/vnd.japannet-registration');
insert into mime_types values (NULL, 'application/vnd.hp-HPGL');
insert into mime_types values (NULL, 'application/vnd.hp-PCL');
insert into mime_types values (NULL, 'application/vnd.hp-PCLXL');
insert into mime_types values (NULL, 'application/vnd.musician');
insert into mime_types values (NULL, 'application/vnd.FloGraphIt');
insert into mime_types values (NULL, 'application/vnd.intercon.formnet');
insert into mime_types values (NULL, 'application/vemmi');
insert into mime_types values (NULL, 'application/vnd.ms-asf');
insert into mime_types values (NULL, 'application/vnd.ecdis-update');
insert into mime_types values (NULL, 'application/vnd.powerbuilder6');
insert into mime_types values (NULL, 'application/vnd.powerbuilder6-s');
insert into mime_types values (NULL, 'application/vnd.lotus-wordpro');
insert into mime_types values (NULL, 'application/vnd.lotus-approach');
insert into mime_types values (NULL, 'application/vnd.lotus-1-2-3');
insert into mime_types values (NULL, 'application/vnd.lotus-organizer');
insert into mime_types values (NULL, 'application/vnd.lotus-screencam');
insert into mime_types values (NULL, 'application/vnd.lotus-freelance');
insert into mime_types values (NULL, 'application/vnd.fujitsu.oasys');
insert into mime_types values (NULL, 'application/vnd.fujitsu.oasys2');
insert into mime_types values (NULL, 'application/vnd.swiftview-ics');
insert into mime_types values (NULL, 'application/vnd.dna');
insert into mime_types values (NULL, 'application/prs.cww');
insert into mime_types values (NULL, 'application/vnd.wt.stf');
insert into mime_types values (NULL, 'application/vnd.dxr');
insert into mime_types values (NULL, 'application/vnd.mitsubishi.misty-guard.trustweb');
insert into mime_types values (NULL, 'application/vnd.ibm.modcap');
insert into mime_types values (NULL, 'application/vnd.acucobol');
insert into mime_types values (NULL, 'application/vnd.fujitsu.oasys3');
insert into mime_types values (NULL, 'application/marc');
insert into mime_types values (NULL, 'application/vnd.fujitsu.oasysprs');
insert into mime_types values (NULL, 'application/vnd.fujitsu.oasysgp');
insert into mime_types values (NULL, 'application/vnd.visio');
insert into mime_types values (NULL, 'application/vnd.netfpx');
insert into mime_types values (NULL, 'application/vnd.audiograph');
insert into mime_types values (NULL, 'application/vnd.epson.salt');
insert into mime_types values (NULL, 'application/vnd.3M.Post-it-Notes');
insert into mime_types values (NULL, 'application/vnd.novadigm.EDX');
insert into mime_types values (NULL, 'application/vnd.novadigm.EXT');
insert into mime_types values (NULL, 'application/vnd.novadigm.EDM');
insert into mime_types values (NULL, 'application/vnd.claymore');
insert into mime_types values (NULL, 'application/vnd.comsocaller');
insert into mime_types values (NULL, 'application/pkcs7-mime');
insert into mime_types values (NULL, 'application/pkcs7-signature');
insert into mime_types values (NULL, 'application/pkcs10');
insert into mime_types values (NULL, 'application/vnd.yellowriver-custom-menu');
insert into mime_types values (NULL, 'application/vnd.ecowin.chart');
insert into mime_types values (NULL, 'application/vnd.ecowin.series');
insert into mime_types values (NULL, 'application/vnd.ecowin.filerequest');
insert into mime_types values (NULL, 'application/vnd.ecowin.fileupdate');
insert into mime_types values (NULL, 'application/vnd.ecowin.seriesrequest');
insert into mime_types values (NULL, 'application/vnd.ecowin.seriesupdate');
insert into mime_types values (NULL, 'application/EDIFACT');
insert into mime_types values (NULL, 'application/EDI-X12');
insert into mime_types values (NULL, 'application/EDI-Consent');
insert into mime_types values (NULL, 'application/vnd.wrq-hp3000-labelled');
insert into mime_types values (NULL, 'application/vnd.minisoft-hp3000-save');
insert into mime_types values (NULL, 'application/vnd.ffsns');
insert into mime_types values (NULL, 'application/vnd.hp-hps');
insert into mime_types values (NULL, 'application/vnd.fujixerox.docuworks');
insert into mime_types values (NULL, 'application/xml');
insert into mime_types values (NULL, 'application/xml-external-parsed-entity');
insert into mime_types values (NULL, 'application/xml-dtd');
insert into mime_types values (NULL, 'application/vnd.anser-web-funds-transfer-initiation');
insert into mime_types values (NULL, 'application/vnd.anser-web-certificate-issue-initiation');
insert into mime_types values (NULL, 'application/vnd.is-xpr');
insert into mime_types values (NULL, 'application/vnd.intu.qbo');
insert into mime_types values (NULL, 'application/vnd.publishare-delta-tree');
insert into mime_types values (NULL, 'application/vnd.cybank');
insert into mime_types values (NULL, 'application/batch-SMTP');
insert into mime_types values (NULL, 'application/vnd.uplanet.alert');
insert into mime_types values (NULL, 'application/vnd.uplanet.cacheop');
insert into mime_types values (NULL, 'application/vnd.uplanet.list');
insert into mime_types values (NULL, 'application/vnd.uplanet.listcmd');
insert into mime_types values (NULL, 'application/vnd.uplanet.channel');
insert into mime_types values (NULL, 'application/vnd.uplanet.bearer-choice');
insert into mime_types values (NULL, 'application/vnd.uplanet.signal');
insert into mime_types values (NULL, 'application/vnd.uplanet.alert-wbxml');
insert into mime_types values (NULL, 'application/vnd.uplanet.cacheop-wbxml');
insert into mime_types values (NULL, 'application/vnd.uplanet.list-wbxml');
insert into mime_types values (NULL, 'application/vnd.uplanet.listcmd-wbxml');
insert into mime_types values (NULL, 'application/vnd.uplanet.channel-wbxml');
insert into mime_types values (NULL, 'application/vnd.uplanet.bearer-choice-wbxml');
insert into mime_types values (NULL, 'application/vnd.epson.quickanime');
insert into mime_types values (NULL, 'application/vnd.commonspace');
insert into mime_types values (NULL, 'application/vnd.fut-misnet');
insert into mime_types values (NULL, 'application/vnd.xfdl');
insert into mime_types values (NULL, 'application/vnd.intu.qfx');
insert into mime_types values (NULL, 'application/vnd.epson.ssf');
insert into mime_types values (NULL, 'application/vnd.epson.msf');
insert into mime_types values (NULL, 'application/vnd.powerbuilder7');
insert into mime_types values (NULL, 'application/vnd.powerbuilder7-s');
insert into mime_types values (NULL, 'application/vnd.lotus-notes');
insert into mime_types values (NULL, 'application/pkixcmp');
insert into mime_types values (NULL, 'application/vnd.wap.wmlc');
insert into mime_types values (NULL, 'application/vnd.wap.wmlscriptc');
insert into mime_types values (NULL, 'application/vnd.motorola.flexsuite');
insert into mime_types values (NULL, 'application/vnd.wap.wbxml');
insert into mime_types values (NULL, 'application/vnd.motorola.flexsuite.wem');
insert into mime_types values (NULL, 'application/vnd.motorola.flexsuite.kmr');
insert into mime_types values (NULL, 'application/vnd.motorola.flexsuite.adsi');
insert into mime_types values (NULL, 'application/vnd.motorola.flexsuite.fis');
insert into mime_types values (NULL, 'application/vnd.motorola.flexsuite.gotap');
insert into mime_types values (NULL, 'application/vnd.motorola.flexsuite.ttc');
insert into mime_types values (NULL, 'application/vnd.ufdl');
insert into mime_types values (NULL, 'application/vnd.accpac.simply.imp');
insert into mime_types values (NULL, 'application/vnd.accpac.simply.aso');
insert into mime_types values (NULL, 'application/vnd.vcx');
insert into mime_types values (NULL, 'application/ipp');
insert into mime_types values (NULL, 'application/ocsp-request');
insert into mime_types values (NULL, 'application/ocsp-response');
insert into mime_types values (NULL, 'application/vnd.previewsystems.box');
insert into mime_types values (NULL, 'application/vnd.mediastation.cdkey');
insert into mime_types values (NULL, 'application/vnd.pg.format');
insert into mime_types values (NULL, 'application/vnd.pg.osasli');
insert into mime_types values (NULL, 'application/vnd.hp-hpid');
insert into mime_types values (NULL, 'application/pkix-cert');
insert into mime_types values (NULL, 'application/pkix-crl');
insert into mime_types values (NULL, 'application/vnd.Mobius.TXF');
insert into mime_types values (NULL, 'application/vnd.Mobius.PLC');
insert into mime_types values (NULL, 'application/vnd.Mobius.DIS');
insert into mime_types values (NULL, 'application/vnd.Mobius.DAF');
insert into mime_types values (NULL, 'application/vnd.Mobius.MSL');
insert into mime_types values (NULL, 'application/vnd.cups-raster');
insert into mime_types values (NULL, 'application/vnd.cups-postscript');
insert into mime_types values (NULL, 'application/vnd.cups-raw');
insert into mime_types values (NULL, 'application/index');
insert into mime_types values (NULL, 'application/index.cmd');
insert into mime_types values (NULL, 'application/index.response');
insert into mime_types values (NULL, 'application/index.obj');
insert into mime_types values (NULL, 'application/index.vnd');
insert into mime_types values (NULL, 'application/vnd.triscape.mxs');
insert into mime_types values (NULL, 'application/vnd.powerbuilder75');
insert into mime_types values (NULL, 'application/vnd.powerbuilder75-s');
insert into mime_types values (NULL, 'application/vnd.dpgraph');
insert into mime_types values (NULL, 'application/http');
insert into mime_types values (NULL, 'application/sdp');
insert into mime_types values (NULL, 'application/vnd.eudora.data');
insert into mime_types values (NULL, 'application/vnd.fujixerox.docuworks.binder');
insert into mime_types values (NULL, 'application/vnd.vectorworks');
insert into mime_types values (NULL, 'application/vnd.grafeq');
insert into mime_types values (NULL, 'application/vnd.bmi');
insert into mime_types values (NULL, 'application/vnd.ericsson.quickcall');
insert into mime_types values (NULL, 'application/vnd.hzn-3d-crossword');
insert into mime_types values (NULL, 'application/vnd.wap.slc');
insert into mime_types values (NULL, 'application/vnd.wap.sic');
insert into mime_types values (NULL, 'application/vnd.groove-injector');
insert into mime_types values (NULL, 'application/vnd.fujixerox.ddd');
insert into mime_types values (NULL, 'application/vnd.groove-account');
insert into mime_types values (NULL, 'application/vnd.groove-identity-message');
insert into mime_types values (NULL, 'application/vnd.groove-tool-message');
insert into mime_types values (NULL, 'application/vnd.groove-tool-template');
insert into mime_types values (NULL, 'application/vnd.groove-vcard');
insert into mime_types values (NULL, 'application/vnd.ctc-posml');
insert into mime_types values (NULL, 'application/vnd.canon-lips');
insert into mime_types values (NULL, 'application/vnd.canon-cpdl');
insert into mime_types values (NULL, 'application/vnd.trueapp');
insert into mime_types values (NULL, 'application/vnd.s3sms');
insert into mime_types values (NULL, 'application/iotp');
insert into mime_types values (NULL, 'application/vnd.mcd');
insert into mime_types values (NULL, 'application/vnd.httphone');
insert into mime_types values (NULL, 'application/vnd.informix-visionary');
insert into mime_types values (NULL, 'application/vnd.msign');
insert into mime_types values (NULL, 'application/vnd.ms-lrm');
insert into mime_types values (NULL, 'application/vnd.contact.cmsg');
insert into mime_types values (NULL, 'application/vnd.epson.esf');
insert into mime_types values (NULL, 'application/whoispp-query');
insert into mime_types values (NULL, 'application/whoispp-response');
insert into mime_types values (NULL, 'application/vnd.mozilla.xul+xml');
insert into mime_types values (NULL, 'application/parityfec');
insert into mime_types values (NULL, 'application/vnd.palm');
insert into mime_types values (NULL, 'application/vnd.fsc.weblaunch');
insert into mime_types values (NULL, 'application/vnd.tve-trigger');
insert into mime_types values (NULL, 'application/dvcs');
insert into mime_types values (NULL, 'application/sieve');
insert into mime_types values (NULL, 'application/vnd.vividence.scriptfile');
insert into mime_types values (NULL, 'application/vnd.hhe.lesson-player');
insert into mime_types values (NULL, 'application/beep+xml');
insert into mime_types values (NULL, 'application/font-tdpfr');
insert into mime_types values (NULL, 'application/vnd.mseq');
insert into mime_types values (NULL, 'application/vnd.aether.imp');
insert into mime_types values (NULL, 'application/vnd.Mobius.MQY');
insert into mime_types values (NULL, 'application/vnd.Mobius.MBK');
insert into mime_types values (NULL, 'application/vnd.vidsoft.vidconference');
insert into mime_types values (NULL, 'application/vnd.ibm.afplinedata');
insert into mime_types values (NULL, 'application/vnd.irepository.package+xml');
insert into mime_types values (NULL, 'application/vnd.sss-ntf');
insert into mime_types values (NULL, 'application/vnd.sss-dtf');
insert into mime_types values (NULL, 'application/vnd.sss-cod');
insert into mime_types values (NULL, 'application/vnd.pvi.ptid1');
insert into mime_types values (NULL, 'application/isup');
insert into mime_types values (NULL, 'application/qsig');
insert into mime_types values (NULL, 'application/timestamp-query');
insert into mime_types values (NULL, 'application/timestamp-reply');
insert into mime_types values (NULL, 'application/vnd.pwg-xhtml-print+xml');
insert into mime_types values (NULL, 'image/jpeg');
insert into mime_types values (NULL, 'image/gif');
insert into mime_types values (NULL, 'image/ief');
insert into mime_types values (NULL, 'image/g3fax');
insert into mime_types values (NULL, 'image/tiff');
insert into mime_types values (NULL, 'image/cgm');
insert into mime_types values (NULL, 'image/naplps');
insert into mime_types values (NULL, 'image/vnd.dwg');
insert into mime_types values (NULL, 'image/vnd.svf');
insert into mime_types values (NULL, 'image/vnd.dxf');
insert into mime_types values (NULL, 'image/png');
insert into mime_types values (NULL, 'image/vnd.fpx');
insert into mime_types values (NULL, 'image/vnd.net-fpx');
insert into mime_types values (NULL, 'image/vnd.xiff');
insert into mime_types values (NULL, 'image/prs.btif');
insert into mime_types values (NULL, 'image/vnd.fastbidsheet');
insert into mime_types values (NULL, 'image/vnd.wap.wbmp');
insert into mime_types values (NULL, 'image/prs.pti');
insert into mime_types values (NULL, 'image/vnd.cns.inf2');
insert into mime_types values (NULL, 'image/vnd.mix');
insert into mime_types values (NULL, 'image/vnd.fujixerox.edmics-rlc');
insert into mime_types values (NULL, 'image/vnd.fujixerox.edmics-mmr');
insert into mime_types values (NULL, 'image/vnd.fst');
insert into mime_types values (NULL, 'audio/basic');
insert into mime_types values (NULL, 'audio/32kadpcm');
insert into mime_types values (NULL, 'audio/vnd.qcelp');
insert into mime_types values (NULL, 'audio/vnd.digital-winds');
insert into mime_types values (NULL, 'audio/vnd.lucent.voice');
insert into mime_types values (NULL, 'audio/vnd.octel.sbc');
insert into mime_types values (NULL, 'audio/vnd.rhetorex.32kadpcm');
insert into mime_types values (NULL, 'audio/vnd.vmx.cvsd');
insert into mime_types values (NULL, 'audio/vnd.nortel.vbk');
insert into mime_types values (NULL, 'audio/vnd.cns.anp1');
insert into mime_types values (NULL, 'audio/vnd.cns.inf1');
insert into mime_types values (NULL, 'audio/L16');
insert into mime_types values (NULL, 'audio/vnd.everad.plj');
insert into mime_types values (NULL, 'audio/telephone-event');
insert into mime_types values (NULL, 'audio/tone');
insert into mime_types values (NULL, 'audio/prs.sid');
insert into mime_types values (NULL, 'audio/vnd.nuera.ecelp4800');
insert into mime_types values (NULL, 'audio/vnd.nuera.ecelp7470');
insert into mime_types values (NULL, 'audio/mpeg');
insert into mime_types values (NULL, 'audio/parityfec');
insert into mime_types values (NULL, 'audio/MP4A-LATM');
insert into mime_types values (NULL, 'audio/vnd.nuera.ecelp9600');
insert into mime_types values (NULL, 'audio/G.722.1');
insert into mime_types values (NULL, 'audio/mpa-robust');
insert into mime_types values (NULL, 'audio/vnd.cisco.nse');
insert into mime_types values (NULL, 'audio/DAT12');
insert into mime_types values (NULL, 'audio/L20');
insert into mime_types values (NULL, 'audio/L24');
insert into mime_types values (NULL, 'video/mpeg');
insert into mime_types values (NULL, 'video/quicktime');
insert into mime_types values (NULL, 'video/vnd.vivo');
insert into mime_types values (NULL, 'video/vnd.motorola.video');
insert into mime_types values (NULL, 'video/vnd.motorola.videop');
insert into mime_types values (NULL, 'video/vnd.fvt');
insert into mime_types values (NULL, 'video/pointer');
insert into mime_types values (NULL, 'video/parityfec');
insert into mime_types values (NULL, 'video/vnd.mpegurl');
insert into mime_types values (NULL, 'video/MP4V-ES');
insert into mime_types values (NULL, 'video/vnd.nokia.interleaved-multimedia');
insert into mime_types values (NULL, 'model/iges');
insert into mime_types values (NULL, 'model/vrml');
insert into mime_types values (NULL, 'model/mesh');
insert into mime_types values (NULL, 'model/vnd.dwf');
insert into mime_types values (NULL, 'model/vnd.gtw');
insert into mime_types values (NULL, 'model/vnd.flatland.3dml');
insert into mime_types values (NULL, 'model/vnd.vtu');
insert into mime_types values (NULL, 'model/vnd.mts');
insert into mime_types values (NULL, 'model/vnd.gdl');
insert into mime_types values (NULL, 'model/vnd.gs-gdl');
insert into mime_types values (NULL, 'model/vnd.parasolid.transmit.text');
insert into mime_types values (NULL, 'model/vnd.parasolid.transmit.binary');
1.1 maildb/libmaildb/db/mysql/doc/queries.sql
Index: queries.sql
===================================================================
-- -------------------------
-- Sample Queries
-- -------------------------
-- Category scan
SELECT mu_m_id, m_msg_id, a.mh_value as date, b.mh_value as hfrom,
c.mh_value as subject, mu_flags
FROM msg_users, msg_hdrs a, msg_hdrs b, msg_hdrs c, msg_ids
WHERE mu_u_id = :u_id
AND mu_ca_id = :ca_id
AND mu_date = a.mh_id
AND mu_from = b.mh_id
AND mu_subject = c.mh_id
ORDER BY a.mh_value
;
-- Construct a message
-- Note this is two separate queries...to get the headers
-- and attachments in the correct sort order. If the application
-- will parse out/sort the returned data we can get this all in one big
-- query.
SELECT mh_m_id, m_msg_id, mh_key, mh_value, mh_sort_order
FROM msg_hdrs, msg_ids
WHERE mh_m_id = m_id
AND m_id = :m_id
ORDER BY mh_sort_order
;
SELECT ma_m_id, m_msg_id, mt_desc, ma_encode, ma_body, ma_path,
ma_sep_data, ma_storage, ma_sort_order
FROM msg_attach, mime_types, msg_ids
WHERE ma_m_id = :m_id
AND m_id = ma_m_id
AND ma_mt_id = mt_id
ORDER BY ma_sort_order
;
-- Scan list of all messages from lyursich
-- Basically same as category scan except drop the mu_ca_id check
-- and add in check of mu_from.
SELECT mu_m_id, a.mh_value as date, b.mh_value as hfrom,
c.mh_value as subject, mu_flags
FROM msg_users, msg_hdrs a, msg_hdrs b, msg_hdrs c
WHERE mu_u_id = :u_id
AND mu_date = a.mh_id
AND mu_from = b.mh_id
AND mu_subject = c.mh_id
AND b.mh_value like '%lyursich%'
ORDER BY a.mh_value
;
-- Count messages in a category
SELECT count(*)
FROM cats
WHERE ca_u_id = :u_id
AND ca_id = :ca_id
;
1.1 maildb/libmaildb/db/mysql/doc/test.sql
Index: test.sql
===================================================================
-- -------------------------
-- Sample Queries
-- -------------------------
-- Category scan
SELECT mu_m_id, m_msg_id, a.mh_value as date, b.mh_value as hfrom,
c.mh_value as subject, mu_flags
FROM msg_users, msg_hdrs a, msg_hdrs b, msg_hdrs c, msg_ids
WHERE mu_u_id = 1
AND mu_ca_id = 1
AND mu_date = a.mh_id
AND mu_from = b.mh_id
AND mu_subject = c.mh_id
ORDER BY a.mh_value
;
-- Construct a message
SELECT mh_m_id, m_msg_id, mh_key, mh_value, mh_sort_order
FROM msg_hdrs, msg_ids
WHERE mh_m_id = m_id
AND m_id = 1
ORDER BY mh_sort_order
;
SELECT ma_m_id, m_msg_id, mt_desc, ma_encode, ma_body, ma_path,
ma_sep_data, ma_storage, ma_sort_order
FROM msg_attach, mime_types, msg_ids
WHERE ma_m_id = 1
AND m_id = ma_m_id
AND ma_mt_id = mt_id
ORDER BY ma_sort_order
;
-- Scan list of all messages from li...@av...
-- Basically same as category scan except drop the mu_ca_id check
-- and add in check of mu_from.
SELECT mu_m_id, a.mh_value as date, b.mh_value as hfrom,
c.mh_value as subject, mu_flags
FROM msg_users, msg_hdrs a, msg_hdrs b, msg_hdrs c
WHERE mu_u_id = 1
AND mu_date = a.mh_id
AND mu_from = b.mh_id
AND mu_subject = c.mh_id
AND b.mh_value like '%lyursich%'
ORDER BY a.mh_value
;
-- Count messages in a category
SELECT count(*)
FROM cats
WHERE ca_u_id = 1
AND ca_id = 1
;
1.1 maildb/libmaildb/db/mysql/doc/users.sql
Index: users.sql
===================================================================
insert into users values (NULL, 'Liza Weissler');
insert into cats values (NULL, 1, 'Inbox', NULL);
|