SQL::Translator::Filter::Names - Tweak the names of schema objects. |
SQL::Translator::Filter::Names - Tweak the names of schema objects.
#! /usr/bin/perl -w use SQL::Translator;
# Lowercase all table names and upper case the first letter of all field # names. (MySql style!) # my $sqlt = SQL::Translator->new( filename => \@ARGV, from => 'MySQL', to => 'MySQL', filters => [ Names => { 'tables' => 'lc', 'fields' => 'ucfirst', }, ], ) || die "SQLFairy error : ".SQL::Translator->error; print($sqlt->translate) || die "SQLFairy error : ".$sqlt->error;
perl(1), the SQL::Translator manpage
May also want a way to pass in arguments for the func e.g. prefix.
filters => [ [ 'Names', { all => 'lc' } ], [ 'Names', { tables => 'lc', fields => 'ucfirst', } ], ],
Mind you if you could give the filter a list this wouldn't be a problem!
filters => [ [ 'Names', all => 'lc' fields => 'ucfirst', ], ],
Which is nice. Might have to change the calling conventions for filters. Would also provide an order to run the filters in rather than having to hard code it into the filter it's self.
SQL::Translator::Filter::Names - Tweak the names of schema objects. |