From: Rafael Kitover Date: Mon, 24 Jan 2011 14:40:24 +0000 (-0500) Subject: update Schema::Loader docs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cab771879758e25c8ade74fc2f8fbc81d8163848;p=dbsrgits%2FDBIx-Class-Historic.git update Schema::Loader docs --- diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index 7fe2058..47e85f9 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -1370,14 +1370,21 @@ retry if the server goes away mid-operations, unlike C. L will connect to a database and create a L and associated sources by examining the database. -The recommend way of achieving this is to use the +The recommend way of achieving this is to use the L utility or the +L helper, as described in +L. + +Alternatively, use the L method: perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:./lib \ - -e 'make_schema_at("My::Schema", { debug => 1 }, [ "dbi:Pg:dbname=foo","postgres" ])' + -e 'make_schema_at("My::Schema", \ + { db_schema => 'myschema', components => ["InflateColumn::DateTime"] }, \ + [ "dbi:Pg:dbname=foo", "username", "password" ])' -This will create a tree of files rooted at C<./lib/My/Schema/> containing -source definitions for all the tables found in the C database. +This will create a tree of files rooted at C<./lib/My/Schema/> containing source +definitions for all the tables found in the C schema in the C +database. =head2 Creating DDL SQL diff --git a/lib/DBIx/Class/Manual/Intro.pod b/lib/DBIx/Class/Manual/Intro.pod index b39c0e3..2d83e31 100644 --- a/lib/DBIx/Class/Manual/Intro.pod +++ b/lib/DBIx/Class/Manual/Intro.pod @@ -74,7 +74,8 @@ L objects. Let's look at how you can set and use your first native L tree. First we'll see how you can set up your classes yourself. If you want them to -be auto-discovered, just skip to the next section, which shows you how to use +be auto-discovered, just skip to the L, which shows you how to use L. =head2 Setting it up manually @@ -191,28 +192,31 @@ foreign key: See L for more information about the various types of available relationships and how you can design your own. -=head2 Using L +=head2 Using DBIx::Class::Schema::Loader -This is an external module, and not part of the L distribution. -It inspects your database, and automatically creates classes for all the tables -in your database. +This module (L) is an external module, and not part +of the L distribution. It inspects your database, and automatically +creates classes for all the tables in your schema. The simplest way to use it is via the L script from the L distribution. For example: - $ dbicdump -o dump_directory=./lib MyApp::Schema dbi:mysql:mydb user pass + $ dbicdump -o dump_directory=./lib \ + -o components='["InflateColumn::DateTime"]' \ + MyApp::Schema dbi:mysql:mydb user pass If you have a mixed-case database, use the C option, e.g.: - $ dbicdump -o dump_directory=./lib -o preserve_case=1 MyApp::Schema \ - dbi:mysql:mydb user pass + $ dbicdump -o dump_directory=./lib -o preserve_case=1 \ + -o components='["InflateColumn::DateTime"]' \ + MyApp::Schema dbi:mysql:mydb user pass If you are using L, then you can use the helper that comes with L: $ script/myapp_create.pl model MyDB DBIC::Schema MyDB::Schema \ create=static moniker_map='{ foo => "FOO" }' dbi:SQLite:./myapp.db \ - on_connect_do='PRAGMA foreign_keys=ON' quote_char='"' + on_connect_do='PRAGMA foreign_keys=ON' quote_char='"' name_sep='.' See L for more information on this helper.