Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sql::translator::filter::names(3pm) [debian man page]

SQL::Translator::Filter::Names(3pm)			User Contributed Perl Documentation		       SQL::Translator::Filter::Names(3pm)

NAME
SQL::Translator::Filter::Names - Tweak the names of schema objects. SYNOPSIS
#! /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; DESCRIPTION
SEE ALSO
perl(1), SQL::Translator BUGS
TODO
Name Groups Define a bunch of useful groups to run the name filters over. e.g. all, fkeys, pkeys etc. More Functions e.g. camelcase, titlecase, single word etc. Also a way to pass in a regexp. May also want a way to pass in arguments for the func e.g. prefix. Multiple Filters on the same name (filter order)? Do we actually need this, you could just run lots of filters. Would make adding func args to the interface easier. 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. AUTHOR
perl v5.14.2 2012-01-18 SQL::Translator::Filter::Names(3pm)

Check Out this Related Man Page

SQL::Translator::Filter::Globals(3pm)			User Contributed Perl Documentation		     SQL::Translator::Filter::Globals(3pm)

NAME
SQL::Translator::Filter::Globals - Add global fields and indices to all tables. SYNOPSIS
# e.g. Add timestamp field to all tables. use SQL::Translator; my $sqlt = SQL::Translator->new( from => 'MySQL', to => 'MySQL', filters => [ Globals => { fields => [ { name => 'modified' data_type => 'TIMESTAMP' } ], indices => [ { fields => 'modifed', }, ] constraints => [ { } ] }, ], ) || die "SQLFairy error : ".SQL::Translator->error; my $sql = $sqlt->translate || die "SQLFairy error : ".$sqlt->error; DESCRIPTION
Adds global fields, indices and constraints to all tables in the schema. The globals to add can either be defined in the filter args or using a _GLOBAL_ table (see below). If a table already contains a field with the same name as a global then it is skipped for that table. The _GLOBAL_ Table An alternative to using the args is to add a table called "_GLOBAL_" to the schema and then just use the filter. Any fields and indices defined on this table will be added to all the tables in the schema and the _GLOBAL_ table removed. The name of the global can be changed using a "global_table" arg to the filter. SEE ALSO
perl(1), SQL::Translator BUGS
Will generate duplicate indices if an index already exists on a table the same as one added globally. Will generate duplicate constraints if a constraint already exists on a table the same as one added globally. TODO
Some extra data values that can be used to control the global addition. e.g. 'skip_global'. AUTHOR
Mark Addison <grommit@users.sourceforge.net> perl v5.14.2 2012-01-18 SQL::Translator::Filter::Globals(3pm)
Man Page