8a480ad75d
* Added base class files for all tables in koha using DBIx::Class::Schema::Loader. * Added a (very basic) test file for C4::Context * Also added dependencies in required files. To Test: [1] Install patch [2] Make sure you can still connect to Koha [3] You may optionally run this test script: use Koha::Database; use Data::Dumper; my $db = Koha::Database->new(); my $schema = $db->schema(); print Dumper($schema->resultset("Borrower")); If you run this file you should get a DBIx dump of the borrowers table. Signed-off-by: wajasu <matted-34813@mypacks.net> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
28 lines
766 B
Perl
Executable file
28 lines
766 B
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
use warnings;
|
|
use C4::Context;
|
|
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
|
|
use Getopt::Long;
|
|
|
|
my $path = "./";
|
|
GetOptions(
|
|
"path=s" => \$path,
|
|
);
|
|
my $context = new C4::Context;
|
|
my $db_driver;
|
|
if ($context->config("db_scheme")){
|
|
$db_driver=C4::Context->db_scheme2dbi($context->config("db_scheme"));
|
|
}else{
|
|
$db_driver="mysql";
|
|
}
|
|
|
|
|
|
my $db_name = $context->config("database");
|
|
my $db_host = $context->config("hostname");
|
|
my $db_port = $context->config("port") || '';
|
|
my $db_user = $context->config("user");
|
|
my $db_passwd = $context->config("pass");
|
|
|
|
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 ]);
|