Search code examples
sqlperldbix-class

How to generate SQL schema from Perl DBIx::Class files?


Please show me how to generate SQL schema from my Perl DBIx::Class files ?

Basically the reverse of make_schema_at in DBIx::Class::Schema::Loader.

I have already built the Perl schema files, I just wish to recreate the schema in my SQL database.

I can't seem to find examples going from Perl -> SQL.

Many thanks in advance.


Solution

  • I believe you are looking for the deploy and deployment_statements functions in DBIx::Class::Schema.

    my $statements = $schema->deployment_statements;
    print "$statements\n";