This initialization is done in the subroutine: InitNonNativeTables()
(searching for that term in the webwork2 directory I get:
~/webwork-docker2/webwork2/lib/WeBWorK/ContentGenerator/CourseAdmin.pm:37: listArchivedCourses unarchiveCourse initNonNativeTables);
~/webwork-docker2/webwork2/lib/WeBWorK/ContentGenerator/CourseAdmin.pm:70: my $table_update_result = initNonNativeTables($ce, $ce->{dbLayoutName});
~/webwork-docker2/webwork2/lib/WeBWorK/Utils/CourseManagement.pm:52: initNonNativeTables
~/webwork-docker2/webwork2/lib/WeBWorK/Utils/CourseManagement.pm:1143: =item initNonNativeTables($ce, $db, $dbLayoutName, %options)
~/webwork-docker2/webwork2/lib/WeBWorK/Utils/CourseManagement.pm:1152: sub initNonNativeTables {
so the function is define on line 1152 of .../Utils/CourseManagement.pm and called on line 70 of CourseAdmin.pm (which is the admin course front page)
You should be able to write a short script fragment which you can use with wwsh. one example of such a fragment is addadmin which is called from the bin directory via wwsh admin ./addadmin
You comments in wwsh may be enough to tell you how you could access the initNonNativeTables() function and run it from the command line.
I've not tried it, but it seems like it might work. Let us know how it goes.
-- Mike