On 8/28/06, Nathanial Hendler <[EMAIL PROTECTED]> wrote:
In the Schema::Loader docs here: http://search.cpan.org/~blblack/DBIx-Class-Schema-Loader-0.03007/lib/DBIx/Class/Schema/Loader.pm#make_schema_at
You'll find the rather convoluted commandline example that can do it all in one shot:
perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:./lib -e 'make_schema_at("New::Schema::Name", { relationships => 1 }, [ "dbi:Pg:dbname=foo","postgres" ])'
Notice the "dump_to_dir:./lib" is telling it to dump into "./lib" directory, and "New/Schema/Name.pm" will be your schema file (+ the files for each table at New/Schema/Name/Foo.pm)
Its ugly to use from the commandline at the moment, but there should be something prettier in the not-too-distant future (or if you're using Catalyst, the Catalyst::Model::DBIC::Schema helper does this for you in create=static mode)
-- Brandon
Is there an example anywhere of doing it the "abnormal" way? I'm not
sure of all the things that need to be done to keep it from having to
scan the database at load time.
In the Schema::Loader docs here: http://search.cpan.org/~blblack/DBIx-Class-Schema-Loader-0.03007/lib/DBIx/Class/Schema/Loader.pm#make_schema_at
You'll find the rather convoluted commandline example that can do it all in one shot:
perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:./lib -e 'make_schema_at("New::Schema::Name", { relationships => 1 }, [ "dbi:Pg:dbname=foo","postgres" ])'
Notice the "dump_to_dir:./lib" is telling it to dump into "./lib" directory, and "New/Schema/Name.pm" will be your schema file (+ the files for each table at New/Schema/Name/Foo.pm)
Its ugly to use from the commandline at the moment, but there should be something prettier in the not-too-distant future (or if you're using Catalyst, the Catalyst::Model::DBIC::Schema helper does this for you in create=static mode)
-- Brandon
_______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
