[Catalyst] Re: Model Helper and PostgreSql Schemas

Alejandro Imass alejandro.imass at gmail.com
Sun Feb 15 18:32:38 GMT 2009


Solved.

After hacking the helper classes and dbic loader, I was happy to
discover that the Catalyst folks have though of this. You can pass
anything after user, pass and will get evaled and passed to the
subclasses, so if you do this:

script/inventory_create.pl model [MODEL_HERE] DBIC::Schema
[PATH_TO_SCHEMA] create=static dbi:Pg:dbname=[DB_NAME] [USER] [PASS]
"{loader_options=>{db_schema=>'[DB_SCHEMA]'}}"

This optional hash at the end finds it's way all the way down to the
specific driver implementation of
DBIx::Class::Schema::Loader::DBI::XXX

Just for the record:
Time taken: a bit more than an hour
Tools used: warn, Data::Dumper



On Mon, Feb 16, 2009 at 12:28 PM, Alejandro Imass
<alejandro.imass at gmail.com> wrote:
> Hi,
>
> I am starting a new project that uses database schemas. The Model
> helper script does not pass down parameters to
> DBIx::Class::Schema::Loader which in turn should pass them down to the
> actual DBD implementation in this case,
> DBIx::Class::Schema::Loader::DBI::Pg which has code like so:
>
> sub _setup {
>    my $self = shift;
>
>    $self->next::method(@_);
>    $self->{db_schema} ||= 'public';
> }
>
> From the DBIC docs and code, this param can be passed with a hash that
> has a key named "loader_options", where I can supposedly set
> "db_schema" and should trickle down to the specific driver. But I
> really don't know much more at the moment since I've never used the
> DBIC::Schema:.Loader outside of Catalyst.
>
> Before I dive further into this and re-invent the wheel, the question
> is if anyone here is working with database schemas with Catalyst and
> has hacked their own version of the helper script, or perhaps the
> helper script actually supports schemas somehow?
>
> Best,
> Alejandro Imass
>



More information about the Catalyst mailing list