1SQL::Translator::SchemaU:s:eIrndCeoxn(t3r)ibuted Perl DoScQuLm:e:nTtraatnisolnator::Schema::Index(3)
2
3
4
6 SQL::Translator::Schema::Index - SQL::Translator index object
7
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
17 "SQL::Translator::Schema::Index" is the index object.
18
19 Primary and unique keys are table constraints, not indices.
20
22 new
23 Object constructor.
24
25 my $schema = SQL::Translator::Schema::Index->new;
26
27 fields
28 Gets and set the fields the index is on. Accepts a string, list or
29 arrayref; returns an array or array reference. Will unique the field
30 names and keep them in order by the first occurrence of a field name.
31
32 $index->fields('id');
33 $index->fields('id', 'name');
34 $index->fields( 'id, name' );
35 $index->fields( [ 'id', 'name' ] );
36 $index->fields( qw[ id name ] );
37
38 my @fields = $index->fields;
39
40 is_valid
41 Determine whether the index is valid or not.
42
43 my $ok = $index->is_valid;
44
45 name
46 Get or set the index's name.
47
48 my $name = $index->name('foo');
49
50 options
51 Get or set the index's options (e.g., "using" or "where" for PG).
52 Returns an array or array reference.
53
54 my @options = $index->options;
55
56 table
57 Get or set the index's table object.
58
59 my $table = $index->table;
60
61 type
62 Get or set the index's type.
63
64 my $type = $index->type('unique');
65
66 Get or set the index's options (e.g., "using" or "where" for PG).
67 Returns
68
69 Currently there are only four acceptable types: UNIQUE, NORMAL,
70 FULL_TEXT, and SPATIAL. The latter two might be MySQL-specific. While
71 both lowercase and uppercase types are acceptable input, this method
72 returns the type in uppercase.
73
74 equals
75 Determines if this index is the same as another
76
77 my $isIdentical = $index1->equals( $index2 );
78
80 Ken Youens-Clark <kclark@cpan.org>.
81
82
83
84perl v5.12.0 2009-08-18 SQL::Translator::Schema::Index(3)