How to use DBIx::Class::Schema::Loader to create schema from an existing MySQL database? -
i trying use dbix::class::schema::loader create schema existing mysql database. used make_schema_at method this:
c:\xampp\perl\bin>perl -mdbix::class::schema::loader=make_schema_at,dump_to_dir:.\lib -e "make_schema_at('turboimmisoft::schema', ['dbi::mysql::dbname=turboimmisoft', 'root', ''])" where: turboimmisoft name of database
i got following error message:
reference found even-sized list expected @ c:/xampp/perl/site/lib/dbix/class/schema/loader.pm line 165. dbix::class::storage::dbi::_connect(): did not provide connection_info @ -e line 1 [download] using activeperl 5.14.4 on windows vista , path the mysql database is: "c:\xampp\mysql\data\". path perl.exe is: "c:\xampp\perl\bin\" to connect mysql database dbi (not dbix::class), use:
use dbi; $driver = "mysql"; $database = "turboimmisoft"; $dsn = "dbi:$driver:database=$database"; $userid = "root"; $password = ""; $dbh = dbi->connect($dsn, $userid, $password) #, {raiseerror => 1 +, autocommit => 1} or die "could not connect database:$dbi::errstr"; any appreciated. new dbix::class have been using dbi since 2007.
do have create new folders in dbix::class folder new schema?
10 months late realize, stumbled across searching else. make_schema_at call wrong.
make_schema_at( $schema, \%loader_options, [$dsn, $user, $pass] ); make_schema_at documentation
you passing in arrayref make_schema_at expecting hashref.
try
c:\xampp\perl\bin>perl -mdbix::class::schema::loader=make_schema_at,dump_to_dir:.\lib -e "make_schema_at('turboimmisoft::schema', { debug => 1 }, ['dbi:mysql:dbname=turboimmisoft', 'root', ''])"
Comments
Post a Comment