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 type.
67
68 Currently there are only four acceptable types: UNIQUE, NORMAL,
69 FULL_TEXT, and SPATIAL. The latter two might be MySQL-specific. While
70 both lowercase and uppercase types are acceptable input, this method
71 returns the type in uppercase.
72
73 equals
74 Determines if this index is the same as another
75
76 my $isIdentical = $index1->equals( $index2 );
77
79 Ken Youens-Clark <kclark@cpan.org>.
80
81
82
83perl v5.34.0 2021-07-22 SQL::Translator::Schema::Index(3)