Changes + Reverts for 0.11000, see Changes file for info
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Parser / YAML.pm
index 6797c68..4170d1f 100644 (file)
@@ -1,9 +1,7 @@
 package SQL::Translator::Parser::YAML;
 
 # -------------------------------------------------------------------
-# $Id: YAML.pm,v 1.6 2004-03-09 19:19:21 kycl4rk Exp $
-# -------------------------------------------------------------------
-# Copyright (C) 2002-4 SQLFairy Authors
+# Copyright (C) 2002-2009 SQLFairy Authors
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
@@ -22,7 +20,7 @@ package SQL::Translator::Parser::YAML;
 
 use strict;
 use vars qw($VERSION);
-$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/;
+$VERSION = '1.59';
 
 use SQL::Translator::Schema;
 use SQL::Translator::Utils qw(header_comment);
@@ -34,7 +32,7 @@ sub parse {
     $data = Load($data);
     $data = $data->{'schema'};
 
-    warn Dumper( $data ) if $translator->debug;
+    warn "YAML data:",Dumper( $data ) if $translator->debug;
 
     my $schema = $translator->schema;
 
@@ -44,13 +42,16 @@ sub parse {
     my @tables = 
         map   { $data->{'tables'}{ $_->[1] } }
         sort  { $a->[0] <=> $b->[0] }
-        map   { [ $data->{'tables'}{ $_ }{'order'}, $_ ] }
+        map   { [ $data->{'tables'}{ $_ }{'order'} || 0, $_ ] }
         keys %{ $data->{'tables'} }
     ;
 
     for my $tdata ( @tables ) {
+  
         my $table = $schema->add_table(
-            name  => $tdata->{'name'},
+            map {
+              $tdata->{$_} ? ($_ => $tdata->{$_}) : ()
+            } (qw/name extra options/)
         ) or die $schema->error;
 
         my @fields =