From: Justin Hunter Date: Tue, 21 Jun 2011 18:27:35 +0000 (-0700) Subject: allow get_column to take anything coerceable into a Column (currently only Str, HashR... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1f5b9ea48851ec6a425561ffd3a869456b55cfdb;p=dbsrgits%2FSQL-Translator-2.0-ish.git allow get_column to take anything coerceable into a Column (currently only Str, HashRef and Column) --- diff --git a/lib/SQL/Translator/Object/Table.pm b/lib/SQL/Translator/Object/Table.pm index 35f9d9e..8840f7c 100644 --- a/lib/SQL/Translator/Object/Table.pm +++ b/lib/SQL/Translator/Object/Table.pm @@ -99,6 +99,10 @@ class SQL::Translator::Object::Table extends SQL::Translator::Object is dirty { isa => Int, ); + around get_column(Column $column does coerce) { + $self->$orig($column->name); + } + around add_column(Column $column does coerce) { die "Can't use column name " . $column->name if $self->exists_column($column->name) || $column->name eq ''; $column->table($self);