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

(-)a/api/v1/swagger/definitions/booking.yaml (+5 lines)
Lines 10-15 properties: Link Here
10
  booking_id:
10
  booking_id:
11
    description: Internal booking identifier
11
    description: Internal booking identifier
12
    type: integer
12
    type: integer
13
  cancellation_reason:
14
    description: Booking cancellation reason
15
    type:
16
      - string
17
      - "null"
13
  creation_date:
18
  creation_date:
14
    description: Creation date and time of this booking
19
    description: Creation date and time of this booking
15
    readOnly: true
20
    readOnly: true
(-)a/installer/data/mysql/atomicupdate/bug_38193-add_cancellation_reason_field_to_bookings_table.pl (+27 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_failure say_success say_info);
3
4
return {
5
    bug_number  => '38193',
6
    description => 'Add cancellation_reason field to bookings table',
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @{$args}{qw(dbh out)};
10
11
        if ( column_exists( 'bookings', 'cancellation_reason' ) ) {
12
            say_info( $out, q{Column 'cancellation_reason' already exists in 'bookings' table. Skipping...} );
13
14
            return;
15
        }
16
17
        my $statement = <<~"SQL";
18
            ALTER TABLE `bookings`
19
            ADD COLUMN `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value BOOKING_CANCELLATION' AFTER `status`;
20
        SQL
21
        if ( $dbh->do($statement) ) {
22
            say_success( $out, q{Added column 'bookings.cancellation_reason'} );
23
        } else {
24
            say_failure( $out, q{Failed to add column 'bookings.cancellation_reason'} );
25
        }
26
    },
27
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 1220-1225 CREATE TABLE `bookings` ( Link Here
1220
  `creation_date` timestamp DEFAULT current_timestamp() COMMENT 'the timestamp for when a booking was created',
1220
  `creation_date` timestamp DEFAULT current_timestamp() COMMENT 'the timestamp for when a booking was created',
1221
  `modification_date` timestamp DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the timestamp for when a booking has been updated',
1221
  `modification_date` timestamp DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the timestamp for when a booking has been updated',
1222
  `status` enum('new', 'cancelled', 'completed') NOT NULL DEFAULT 'new' COMMENT 'current status of the booking',
1222
  `status` enum('new', 'cancelled', 'completed') NOT NULL DEFAULT 'new' COMMENT 'current status of the booking',
1223
  `cancellation_reason` varchar(80) DEFAULT NULL COMMENT 'optional authorised value BOOKING_CANCELLATION',
1223
  PRIMARY KEY (`booking_id`),
1224
  PRIMARY KEY (`booking_id`),
1224
  KEY `patron_id` (`patron_id`),
1225
  KEY `patron_id` (`patron_id`),
1225
  KEY `biblio_id` (`biblio_id`),
1226
  KEY `biblio_id` (`biblio_id`),
1226
- 

Return to bug 38193