[Catalyst] Postgresql database with non default -public- schema
Peter Shangov
pshangov at yahoo.com
Wed Oct 20 16:02:30 GMT 2010
Hi,
When generating models your create.pl script uses internally
DBIx::Class::Schema::Loader and you can pass to it most of the options that you
can pass to DBIx::Class::Schema::Loader's dbicdump utility. You will probably
need to use 'db_schema', which lets you specify the schema for which to generate
table classes. You may also look into 'qualify_objects', which prepends the
value of 'db_schema' to table names and relationships (this may be useful if you
are working with multiple schemas simultaneously). All of the above options are
documented in the docs for DBIx::Class::Schema::Loader::Base.
Regards,
----- Original Message ----
> From: Hetényi Csaba <csabiwork at tata.hu>
> To: The elegant MVC web framework <catalyst at lists.scsys.co.uk>
> Sent: Wed, 20 October, 2010 17:22:15
> Subject: [Catalyst] Postgresql database with non default -public- schema
>
> Dear All
>
> Please forgive me, may i must ask this question on DBIX maillist.
>
> I'd like to use "script/???_create.pl" helper script to create
> model from a PostgreSql database.
> But my tables are not in the default Postgre tablespace (public).
>
> Is this helper script capable to automatically create model for
> the non-default tablespace?
>
> If i run the script the standard way:
>
> script/pcm_create.pl model DB DBIC::Schema Pcm::Schema create=static
>components=TimeStamp,EncodedColumn 'dbi:Pg:dbname=pcmv2;host=xxx.xx' 'pcmuser'
>'xxx' '{ AutoCommit => 1 }'
>
> the script dumps schema without errors:
>
> ...
> Dumping manual schema for Pcm::Schema to directory
>/home/csabi/Dev/Pcm/script/../lib ...
> Schema dump completed.
> created "/home/csabi/Dev/Pcm/script/../lib/Pcm/Model/DB.pm"
> created "/home/csabi/Dev/Pcm/script/../t/model_DB.t"
>
> But when starting the application it says:
>
> ******************************* WARNING
>***************************************
> * No sources found (did you forget to define your tables?)
>*
> *
>*
> * To turn off this warning, set the CMDS_NO_SOURCES environment variable.
>*
>
*******************************************************************************
>
> which is correct, because there is no tables in the default "public" pg
>schema.
> My tables are in the manually created "pcmbiz" schema.
>
> Thank You in advance!
>
> -- Hetényi Csaba
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
More information about the Catalyst
mailing list