[Dbix-class] Please test DBIx::Class::Schema::Loader 0.07036_01

Dagfinn Ilmari Mannsåker ilmari at ilmari.org
Sun Aug 11 14:24:05 GMT 2013


Hi all,

I've just uploaded a new development release of
DBIx::Class::Schema::Loader, which improves the handling of multi-schema
databases and many_to_many bridges, so if you use either of these
features, I would greatly appreciate both testing and review of the new
functionality.

The release is at
http://metacpan.org/release/ILMARI/DBIx-Class-Schema-Loader-0.07036_01

And the code on a git branch
https://github.com/dbsrgits/dbix-class-schema-loader/commits/topic/better-multi-schema

The multi-schema changes make it easier to dump several schemas
(potentially with similarly-named tables) in one go, and thus get
inter-schema relationships automatically generated. They are:

  - Allow specifying the separator used for joining moniker parts

    This means you can get monikers on the form MySchema::MyTable,
    without resorting to moniker_map.

  - Allow using all the moniker parts in hashref moniker_map

    For example:

       moniker_parts => [qw(schema name)],
       moniker_map => {
           foo => { bar  => "FooishBar" },
       },

    In which case the table "bar" in the "foo" schema would get the
    moniker "FooishBar".  If no fully-qualified match is found, but a
    non-ref entry for the unqualified name does, this is still used,
    just like before.

  - Allow matching all the moniker parts in constraint/exclude

    If specified as arrayrefs of arrayrefs, the constraint and exclude
    parameters are traversed by matching against each moniker part
    consecutively.  For example:

      db_schema => [qw(some_schema other_schema)],
      moniker_parts => [qw(schema name)],
      constraint => [
        [ qr/\Asome_schema\z/ => qr/\A(?:foo|bar)\z/ ],
        [ qr/\Aother_schema\z/ => qr/\Abaz\z/ ],
      ],

    In which case only the tables "foo" and "bar" in "some_schema" and
    "baz" in "other_schema" will be dumped.

    I just realised I'd forgotten to add documentation for this, I will
    do that before making a proper release.

The many_to_many changes are just fixes for a limitation and a bug that
I discovered when regenerating a schema with the above changes and
picking up some previously-manual many_to_many bridges:

  - Allow specifying custom attributes for many_to_many bridges

    relationship_attrs now gets consulted for many_to_many relationship
    bridges, both in the hashref and coderef forms. For the code ref
    form, the remote "remote" table/columns refers to the table on the
    far side of the link table, not the link table itself.

  - Fix many_to_many bridges involving might_have relationships

    If there's a unique constraint on either of the foreign keys in the
    link table, Schema::Loader no longer fails spectacularly when
    generating the many_to_many bridge. Note that the bridge name is
    still plural, and it returns a resultset, even though there can only
    be one row. This may be improved in future versions.


-- 
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live with
 the consequences of."                              -- Skud's Meta-Law




More information about the DBIx-Class mailing list