[Dbix-class] Column renaming.

Peter Rabbitson rabbit+dbic at rabbit.us
Mon Apr 22 09:42:42 GMT 2013


On Sun, Apr 21, 2013 at 09:55:53AM -0700, Bill Moseley wrote:
> I have a column in a table that is going to be renamed from "foo" to "bar".
>  I know I can use the "accessor" attribute, but there's other usage such as
> $obj->update( { foo => 'new' } ), and also ->create and the column is used
> in joins   ( { 'other.foo' => 'new' } ).
> 
> Is there any other option besides a big search and replace and hope tests
> catch all usage?
> 


The "right way"(tm) is the new Data::Query based architecture, but that is
not yet near production use. An alternative is a hacky but working hook of
a spot in SQL::Abstract where all column names pass through eventually.

There was some work done on this but it stalled due to lack of tuits 
(and people willing to work on the gnarly codepath) [1]. The Oracle 
storage is currently using the same approach because of its inability of 
supporting identifiers longer than 30 characters [2].

HTH

Cheers

[1] https://github.com/dbsrgits/dbix-class/compare/master...blocked_by_work_suspended_before_dq_lands;alias-columns
[2] https://github.com/dbsrgits/dbix-class/blob/master/lib/DBIx/Class/SQLMaker/Oracle.pm#L110





More information about the DBIx-Class mailing list