[Dbix-class] DBIx::Class::Schema::Loader with multiple schemas
nick at webcraftcs.com
Wed Dec 19 22:28:02 GMT 2012
Thanks for your ideas Alejandro,
Operating on the two DBs in db_schema simultaneously ensures that all
inter-DB relationships are created correctly, otherwise they seem to
create independently without any connecting relationships when running
Yes, MySQL uses schema and DB interchangeably
I've actually decided to go for the filter_generated_code option with
which I can just do a regex replace on the table name. This seems to
work ok although I need to override the checksum checking, not ideal.
Thanks for your help!
On 19/12/12 22:02, Alejandro Imass wrote:
> 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..
More information about the DBIx-Class