Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Errors when dumping database in Catalyst after make install

by Beatnik (Parson)
on Feb 17, 2016 at 22:46 UTC ( #1155499=perlquestion: print w/replies, xml ) Need Help??

Beatnik has asked for the wisdom of the Perl Monks concerning the following question:

So I've been working on the dev server code of some Catalyst application for a while. I decided to deploy it to a nginx instance and 'install' it properly. All went fine until I needed to make some database updates and needed to regenerate all Result classes. I ran script/foo_create.pl model DB DBIC::Schema Foo::Schema create=static dbi:mysql:foo root password quote_names=1 like I had been before to regenerate the classes. Unfortunately, now I got a whole bunch of errors like below for pretty much all tables in the database.
********************************************************************** +***** DBIx::Class::Relationship::ManyToMany::many_to_many(): ********************************************************************** +***** The many-to-many relationship 'users' is trying to create a utility me +thod called users_rs. This will completely overwrite one such already existing method on cla +ss Foo::Schema::Result::Role. You almost certainly want to rename your method or the many-to-many relationship, as the functionality of the original method will not be accessible anymore. To disable this warning set to a true value the environment variable DBIC_OVERWRITE_HELPER_METHODS_OK ********************************************************************** +***** exists "/home/hendrik/Foo/script/../lib/Foo/Model/DB.pm".
I understand this is triggered by a specific setting for DBIx::Class::Schema::Loader but I can't seem to find how I set that flag. I did try to add it as an argument to the create script or add it to the base class in the package config method. The Result classes are containing all methods twice as they're being loaded through 'existing' instances in @INC. Any hints?
# Created by DBIx::Class::Schema::Loader v0.07045 @ 2016-02-17 22:44:4 +1 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bMzHYuEZzJ2A0eJIDbbqVA # These lines were loaded from '/usr/local/share/perl/5.18.2/Foo/Schem +a/Result/User.pm' found in @INC. # They are now part of the custom portion of this file # for you to hand-edit. If you do not either delete # this section or remove that file from @INC, this section # will be repeated redundantly when you re-create this # file again via Loader! See skip_load_external to disable # this feature.


Greetz
Beatnik
... I'm belgian but I don't play one on TV.

Replies are listed 'Best First'.
Re: Errors when dumping database in Catalyst after make install
by Myrddin Wyllt (Hermit) on Feb 18, 2016 at 00:57 UTC

    I've had this happen when I tried to re-create the schema of a dev version catalyst application on a machine that had an existing version installed to somewhere in @INC. I got round it by removing the conflicting version, running the create script and re-installing, although I realise this may not be an option in your case.

    I just re-created my conflict situation and adding the skip_load_external option to foo_create.pl is working here. So I am getting the errors when I run:-

     script/foo_create.pl model DB DBIC::Schema Foo::Schema create=static dbi:mysql:foo root password

    but not when I run:-

    script/foo_create.pl model DB DBIC::Schema Foo::Schema create=static +skip_load_external=1 dbi:mysql:foo root password

    I think it might matter that the option appears before the connection string, as the DBIx::Class::Schema::Loader docs say that options after the connection don't have any effect - I haven't trawled through the Catalyst code to check this, but as I say, it's working for me as listed above. (Catalyst 5.90103)

    UPDATE - I've just tested it again with the option after the connect string, and it doesn't make any difference - still getting errors with skip_load_external=0, which are fixed with skip_load_external=1

      I played around a bit with the relationships in the file, ran a number of variations of the create script and cleaned up @INC. All seems to be OK, for now. skip_load_external=1 has a different effect than skip_load_external=0 and leaving it out altogether.


      Greetz
      Beatnik
      ... I'm belgian but I don't play one on TV.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1155499]
Approved by Tanktalus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2019-07-20 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?