1SQL::Translator::SchemaU:s:eIrndCeoxn(t3r)ibuted Perl DoScQuLm:e:nTtraatnisolnator::Schema::Index(3)
2
3
4

NAME

6       SQL::Translator::Schema::Index - SQL::Translator index object
7

SYNOPSIS

9         use SQL::Translator::Schema::Index;
10         my $index = SQL::Translator::Schema::Index->new(
11             name   => 'foo',
12             fields => [ id ],
13             type   => 'unique',
14         );
15

DESCRIPTION

17       "SQL::Translator::Schema::Index" is the index object.
18
19       Primary and unique keys are table constraints, not indices.
20

METHODS

22       new
23
24       Object constructor.
25
26         my $schema = SQL::Translator::Schema::Index->new;
27
28       fields
29
30       Gets and set the fields the index is on.  Accepts a string, list or
31       arrayref; returns an array or array reference.  Will unique the field
32       names and keep them in order by the first occurrence of a field name.
33
34         $index->fields('id');
35         $index->fields('id', 'name');
36         $index->fields( 'id, name' );
37         $index->fields( [ 'id', 'name' ] );
38         $index->fields( qw[ id name ] );
39
40         my @fields = $index->fields;
41
42       is_valid
43
44       Determine whether the index is valid or not.
45
46         my $ok = $index->is_valid;
47
48       name
49
50       Get or set the index's name.
51
52         my $name = $index->name('foo');
53
54       options
55
56       Get or set the index's options (e.g., "using" or "where" for PG).
57       Returns an array or array reference.
58
59         my @options = $index->options;
60
61       table
62
63       Get or set the index's table object.
64
65         my $table = $index->table;
66
67       type
68
69       Get or set the index's type.
70
71         my $type = $index->type('unique');
72
73       equals
74
75       Determines if this index is the same as another
76
77         my $isIdentical = $index1->equals( $index2 );
78

AUTHOR

80       Ken Y. Clark <kclark@cpan.org>.
81
82
83
84perl v5.8.8                       2007-10-24 SQL::Translator::Schema::Index(3)
Impressum