Skip Menu |

This queue is for tickets about the DBIx-Class-Schema-Loader CPAN distribution.

Report information
The Basics
Id: 55383
Status: resolved
Priority: 0/
Queue: DBIx-Class-Schema-Loader

People
Owner: Nobody in particular
Requestors: ovid [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.05003
Fixed in: (no value)



Subject: Would like a .dcslrc file
I'm not sure of the exact syntax, but it would be nice to have a .schema_rc file. Currently when I rebuild my schema, I do the following: perl script/veure_create.pl model \ DB DBIC::Schema Veure::Schema create=static \ exclude=dbix_migration \ components=TimeStamp,EncodedColumn \ dbi:Pg:dbname=veure $user $pass I've just created a "stations_visited" table and in that table I have a reference to "character_id". In my Veure::Schema::Result::Character class, I now have the following "has_many" relationship: __PACKAGE__->has_many( "stations_visiteds", "Veure::Schema::Result::StationsVisited", { "foreign.character_id" => "self.id" }, ); "stations_visited" is disappointing. What I would love to see is a .schema_rc file which gives me the power to override certain names so that if DCSL's normally good naming defaults don't work, it's easy to still override them. I'm sure I could subclass DCSL to get what I want, but really, I just care about overriding naming at times. Slogging through all of the code when I just want a configuration file is a distraction from building my own code :) Cheers, Ovid
On Tue Mar 09 15:25:44 2010, OVID wrote: Show quoted text
> I've just created a "stations_visited" table and in that table I have a > reference to "character_id". In my Veure::Schema::Result::Character > class, I now have the following "has_many" relationship: > > __PACKAGE__->has_many( > "stations_visiteds", > "Veure::Schema::Result::StationsVisited", > { "foreign.character_id" => "self.id" }, > );
I forgot to mention that I have worked on two BBC projects which do not use DCSL for this reason. They want fine-grained control over these names, so they're writing classes manually when they'd rather not. Cheers, Ovid
Subject: Re: [rt.cpan.org #55383] Would like a .dcslrc file
Date: Tue, 9 Mar 2010 15:53:31 -0500
To: Curtis 'Ovid' Poe via RT <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>
From: Rafael Kitover <rkitover [...] io.com>
On Tue, Mar 09, 2010 at 03:25:54PM -0500, Curtis 'Ovid' Poe via RT wrote: Show quoted text
> Tue Mar 09 15:25:44 2010: Request 55383 was acted upon. > Transaction: Ticket created by OVID > Queue: DBIx-Class-Schema-Loader > Subject: Would like a .dcslrc file > Broken in: 0.05003 > Severity: Wishlist > Owner: Nobody > Requestors: ovid@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=55383 > > > > I'm not sure of the exact syntax, but it would be nice to have a > .schema_rc file. Currently when I rebuild my schema, I do the following: > > perl script/veure_create.pl model \ > DB DBIC::Schema Veure::Schema create=static \ > exclude=dbix_migration \ > components=TimeStamp,EncodedColumn \ > dbi:Pg:dbname=veure $user $pass > > I've just created a "stations_visited" table and in that table I have a > reference to "character_id". In my Veure::Schema::Result::Character > class, I now have the following "has_many" relationship: > > __PACKAGE__->has_many( > "stations_visiteds", > "Veure::Schema::Result::StationsVisited", > { "foreign.character_id" => "self.id" }, > ); > > "stations_visited" is disappointing. What I would love to see is a > .schema_rc file which gives me the power to override certain names so > that if DCSL's normally good naming defaults don't work, it's easy to > still override them.
We can certainly do that. In the meanwhile try this option: inflect_plural='{ stations_visited => "rel_name_you_want" }' Show quoted text
> > I'm sure I could subclass DCSL to get what I want, but really, I just care > about overriding naming at times. Slogging through all of the code > when I just want a configuration file is a distraction from building my > own code :) > > Cheers, > Ovid
Subject: Re: [rt.cpan.org #55383] Would like a .dcslrc file
Date: Tue, 9 Mar 2010 13:26:12 -0800 (PST)
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: Ovid <curtis_ovid_poe [...] yahoo.com>
Show quoted text
----- Original Message ----
> From: Rafael Kitover via RT <bug-DBIx-Class-Schema-Loader@rt.cpan.org>
> In the meanwhile try this option: > > inflect_plural='{ stations_visited => "rel_name_you_want" }'
Works like a charm. Thank you :) Yet another thing I missed in the docs. I'm using this module enough that I really, really should read through them carefully :( Cheers, Ovid-- Buy the book - http://www.oreilly.com/catalog/perlhks/ Tech blog - http://use.perl.org/~Ovid/journal/ Twitter - http://twitter.com/OvidPerl Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
Subject: Re: [rt.cpan.org #55383] Would like a .dcslrc file
Date: Thu, 11 Mar 2010 22:06:07 -0500
To: Ovid via RT <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>
From: Rafael Kitover <rkitover [...] cpan.org>
I've added a 'config_file' option in git, which is just a file that returns a hashref to be merged into the other options (but does not override them.) mst suggested that we store options in the Schema.pm, which seems like a good idea. Then when running without options it would default to the ones stored in Schema.pm. That should make things a bit dwimmier in catalyst land too. Will work on adding that soon. On Tue, Mar 09, 2010 at 04:27:14PM -0500, Ovid via RT wrote: Show quoted text
> Queue: DBIx-Class-Schema-Loader > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=55383 > > > ----- Original Message ----
> > From: Rafael Kitover via RT <bug-DBIx-Class-Schema-Loader@rt.cpan.org>
> >
> > In the meanwhile try this option: > > > > inflect_plural='{ stations_visited => "rel_name_you_want" }'
> > > Works like a charm. Thank you :) Yet another thing I missed in the docs. I'm using this module enough that I really, really should read through them carefully :(
Subject: Re: [rt.cpan.org #55383] Would like a .dcslrc file
Date: Tue, 16 Mar 2010 12:39:51 -0400
To: Ovid via RT <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>
From: Rafael Kitover <rkitover [...] cpan.org>
On Tue, Mar 09, 2010 at 04:27:14PM -0500, Ovid via RT wrote: Show quoted text
> Queue: DBIx-Class-Schema-Loader > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=55383 >
I just changed the inflection code again, try git S::L along with: http://pause.perl.org:81/incoming/Lingua-EN-Inflect-Phrase-0.02.tar.gz This takes care of the 'stations visited' case, and some others please. Please let me know if you still get any unsatisfactory names.
Subject: Re: [rt.cpan.org #55383] Would like a .dcslrc file
Date: Wed, 17 Mar 2010 00:29:31 -0700 (PDT)
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: Ovid <curtis_ovid_poe [...] yahoo.com>
--- On Tue, 16/3/10, rkitover@cpan.org via RT <bug-DBIx-Class-Schema-Loader@rt.cpan.org> wrote: Show quoted text
> From: rkitover@cpan.org via RT <bug-DBIx-Class-Schema-Loader@rt.cpan.org>
Show quoted text
> >        Queue:
> DBIx-Class-Schema-Loader > > I just changed the inflection code again, try git S::L > along with: > > http://pause.perl.org:81/incoming/Lingua-EN-Inflect-Phrase-0.02.tar.gz
Some things are better, but other things are worse: =head2 station_area @@ -241,7 +242,7 @@ __PACKAGE__->belongs_to( "station_area", "Veure::Schema::Result::StationArea", { id => "station_area_id" }, - {}, + { on_delete => "CASCADE", on_update => "CASCADE" }, ); Why is this "CASCADE" for these options? This is a drastic change in behavior and certainly not how I've set up my constraints. All of my constraints match the following the following: FOREIGN KEY ($field_name) REFERENCES $table(id) INITIALLY DEFERRED Cheers, Ovid -- Buy the book - http://www.oreilly.com/catalog/perlhks/ Tech blog - http://blogs.perl.org/users/ovid/ Twitter - http://twitter.com/OvidPerl Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
Subject: Re: [rt.cpan.org #55383] Would like a .dcslrc file
Date: Wed, 17 Mar 2010 06:29:39 -0400
To: Ovid via RT <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>
From: Rafael Kitover <rkitover [...] cpan.org>
On Wed, Mar 17, 2010 at 03:31:29AM -0400, Ovid via RT wrote: Show quoted text
> Queue: DBIx-Class-Schema-Loader > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=55383 > > > --- On Tue, 16/3/10, rkitover@cpan.org via RT <bug-DBIx-Class-Schema-Loader@rt.cpan.org> wrote: >
> > From: rkitover@cpan.org via RT <bug-DBIx-Class-Schema-Loader@rt.cpan.org>
>
> > >        Queue:
> > DBIx-Class-Schema-Loader > > > > I just changed the inflection code again, try git S::L > > along with: > > > > http://pause.perl.org:81/incoming/Lingua-EN-Inflect-Phrase-0.02.tar.gz
> > > Some things are better, but other things are worse:
Do you mean in terms of the rel names or the cascade options below? Rel names like 'stations visited' should be handled now. If you see any rel names that are not what you expect, please let me know. Show quoted text
> > =head2 station_area > @@ -241,7 +242,7 @@ __PACKAGE__->belongs_to( > "station_area", > "Veure::Schema::Result::StationArea", > { id => "station_area_id" }, > - {}, > + { on_delete => "CASCADE", on_update => "CASCADE" }, > ); > > Why is this "CASCADE" for these options? This is a drastic change in behavior and certainly not how I've set up my constraints. > > All of my constraints match the following the following: > > FOREIGN KEY ($field_name) REFERENCES $table(id) INITIALLY DEFERRED
This changes only the behavior on $schema->deploy (deploying as DDL to a database) not for DBIC itself. Until we have introspection for cascade/deferrable options, these are good defaults to have I think. I just added is_deferrable => 1 to belongs_to as well.
Added config_file option in 0.06000 TODO: storing loader options in Schema.pm