GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

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

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

  # 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;

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.

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.

perl(1), SQL::Translator

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.

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

Mark Addison <grommit@users.sourceforge.net>
2020-09-14 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.