Installation

How to automate init of depths, locations, location_addresses?

Re: How to automate init of depths, locations, location_addresses?

by Allan Metts -
Number of replies: 2
Thanks, Mike. I gave it a whirl, but punted in the end and added these tables with a manual login to the Admin course. Looking at intNonNativeTables, it appears that it's doing quite a bit more than addAdmin. If I'm interpreting things correctly, it's consulting a reference DB layout and deciding for itself what represents a "non-native table". I was hoping to find three simple "create table" statements somewhere.

Unfortunately, I'm not fluent at all in PERL -- and even less familiar with WebWork's design and implementation. I pasted the entire subroutine into a fresh file, added a command at the bottom of the file to run that subroutine, and executed the file with wwsh. I got complaints of uninitialized variables and decided I'd reached the end of my competency. :)

I'll post this into GitHub issues in case someone else considers this a worthwhile improvement to the application. Thanks for helping me out!
In reply to Allan Metts

Re: How to automate init of depths, locations, location_addresses?

by Andrew Parker -

instead of copying the subroutine verbatim, import the function itself. It's defined in CourseManagement, so our wwsh script only actually needs two lines.

# tell WeBWorK to import 'initNonNativeTables' from WeBWorK/Utils/CourseManagement.pm
use WeBWorK::Utils::CourseManagement 'initNonNativeTables';

# execute the subroutine as called in CourseAdmin.pm
my $table_update_result = initNonNativeTables($ce, $ce->{dbLayoutName});

# see what's in the return value
warn Dumper($table_update_result);
exit;


In reply to Andrew Parker

Re: How to automate init of depths, locations, location_addresses?

by Allan Metts -

Thanks for posting this, Andrew.  I haven't had a chance to try it on an un-initialized system yet, but it looks like it's exactly what I need.  I'll update the GitHub issue I created previously with your suggestion.