1SQL::Translator::FilterU:s:eGrloCboanltsr(i3b)uted PerlSDQoLc:u:mTernatnastliaotnor::Filter::Globals(3)
2
3
4

NAME

6       SQL::Translator::Filter::Globals - Add global fields and indices to all
7       tables.
8

SYNOPSIS

10         # e.g. Add timestamp field to all tables.
11         use SQL::Translator;
12
13         my $sqlt = SQL::Translator->new(
14             from => 'MySQL',
15             to   => 'MySQL',
16             filters => [
17               Globals => {
18                   fields => [
19                       {
20                           name => 'modified'
21                           data_type => 'TIMESTAMP'
22                       }
23                   ],
24                   indices => [
25                       {
26                           fields => 'modifed',
27                       },
28                   ]
29                   constraints => [
30                       {
31                       }
32                   ]
33               },
34             ],
35         ) ⎪⎪ die "SQLFairy error : ".SQL::Translator->error;
36         my $sql = $sqlt->translate ⎪⎪ die "SQLFairy error : ".$sqlt->error;
37

DESCRIPTION

39       Adds global fields, indices and constraints to all tables in the
40       schema.  The globals to add can either be defined in the filter args or
41       using a _GLOBAL_ table (see below).
42
43       If a table already contains a field with the same name as a global then
44       it is skipped for that table.
45
46       The _GLOBAL_ Table
47
48       An alternative to using the args is to add a table called "_GLOBAL_" to
49       the schema and then just use the filter. Any fields and indices defined
50       on this table will be added to all the tables in the schema and the
51       _GLOBAL_ table removed.
52
53       The name of the global can be changed using a "global_table" arg to the
54       filter.
55

SEE ALSO

57       perl(1), SQL::Translator
58

BUGS

60       Will generate duplicate indices if an index already exists on a table
61       the same as one added globally.
62
63       Will generate duplicate constraints if a constraint already exists on a
64       table the same as one added globally.
65

TODO

67       Some extra data values that can be used to control the global addition.
68       e.g.  'skip_global'.
69

AUTHOR

71       Mark Addison <grommit@users.sourceforge.net>
72
73
74
75perl v5.8.8                       2007-10-24SQL::Translator::Filter::Globals(3)
Impressum