|
Lines 1-28
Link Here
|
| 1 |
#!/usr/bin/perl |
|
|
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
use C4::Context; |
| 6 |
use DBIx::Class::Schema::Loader qw/ make_schema_at /; |
| 7 |
use Getopt::Long; |
| 8 |
|
| 9 |
my $path = "./"; |
| 10 |
GetOptions( |
| 11 |
"path=s" => \$path, |
| 12 |
); |
| 13 |
my $context = new C4::Context; |
| 14 |
my $db_driver; |
| 15 |
if ($context->config("db_scheme")){ |
| 16 |
$db_driver=C4::Context->db_scheme2dbi($context->config("db_scheme")); |
| 17 |
}else{ |
| 18 |
$db_driver="mysql"; |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
my $db_name = $context->config("database"); |
| 23 |
my $db_host = $context->config("hostname"); |
| 24 |
my $db_port = $context->config("port") || ''; |
| 25 |
my $db_user = $context->config("user"); |
| 26 |
my $db_passwd = $context->config("pass"); |
| 27 |
|
| 28 |
make_schema_at("Koha::Schema", {debug => 1, dump_directory => $path}, ["DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",$db_user, $db_passwd ]); |