Bug 18000 - Add --tablename option to misc/devel/update_dbix_class_files.pl script
Summary: Add --tablename option to misc/devel/update_dbix_class_files.pl script
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Alex Arnaud
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks: 18229
  Show dependency treegraph
 
Reported: 2017-01-26 14:36 UTC by Alex Arnaud
Modified: 2017-03-10 11:08 UTC (History)
4 users (show)

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


Attachments
Bug 18000 - Add --tablename option to misc/devel/update_dbix_class_files.pl script (1.41 KB, patch)
2017-01-26 14:37 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 18000 - Add --tablename option to misc/devel/update_dbix_class_files.pl script (1.41 KB, patch)
2017-01-26 14:39 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 18000 - Add --tablename option to misc/devel/update_dbix_class_files.pl script (1.62 KB, patch)
2017-03-08 15:27 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Arnaud 2017-01-26 14:36:42 UTC
Developers,

Don't you think it's quite disturbing to see that all Koha schema files appear as modified in your git status when you ran update_dbix_class_files.pl script to get the one related to the table you've just created ?

If yes, here is a patch that add the ability to specify a table name to this script, so test and sign.
Comment 1 Alex Arnaud 2017-01-26 14:37:42 UTC Comment hidden (obsolete)
Comment 2 Alex Arnaud 2017-01-26 14:39:25 UTC
Created attachment 59585 [details] [review]
Bug 18000 - Add --tablename option to misc/devel/update_dbix_class_files.pl script
Comment 3 Jonathan Druart 2017-01-27 10:46:30 UTC
I think this is fixed in new version of DBIx::Class::Schema::Loader, I have 0.07042
Comment 4 Alex Arnaud 2017-01-27 11:55:00 UTC
(In reply to Jonathan Druart from comment #3)
> I think this is fixed in new version of DBIx::Class::Schema::Loader, I have
> 0.07042

Tested with version 0.07046 and it's better but i still got about thirty files modified. I keep thinking this feature could be nice to avoid that.
Comment 5 Jonathan Druart 2017-01-27 12:02:14 UTC
It would be good to pass several tables. It seems that we can pass a regexp, so I tried:
  --tablename='*borro*'

And got:
\A* matches null string many times in regex; marked by <-- HERE in m/\A* <-- HERE borro*\z/ at misc/devel/update_dbix_class_files.pl line 59.
Comment 6 Olli-Antti Kivilahti 2017-03-08 15:27:39 UTC
Created attachment 60919 [details] [review]
Bug 18000 - Add --tablename option to misc/devel/update_dbix_class_files.pl script

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Makes life working with DBIx::Class less miserable.
    perl misc/devel/update_dbix_class_files.pl --tablename issuingrules
Works as advertised.
Comment 7 Olli-Antti Kivilahti 2017-03-08 15:30:27 UTC
This is a much needed improvement.

Typically we only alter one table at a time so multiple table updating is not very important for most developers.

If you are a RM, you prolly use this without --tablename.

See Bug 18229 to make this even more approachable.
Comment 8 Marcel de Rooy 2017-03-10 11:08:46 UTC
This does not seem to work.
I tested table virtualshelves (added a column).
The results between running with table only and on the whole db are different.
If you run only on one table, you loose has_many and belongs_to etc.
Seems quite dangerous..