[Dbix-class] Using sqlt with DBIx-Class schemas

Matija Grabnar matija at literal.si
Mon May 1 09:48:16 CEST 2006


For a project (in Catalyst, if it matters) I wanted to write a 
DBIx::Class schema first, then use sqlt to translate that schema into 
appropriate SQL commands to create the database. (I considered doing it 
the other way, but I don't think sqlt would correctly pick up 
many-to-many relations automaticaly)

However, I'm having a problem: sqlt refuses to parse my DBIx::Class schema.
The error is:
Error: translate: Error with parser 'DBIx::Class': Undefined subroutine 
&DBIx::Class::parse called at 
/usr/local/share/perl/5.8.8/SQL/Translator.pm line 484.

When I run sqlt in debug mode, I see a difference between how the 
DBIx::Class producer (which works) and the parser (which doesn't work) 
get registered:

sqlt -d -f DBIx-Class -t DBIx-Class-File STest/Schema.pm
[SQL::Translator] Got parser: code ref
[SQL::Translator] Got producer: code ref
[SQL::Translator] Got parser: DBIx::Class::parse
[SQL::Translator] Got producer: 
SQL::Translator::Producer::DBIx::Class::File::produce
[SQL::Translator] Got filename: 'STest/Schema.pm'
[SQL::Translator] Opening 'STest/Schema.pm' to get contents.
Error: translate: Error with parser 'DBIx::Class': Undefined subroutine 
&DBIx::Class::parse called at 
/usr/local/share/perl/5.8.8/SQL/Translator.pm line 484.

The producer is registered with a full 
SQL::Translator::Producer::DBIx::Class::File::produce class, while the 
parser just gets registered DBIx::Class::parse class.

Is that a sqlt problem, or a DBIx::Class problem in the parsing module?



More information about the Dbix-class mailing list