From: Justin Hunter Date: Sat, 3 Oct 2009 04:52:14 +0000 (-0700) Subject: fix some typos and add multi methods for drop_index X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1dde2bfead1aa29bb7c30bf6d4e951c9c89c3e61;p=dbsrgits%2FSQL-Translator-2.0-ish.git fix some typos and add multi methods for drop_index --- diff --git a/lib/SQL/Translator/Object/Table.pm b/lib/SQL/Translator/Object/Table.pm index 9bd05bc..f9bd68b 100644 --- a/lib/SQL/Translator/Object/Table.pm +++ b/lib/SQL/Translator/Object/Table.pm @@ -128,13 +128,24 @@ class SQL::Translator::Object::Table extends SQL::Translator::Object is dirty { before name($name?) { die "Can't use table name $name, table already exists" if $name && $self->schema->exists_table($name) && $name ne $self->name } multi method drop_column(Column $column, Int :$cascade = 0) { - die "Can't drop non-existant table " . $column->name unless $self->exists_column($column->name); + die "Can't drop non-existant column " . $column->name unless $self->exists_column($column->name); $self->remove_column($column->name); } multi method drop_column(Str $column, Int :$cascade = 0) { - die "Can't drop non-existant table " . $column unless $self->exists_column($column); + die "Can't drop non-existant column " . $column unless $self->exists_column($column); $self->remove_column($column); } + + multi method drop_index(Index $index) { + die "Can't drop non-existant index " . $index->name unless $self->exists_index($index->name); + $self->remove_index($index->name); + + } + + multi method drop_index(Str $index) { + die "Can't drop non-existant index " . $index unless $self->exists_index($index); + $self->remove_index($index); + } }