Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sql::translator::filter::globals(3pm) [debian 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)

Check Out this Related Man Page

SQL::Translator::Schema::Index(3pm)			User Contributed Perl Documentation		       SQL::Translator::Schema::Index(3pm)

NAME
SQL::Translator::Schema::Index - SQL::Translator index object SYNOPSIS
use SQL::Translator::Schema::Index; my $index = SQL::Translator::Schema::Index->new( name => 'foo', fields => [ id ], type => 'unique', ); DESCRIPTION
"SQL::Translator::Schema::Index" is the index object. Primary and unique keys are table constraints, not indices. METHODS
new Object constructor. my $schema = SQL::Translator::Schema::Index->new; fields Gets and set the fields the index is on. Accepts a string, list or arrayref; returns an array or array reference. Will unique the field names and keep them in order by the first occurrence of a field name. $index->fields('id'); $index->fields('id', 'name'); $index->fields( 'id, name' ); $index->fields( [ 'id', 'name' ] ); $index->fields( qw[ id name ] ); my @fields = $index->fields; is_valid Determine whether the index is valid or not. my $ok = $index->is_valid; name Get or set the index's name. my $name = $index->name('foo'); options Get or set the index's options (e.g., "using" or "where" for PG). Returns an array or array reference. my @options = $index->options; table Get or set the index's table object. my $table = $index->table; type Get or set the index's type. my $type = $index->type('unique'); Get or set the index's type. Currently there are only four acceptable types: UNIQUE, NORMAL, FULL_TEXT, and SPATIAL. The latter two might be MySQL-specific. While both lowercase and uppercase types are acceptable input, this method returns the type in uppercase. equals Determines if this index is the same as another my $isIdentical = $index1->equals( $index2 ); AUTHOR
Ken Youens-Clark <kclark@cpan.org>. perl v5.14.2 2012-01-18 SQL::Translator::Schema::Index(3pm)
Man Page