
diff -r 8c201fa3bdc7 -r 345ee7421989 lib/create_db.sql
--- a/lib/create_db.sql	Fri Sep 26 11:31:09 2003 -0400
+++ b/lib/create_db.sql	Fri Sep 26 18:18:33 2003 -0400
@@ -1,29 +1,39 @@
+--
+
+CREATE TABLE users (
+  id int NOT NULL,
+  name varchar(255) DEFAULT '' NOT NULL,
+  PRIMARY KEY (id)
+);
+
+CREATE INDEX index_users_name ON users(name);
+
 --
 -- Table structure for table 'bookmark'
 --
 CREATE TABLE bookmarks (
   id int NOT NULL,
+  userid int NOT NULL,
   url varchar(255) DEFAULT '' NOT NULL,
   name varchar(255) DEFAULT '' NOT NULL,
   ldesc varchar(255) DEFAULT '' NOT NULL,
   added date DEFAULT '1998-01-01' NOT NULL,
-  PRIMARY KEY (id)
+  PRIMARY KEY (id, userid)
 );
 
+CREATE INDEX index_bookmarks_userid ON bookmarks(userid);
+
 --
 -- Table structure for table 'keywords'
 --
 CREATE TABLE keywords (
   id int DEFAULT '0' NOT NULL,
+  userid int DEFAULT '0' NOT NULL,
   name varchar(30) DEFAULT '' NOT NULL,
-  PRIMARY KEY (id)
+  PRIMARY KEY (id, userid)
 );
 
---
--- Default nil keyword
---
-
-INSERT INTO keywords(id, name) VALUES (0, '--');
+CREATE INDEX index_keywords_name ON keywords(userid, name);
 
 --
 -- Cross reference table for linking keywords and bookmarks
@@ -32,19 +42,22 @@
 CREATE TABLE bookmarks_keywords (
   bookmark int NOT NULL,
   keyword int DEFAULT '0' NOT NULL,
-  PRIMARY KEY (bookmark, keyword)
+  userid int DEFAULT '0' NOT NULL,
+  PRIMARY KEY (bookmark, keyword, userid)
 );
 
-CREATE INDEX bkkw_kw_idx ON bookmarks_keywords (keyword);
+CREATE INDEX index_bkkw_kwuser ON bookmarks_keywords (keyword, userid);
+CREATE INDEX index_bkkw_user ON bookmarks_keywords (userid);
+CREATE INDEX index_bkkw_bkuser ON bookmarks_keywords (bookmark, userid);
 
 --
 -- Table structure for table 'db_sequence'
 --
 CREATE TABLE db_sequence (
   seq_name varchar(30)    DEFAULT '' NOT NULL,
+  userid int DEFAULT '0' NOT NULL,
   nextid int DEFAULT '0' NOT NULL,
-  PRIMARY KEY (seq_name)
+  PRIMARY KEY (seq_name, userid)
 );
 
-INSERT INTO db_sequence (seq_name, nextid) VALUES ('bookmarks', 0);
-INSERT INTO db_sequence (seq_name, nextid) VALUES ('keywords' , 1);
+INSERT INTO db_sequence (seq_name, userid, nextid) VALUES ('users' , -1, 0);




