add is_valid method and a default for type
[dbsrgits/SQL-Translator-2.0-ish.git] / lib / SQL / Translator / Object / Index.pm
index b22c041..865503a 100644 (file)
@@ -37,8 +37,11 @@ class SQL::Translator::Object::Index extends SQL::Translator::Object {
     has 'type' => (
         is => 'rw',
         isa => Str,
-        required => 1
+        required => 1,
+        default => 'NORMAL',
     );
 
     around add_column(Column $column) { $self->$orig($column->name, $column) }
+
+    method is_valid { $self->table && scalar $self->get_columns ? 1 : undef }
 }