Lines 19-34
Link Here
|
19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
20 |
|
20 |
|
21 |
use Modern::Perl; |
21 |
use Modern::Perl; |
|
|
22 |
|
22 |
use DBIx::Class::Schema::Loader qw/ make_schema_at /; |
23 |
use DBIx::Class::Schema::Loader qw/ make_schema_at /; |
|
|
24 |
|
23 |
use Getopt::Long; |
25 |
use Getopt::Long; |
|
|
26 |
use Pod::Usage; |
24 |
|
27 |
|
25 |
my $path = "./"; |
28 |
my $path = "./"; |
26 |
my $db_driver = 'mysql'; |
29 |
my $db_driver = 'mysql'; |
27 |
my $db_host = 'localhost'; |
30 |
my $db_host = 'localhost'; |
28 |
my $db_port = '3306'; |
31 |
my $db_port = '3306'; |
29 |
my $db_name = ''; |
32 |
my $db_name; |
30 |
my $db_user = ''; |
33 |
my $db_user; |
31 |
my $db_passwd = ''; |
34 |
my $db_passwd; |
|
|
35 |
my $help; |
36 |
|
32 |
GetOptions( |
37 |
GetOptions( |
33 |
"path=s" => \$path, |
38 |
"path=s" => \$path, |
34 |
"db_driver=s" => \$db_driver, |
39 |
"db_driver=s" => \$db_driver, |
Lines 37-46
GetOptions(
Link Here
|
37 |
"db_name=s" => \$db_name, |
42 |
"db_name=s" => \$db_name, |
38 |
"db_user=s" => \$db_user, |
43 |
"db_user=s" => \$db_user, |
39 |
"db_passwd=s" => \$db_passwd, |
44 |
"db_passwd=s" => \$db_passwd, |
|
|
45 |
"h|help" => \$help |
40 |
); |
46 |
); |
41 |
|
47 |
|
42 |
make_schema_at( |
48 |
# If we were asked for usage instructions, do it |
43 |
"Koha::Schema", |
49 |
pod2usage(1) if defined $help; |
44 |
{ debug => 1, dump_directory => $path, preserve_case => 1 }, |
50 |
|
45 |
["DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",$db_user, $db_passwd ] |
51 |
if (! defined $db_name ) { |
46 |
); |
52 |
print "Error: \'db_name\' parameter is mandatory.\n"; |
|
|
53 |
pod2usage(1); |
54 |
} else { |
55 |
|
56 |
make_schema_at( |
57 |
"Koha::Schema", |
58 |
{ debug => 1, dump_directory => $path, preserve_case => 1 }, |
59 |
["DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",$db_user, $db_passwd ] |
60 |
); |
61 |
} |
62 |
|
63 |
1; |
64 |
|
65 |
=head1 NAME |
66 |
|
67 |
misc/devel/update_dbix_class_files.pl |
68 |
|
69 |
=head1 SYNOPSIS |
70 |
|
71 |
update_dbix_class_files.pl --db_name=db-name --db_user=db-user \ |
72 |
--db_passwd=db-pass ... |
73 |
|
74 |
The command in usually called from the root directory for the Koha source tree. |
75 |
If you are runing from another directory, use the --path switch to specify |
76 |
a different path. |
77 |
|
78 |
=head1 OPTIONS |
79 |
|
80 |
=over 8 |
81 |
|
82 |
=item B<--db_name> |
83 |
|
84 |
DB name. (mandatory) |
85 |
|
86 |
=item B<--db_user> |
87 |
|
88 |
DB user name. |
89 |
|
90 |
=item B<--db_passwd> |
91 |
|
92 |
DB password. |
93 |
|
94 |
=item B<--db_driver> |
95 |
|
96 |
DB driver to be used. (defaults to 'mysql') |
97 |
|
98 |
=item B<--db_host> |
99 |
|
100 |
hostname for the DB server. (defaults to 'localhost') |
101 |
|
102 |
=item B<--db_port> |
103 |
|
104 |
port number for the DB server. (defaults to '3306') |
105 |
|
106 |
=item B<--path> |
107 |
|
108 |
path into which create the schema files. (defaults to './') |
109 |
|
110 |
=item B<-h|--help> |
111 |
|
112 |
prints this help text |
113 |
|
114 |
=back |
47 |
- |
|
|