Reverse engineer database schema from DBIx::Class
Oliver Gorwits
oliver at cpan.org
Thu Jul 5 22:01:33 BST 2012
On 2012-07-05 10:58, Zbigniew Łukasiak wrote:
> On Thu, Jul 5, 2012 at 11:47 AM, Shantanu Bhadoria
> <shantanu at cpan.org> wrote:
>> DBIx::Class. Then in a stupid move I deleted my db by accident and I
>> am now
>> left with only the schema classes.I didnt really have any data in
>> the db
>> but is there a way to create a DB schema sql back from DBIx::Class
>> Result
>> classes?
>
> Have a look at:
>
> http://search.cpan.org/~arodland/DBIx-Class-0.08196/lib/DBIx/Class/Schema.pm#deploy
and if you just want the SQL statements printing, something like this
should work:
perl -I./lib -MDBIx::Class -MMy::Schema -e \
'$s=My::Schema->connect("dbi:mysql:"); print scalar
$s->storage->deployment_statements($s, undef, undef, undef,
{no_comments => 1,
quote_table_names => 0,
quote_field_names => 0})'
HTH,
regards,
oliver.
More information about the london.pm
mailing list