From: Justin Hunter Date: Fri, 4 Sep 2009 18:31:42 +0000 (-0700) Subject: move method 'aliases' into handles X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=db2e467f94ae2ce571d647d46b87f2532cae94dc;p=dbsrgits%2FSQL-Translator-2.0-ish.git move method 'aliases' into handles --- diff --git a/lib/SQL/Translator/Object/Constraint.pm b/lib/SQL/Translator/Object/Constraint.pm index 266ae4f..96c598c 100644 --- a/lib/SQL/Translator/Object/Constraint.pm +++ b/lib/SQL/Translator/Object/Constraint.pm @@ -26,6 +26,11 @@ class SQL::Translator::Object::Constraint extends SQL::Translator::Object { get_columns => 'values', get_column => 'get', add_column => 'set', + + ## compat + get_fields => 'values', + fields => 'keys', + field_names => 'keys', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); @@ -65,9 +70,5 @@ class SQL::Translator::Object::Constraint extends SQL::Translator::Object { around add_column(Column $column) { $self->$orig($column->name, $column) } - method get_fields { $self->get_columns } - method fields { $self->column_ids } - method field_names { $self->column_ids } - method reference_fields { $self->reference_columns } } diff --git a/lib/SQL/Translator/Object/Index.pm b/lib/SQL/Translator/Object/Index.pm index ccb2dd4..b22c041 100644 --- a/lib/SQL/Translator/Object/Index.pm +++ b/lib/SQL/Translator/Object/Index.pm @@ -26,6 +26,10 @@ class SQL::Translator::Object::Index extends SQL::Translator::Object { get_columns => 'values', get_column => 'get', add_column => 'set', + + ## compat + get_fields => 'values', + fields => 'keys', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); @@ -37,7 +41,4 @@ class SQL::Translator::Object::Index extends SQL::Translator::Object { ); around add_column(Column $column) { $self->$orig($column->name, $column) } - - method get_fields { $self->get_columns } - method fields { $self->column_ids } } diff --git a/lib/SQL/Translator/Object/Table.pm b/lib/SQL/Translator/Object/Table.pm index 5b92e33..8686884 100644 --- a/lib/SQL/Translator/Object/Table.pm +++ b/lib/SQL/Translator/Object/Table.pm @@ -20,6 +20,10 @@ class SQL::Translator::Object::Table extends SQL::Translator::Object { get_columns => 'values', get_column => 'get', add_column => 'set', + + ## compat + get_fields => 'values', + fields => 'keys', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); @@ -84,9 +88,6 @@ class SQL::Translator::Object::Table extends SQL::Translator::Object { around add_constraint(Constraint $constraint) { $self->$orig($constraint->name, $constraint) } around add_sequence(Sequence $sequence) { $self->$orig($sequence->name, $sequence) } - method get_fields { $self->get_columns } - method fields { $self->column_ids } - multi method primary_key(Any $) { grep /^PRIMARY KEY$/, $_->type for $self->get_constraints } multi method primary_key(Str $column) { $self->get_column($column)->is_primary_key(1) } diff --git a/lib/SQL/Translator/Object/Trigger.pm b/lib/SQL/Translator/Object/Trigger.pm index ca4507b..ddd95ab 100644 --- a/lib/SQL/Translator/Object/Trigger.pm +++ b/lib/SQL/Translator/Object/Trigger.pm @@ -19,6 +19,10 @@ class SQL::Translator::Object::Trigger extends SQL::Translator::Object { get_columns => 'values', get_column => 'get', add_column => 'set', + + ## compat + get_fields => 'values', + fields => 'keys', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); @@ -47,7 +51,4 @@ class SQL::Translator::Object::Trigger extends SQL::Translator::Object { ); around add_column(Column $column) { $self->$orig($column->name, $column) } - - method get_fields { $self->get_columns } - method fields { $self->column_ids } } diff --git a/lib/SQL/Translator/Object/View.pm b/lib/SQL/Translator/Object/View.pm index d77f747..a185421 100644 --- a/lib/SQL/Translator/Object/View.pm +++ b/lib/SQL/Translator/Object/View.pm @@ -19,6 +19,10 @@ class SQL::Translator::Object::View extends SQL::Translator::Object { get_columns => 'values', get_column => 'get', add_column => 'set', + + ## compat + get_fields => 'values', + fields => 'keys', }, default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash }, ); @@ -30,7 +34,4 @@ class SQL::Translator::Object::View extends SQL::Translator::Object { ); around add_column(Column $column) { $self->$orig($column->name, $column) } - - method get_fields { $self->get_columns } - method fields { $self->column_ids } }