I have a MySQL version 5 table named languagelist structured like this: create table languagelist ( lsigntypid varchar(260) NOT NULL, lstage varchar(260) NULL, lopcl varchar(260) NULL, lentdes varchar(260) NULL, lmajcat varchar(260) NULL, lfld varchar(260) NULL, lflsuh varchar(260) NULL, lflv varchar(260) NULL, lflvd varchar(260) NULL, lmemo1 text NULL, lremarks1 varchar(260) NULL, lremarks2 varchar(260) NULL, INDEX (lsigntypid) ) ENGINE = InnoDB;
I (just now) created a DBIC "result source" or "table class" file for this, following the tutorial at http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7000/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod#Create_the_DBIC_%22Result_Source%22_Files : ------------(start of table class code)----------- package SignTypDB::LanguageList; use base qw/DBIx::Class/; # Load required DBIC stuff __PACKAGE__->load_components(qw/PK::Auto Core/); # Set the table name __PACKAGE__->table('languagelist'); # Set columns in table __PACKAGE__->add_columns(qw/lsigntypid lstage lopcl lentdes lmajcat lfld lflsuh lflv lflvd lmemo1 lremarks1 lremarks2/); ----------(end of table class code) ------ I want to add an index to the table class code above. Following the example given here: --> http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/Manual/Cookbook.pod#Adding_Indexes_And_Functions_To_Your_SQL I think I need to append the following code the the table class shown above: -------------(start of index sub) --------- sub sqlt_deploy_hook { my ($self, $sqlt_table) = @_; $sqlt_table->add_index(name => 'idx_name', fields => ['lsigntypid']); } -------------(end of index sub) --------- Does the above look correct? What does the 'name' above reference in this context? Is it just a name for the index? Should I change it from 'idx_name' to something else? Thanks Bob Cochran Greenbelt, Maryland, USA _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/