Bugzilla – Attachment 157585 Details for
Bug 31383
Additional contents: We need a parent and child table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31383: Fix the DB upgrade process
Bug-31383-Fix-the-DB-upgrade-process.patch (text/plain), 2.70 KB, created by
Jonathan Druart
on 2023-10-21 06:19:41 UTC
(
hide
)
Description:
Bug 31383: Fix the DB upgrade process
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-10-21 06:19:41 UTC
Size:
2.70 KB
patch
obsolete
>From ca14259593f7dd8fbdd74b159eea656170d99db0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 21 Oct 2023 08:17:10 +0200 >Subject: [PATCH] Bug 31383: Fix the DB upgrade process > >This patch fixes misc4dev/run_tests.pl --run-db-upgrade-only > >We need to make sure the column exists before running the query. >--- > installer/data/mysql/db_revs/211200005.pl | 23 +++++++++++++---------- > installer/data/mysql/db_revs/211200013.pl | 12 +++++++----- > 2 files changed, 20 insertions(+), 15 deletions(-) > >diff --git a/installer/data/mysql/db_revs/211200005.pl b/installer/data/mysql/db_revs/211200005.pl >index 48c97c746b0..c270ae6c582 100755 >--- a/installer/data/mysql/db_revs/211200005.pl >+++ b/installer/data/mysql/db_revs/211200005.pl >@@ -6,15 +6,18 @@ return { > up => sub { > my ($args) = @_; > my ($dbh, $out) = @$args{qw(dbh out)}; >- $dbh->do(q{ >- DELETE FROM additional_contents >- WHERE code NOT IN ( >- SELECT code FROM ( >- SELECT code >- FROM additional_contents >- WHERE lang = "default" >- ) as tmp >- ); >- }); >+ # Run this only if 230600041 has not been run before >+ if ( column_exists('additional_contents', 'lang') ) { >+ $dbh->do(q{ >+ DELETE FROM additional_contents >+ WHERE code NOT IN ( >+ SELECT code FROM ( >+ SELECT code >+ FROM additional_contents >+ WHERE lang = "default" >+ ) as tmp >+ ); >+ }); >+ } > }, > } >diff --git a/installer/data/mysql/db_revs/211200013.pl b/installer/data/mysql/db_revs/211200013.pl >index 43097d2e61f..1abc5869b2f 100755 >--- a/installer/data/mysql/db_revs/211200013.pl >+++ b/installer/data/mysql/db_revs/211200013.pl >@@ -48,11 +48,13 @@ return { > }); > say $out "Ensure additional_contents.code is VARCHAR(100)"; > >- $dbh->do(q{ >- ALTER TABLE `additional_contents` >- MODIFY COLUMN `lang` VARCHAR(50) NOT NULL DEFAULT '' >- }); >- say $out "Ensure additional_contents.lang is VARCHAR(50)"; >+ if ( column_exists('additional_contents', 'lang') ) { >+ $dbh->do(q{ >+ ALTER TABLE `additional_contents` >+ MODIFY COLUMN `lang` VARCHAR(50) NOT NULL DEFAULT '' >+ }); >+ say $out "Ensure additional_contents.lang is VARCHAR(50)"; >+ } > > $dbh->do(q{ > ALTER TABLE search_marc_map MODIFY `marc_type` enum('marc21','unimarc') NOT NULL COMMENT 'what MARC type this map is for' >-- >2.34.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 31383
:
147891
|
147892
|
147893
|
147894
|
147895
|
147896
|
149813
|
149814
|
149815
|
149816
|
149817
|
149818
|
152423
|
152424
|
152425
|
152426
|
152427
|
152428
|
152545
|
152546
|
152547
|
152566
|
152660
|
152661
|
152662
|
152663
|
152664
|
152665
|
152666
|
152667
|
152668
|
152669
|
153013
|
153666
|
153667
|
153668
|
153669
|
153670
|
153671
|
153672
|
153673
|
153674
|
153675
|
153676
|
156048
|
156049
|
156050
|
156051
|
156052
|
156053
|
156054
|
156055
|
156056
|
156057
|
156058
|
156265
|
156266
|
156267
|
156268
|
156269
|
156270
|
156271
|
156272
|
156273
|
156274
|
156275
|
156276
|
157539
|
157540
|
157541
|
157542
|
157543
|
157544
|
157545
|
157546
|
157547
|
157548
|
157549
|
157550
|
157580
| 157585 |
157640
|
157741
|
157742