[Dbix-class] DBIx::Class::Schema::Loader with multiple schemas
aimass at yabarana.com
Wed Dec 19 22:02:19 GMT 2012
On Wed, Dec 19, 2012 at 4:51 PM, Nick Anderson <nick at webcraftcs.com> wrote:
> Thanks for that.
> I am using db_schema:
> db_schema => ['A','B']
> but it still adds the prefixes for both DBs even for the DB specified in the
> connection info.
I have never tried an arrayref on db_schema. But just a thought... If
you run the loader twice with a single db_schema per run, it still
creates prefixes even on non-conflicting tables?
> I'm using MySQL
AFAIK a 'schema' in MySQL is actually what MySQL calls a database, in
other words database = schema in MySQL. In Oracle a schema is actually
a user and in Pg a schema is actually a schema.
Maybe in your case, running the loader several times over the same
namespace and forgetting about the db_schema but switching databases
will. work. The disadvantage is that conflicting tables result classes
will be overridden.
Yet another option that comes to mind is run the loader several times.
The first time without schema. This will be your database A (that you
don't want prefixes in). Then run the loader for each other database
and use monikers to force the prefix?
Anyway, just trying to help by pitching in some ideas..
> On 19/12/12 21:22, Alejandro Imass wrote:
>> On Wed, Dec 19, 2012 at 3:06 PM, Nick Anderson<nick at webcraftcs.com>
>>> I am trying to use DBIx::Class::Schema::Loader to create a schema for two
>>> inter-related databases but am having trouble where it insists on
>>> with the database name:
>>> With one database, it doesn't include the prefix.
>>> With two it includes it even where there are no conflicting table names.
>> Going out on a limb here but instead of moniker_parts have you looked
>> at using the db_schema option? it should load tables owned by that
>> user (or in that schema in Pg's case) without prefix and only add the
>> prefix on conflicting ones. I use Pg schemas and works well for me.
>> BTW you did not mention your RDBMS.
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
More information about the DBIx-Class