dsc_dump_schema.pl - script to dump a schema from a database
#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
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.
More verbose help screen
The connection string you would pass to DBI->connect() when connecting to your database.
DBI->connect()
Username for the database.
--username myuser@somehost
--password mysecret
Password for the database.
Base class namespace used for your schema. Optional. If not passed it will be guessed from the schema name:
my_dbname -> MyDbname --namespace MyModel
If there are alreday dumped classed to the desired location on the filesystem they will be ovwerwritten.
--overwrite 1
Directory path in which the classes will be dumped. The directory must exist. It will not be created.
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%
DBIx::Simple::Class, DBIx::Simple, DBIx::Simple::Class::Schema, Mojolicious::Plugin::DSC
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.
To install DBIx::Simple::Class, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Simple::Class
CPAN shell
perl -MCPAN -e shell install DBIx::Simple::Class
For more information on module installation, please visit the detailed CPAN module installation guide.