Bernhard Graf wrote:
> One common practice to avoid problems with reserved words in column (or 
> table) names is to prefix every name with an underscore.
> 
> Is there an elegant and working way in DBIC to accomplish this?
> 
> I already tried
> 
> __PACKAGE__->add_columns(
>   user => {
>     data_type => 'varchar',
>     name => '_user',
>   },
> );
> 
> and deploy() actually generated an SQL column "_user", but then failed 
> at the first
> 
> __PACKAGE__->add_unique_constraint(['user']);

Do not mutilate column names, but instead use your tools the way they
were intended to be:
http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/Storage/DBI.pm#quote_char

As a side note - it is wise to avoid naming columns identical to perl
conventional method names (i.e. having a column 'new' will have some
strange side effects)

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to