Bugzilla – Attachment 171524 Details for
Bug 37592
Add a record of creation and modification to bookings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37592: (QA follow-up) Change created_on, updated_on to creation_date, modification_date
Bug-37592-QA-follow-up-Change-createdon-updatedon-.patch (text/plain), 5.39 KB, created by
Paul Derscheid
on 2024-09-16 10:11:58 UTC
(
hide
)
Description:
Bug 37592: (QA follow-up) Change created_on, updated_on to creation_date, modification_date
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2024-09-16 10:11:58 UTC
Size:
5.39 KB
patch
obsolete
>From 6d987abacb32be2f7f0dade2ba3c8988ddfea576 Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Mon, 16 Sep 2024 10:06:38 +0000 >Subject: [PATCH] Bug 37592: (QA follow-up) Change created_on, updated_on to > creation_date, modification_date > >It makes sense not to introduce mapping code if there's no reason for it. >Accordingly the the columns are now of type DATETIME instead. >--- > Koha/Booking.pm | 5 +-- > ...2-add_created_at_updated_at_to_bookings.pl | 39 ++++++++++--------- > 2 files changed, 22 insertions(+), 22 deletions(-) > >diff --git a/Koha/Booking.pm b/Koha/Booking.pm >index 403ca3bf4e..e5297d8d17 100644 >--- a/Koha/Booking.pm >+++ b/Koha/Booking.pm >@@ -241,10 +241,7 @@ on the API. > =cut > > sub to_api_mapping { >- return { >- created_on => "creation_date", >- updated_on => "modification_date" >- }; >+ return {}; > } > > =head3 delete >diff --git a/installer/data/mysql/atomicupdate/bug_37592-add_created_at_updated_at_to_bookings.pl b/installer/data/mysql/atomicupdate/bug_37592-add_created_at_updated_at_to_bookings.pl >index 2177a85ee8..0c95f4f425 100755 >--- a/installer/data/mysql/atomicupdate/bug_37592-add_created_at_updated_at_to_bookings.pl >+++ b/installer/data/mysql/atomicupdate/bug_37592-add_created_at_updated_at_to_bookings.pl >@@ -3,7 +3,7 @@ use Koha::Installer::Output qw(say_warning say_failure say_success say_info); > > return { > bug_number => '37592', >- description => 'Add created_on, updated_on fields to bookings table', >+ description => 'Add creation_date, modification_date fields to bookings table', > up => sub { > my ($args) = @_; > my ( $dbh, $out ) = @{$args}{qw(dbh out)}; >@@ -12,50 +12,53 @@ return { > SELECT column_name > FROM information_schema.COLUMNS > WHERE table_name = 'bookings' >- AND column_name IN ('created_on', 'updated_on') >+ AND column_name IN ('creation_date', 'modification_date') > SQL > my $existing_columns = $dbh->selectcol_arrayref($columns_exist_query); > if ( @{$existing_columns} == 2 ) { >- say_info( $out, q{Columns 'created_on' and 'updated_on' already exist in 'bookings' table. Skipping...} ); >+ say_info( >+ $out, >+ q{Columns 'creation_date' and 'modification_date' already exist in 'bookings' table. Skipping...} >+ ); > > return; > } > >- my $created_on_statement = <<~'SQL'; >- ALTER TABLE bookings ADD COLUMN created_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'The timestamp for when a bookings was created' >+ my $creation_date_statement = <<~'SQL'; >+ ALTER TABLE bookings ADD COLUMN creation_date DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'The datetime for when a bookings was created' > SQL >- my $updated_on_statement = <<~'SQL'; >- ALTER TABLE bookings ADD COLUMN updated_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'The timestamp for when a booking has been updated' >+ my $modification_date_statement = <<~'SQL'; >+ ALTER TABLE bookings ADD COLUMN modification_date DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'The datetime for when a booking has been updated' > SQL > if ( @{$existing_columns} == 0 ) { >- if ( $dbh->do("$created_on_statement AFTER `end_date`") ) { >- say_success( $out, q{Added column 'bookings.created_on'} ); >+ if ( $dbh->do("$creation_date_statement AFTER `end_date`") ) { >+ say_success( $out, q{Added column 'bookings.creation_date'} ); > } else { >- say_failure( $out, q{Failed to add column 'bookings.created_on': } . $dbh->errstr ); >+ say_failure( $out, q{Failed to add column 'bookings.creation_date': } . $dbh->errstr ); > } > >- if ( $dbh->do("$updated_on_statement AFTER `created_on`") ) { >- say_success( $out, q{Added column 'bookings.updated_on'} ); >+ if ( $dbh->do("$modification_date_statement AFTER `creation_date`") ) { >+ say_success( $out, q{Added column 'bookings.modification_date'} ); > } else { >- say_failure( $out, q{Failed to add column 'bookings.updated_on': } . $dbh->errstr ); >+ say_failure( $out, q{Failed to add column 'bookings.modification_date': } . $dbh->errstr ); > } > > return; > } > > if ( @{$existing_columns} == 1 ) { >- foreach my $column ( 'created_on', 'updated_on' ) { >+ foreach my $column ( 'creation_date', 'modification_date' ) { > if ( column_exists( 'bookings', $column ) ) { > next; > } > > my $statement; >- if ( $column eq 'created_on' ) { >- $statement = "$created_on_statement AFTER `end_date`"; >+ if ( $column eq 'creation_date' ) { >+ $statement = "$creation_date_statement AFTER `end_date`"; > } > >- if ( $column eq 'updated_on' ) { >- $statement = "$updated_on_statement AFTER `created_on`"; >+ if ( $column eq 'modification_date' ) { >+ $statement = "$modification_date_statement AFTER `creation_date`"; > } > > if ( $dbh->do($statement) ) { >-- >2.46.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37592
:
170144
|
170161
|
170763
|
171254
|
171376
|
171377
|
171378
| 171524 |
171645
|
174968
|
174969
|
174970
|
174971
|
174972
|
174973