I am so frustrated having to write those elongated --db_name, --db* parameters. This patch automatically loads defaults from your ~/.my.cnf so you don't have to copypaste stuff or write ad-hoc bash scripts.
Created attachment 60918 [details] [review] Bug 18229 - update_dbix_class_files.pl loads defaults from ~/.my.cnf A) Put this to your ~/.my.cnf [client] host = 10.0.3.10 port = 3306 user = koha_ci password = "Mr. senior plays with his junior" database = koha_ci B) Then run update_dbix_class_files.pl perl misc/devel/update_dbix_class_files.pl --tablename issuingrules C) Update DBIx::Class files like a boss
See: commit e0b0ae20531736ede2cd1113baf16323cb69b3d9 bug 8798: (follow-up) pass DB connection params to DBIC schema updater explicitly This patch changes update_dbix_class_files.pl so that the connection parameters to the reference database must be passed explicitly via command-line switches, rather than grabbing them from the current Koha context. The purpose of this is to intentionally put up a roadblock to reduce the chance that a developer (or release manager) accidentally updates the schema files to include local testing cruft such as temporary tables.
If you feel like that. I don't mind forking this feature.
Actually I already wrote such a patch, but when I say Galen's patch I did not submit mine. I think this could be re-discussed.
(In reply to Jonathan Druart from comment #4) > Actually I already wrote such a patch, but when I say Galen's patch I did > not submit mine. > > I think this could be re-discussed. Hmm.. I also wrote a similar patch (in bug 21177). We are at least 3 developers annoyed enough to have written a patch to change that. I think the reasoning behind this "roadblock" is not valid. Developers are lazy by definition, and if they are annoyed or frustrated by this they will quickly write a custom script to read $KOHA_CONF (or my.cnf) and call update_dbix_class_files.pl with the correct parameters (like this one: https://gitlab.com/snippets/1753594) Anyway the real danger is for people that push these modifications (RM and RMaint), and I think they know what they're doing. Now, about this particular bug, I think reading .my.cnf will not be useful for everyone. I, for instance, have several instances of Koha on the same host, and .my.cnf references my primary koha database. So if I'm working on another instance and forget to set --db_name, the script will update my local schema based on another database. So reading $KOHA_CONF would be better in my case.
I think it makes more sense to read koha-conf.xml, marking as a duplicate of bug 21177. Feel free to reopen if you disagree. *** This bug has been marked as a duplicate of bug 21177 ***