|
Lines 2004-2016
CREATE TABLE `tags` (
Link Here
|
| 2004 |
-- |
2004 |
-- |
| 2005 |
|
2005 |
|
| 2006 |
DROP TABLE IF EXISTS `tags_all`; |
2006 |
DROP TABLE IF EXISTS `tags_all`; |
| 2007 |
CREATE TABLE `tags_all` ( |
2007 |
CREATE TABLE `tags_all` ( -- all of the tags |
| 2008 |
`tag_id` int(11) NOT NULL auto_increment, |
2008 |
`tag_id` int(11) NOT NULL auto_increment, -- unique id and primary key |
| 2009 |
`borrowernumber` int(11) NOT NULL, |
2009 |
`borrowernumber` int(11) NOT NULL, -- the patron who added the tag (borrowers.borrowernumber) |
| 2010 |
`biblionumber` int(11) NOT NULL, |
2010 |
`biblionumber` int(11) NOT NULL, -- the bib record this tag was left on (biblio.biblionumber) |
| 2011 |
`term` varchar(255) NOT NULL, |
2011 |
`term` varchar(255) NOT NULL, -- the tag |
| 2012 |
`language` int(4) default NULL, |
2012 |
`language` int(4) default NULL, -- the language the tag was left in |
| 2013 |
`date_created` datetime NOT NULL, |
2013 |
`date_created` datetime NOT NULL, -- the date the tag was added |
| 2014 |
PRIMARY KEY (`tag_id`), |
2014 |
PRIMARY KEY (`tag_id`), |
| 2015 |
KEY `tags_borrowers_fk_1` (`borrowernumber`), |
2015 |
KEY `tags_borrowers_fk_1` (`borrowernumber`), |
| 2016 |
KEY `tags_biblionumber_fk_1` (`biblionumber`), |
2016 |
KEY `tags_biblionumber_fk_1` (`biblionumber`), |
|
Lines 2025-2036
CREATE TABLE `tags_all` (
Link Here
|
| 2025 |
-- |
2025 |
-- |
| 2026 |
|
2026 |
|
| 2027 |
DROP TABLE IF EXISTS `tags_approval`; |
2027 |
DROP TABLE IF EXISTS `tags_approval`; |
| 2028 |
CREATE TABLE `tags_approval` ( |
2028 |
CREATE TABLE `tags_approval` ( -- approved tags |
| 2029 |
`term` varchar(255) NOT NULL, |
2029 |
`term` varchar(255) NOT NULL, -- the tag |
| 2030 |
`approved` int(1) NOT NULL default '0', |
2030 |
`approved` int(1) NOT NULL default '0', -- whether the tag is approved or not (1=yes, 0=pending, -1=rejected) |
| 2031 |
`date_approved` datetime default NULL, |
2031 |
`date_approved` datetime default NULL, -- the date this tag was approved |
| 2032 |
`approved_by` int(11) default NULL, |
2032 |
`approved_by` int(11) default NULL, -- the librarian who approved the tag (borrowers.borrowernumber) |
| 2033 |
`weight_total` int(9) NOT NULL default '1', |
2033 |
`weight_total` int(9) NOT NULL default '1', -- the total number of times this tag was used |
| 2034 |
PRIMARY KEY (`term`), |
2034 |
PRIMARY KEY (`term`), |
| 2035 |
KEY `tags_approval_borrowers_fk_1` (`approved_by`), |
2035 |
KEY `tags_approval_borrowers_fk_1` (`approved_by`), |
| 2036 |
CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) |
2036 |
CONSTRAINT `tags_approval_borrowers_fk_1` FOREIGN KEY (`approved_by`) |
|
Lines 2042-2051
CREATE TABLE `tags_approval` (
Link Here
|
| 2042 |
-- |
2042 |
-- |
| 2043 |
|
2043 |
|
| 2044 |
DROP TABLE IF EXISTS `tags_index`; |
2044 |
DROP TABLE IF EXISTS `tags_index`; |
| 2045 |
CREATE TABLE `tags_index` ( |
2045 |
CREATE TABLE `tags_index` ( -- a weighted list of all tags and where they are used |
| 2046 |
`term` varchar(255) NOT NULL, |
2046 |
`term` varchar(255) NOT NULL, -- the tag |
| 2047 |
`biblionumber` int(11) NOT NULL, |
2047 |
`biblionumber` int(11) NOT NULL, -- the bib record this tag was used on (biblio.biblionumber) |
| 2048 |
`weight` int(9) NOT NULL default '1', |
2048 |
`weight` int(9) NOT NULL default '1', -- the number of times this term was used on this bib record |
| 2049 |
PRIMARY KEY (`term`,`biblionumber`), |
2049 |
PRIMARY KEY (`term`,`biblionumber`), |
| 2050 |
KEY `tags_index_biblionumber_fk_1` (`biblionumber`), |
2050 |
KEY `tags_index_biblionumber_fk_1` (`biblionumber`), |
| 2051 |
CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`) |
2051 |
CONSTRAINT `tags_index_term_fk_1` FOREIGN KEY (`term`) |
| 2052 |
- |
|
|