Implemented add_field, only the field is added, nothing more for now.
Daniel Ruoso [Wed, 23 Apr 2008 14:49:34 +0000 (14:49 +0000)]
lib/SQL/Translator/Producer/Oracle.pm

index f7083e8..e603124 100644 (file)
@@ -446,6 +446,21 @@ sub alter_field {
     return 'ALTER TABLE '.$table_name_ur.' MODIFY ( '.join('', @$field_defs).' )';
 }
 
+sub add_field {
+    my ($new_field, $options) = @_;
+
+    my ($field_create, $field_defs, $trigger_defs, $field_comments) =
+      create_field($new_field, $options, {});
+
+    my $table_name = $new_field->table->name;
+    my $table_name_ur = unreserve( $table_name );
+
+    my $out = sprintf('ALTER TABLE %s ADD ( %s )',
+                      $table_name_ur,
+                      join('', @$field_defs));
+    return $out;
+}
+
 sub create_field {
     my ($field, $options, $field_name_scope) = @_;