View | Details | Raw Unified | Return to bug 30291
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_30291_-_rename_recalls_columns.pl (+25 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "30291",
5
    description => "Renaming recalls table columns",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        if( TableExists( 'recalls' ) and column_exists( 'recalls', 'recall_id' ) ) {
11
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN recall_id id int(11) NOT NULL AUTO_INCREMENT });
12
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN borrowernumber patron_id int(11) NOT NULL DEFAULT 0 });
13
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN recalldate created_date datetime DEFAULT NULL });
14
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN biblionumber biblio_id int(11) NOT NULL DEFAULT 0 });
15
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN branchcode pickup_library_id varchar(10) DEFAULT NULL });
16
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN cancellationdate completed_date datetime DEFAULT NULL });
17
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN recallnotes notes mediumtext });
18
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN itemnumber item_id int(11) DEFAULT NULL });
19
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN waitingdate waiting_date datetime DEFAULT NULL });
20
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN expirationdate expiration_date datetime DEFAULT NULL });
21
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN old completed TINYINT(1) NOT NULL DEFAULT 0 });
22
            $dbh->do(q{ ALTER TABLE recalls CHANGE COLUMN item_level_recall item_level TINYINT(1) NOT NULL DEFAULT 0 });
23
        }
24
    },
25
};
(-)a/installer/data/mysql/kohastructure.sql (-27 / +26 lines)
Lines 4282-4313 CREATE TABLE `ratings` ( Link Here
4282
--
4282
--
4283
4283
4284
DROP TABLE IF EXISTS recalls;
4284
DROP TABLE IF EXISTS recalls;
4285
CREATE TABLE recalls ( -- information related to recalls in Koha
4285
CREATE TABLE recalls (
4286
    recall_id int(11) NOT NULL auto_increment, -- primary key
4286
    id int(11) NOT NULL AUTO_INCREMENT COMMENT "Unique identifier for this recall",
4287
    borrowernumber int(11) NOT NULL DEFAULT 0, -- foreign key from the borrowers table defining which patron requested a recall
4287
    patron_id int(11) NOT NULL DEFAULT 0 COMMENT "Identifier for patron who requested recall",
4288
    recalldate datetime DEFAULT NULL, -- the date the recall request was placed
4288
    created_date datetime DEFAULT NULL COMMENT "Date the recall was requested",
4289
    biblionumber int(11) NOT NULL DEFAULT 0, -- foreign key from the biblio table defining which bib record this request is for
4289
    biblio_id int(11) NOT NULL DEFAULT 0 COMMENT "Identifier for bibliographic record that has been recalled",
4290
    branchcode varchar(10) DEFAULT NULL, -- foreign key from the branches table defining which branch the patron wishes to pick up their recall from
4290
    pickup_library_id varchar(10) DEFAULT NULL COMMENT "Identifier for recall pickup library",
4291
    cancellationdate datetime DEFAULT NULL, -- the date this recall was cancelled
4291
    completed_date datetime DEFAULT NULL COMMENT "Date the recall is completed (fulfilled, cancelled or expired)",
4292
    recallnotes mediumtext, -- notes related to this recall
4292
    notes mediumtext COMMENT "Notes related to the recall",
4293
    priority smallint(6) DEFAULT NULL, -- where in the queue the patron sits
4293
    priority smallint(6) DEFAULT NULL COMMENT "Where in the queue the patron sits",
4294
    status ENUM('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested', -- request status
4294
    status ENUM('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested' COMMENT "Status of recall",
4295
    timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- the date and time this recall was last updated
4295
    timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT "Date and time the recall was last updated",
4296
    itemnumber int(11) DEFAULT NULL, -- foreign key from the items table defining the specific item the recall request was placed on
4296
    item_id int(11) DEFAULT NULL COMMENT "Identifier for item record that was recalled, if an item-level recall",
4297
    waitingdate datetime DEFAULT NULL, -- the date the item was marked as waiting for the patron at the library
4297
    waiting_date datetime DEFAULT NULL COMMENT "Date an item was marked as waiting for the patron at the library",
4298
    expirationdate datetime DEFAULT NULL, -- the date the recall expires
4298
    expiration_date datetime DEFAULT NULL COMMENT "Date recall is no longer required, or date recall will expire after waiting on shelf for pickup",
4299
    old TINYINT(1) NOT NULL DEFAULT 0, -- flag if the recall is old and no longer active, i.e. expired, cancelled or completed
4299
    completed TINYINT(1) NOT NULL DEFAULT 0 COMMENT "Flag if recall is old and no longer active, i.e. expired, cancelled or completed",
4300
    item_level_recall TINYINT(1) NOT NULL DEFAULT 0, -- flag if item-level recall
4300
    item_level TINYINT(1) NOT NULL DEFAULT 0 COMMENT "Flag if recall is for a specific item",
4301
     PRIMARY KEY (recall_id),
4301
    PRIMARY KEY (id),
4302
     KEY borrowernumber (borrowernumber),
4302
    KEY recalls_ibfk_1 (patron_id),
4303
     KEY biblionumber (biblionumber),
4303
    KEY recalls_ibfk_2 (biblio_id),
4304
     KEY itemnumber (itemnumber),
4304
    KEY recalls_ibfk_3 (item_id),
4305
     KEY branchcode (branchcode),
4305
    KEY recalls_ibfk_4 (pickup_library_id),
4306
     CONSTRAINT recalls_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
4306
    CONSTRAINT recalls_ibfk_1 FOREIGN KEY (patron_id) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
4307
     CONSTRAINT recalls_ibfk_2 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE,
4307
    CONSTRAINT recalls_ibfk_2 FOREIGN KEY (biblio_id) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE,
4308
     CONSTRAINT recalls_ibfk_3 FOREIGN KEY (itemnumber) REFERENCES items (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE,
4308
    CONSTRAINT recalls_ibfk_3 FOREIGN KEY (item_id) REFERENCES items (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE,
4309
     CONSTRAINT recalls_ibfk_4 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
4309
    CONSTRAINT recalls_ibfk_4 FOREIGN KEY (pickup_library_id) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
4310
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4310
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT="Information related to recalls in Koha";
4311
4311
4312
--
4312
--
4313
-- Table structure for table `repeatable_holidays`
4313
-- Table structure for table `repeatable_holidays`
4314
- 

Return to bug 30291