Bug 7249 : Allow reports to be called through a restful interface
[koha.git] / installer / data / mysql / kohastructure.sql
index 21c657d..9a94e0f 100644 (file)
@@ -286,7 +286,7 @@ CREATE TABLE `borrower_attribute_types` ( -- definitions for custom patron field
   `staff_searchable` tinyint(1) NOT NULL default 0, -- defines if this field is searchable via the patron search in the staff client (1 for yes, 0 for no)
   `authorised_value_category` varchar(10) default NULL, -- foreign key from authorised_values that links this custom field to an authorized value category
   `display_checkout` tinyint(1) NOT NULL default 0,-- defines if this field displays in checkout screens
-  `category_code` VARCHAR(1) NOT NULL DEFAULT '',-- defines a category for an attribute_type
+  `category_code` VARCHAR(1) NULL DEFAULT NULL,-- defines a category for an attribute_type
   `class` VARCHAR(255) NOT NULL DEFAULT '',-- defines a class for an attribute_type
   PRIMARY KEY  (`code`),
   KEY `auth_val_cat_idx` (`authorised_value_category`)
@@ -1545,6 +1545,7 @@ CREATE TABLE `patronimage` (
 -- this table is MyISAM, InnoDB tables are growing only and this table is filled/emptied/filled/emptied...
 -- so MyISAM is better in this case
 
+DROP TABLE IF EXISTS `pending_offline_operations`;
 CREATE TABLE `pending_offline_operations` (
   `operationid` int(11) NOT NULL AUTO_INCREMENT,
   `userid` varchar(30) NOT NULL,
@@ -1713,6 +1714,8 @@ CREATE TABLE saved_sql (
    `report_name` varchar(255) default NULL,
    `type` varchar(255) default NULL,
    `notes` text,
+   `cache_expiry` int NOT NULL default 300,
+   `public` boolean NOT NULL default FALSE,
    PRIMARY KEY  (`id`),
    KEY boridx (`borrowernumber`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -2813,6 +2816,21 @@ CREATE TABLE IF NOT EXISTS `social_data` (
   PRIMARY KEY  (`isbn`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+--
+-- 'Ratings' table. This tracks the star ratings set by borrowers.
+--
+
+DROP TABLE IF EXISTS ratings;
+CREATE TABLE ratings (
+    borrowernumber int(11) NOT NULL, -- the borrower this rating is for
+    biblionumber int(11) NOT NULL, -- the biblio it's for
+    rating_value tinyint(1) NOT NULL, -- the rating, from 1-5
+    timestamp timestamp NOT NULL default CURRENT_TIMESTAMP,
+    PRIMARY KEY  (borrowernumber,biblionumber),
+    CONSTRAINT ratings_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
+    CONSTRAINT ratings_ibfk_2 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;