[Dbix-class] Schema export

Jonas Alves jonas.alves at co.clix.pt
Thu Mar 2 01:17:06 CET 2006


I think sqlt isn't prepared to handle DBIC. I patched it this way.

168a169
 > my $dbic_schema;
205a207
 >     'schema=s'         => \$dbic_schema,
239a242
 >         'DBIx::Schema'   => $dbic_schema,


So now you just need to do:
sqlt --from SQL::Translator::Parser::DBIx::Class \
      --to MySQL --schema My::Schema

Maybe there is another way but this works for me.

--Jonas

Bernhard Graf wrote:
> Cookbook tells:
> 
> "To create a MySQL database from an existing DBIx::Class schema, convert
> the schema to MySQL's dialect of SQL:
> 
> sqlt --from DBIx::Class --to MySQL --DBIx::Class "MySchema.pm" > Schema1.sql
> 
> This does not work.
> First of all the --DBIx::Class argument is obviously not valid.
> 
> sqlt --from DBIx::Class --to MySQL "MySchema.pm" > Schema1.sql
> spits out:
> 
> Error: translate: Error with parser 'DBIx::Class': Undefined subroutine
> &DBIx::Class::parse called at
> /usr/lib/perl5/vendor_perl/5.8.5/SQL/Translator.pm line 484.
> 
> What is the correct way?




More information about the Dbix-class mailing list