The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

dsc_dump_schema.pl - script to dump a schema from a database

SYNOPSIS

  #dump all tables
  dsc_dump_schema.pl --dsn DBI:mysql:database=mydb;host=127.0.0.1;mysql_enable_utf8=1 \
  -u me -p mypassword --overwrite 1 --lib_root ./lib

  #dump only the "users" table - using short options and choosing a namespace
  dsc_dump_schema.pl -dsn dbi:SQLite:database=etc/ado.sqlite -n Ado::Model -l lib -t users
  
  dsc_dump_schema.pl -? #for more help
  

DESCRIPTION

This is a helper script to dump DBIx::Simple::Class based classes from an existing database. Currently it is known to work with mysql and SQLite databases.

You can then edit those classes, add methods and customise the checks for the accepted table fields in each of the dumped classes. You can also use these classes ASIS to access and update table rows in an object oriented fashion.

OPTIONS

--help|-h|?

More verbose help screen

--dsn|-d

The connection string you would pass to DBI->connect() when connecting to your database.

--user|-u

Username for the database.

  --username myuser@somehost

--password|-p

  --password mysecret

Password for the database.

--namespace|-n

Base class namespace used for your schema. Optional. If not passed it will be guessed from the schema name:

  my_dbname -> MyDbname

  --namespace MyModel

--overwrite|-o

If there are alreday dumped classed to the desired location on the filesystem they will be ovwerwritten.

  --overwrite 1

--lib_root|-l

Directory path in which the classes will be dumped. The directory must exist. It will not be created.

--table|-t

This option allows you to specify a table name. In some cases after modifying some table you may need to dump a class only for this table. Note! When a table is specified the base (schema) class is not generated!

  #only table users
  -t users

  #all tables starting with "shop"
  -t shop%

SEE ALSO

DBIx::Simple::Class, DBIx::Simple, DBIx::Simple::Class::Schema, Mojolicious::Plugin::DSC

LICENSE AND COPYRIGHT

Copyright 2013 Красимир Беров (Krasimir Berov).

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

See http://www.opensource.org/licenses/artistic-license-2.0 for more information.