[Bug 6517] New: koha-create wants "use database" in DEFAULTSQL
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 Bug #: 6517 Summary: koha-create wants "use database" in DEFAULTSQL Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P5 Component: Packaging AssignedTo: robin@catalyst.net.nz ReportedBy: magnus@enger.priv.no QAContact: koha-bugs@lists.koha-community.org If koha-create is given the path to a DEFAULTSQL in /etc/koha/koha-sites.conf, it looks like it expects to find a statement similar to this at the top of that file: use koha___KOHASITE__; This piece of the code will then replace __KOHASITE__ with the name of the site being created: # Populate the database with default content. zcat "$DEFAULTSQL" | sed "s/__KOHASITE__/$name/g" | mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpwd" As far as I can see this means one has to remember to add the use koha___KOHASITE__; to the file whenever a new DEFAULTSQL is created. Wouldn't it be easier and less error prone to make mysql use the right database by including the name of the database in the call to mysql? Something like this: # Populate the database with default content. zcat "$DEFAULTSQL" | mysql --host="$mysqlhost" --user="$mysqluser" --password="$mysqlpwd" $mysqldb -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 --- Comment #1 from Robin Sheat <robin@catalyst.net.nz> 2011-06-19 01:58:21 UTC --- Did you use "koha-dump-defaults" to produce the default SQL? I think that this should take care of it for you. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 --- Comment #2 from Magnus Enger <magnus@enger.priv.no> 2011-06-29 11:21:54 UTC --- Ah, no I used plain ol' mysqldump. But I think it would be good if it was possible to make a mysqldump on a system not running from the packages and then base installs made with the packages on that. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 --- Comment #3 from Robin Sheat <robin@catalyst.net.nz> 2011-06-29 12:26:50 UTC --- You can, use '--all-databases' when running mysqldump (but still provide the database name.) Keep in mind that part of the script is to replace the name of the instance with the placeholder, so that you can make it refer to itself (perhaps a default title or paths or something) and it'll replace that when it's installed to an instance. So it's still handy if you're in a position to use it. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 --- Comment #4 from Robin Sheat <robin@catalyst.net.nz> 2011-06-29 12:27:48 UTC --- oh, --all-databases will put in the exact database name which isn't so good for a template. So your idea is still worthwhile :) -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 Magnus Enger <magnus@enger.priv.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|robin@catalyst.net.nz |magnus@enger.priv.no --- Comment #5 from Magnus Enger <magnus@enger.priv.no> 2011-06-29 21:36:23 UTC --- Created attachment 4537 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=4537 Proposed patch This patch makes sure that pointing DEFAULTSQL in /etc/koha/koha-sites.conf to any (gzip'ed) file produced by mysqldump works, by adding the name of the database to the end of the call to mysql, when the specified SQL file is loaded. Files produced with koha-dump-defaults should still work too. To test: - Apply the patch - Create an SQL file from an existing installation with mysqldump - gzip the SQL file - point DEFAULTSQL to the file in /etc/koha/koha-sites.conf - create a new site with koha-create --create-db -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 Magnus Enger <magnus@enger.priv.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 |PATCH-Sent Patch Status|--- |Needs Signoff -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 Frère Sébastien Marie <semarie-koha@latrappe.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |semarie-koha@latrappe.fr --- Comment #6 from Frère Sébastien Marie <semarie-koha@latrappe.fr> 2011-06-30 06:20:26 UTC --- I suggest that the variable $mysqldb should be quoted. There isn't difference in general case, but it is a better practice to quote arguments. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 Magnus Enger <magnus@enger.priv.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #4537|0 |1 is obsolete| | --- Comment #7 from Magnus Enger <magnus@enger.priv.no> 2011-06-30 06:51:55 UTC --- Created attachment 4538 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=4538 Revised patch The revised patch quotes the variable $mysqldb, as suggested by Frère Sébastien Marie. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #4538|0 |1 is obsolete| | --- Comment #8 from Chris Cormack <chris@bigballofwax.co.nz> 2011-07-02 21:09:05 UTC --- Created attachment 4549 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=4549 Bug 6517 - [REVISED] koha-create wants "use database" in DEFAULTSQL The revised patch quotes the variable $mysqldb, as suggested by Frère Sébastien Marie. This patch makes sure that pointing DEFAULTSQL in /etc/koha/koha-sites.conf to any (gzip'ed) file produced by mysqldump works, by adding the name of the database to the end of the call to mysql, when the specified SQL file is loaded. Files produced with koha-dump-defaults should still work too. To test: - Apply the patch - Create a new package with build-git-snapshot - Install the package - Create an SQL file from an existing installation with mysqldump - gzip the SQL file - point DEFAULTSQL to the file in /etc/koha/koha-sites.conf - create a new site with koha-create --create-db Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz Patch Status|Needs Signoff |Signed Off -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Signed Off |Patch Pushed --- Comment #9 from Chris Cormack <chris@bigballofwax.co.nz> 2011-09-11 22:52:33 UTC --- Packaging only bug, please test -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 --- Comment #10 from Chris Nighswonger <cnighswonger@foundations.edu> 2011-10-26 18:02:20 UTC --- The fix for this bug was published in the 3.4.5 release. If you were the reporter of this bug, please take time to verify the fix and update the status of this bug report accordingly. If the bug is fixed to your satisfaction, please close this report. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6517 Magnus Enger <magnus@enger.priv.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA Contact for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org