Added some sample data to the schema file and other assorted additions and tweaks
This commit is contained in:
parent
89949042c3
commit
2a866fe3cd
1 changed files with 146 additions and 20 deletions
|
@ -1,11 +1,15 @@
|
|||
<schema version="1">
|
||||
BEGIN;
|
||||
<schema version="2">
|
||||
-- IF EXISTS not yet available in available mozStorage binaries,
|
||||
-- so we fake it with a bunch of try/catches in the _initializeSchema()
|
||||
|
||||
-- DROP TABLE IF EXISTS version;
|
||||
CREATE TABLE version (
|
||||
version INT PRIMARY KEY
|
||||
version INTEGER PRIMARY KEY
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS objects;
|
||||
CREATE TABLE objects (
|
||||
objectID INT PRIMARY KEY,
|
||||
objectID INTEGER PRIMARY KEY,
|
||||
objectTypeID INT,
|
||||
objectTitle TEXT,
|
||||
objectDate DATETIME,
|
||||
|
@ -13,24 +17,36 @@ BEGIN;
|
|||
objectDateModified DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
objectSource TEXT,
|
||||
objectRights TEXT,
|
||||
parentID INT,
|
||||
orderIndex INT
|
||||
folderID INT,
|
||||
orderIndex INT,
|
||||
FOREIGN KEY (folderID) REFERENCES folders(folderID)
|
||||
);
|
||||
CREATE INDEX parentID ON objects (parentID);
|
||||
CREATE INDEX folderID ON objects (folderID);
|
||||
|
||||
-- DROP TABLE IF EXISTS objectTypes;
|
||||
CREATE TABLE objectTypes (
|
||||
objectTypeID INT PRIMARY KEY,
|
||||
objectTypeID INTEGER PRIMARY KEY,
|
||||
typeName TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE fields (
|
||||
fieldID INT PRIMARY KEY,
|
||||
fieldName TEXT,
|
||||
regex TEXT
|
||||
-- DROP TABLE IF EXISTS fieldFormats;
|
||||
CREATE TABLE fieldFormats (
|
||||
fieldFormatID INTEGER PRIMARY KEY,
|
||||
regex TEXT,
|
||||
isInteger INT
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS fields;
|
||||
CREATE TABLE fields (
|
||||
fieldID INTEGER PRIMARY KEY,
|
||||
fieldName TEXT,
|
||||
fieldFormatID INT,
|
||||
FOREIGN KEY (fieldFormatID) REFERENCES fieldFormat(fieldFormatID)
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS objectTypeFields;
|
||||
CREATE TABLE objectTypeFields (
|
||||
objectTypeID,
|
||||
objectTypeID INT,
|
||||
fieldID INT,
|
||||
orderIndex INT,
|
||||
PRIMARY KEY (objectTypeID, fieldID),
|
||||
|
@ -38,6 +54,7 @@ BEGIN;
|
|||
FOREIGN KEY (fieldID) REFERENCES objectTypes(objectTypeID)
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS objectData;
|
||||
CREATE TABLE objectData (
|
||||
objectID INT,
|
||||
fieldID INT,
|
||||
|
@ -48,11 +65,13 @@ BEGIN;
|
|||
);
|
||||
CREATE INDEX value ON objectData (value);
|
||||
|
||||
-- DROP TABLE IF EXISTS keywords;
|
||||
CREATE TABLE keywords (
|
||||
keywordID INT PRIMARY KEY,
|
||||
keywordID INTEGER PRIMARY KEY,
|
||||
keyword TEXT
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS objectKeywords;
|
||||
CREATE TABLE objectKeywords (
|
||||
objectID INT,
|
||||
keywordID INT,
|
||||
|
@ -61,25 +80,132 @@ BEGIN;
|
|||
FOREIGN KEY (keywordID) REFERENCES keywords(keywordID)
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS creators;
|
||||
CREATE TABLE creators (
|
||||
creatorID INT PRIMARY KEY,
|
||||
creatorID INTEGER PRIMARY KEY,
|
||||
creatorTypeID INT,
|
||||
firstName TEXT,
|
||||
lastName TEXT
|
||||
lastName TEXT,
|
||||
FOREIGN KEY (creatorTypeID) REFERENCES creatorTypes(creatorTypeID)
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS creatorTypes;
|
||||
CREATE TABLE creatorTypes (
|
||||
creatorTypeID INT PRIMARY KEY,
|
||||
creatorTypeID INTEGER PRIMARY KEY,
|
||||
creatorType TEXT
|
||||
);
|
||||
|
||||
-- DROP TABLE IF EXISTS objectCreators;
|
||||
CREATE TABLE objectCreators (
|
||||
objectID INT,
|
||||
creatorID INT,
|
||||
creatorTypeID INT,
|
||||
orderIndex INT,
|
||||
orderIndex INT DEFAULT 1,
|
||||
PRIMARY KEY (objectID, creatorID),
|
||||
FOREIGN KEY (objectID) REFERENCES objects(objectID),
|
||||
FOREIGN KEY (creatorID) REFERENCES creators(creatorID)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
-- DROP TABLE IF EXISTS folders;
|
||||
CREATE TABLE folders (
|
||||
folderID INTEGER PRIMARY KEY,
|
||||
folderName TEXT,
|
||||
parentFolderID INT DEFAULT 0,
|
||||
orderIndex INT,
|
||||
FOREIGN KEY (parentFolderID) REFERENCES folders(folderID)
|
||||
);
|
||||
|
||||
|
||||
|
||||
-- Some sample data
|
||||
INSERT INTO objectTypes VALUES (1,'Book');
|
||||
INSERT INTO objectTypes VALUES (2,'Journal Article');
|
||||
|
||||
INSERT INTO "fieldFormats" VALUES(1, '.*', 0);
|
||||
INSERT INTO "fieldFormats" VALUES(2, '[0-9]*', 1);
|
||||
INSERT INTO "fieldFormats" VALUES(3, '[0-9]{4}', 1);
|
||||
|
||||
INSERT INTO fields VALUES (1,'Series',NULL);
|
||||
INSERT INTO fields VALUES (2,'Volume',NULL);
|
||||
INSERT INTO fields VALUES (3,'Number',NULL);
|
||||
INSERT INTO fields VALUES (4,'Edition',NULL);
|
||||
INSERT INTO fields VALUES (5,'Place',NULL);
|
||||
INSERT INTO fields VALUES (6,'Publisher',NULL);
|
||||
INSERT INTO fields VALUES (7,'Year',NULL);
|
||||
INSERT INTO fields VALUES (8,'Pages',NULL);
|
||||
INSERT INTO fields VALUES (9,'ISBN',NULL);
|
||||
INSERT INTO fields VALUES (10,'Publication',NULL);
|
||||
INSERT INTO fields VALUES (11,'ISSN',NULL);
|
||||
|
||||
INSERT INTO objectTypeFields VALUES (1,1,1);
|
||||
INSERT INTO objectTypeFields VALUES (1,2,2);
|
||||
INSERT INTO objectTypeFields VALUES (1,3,3);
|
||||
INSERT INTO objectTypeFields VALUES (1,4,4);
|
||||
INSERT INTO objectTypeFields VALUES (1,5,5);
|
||||
INSERT INTO objectTypeFields VALUES (1,6,6);
|
||||
INSERT INTO objectTypeFields VALUES (1,7,7);
|
||||
INSERT INTO objectTypeFields VALUES (1,8,8);
|
||||
INSERT INTO objectTypeFields VALUES (1,9,9);
|
||||
INSERT INTO objectTypeFields VALUES (2,10,1);
|
||||
INSERT INTO objectTypeFields VALUES (2,2,2);
|
||||
INSERT INTO objectTypeFields VALUES (2,3,3);
|
||||
INSERT INTO objectTypeFields VALUES (2,8,4);
|
||||
|
||||
INSERT INTO "objects" VALUES(1, 1, 'Online connections: Internet interpersonal relationships', NULL, '2006-03-12 05:24:40', '2006-03-12 05:24:40', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(2, 1, 'Computer-Mediated Communication: Human-to-Human Communication Across the Internet', NULL, '2006-03-12 05:25:50', '2006-03-12 05:25:50', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(3, 2, 'Residential propinquity as a factor in marriage selection', NULL, '2006-03-12 05:26:37', '2006-03-12 05:26:37', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(4, 1, 'Connecting: how we form social bonds and communities in the Internet age', NULL, '2006-03-12 05:27:15', '2006-03-12 05:27:15', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(5, 1, 'Male, Female, Email: The Struggle for Relatedness in a Paranoid Society', NULL, '2006-03-12 05:27:36', '2006-03-12 05:27:36', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(6, 2, 'Social Implications of Sociology', NULL, '2006-03-12 05:27:53', '2006-03-12 05:27:53', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(7, 1, 'Social Pressures in Informal Groups: A Study of Human Factors in Housing', NULL, '2006-03-12 05:28:05', '2006-03-12 05:28:05', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(8, 1, 'Cybersociety 2.0: Revisiting Computer-Mediated Community and Technology', NULL, '2006-03-12 05:28:37', '2006-03-12 05:28:37', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(9, 2, 'The Computer as a Communication Device', NULL, '2006-03-12 05:29:03', '2006-03-12 05:29:03', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(10, 2, 'What Does Research Say about the Nature of Computer-mediated Communication: Task-Oriented, Social-Emotion-Oriented, or Both?', NULL, '2006-03-12 05:29:12', '2006-03-12 05:29:12', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(11, 1, 'The second self: computers and the human spirit', NULL, '2006-03-12 05:30:38', '2006-03-12 05:30:38', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(12, 1, 'Life on the screen: identity in the age of the Internet', NULL, '2006-03-12 05:30:49', '2006-03-12 05:30:49', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(13, 2, 'The computer conference: An altered state of communication', NULL, '2006-03-12 05:31:00', '2006-03-12 05:31:00', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(14, 2, 'Computer Networks as Social Networks: Collaborative Work, Telework, and Community', NULL, '2006-03-12 05:31:17', '2006-03-12 05:31:17', NULL, NULL, NULL, NULL);
|
||||
INSERT INTO "objects" VALUES(15, 1, 'The Internet in everyday life', NULL, '2006-03-12 05:31:41', '2006-03-12 05:31:41', NULL, NULL, NULL, NULL);
|
||||
|
||||
INSERT INTO "objectData" VALUES(1, 7, 2001);
|
||||
INSERT INTO "objectData" VALUES(1, 5, 'Cresskill, N.J.');
|
||||
INSERT INTO "objectData" VALUES(1, 6, 'Hampton Press');
|
||||
INSERT INTO "objectData" VALUES(2, 7, 2002);
|
||||
INSERT INTO "objectData" VALUES(2, 6, 'Allyn & Bacon Publishers');
|
||||
INSERT INTO "objectData" VALUES(2, 8, 347);
|
||||
INSERT INTO "objectData" VALUES(2, 9, '0-205-32145-3');
|
||||
|
||||
INSERT INTO "creators" VALUES(1, NULL, 'Susan B.', 'Barnes');
|
||||
INSERT INTO "creators" VALUES(2, NULL, 'J.S.', 'Bassard');
|
||||
INSERT INTO "creators" VALUES(3, NULL, 'Mary', 'Chayko');
|
||||
INSERT INTO "creators" VALUES(4, NULL, 'Michael', 'Civin');
|
||||
INSERT INTO "creators" VALUES(5, NULL, 'Paul', 'DiMaggio');
|
||||
INSERT INTO "creators" VALUES(6, NULL, 'Leon', 'Festinger');
|
||||
INSERT INTO "creators" VALUES(7, NULL, 'Stanley', 'Schachter');
|
||||
INSERT INTO "creators" VALUES(8, NULL, 'Kurt', 'Back');
|
||||
INSERT INTO "creators" VALUES(9, NULL, 'Steven G.', 'Jones');
|
||||
INSERT INTO "creators" VALUES(10, NULL, 'J.C.R.', 'Licklider');
|
||||
INSERT INTO "creators" VALUES(11, NULL, 'Robert W.', 'Taylor');
|
||||
INSERT INTO "creators" VALUES(12, NULL, 'Yuliang', 'Lui');
|
||||
INSERT INTO "creators" VALUES(13, NULL, 'Sherry', 'Turkle');
|
||||
INSERT INTO "creators" VALUES(14, NULL, 'J.', 'Vallee');
|
||||
INSERT INTO "creators" VALUES(15, NULL, 'Barry', 'Wellman');
|
||||
|
||||
INSERT INTO "objectCreators" VALUES(1, 1, 1);
|
||||
INSERT INTO "objectCreators" VALUES(2, 1, 1);
|
||||
INSERT INTO "objectCreators" VALUES(3, 2, 1);
|
||||
INSERT INTO "objectCreators" VALUES(4, 3, 1);
|
||||
INSERT INTO "objectCreators" VALUES(5, 4, 1);
|
||||
INSERT INTO "objectCreators" VALUES(6, 5, 1);
|
||||
INSERT INTO "objectCreators" VALUES(7, 6, 1);
|
||||
INSERT INTO "objectCreators" VALUES(8, 9, 1);
|
||||
INSERT INTO "objectCreators" VALUES(9, 10, 1);
|
||||
INSERT INTO "objectCreators" VALUES(10, 12, 1);
|
||||
INSERT INTO "objectCreators" VALUES(11, 13, 1);
|
||||
INSERT INTO "objectCreators" VALUES(12, 13, 1);
|
||||
INSERT INTO "objectCreators" VALUES(13, 14, 1);
|
||||
INSERT INTO "objectCreators" VALUES(14, 15, 1);
|
||||
INSERT INTO "objectCreators" VALUES(15, 15, 1);
|
||||
INSERT INTO "objectCreators" VALUES(7, 7, 2);
|
||||
INSERT INTO "objectCreators" VALUES(7, 8, 3);
|
||||
INSERT INTO "objectCreators" VALUES(9, 11, 2);
|
||||
</schema>
|
||||
|
|
Loading…
Reference in a new issue