Bugzilla – Attachment 148348 Details for
Bug 32334
Sync comments in database with schema
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32334: (follow-up) Improvement for schema parameter
Bug-32334-follow-up-Improvement-for-schema-paramet.patch (text/plain), 3.32 KB, created by
David Nind
on 2023-03-17 13:34:25 UTC
(
hide
)
Description:
Bug 32334: (follow-up) Improvement for schema parameter
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-03-17 13:34:25 UTC
Size:
3.32 KB
patch
obsolete
>From 4e0d1e10206700bebabf8bd186db57c6e73b1f15 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 17 Mar 2023 07:46:44 +0000 >Subject: [PATCH] Bug 32334: (follow-up) Improvement for schema parameter > >Essentially only adds a warn, some cosmetic changes too. > >Test plan: >Copy your kohastructure to xx.sql. >Run sync_db_comments.pl -schema xx.sql. You will see usage. >Run sync_db_comments.pl -schema xyz.sql. You will see a warn and >the usage statement. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Database/Commenter.pm | 6 ++++-- > misc/maintenance/sync_db_comments.pl | 7 ++++--- > 2 files changed, 8 insertions(+), 5 deletions(-) > >diff --git a/Koha/Database/Commenter.pm b/Koha/Database/Commenter.pm >index 2b37067c76..fb4048f1dc 100644 >--- a/Koha/Database/Commenter.pm >+++ b/Koha/Database/Commenter.pm >@@ -77,7 +77,7 @@ sub new { > unless ref($self->{dbh}) eq DBI_HANDLE_CLASS; > > $self->{database} //= ( $self->{dbh}->selectrow_array('SELECT DATABASE()') )[0]; >- $self->_find_schema unless $self->{schema_file}; >+ $self->_find_schema; > $self->{schema_info} = {}; > > return $self; >@@ -159,7 +159,9 @@ sub renumber { > sub _find_schema { > my $self = shift; > my $rootdir = C4::Context->config('intranetdir'); >- if( -e "$rootdir/". KOHA_STRUCTURE ) { >+ if( $self->{schema_file} ) { >+ warn "File ". $self->{schema_file}. " not found!\n" if !-e $self->{schema_file}; >+ } elsif( -e "$rootdir/". KOHA_STRUCTURE ) { > $self->{schema_file} = "$rootdir/". KOHA_STRUCTURE; > } elsif( -e "$rootdir/intranet/cgi-bin/". KOHA_STRUCTURE ) { > $self->{schema_file} = "$rootdir/intranet/cgi-bin/". KOHA_STRUCTURE; >diff --git a/misc/maintenance/sync_db_comments.pl b/misc/maintenance/sync_db_comments.pl >index 07ee001cb6..57cbdef381 100755 >--- a/misc/maintenance/sync_db_comments.pl >+++ b/misc/maintenance/sync_db_comments.pl >@@ -36,14 +36,14 @@ GetOptions( > 'help|h' => \$cmd_args->{help}, > 'renumber' => \$cmd_args->{renumber}, > 'reset' => \$cmd_args->{reset}, >- 'schema:s' => \$cmd_args->{schema}, >+ 'schema:s' => \$cmd_args->{schema_file}, > 'table:s' => \$cmd_args->{table}, > 'verbose|v' => \$cmd_args->{verbose}, > ); > $cmd_args->{dry_run} = !$cmd_args->{commit}; > > my $commenter = Koha::Database::Commenter->new({ >- database => delete $cmd_args->{database}, dbh => C4::Context->dbh, schema_file => delete $cmd_args->{schema}, >+ database => delete $cmd_args->{database}, dbh => C4::Context->dbh, schema_file => delete $cmd_args->{schema_file}, > }); > my $messages = $cmd_args->{verbose} || $cmd_args->{dry_run} ? [] : undef; > if( $cmd_args->{help} ) { >@@ -94,9 +94,10 @@ misc/maintenance/sync_db_comments.pl > Clear all column comments in database. > The verbose flag shows all issued ALTER TABLE statements. > >- misc/maintance/sync_db_comments.pl -reset -commit -database mydb -table items >+ misc/maintance/sync_db_comments.pl -reset -commit -database mydb -table items -schema newstructure.sql > Only resets comments in items table. > Operates on specific database instead of the one from $KOHA_CONF. >+ Reads the schema from the specified file instead of default one. > > misc/maintance/sync_db_comments.pl -renumber > Renumbers all comments like Comment_1,2,.. >-- >2.30.2
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 32334
:
144391
|
144392
|
144393
|
144394
|
146712
|
146713
|
146714
|
146715
|
146716
|
146717
|
146718
|
146719
|
146720
|
148266
|
148299
|
148335
|
148338
|
148339
|
148340
|
148341
|
148342
|
148343
|
148344
|
148345
|
148346
|
148347
|
148348
|
149259
|
149260
|
149261
|
149262
|
149263
|
149264
|
149265
|
149266
|
149267
|
149268
|
149269
|
149270