From: Ken Youens-Clark Date: Wed, 2 Jul 2003 18:18:44 +0000 (+0000) Subject: Strip field size qualifiers from index fields as SQLite doesn't like. X-Git-Tag: v0.04~379 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=34d2319ca0dce937ab5132802959aa751468a186;p=dbsrgits%2FSQL-Translator.git Strip field size qualifiers from index fields as SQLite doesn't like. --- diff --git a/lib/SQL/Translator/Producer/SQLite.pm b/lib/SQL/Translator/Producer/SQLite.pm index c71fe6d..a210264 100644 --- a/lib/SQL/Translator/Producer/SQLite.pm +++ b/lib/SQL/Translator/Producer/SQLite.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::SQLite; # ------------------------------------------------------------------- -# $Id: SQLite.pm,v 1.5 2003-06-11 04:00:44 kycl4rk Exp $ +# $Id: SQLite.pm,v 1.6 2003-07-02 18:18:44 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain , @@ -29,7 +29,7 @@ use SQL::Translator::Utils qw(debug header_comment); use vars qw[ $VERSION $DEBUG $WARN ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; $WARN = 0 unless defined $WARN; @@ -114,7 +114,9 @@ sub produce { for my $index ( $table->get_indices ) { my $name = $index->name; $name = mk_name($table_name, $name || ++$idx_name_default); - my @fields = $index->fields; + + # strip any field size qualifiers as SQLite doesn't like these + my @fields = map { s/\(\d+\)$//; $_ } $index->fields; push @index_defs, "CREATE INDEX $name on $table_name ". '(' . join( ', ', @fields ) . ')';