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 our $VERSION = '1.62';
40 my %args = { +shift };
43 foreach ( $schema->get_tables ) {
44 my %extra = $_->extra;
46 $extra{label} ||= ucfirst($_->name);
51 foreach ( map { $_->get_fields } $schema->get_tables ) {
52 my %extra = $_->extra;
54 $extra{label} ||= ucfirst($_->name);
65 Maybe I'm trying to do too much in one go. Args set a match and then an update,
66 if you want to set lots of things, use lots of filters!
70 C<perl(1)>, L<SQL::Translator>