Bug 28749 - All backups behave as if --without-db-name is passed
Summary: All backups behave as if --without-db-name is passed
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Jason Boyer
QA Contact: Testopia
URL:
Keywords:
Depends on: 26947
Blocks:
  Show dependency treegraph
 
Reported: 2021-07-23 13:45 UTC by Jason Boyer
Modified: 2022-12-12 21:24 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.03


Attachments
Restore the database name to Koha dumps (512 bytes, patch)
2021-07-23 13:45 UTC, Jason Boyer
Details | Diff | Splinter Review
Bug 28749: Restore the database name to Koha dumps (1.59 KB, patch)
2021-07-28 14:21 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Boyer 2021-07-23 13:45:16 UTC
Created attachment 123114 [details] [review]
Restore the database name to Koha dumps

The line to use the --databases flag with mysqldump by default was accidentally removed from koha-dump when the --schema-only option was added. This makes all backups act as if koha-dump is called with the --without-db-name flag, causing koha-restore to fail to restore the database because it's neither CREATEd or USEd.
Comment 1 Jonathan Druart 2021-07-28 11:59:38 UTC
Caused by:
  commit d406d9016460ec8819d68d5d861627c5b3b5accb
  Bug 26947: Add schema-only option to koha-dump


Is your patch ready for testing, Jason?
Comment 2 Jason Boyer 2021-07-28 12:05:52 UTC
It is, I just missed changing the status to say so. Thanks for the reminder. :)
Comment 3 Nick Clemens 2021-07-28 14:21:56 UTC
Created attachment 123254 [details] [review]
Bug 28749: Restore the database name to Koha dumps

The line to use the --databases flag with mysqldump by default was accidentally
removed from koha-dump when the --schema-only option was added. This makes all
backups act as if koha-dump is called with the --without-db-name flag, causing
koha-restore to fail to restore the database because it's neither CREATEd or USEd.

This patch restores that line

To test:
1 - sudo debian/scripts/koha-dump kohadev
2 - zcat /var/spool/koha/kohadev/kohadev-2021-07-28.sql.gz | grep DATABASE
3 - Notice no output
4 - Apply patch
5 - sudo debian/scripts/koha-dump kohadev
6 - zcat /var/spool/koha/kohadev/kohadev-2021-07-28.sql.gz | grep DATABASE
7 - You get the line:
    CREATE DATABASE /*!32312 IF NOT EXISTS*/ `koha_kohadev` /*!40100 DEFAULT CHARACTER SET latin1 */;

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Nick Clemens 2021-07-28 14:23:42 UTC
Trivial, passing QA

Thanks Jason!
Comment 5 Jonathan Druart 2021-07-30 14:02:55 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 6 Jonathan Druart 2021-07-30 14:05:26 UTC
Congratulations, Jason, for your first patch pushed! :)
Comment 7 Jason Boyer 2021-07-30 14:06:53 UTC
Woo! Hopefully the next one will be a bit more substantial. :)
Comment 8 Kyle M Hall 2021-08-06 11:48:17 UTC
Pushed to 21.05.x for 21.05.03
Comment 9 Fridolin Somers 2021-08-11 19:12:34 UTC
Depends on Bug 26947 not in 20.11.x