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

Ash Berlin ash_dbix-class at firemirror.com
Mon May 1 11:51:31 CEST 2006


Matija Grabnar wrote:
> 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:
>   

This was a problem i discovered and I thought Matt made a note of maybe
not. The problem is sqlt is pickup up DBIx::Class (as in the db access
module) before it picks up SQL::Translator::Parser::DBIx::Class. Perhaps
try the following (untested) cmd

sqlt -d -f SQL-Translator-Parser-DBIx-Class -t DBIx-Class-File 
STest/Schema.pm

Ash






More information about the Dbix-class mailing list