Search code examples
perlschemacatalystdbix-class

dbix::class generate schema for a non-catalyst app


I've been building Catalyst apps lately and one thing I love is using Catalyst's create script to easily generate the table schemas for DBIx::Class. I'd like to be able to use DBIX::Class without having to write the schemas for my tables manually. Is there a way to do this without doing it by hand? Thanks!


Solution

  • DBIx::Class::Schema::Loader's dbicdump script can be used for dumping schema. An example from the documentation:

    dbicdump -o dump_directory=./lib \
             -o components='["InflateColumn::DateTime"]' \
             -o debug=1 \
             My::Schema \
             'dbi:Pg:dbname=foo' \
             myuser \
             mypassword