Bug 22521: Increase varchar size for accounttype
[koha-equinox.git] / installer / data / mysql / kohastructure.sql
index 4430d6f..8c60c99 100644 (file)
@@ -318,6 +318,8 @@ CREATE TABLE `categories` ( -- this table shows information related to Koha patr
   `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL default '-1', -- wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions
   `default_privacy` ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default', -- Default privacy setting for this patron category
   `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron category if this item has previously been checked out to this patron if 'yes', not if 'no', defer to syspref setting if 'inherit'.
+  `reset_password` TINYINT(1) NULL DEFAULT NULL, -- if patrons of this category can do the password reset flow,
+  `change_password` TINYINT(1) NULL DEFAULT NULL, -- if patrons of this category can change their passwords in the OAPC
   PRIMARY KEY  (`categorycode`),
   UNIQUE KEY `categorycode` (`categorycode`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@@ -607,6 +609,7 @@ CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower
   `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
   `login_attempts` int(4) default 0, -- number of failed login attemps
   `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
+  `flgAnonymized` tinyint DEFAULT 0, -- flag for data anonymization
   KEY borrowernumber (borrowernumber),
   KEY `cardnumber` (`cardnumber`),
   KEY `sms_provider_id` (`sms_provider_id`)
@@ -1491,7 +1494,7 @@ CREATE TABLE `search_marc_map` (
   id int(11) NOT NULL AUTO_INCREMENT,
   index_name ENUM('biblios','authorities') NOT NULL COMMENT 'what storage index this map is for',
   marc_type ENUM('marc21', 'unimarc', 'normarc') NOT NULL COMMENT 'what MARC type this map is for',
-  marc_field VARCHAR(255) NOT NULL COMMENT 'the MARC specifier for this field',
+  marc_field VARCHAR(255) NOT NULL COLLATE utf8mb4_bin COMMENT 'the MARC specifier for this field',
   PRIMARY KEY(`id`),
   UNIQUE key `index_name` (`index_name`, `marc_field` (191), `marc_type`),
   INDEX (`index_name`)
@@ -1641,6 +1644,7 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons
   `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
   `login_attempts` int(4) default 0, -- number of failed login attemps
   `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
+  `flgAnonymized` tinyint DEFAULT 0, -- flag for data anonymization
   UNIQUE KEY `cardnumber` (`cardnumber`),
   PRIMARY KEY `borrowernumber` (`borrowernumber`),
   KEY `categorycode` (`categorycode`),
@@ -1727,7 +1731,7 @@ CREATE TABLE `issues` ( -- information related to check outs or issues
   `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
   `returndate` datetime default NULL, -- date the item was returned, will be NULL until moved to old_issues
   `lastreneweddate` datetime default NULL, -- date the item was last renewed
-  `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
+  `renewals` tinyint(4) NOT NULL default 0, -- lists the number of times the item was renewed
   `auto_renew` BOOLEAN default FALSE, -- automatic renewal
   `auto_renew_error` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, -- automatic renewal error
   `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
@@ -1759,7 +1763,7 @@ CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r
   `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out
   `returndate` datetime default NULL, -- date the item was returned
   `lastreneweddate` datetime default NULL, -- date the item was last renewed
-  `renewals` tinyint(4) default NULL, -- lists the number of times the item was renewed
+  `renewals` tinyint(4) NOT NULL default 0, -- lists the number of times the item was renewed
   `auto_renew` BOOLEAN default FALSE, -- automatic renewal
   `auto_renew_error` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, -- automatic renewal error
   `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
@@ -2676,13 +2680,14 @@ CREATE TABLE `accountlines` (
   `date` date default NULL,
   `amount` decimal(28,6) default NULL,
   `description` LONGTEXT,
-  `accounttype` varchar(5) default NULL,
+  `accounttype` varchar(16) default NULL,
+  `status` varchar(16) default NULL,
   `payment_type` varchar(80) default NULL, -- optional authorised value PAYMENT_TYPE
   `amountoutstanding` decimal(28,6) default NULL,
-  `lastincrement` decimal(28,6) default NULL,
   `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
   `note` MEDIUMTEXT NULL default NULL,
   `manager_id` int(11) NULL DEFAULT NULL,
+  `interface` VARCHAR(16) NOT NULL,
   `branchcode` VARCHAR( 10 ) NULL DEFAULT NULL, -- the branchcode of the library where a payment was made, a manual invoice created, etc.
   PRIMARY KEY (`accountlines_id`),
   KEY `acctsborridx` (`borrowernumber`),
@@ -4271,7 +4276,8 @@ CREATE TABLE `circulation_rules` (
 -- Table structure for table `stockrotationrotas`
 --
 
-CREATE TABLE IF NOT EXISTS stockrotationrotas (
+DROP TABLE IF EXISTS stockrotationrotas;
+CREATE TABLE stockrotationrotas (
     rota_id int(11) auto_increment,         -- Stockrotation rota ID
     title varchar(100) NOT NULL,            -- Title for this rota
     description text NOT NULL,              -- Description for this rota
@@ -4284,7 +4290,8 @@ CREATE TABLE IF NOT EXISTS stockrotationrotas (
 -- Table structure for table `stockrotationstages`
 --
 
-CREATE TABLE IF NOT EXISTS stockrotationstages (
+DROP TABLE IF EXISTS stockrotationstages;
+CREATE TABLE stockrotationstages (
     stage_id int(11) auto_increment,     -- Unique stage ID
     position int(11) NOT NULL,           -- The position of this stage within its rota
     rota_id int(11) NOT NULL,            -- The rota this stage belongs to
@@ -4305,7 +4312,8 @@ CREATE TABLE IF NOT EXISTS stockrotationstages (
 -- Table structure for table `stockrotationitems`
 --
 
-CREATE TABLE IF NOT EXISTS stockrotationitems (
+DROP TABLE IF EXISTS stockrotationitems;
+CREATE TABLE stockrotationitems (
     itemnumber_id int(11) NOT NULL,         -- Itemnumber to link to a stage & rota
     stage_id int(11) NOT NULL,              -- stage ID to link the item to
     indemand tinyint(1) NOT NULL default 0, -- Should this item be skipped for rotation?