Bugzilla – Attachment 114021 Details for
Bug 26947
kohastructure.sql should be updated for each release
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26947: Add scheam-only option to koha-dump
Bug-26947-Add-scheam-only-option-to-koha-dump.patch (text/plain), 4.92 KB, created by
Victor Grousset/tuxayo
on 2020-11-26 19:04:22 UTC
(
hide
)
Description:
Bug 26947: Add scheam-only option to koha-dump
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2020-11-26 19:04:22 UTC
Size:
4.92 KB
patch
obsolete
>From f2c98d08e02c5cdb7f178a3610cd44cde973f497 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 13 Nov 2020 13:48:48 +0000 >Subject: [PATCH] Bug 26947: Add scheam-only option to koha-dump > >This patch adds a new --schema-only optoin to the koha-dump script. > >This can be used to generate a new kohastructure.sql file during the release, and later to >compare the DB structure of a koha instance to the kohastructure.sql file shipped with a version >to identify any missing constraints or other db structure issues > >To test: >1 - debian/scripts/koha-dump kohadev >2 - Confirm db and configs are dumped correctly >3 - Apply patch >4 - debian/scripts/koha-dump --help >5 - Confirm new option is listed and makes sense >6 - debian/scripts/koha-dump --schema-only kohadev >7 - Confirm only schema is dumped and is not zipped >8 - debian/scripts/koha-dump kohadev >9 - Confirm entire db is dumped as before > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > debian/scripts/koha-dump | 69 +++++++++++++++++++++++++--------------- > 1 file changed, 43 insertions(+), 26 deletions(-) > >diff --git a/debian/scripts/koha-dump b/debian/scripts/koha-dump >index 707a8dfe05..418fd9fe01 100755 >--- a/debian/scripts/koha-dump >+++ b/debian/scripts/koha-dump >@@ -39,13 +39,17 @@ $scriptname > > This script dumps your Koha instance data for backup or migration. > >+The schema only option can be used to compare your existing database schema >+to the expected Koha structure. >+ > Usage: > $scriptname [--quiet|-q] [--exclude-indexes] instancename1 [instancename2...] > $scriptname -h|--help > >- --exclude-indexes Include Zebra indexes on the backup. >+ --schema-only Dump only the database schema >+ --exclude-indexes Include Zebra indexes on the backup > --quiet|-q Make the script avoid printing to STDOUT >- (useful for calling from another scripts). >+ (useful for calling from another scripts) > --help|-h Display this help message > --without-db-name Do not include database name > >@@ -69,44 +73,57 @@ dump_instance() > backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig || true )" > [ -z "$backupdir" ] && backupdir="/var/spool/koha/$name" > dbdump="$backupdir/$name-$date.sql.gz" >- [ "$quiet" = "no" ] && echo "* DB to $dbdump" >- dbflag="--databases" > [ "$without_db_name" = "yes" ] && dbflag="" >- mysqldump $dbflag --host="$mysqlhost" \ >- --user="$mysqluser" --password="$mysqlpass" "$mysqldb" | >- gzip > "$dbdump" >- chown "root:$name-koha" "$dbdump" >- chmod g+r "$dbdump" >- >- instancefile="$name.conf" >+ if [ "$schema_only" = "yes" ] >+ then >+ schemadump="$backupdir/$name-schema-$date.sql" >+ [ "$quiet" = "no" ] && echo "* schema to $schemadump" >+ mysqldump $dbflag -d --host="$mysqlhost" \ >+ --user="$mysqluser" --password="$mysqlpass" "$mysqldb" > "$schemadump" >+ chown "root:$name-koha" "$dbdump" >+ chmod g+r "$dbdump" >+ else >+ [ "$quiet" = "no" ] && echo "* DB to $dbdump" >+ mysqldump $dbflag --host="$mysqlhost" \ >+ --user="$mysqluser" --password="$mysqlpass" "$mysqldb" | >+ gzip > "$dbdump" >+ chown "root:$name-koha" "$dbdump" >+ chmod g+r "$dbdump" >+ >+ instancefile="$name.conf" >+ >+ # Dump configs, logs, etc. >+ metadump="$backupdir/$name-$date.tar.gz" >+ [ "$quiet" = "no" ] && echo "* configs, logs to $metadump" >+ >+ if [ "$exclude_indexes" = "yes" ]; then >+ excludes="--exclude=var/lib/koha/$name/biblios \ >+ --exclude=var/lib/koha/$name/authorities" >+ fi > >- # Dump configs, logs, etc. >- metadump="$backupdir/$name-$date.tar.gz" >- [ "$quiet" = "no" ] && echo "* configs, logs to $metadump" >+ tar -czf "$metadump" -C / $excludes \ >+ "etc/koha/sites/$name" \ >+ "etc/apache2/sites-available/$instancefile" \ >+ "etc/apache2/sites-enabled/$instancefile" \ >+ "var/lib/koha/$name" \ >+ "var/log/koha/$name" > >- if [ "$exclude_indexes" = "yes" ]; then >- excludes="--exclude=var/lib/koha/$name/biblios \ >- --exclude=var/lib/koha/$name/authorities" >+ [ "$quiet" = "no" ] && echo "Done." > fi >- >- tar -czf "$metadump" -C / $excludes \ >- "etc/koha/sites/$name" \ >- "etc/apache2/sites-available/$instancefile" \ >- "etc/apache2/sites-enabled/$instancefile" \ >- "var/lib/koha/$name" \ >- "var/log/koha/$name" >- >- [ "$quiet" = "no" ] && echo "Done." > } > > # Default values > quiet="no" > exclude_indexes="no" > without_db_name="no" >+schema_only="no" > > while [ $# -gt 0 ]; do > > case "$1" in >+ --schema-only) >+ schema_only="yes" >+ shift ;; > --exclude-indexes) > exclude_indexes="yes" > shift ;; >-- >2.29.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 26947
:
113603
|
113794
|
113799
|
113800
|
113802
|
113803
|
113804
|
113805
|
113989
|
114021
|
114022
|
114023
|
114024
|
114025
|
114195
|
114196
|
114197
|
114198
|
114199
|
114201
|
115065
|
115066
|
115067
|
115068
|
115069
|
115070
|
115073