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 4287-4318 CREATE TABLE `ratings` ( Link Here
4287
--
4287
--
4288
4288
4289
DROP TABLE IF EXISTS recalls;
4289
DROP TABLE IF EXISTS recalls;
4290
CREATE TABLE recalls ( -- information related to recalls in Koha
4290
CREATE TABLE recalls (
4291
    recall_id int(11) NOT NULL auto_increment, -- primary key
4291
    id int(11) NOT NULL AUTO_INCREMENT COMMENT "Unique identifier for this recall",
4292
    borrowernumber int(11) NOT NULL DEFAULT 0, -- foreign key from the borrowers table defining which patron requested a recall
4292
    patron_id int(11) NOT NULL DEFAULT 0 COMMENT "Identifier for patron who requested recall",
4293
    recalldate datetime DEFAULT NULL, -- the date the recall request was placed
4293
    created_date datetime DEFAULT NULL COMMENT "Date the recall was requested",
4294
    biblionumber int(11) NOT NULL DEFAULT 0, -- foreign key from the biblio table defining which bib record this request is for
4294
    biblio_id int(11) NOT NULL DEFAULT 0 COMMENT "Identifier for bibliographic record that has been recalled",
4295
    branchcode varchar(10) DEFAULT NULL, -- foreign key from the branches table defining which branch the patron wishes to pick up their recall from
4295
    pickup_library_id varchar(10) DEFAULT NULL COMMENT "Identifier for recall pickup library",
4296
    cancellationdate datetime DEFAULT NULL, -- the date this recall was cancelled
4296
    completed_date datetime DEFAULT NULL COMMENT "Date the recall is completed (fulfilled, cancelled or expired)",
4297
    recallnotes mediumtext, -- notes related to this recall
4297
    notes mediumtext COMMENT "Notes related to the recall",
4298
    priority smallint(6) DEFAULT NULL, -- where in the queue the patron sits
4298
    priority smallint(6) DEFAULT NULL COMMENT "Where in the queue the patron sits",
4299
    status ENUM('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested', -- request status
4299
    status ENUM('requested','overdue','waiting','in_transit','cancelled','expired','fulfilled') DEFAULT 'requested' COMMENT "Status of recall",
4300
    timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- the date and time this recall was last updated
4300
    timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT "Date and time the recall was last updated",
4301
    itemnumber int(11) DEFAULT NULL, -- foreign key from the items table defining the specific item the recall request was placed on
4301
    item_id int(11) DEFAULT NULL COMMENT "Identifier for item record that was recalled, if an item-level recall",
4302
    waitingdate datetime DEFAULT NULL, -- the date the item was marked as waiting for the patron at the library
4302
    waiting_date datetime DEFAULT NULL COMMENT "Date an item was marked as waiting for the patron at the library",
4303
    expirationdate datetime DEFAULT NULL, -- the date the recall expires
4303
    expiration_date datetime DEFAULT NULL COMMENT "Date recall is no longer required, or date recall will expire after waiting on shelf for pickup",
4304
    old TINYINT(1) NOT NULL DEFAULT 0, -- flag if the recall is old and no longer active, i.e. expired, cancelled or completed
4304
    completed TINYINT(1) NOT NULL DEFAULT 0 COMMENT "Flag if recall is old and no longer active, i.e. expired, cancelled or completed",
4305
    item_level_recall TINYINT(1) NOT NULL DEFAULT 0, -- flag if item-level recall
4305
    item_level TINYINT(1) NOT NULL DEFAULT 0 COMMENT "Flag if recall is for a specific item",
4306
     PRIMARY KEY (recall_id),
4306
    PRIMARY KEY (id),
4307
     KEY borrowernumber (borrowernumber),
4307
    KEY recalls_ibfk_1 (patron_id),
4308
     KEY biblionumber (biblionumber),
4308
    KEY recalls_ibfk_2 (biblio_id),
4309
     KEY itemnumber (itemnumber),
4309
    KEY recalls_ibfk_3 (item_id),
4310
     KEY branchcode (branchcode),
4310
    KEY recalls_ibfk_4 (pickup_library_id),
4311
     CONSTRAINT recalls_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
4311
    CONSTRAINT recalls_ibfk_1 FOREIGN KEY (patron_id) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
4312
     CONSTRAINT recalls_ibfk_2 FOREIGN KEY (biblionumber) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE,
4312
    CONSTRAINT recalls_ibfk_2 FOREIGN KEY (biblio_id) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE,
4313
     CONSTRAINT recalls_ibfk_3 FOREIGN KEY (itemnumber) REFERENCES items (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE,
4313
    CONSTRAINT recalls_ibfk_3 FOREIGN KEY (item_id) REFERENCES items (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE,
4314
     CONSTRAINT recalls_ibfk_4 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
4314
    CONSTRAINT recalls_ibfk_4 FOREIGN KEY (pickup_library_id) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
4315
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4315
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT="Information related to recalls in Koha";
4316
4316
4317
--
4317
--
4318
-- Table structure for table `repeatable_holidays`
4318
-- Table structure for table `repeatable_holidays`
4319
- 

Return to bug 30291