package SQL::Translator::Producer::YAML;
-# -------------------------------------------------------------------
-# $Id$
-# -------------------------------------------------------------------
-# 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
-# published by the Free Software Foundation; version 2.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA
-# -------------------------------------------------------------------
-
=head1 NAME
SQL::Translator::Producer::YAML - A YAML producer for SQL::Translator
use strict;
use vars qw($VERSION);
-$VERSION = '1.99';
+$VERSION = '1.59';
use YAML qw(Dump);
show_warnings => $translator->show_warnings,
trace => $translator->trace,
version => $translator->version,
- }
+ },
+ keys %{$schema->extra} ? ('extra' => { $schema->extra } ) : (),
});
}
map { ($_->name => view_field($_)) }
$table->get_fields
},
+ keys %{$table->extra} ? ('extra' => { $table->extra } ) : (),
};
}
'options' => scalar $constraint->options,
'on_delete' => scalar $constraint->on_delete,
'on_update' => scalar $constraint->on_update,
- 'reference_fields' => scalar $constraint->reference_fields,
+ 'reference_fields' => [ map { ref $_ ? $_->name : $_ } $constraint->reference_fields ],
'reference_table' => scalar $constraint->reference_table,
'type' => scalar $constraint->type,
+ keys %{$constraint->extra} ? ('extra' => { $constraint->extra } ) : (),
};
}
'is_unique' => scalar $field->is_unique,
$field->is_auto_increment ? ('is_auto_increment' => 1) : (),
$field->comments ? ('comments' => $field->comments) : (),
- 'extra' => { $field->extra },
+ keys %{$field->extra} ? ('extra' => { $field->extra } ) : (),
};
}
'parameters' => scalar $procedure->parameters,
'owner' => scalar $procedure->owner,
'comments' => scalar $procedure->comments,
+ keys %{$procedure->extra} ? ('extra' => { $procedure->extra } ) : (),
};
}
'order' => scalar $trigger->order,
'name' => scalar $trigger->name,
'perform_action_when' => scalar $trigger->perform_action_when,
- 'database_event' => scalar $trigger->database_event,
+ 'database_events' => scalar $trigger->database_events,
'fields' => scalar $trigger->fields,
'on_table' => scalar $trigger->on_table,
'action' => scalar $trigger->action,
+ keys %{$trigger->extra} ? ('extra' => { $trigger->extra } ) : (),
};
}
'name' => scalar $view->name,
'sql' => scalar $view->sql,
'fields' => scalar $view->fields,
+ keys %{$view->extra} ? ('extra' => { $view->extra } ) : (),
};
}
'type' => scalar $index->type,
'fields' => scalar $index->fields,
'options' => scalar $index->options,
+ keys %{$index->extra} ? ('extra' => { $index->extra } ) : (),
};
}
=head1 AUTHORS
darren chamberlain E<lt>darren@cpan.orgE<gt>,
-Ken Y. Clark E<lt>kclark@cpan.orgE<gt>.
+Ken Youens-Clark E<lt>kclark@cpan.orgE<gt>.
=cut