1 package SQL::Translator::Filter::DefaultExtra;
5 SQL::Translator::Filter::DefaultExtra - Set default extra data values for schema
12 my $sqlt = SQL::Translator->new(
17 # XXX - These should really be ordered
19 # Default widget for fields to basic text edit.
20 'field.widget' => 'text',
22 'field(data_type=BIT).widget' => 'yesno',
24 # Default label (human formated name) for fields and tables
25 'field.label' => '=ucfirst($name)',
26 'table.label' => '=ucfirst($name)',
29 ) || die "SQLFairy error : ".SQL::Translator->error;
30 my $sql = $sqlt->translate || die "SQLFairy error : ".$sqlt->error;
36 use vars qw/$VERSION/;
41 my %args = { +shift };
44 foreach ( $schema->get_tables ) {
45 my %extra = $_->extra;
47 $extra{label} ||= ucfirst($_->name);
52 foreach ( map { $_->get_fields } $schema->get_tables ) {
53 my %extra = $_->extra;
55 $extra{label} ||= ucfirst($_->name);
66 Maybe I'm trying to do too much in one go. Args set a match and then an update,
67 if you want to set lots of things, use lots of filters!
71 L<perl(1)>, L<SQL::Translator>